Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-15 Bug fix for existing db import #16

Merged
merged 3 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .m2c/bin/m2c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

declare -r m2c_version="0.3.1"
declare -r m2c_version="0.3.2"
declare -r m2c_os="$(uname -s | awk '{print tolower($0)}')"
declare -r m2c_global_dir="$(echo ~/.m2c)"
declare m2c_loading_pid=
Expand Down Expand Up @@ -154,7 +154,8 @@ m2c_ask_text() {
error_info=$4 \
validate=$5 \
validate_value=() \
res valid error_count res_count valid=1
res res_count \
error_count valid=1

shift
shift
Expand Down Expand Up @@ -192,7 +193,7 @@ m2c_ask_text() {
error_count="$(echo -en "$error_count" | awk 'END { print NR }')"
fi

res="$(read -er 2>&1 | tee >(cat - >&5) | tr -d '\r')"
read -r res
res_count=$(echo "$res" | awk 'END { print NR }')

[[ ${error_count} -eq 0 ]] && (( res_count++ ))
Expand Down Expand Up @@ -528,9 +529,7 @@ then

m2c_sign "m2c.test"

m2c_res="$(pwd)"
m2c_global up
cd "$m2c_res"

m2c_info_bold "\n[Installation finished]\n\n"
m2c_msg "Mage2click toolset is successfully installed! \n\nRun \`m2c --help\` command for usage information. \nVisit local https://m2c.test to check useful links to included services.\n\n"
Expand Down
2 changes: 1 addition & 1 deletion .m2c/build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
49
50
62 changes: 30 additions & 32 deletions .m2c/functions/m2c
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,16 @@ m2c_global_up() {

m2c_info_bold "\n[Creating docker container$( (("${#service[@]}" > 1)) && echo "s" )]\n\n"

cd "$m2c_global_dir/docker/"

for i in "${!service[@]}"
do
m2c_global_print_service ${service[$i]}
m2c_loading
docker-compose --project-name m2c \
--file docker-compose.yml up \
--detach --force-recreate --no-color --no-deps ${service[$i]} >"$m2c_log" 2>&1
(
cd "$m2c_global_dir/docker/" && \
docker-compose --project-name m2c \
--file docker-compose.yml up \
--detach --force-recreate --no-color --no-deps ${service[$i]}
) >"$m2c_log" 2>&1
m2c_result $?
done
}
Expand Down Expand Up @@ -1643,10 +1644,7 @@ m2c_local() {
*)
local m2c_local_command=
local m2c_local_service=()
local m2c_local_services=("db" "php" "xdebug" "nginx" "redis" "varnish" \
"elasticsearch" "phpmyadmin" "rabbitmq")

local m2c_local_existing_services=($(m2c_local_list_services))
local m2c_local_services=($(m2c_local_list_services))

while (("$#"))
do
Expand All @@ -1666,7 +1664,7 @@ m2c_local() {
shift
;;
*)
if m2c_in_array "$1" ${m2c_local_existing_services[@]}
if m2c_in_array "$1" ${m2c_local_services[@]}
then
m2c_local_service+=("$1")
shift
Expand All @@ -1681,7 +1679,7 @@ m2c_local() {
then
if ! (("${#m2c_local_service[@]}"))
then
m2c_local_service=("${m2c_local_existing_services[@]}")
m2c_local_service=("${m2c_local_services[@]}")
fi

case ${m2c_local_command} in
Expand Down Expand Up @@ -2004,35 +2002,35 @@ m2c_local_project_up() {

if [[ -n ${service} ]]
then
cd "$m2c_project_dir/.m2c/docker/"
(
cd "$m2c_project_dir/.m2c/docker/" && \
docker-compose --project-name "${M2C_CFG_DOMAIN_NAME/.test/}" \
--file docker-compose.yml \
--file docker-compose.$([[ -n ${M2C_CFG_VARNISH} ]] && echo "varnish" || echo "nginx").yml \
${M2C_CFG_PHPMYADMIN:+--file docker-compose.phpmyadmin.yml} \
${M2C_CFG_ELASTICSEARCH:+--file docker-compose.elasticsearch.yml} \
${M2C_CFG_RABBITMQ:+--file docker-compose.rabbitmq.yml} \
--file docker-compose.${m2c_os}.yml \
up --detach --force-recreate --no-color --no-deps "$service"
) >"$m2c_log" 2>&1
return $?
fi

return 1
}

m2c_local_list_services() {
(
cd "$m2c_project_dir/.m2c/docker/" && \
docker-compose --project-name "${M2C_CFG_DOMAIN_NAME/.test/}" \
--file docker-compose.yml \
--file docker-compose.$([[ -n ${M2C_CFG_VARNISH} ]] && echo "varnish" || echo "nginx").yml \
${M2C_CFG_PHPMYADMIN:+--file docker-compose.phpmyadmin.yml} \
${M2C_CFG_ELASTICSEARCH:+--file docker-compose.elasticsearch.yml} \
${M2C_CFG_RABBITMQ:+--file docker-compose.rabbitmq.yml} \
--file docker-compose.${m2c_os}.yml \
up --detach --force-recreate --no-color --no-deps "$service" >"$m2c_log" 2>&1

return $?
fi

return 1
}

m2c_local_list_services() {
cd "$m2c_project_dir/.m2c/docker/"

docker-compose --project-name "${M2C_CFG_DOMAIN_NAME/.test/}" \
--file docker-compose.yml \
--file docker-compose.$([[ -n ${M2C_CFG_VARNISH} ]] && echo "varnish" || echo "nginx").yml \
${M2C_CFG_PHPMYADMIN:+--file docker-compose.phpmyadmin.yml} \
${M2C_CFG_ELASTICSEARCH:+--file docker-compose.elasticsearch.yml} \
${M2C_CFG_RABBITMQ:+--file docker-compose.rabbitmq.yml} \
--file docker-compose.${m2c_os}.yml \
ps --services --all

ps --services --all
)
return $?
}

Expand Down
Loading