diff --git a/commands/env-init.help b/commands/env-init.help index 255a45fb..c03d2bb1 100755 --- a/commands/env-init.help +++ b/commands/env-init.help @@ -21,10 +21,7 @@ WARDEN_USAGE=$(cat <&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1 - -WARDEN_ENV_PATH="$(locateEnvPath)" || exit $? -loadEnvConfig "${WARDEN_ENV_PATH}" || exit $? - -if (( ${#WARDEN_PARAMS[@]} == 0 )); then - fatal "This command has required params; use --help for details." -fi - -## disable sync command on non-darwin environments where it should not be used -if [[ ${WARDEN_ENV_SUBT} != "darwin" ]]; then - fatal "Mutagen sync sessions are not used on \"${WARDEN_ENV_SUBT}\" host environments." -fi - -## attempt to install mutagen if not already present -if ! which mutagen >/dev/null; then - echo -e "\033[33mMutagen could not be found; attempting install via brew.\033[0m" - brew install havoc-io/mutagen/mutagen -fi - -## verify mutagen version constraint -MUTAGEN_VERSION=$(mutagen version 2>/dev/null) || true -MUTAGEN_REQUIRE=0.11.8 -if [[ $OSTYPE =~ ^darwin ]] && ! test $(version ${MUTAGEN_VERSION}) -ge $(version ${MUTAGEN_REQUIRE}); then - error "Mutagen version ${MUTAGEN_REQUIRE} or greater is required (version ${MUTAGEN_VERSION} is installed)." - >&2 printf "\nPlease update Mutagen:\n\n brew upgrade havoc-io/mutagen/mutagen\n\n" - exit 1 -fi - -if [[ $OSTYPE =~ ^darwin && -z "${MUTAGEN_SYNC_FILE}" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - - if [[ -f "${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_HOME_DIR}/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - fi - - if [[ -f "${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/environments/${WARDEN_ENV_TYPE}/${WARDEN_ENV_TYPE}.mutagen.yml" - fi - - if [[ -f "${WARDEN_ENV_PATH}/.warden/mutagen.yml" ]]; then - export MUTAGEN_SYNC_FILE="${WARDEN_ENV_PATH}/.warden/mutagen.yml" - fi -fi - -## if no mutagen configuration file exists for the environment type, exit with error -if [[ ! -f "${MUTAGEN_SYNC_FILE}" ]]; then - fatal "Mutagen configuration does not exist for environment type \"${WARDEN_ENV_TYPE}\"" -fi - -## sub-command execution -case "${WARDEN_PARAMS[0]}" in - start) - ## terminate any existing sessions with matching env label - mutagen sync terminate --label-selector "warden-sync=${WARDEN_ENV_NAME}" - - ## create sync session based on environment type configuration - mutagen sync create -c "${MUTAGEN_SYNC_FILE}" \ - --label "warden-sync=${WARDEN_ENV_NAME}" --ignore "${WARDEN_SYNC_IGNORE:-}" \ - "${WARDEN_ENV_PATH}${WARDEN_WEB_ROOT:-}" "docker://$($WARDEN_BIN env ps -q php-fpm)/var/www/html" - - ## wait for sync session to complete initial sync before exiting - echo "Waiting for initial synchronization to complete" - while ! mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \ - | grep -i 'watching for changes'>/dev/null; - do - if mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \ - | grep -i 'Last error' > /dev/null; then - MUTAGEN_ERROR=$(mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \ - | sed -n 's/Last error: \(.*\)/\1/p') - fatal "Mutagen encountered an error during sync: ${MUTAGEN_ERROR}" - fi - printf .; sleep 1; done; echo - ;; - stop) - mutagen sync terminate --label-selector "warden-sync=${WARDEN_ENV_NAME}" - ;; - list|flush|monitor|pause|reset|resume) - mutagen sync "${WARDEN_PARAMS[@]}" "${@}" --label-selector "warden-sync=${WARDEN_ENV_NAME}" - ;; - *) - fatal "The command \"${WARDEN_PARAMS[0]}\" does not exist. Please use --help for usage." - ;; -esac diff --git a/commands/sync.help b/commands/sync.help deleted file mode 100755 index e2eedf16..00000000 --- a/commands/sync.help +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash -[[ ! ${WARDEN_DIR} ]] && >&2 echo -e "\033[31mThis script is not intended to be run directly!\033[0m" && exit 1 - -WARDEN_USAGE=$(cat < - -\033[33mOptions:\033[0m - -h, --help Display this help menu - -\033[33mCommands:\033[0m - start Starts mutagen sync for the current project environment - stop Stops the mutagen sync for the current project environment - list Lists mutagen session status for current project environment - and optionally (with -l) the full configuration - - monitor Continously lists mutagen session status for current project - flush Force a synchronization cycle on sync session for current project - pause Pauses the mutagen sync for the current project environment - resume Resumes the mutagen sync for the current project environment - reset Reset synchronization session history for current project environment -EOF -) diff --git a/environments/drupal/drupal.darwin.yml b/environments/drupal/drupal.darwin.yml deleted file mode 100644 index 2a18e5bc..00000000 --- a/environments/drupal/drupal.darwin.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/web/sites/default/files:/var/www/html/web/sites/default/files:cached - - .${WARDEN_WEB_ROOT:-}/web/sites/default/private:/var/www/html/web/sites/default/private:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=web/sites/default/files web/sites/default/private ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: diff --git a/environments/drupal/drupal.mutagen.yml b/environments/drupal/drupal.mutagen.yml deleted file mode 100644 index fd21a4aa..00000000 --- a/environments/drupal/drupal.mutagen.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: true - paths: - # Root .git folder - - "/.git/" - - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Drupal files - - "web/sites/default/files/**" - - "web/sites/default/private/**" - - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" diff --git a/environments/magento1/magento1.darwin.yml b/environments/magento1/magento1.darwin.yml deleted file mode 100644 index 045c1e52..00000000 --- a/environments/magento1/magento1.darwin.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/media:/var/www/html/media:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=media ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: diff --git a/environments/magento1/magento1.mutagen.yml b/environments/magento1/magento1.mutagen.yml deleted file mode 100644 index 454da1e3..00000000 --- a/environments/magento1/magento1.mutagen.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: true - paths: - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Magento files - - "/media" - - "/var/**" - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" diff --git a/environments/magento2/magento2.darwin.yml b/environments/magento2/magento2.darwin.yml deleted file mode 100644 index 62f21d0f..00000000 --- a/environments/magento2/magento2.darwin.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/pub/media:/var/www/html/pub/media:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=pub/media ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: diff --git a/environments/magento2/magento2.mutagen.yml b/environments/magento2/magento2.mutagen.yml deleted file mode 100644 index 9de33738..00000000 --- a/environments/magento2/magento2.mutagen.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: false - paths: - # Root .git folder - - "/.git/" - - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Magento files - - "/pub/media" - - "/pub/static/**" - - "!/pub/static/.htaccess" - - "/var/**" - - "!/var/.htaccess" - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755" diff --git a/environments/shopware/shopware.darwin.yml b/environments/shopware/shopware.darwin.yml deleted file mode 100644 index cfee1635..00000000 --- a/environments/shopware/shopware.darwin.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "3.5" - -x-volumes: &volumes - - .${WARDEN_WEB_ROOT:-}/public/media:/var/www/html/public/media:cached - - appdata:/var/www/html - -x-environment: &environment - - CHOWN_DIR_LIST=public/media ${CHOWN_DIR_LIST:-} - -services: - nginx: { volumes: *volumes } - php-fpm: { volumes: *volumes, environment: *environment } - php-debug: { volumes: *volumes, environment: *environment } - -volumes: - appdata: diff --git a/environments/shopware/shopware.mutagen.yml b/environments/shopware/shopware.mutagen.yml deleted file mode 100644 index 58cb10df..00000000 --- a/environments/shopware/shopware.mutagen.yml +++ /dev/null @@ -1,24 +0,0 @@ ---- -sync: - defaults: - mode: two-way-resolved - watch: - pollingInterval: 10 - ignore: - vcs: true - paths: - # System files - - ".DS_Store" - - "._*" - - # Vim files - - "*~" - - "*.sw[a-p]" - - # Application files - - "/public/media" - - "/var" - - permissions: - defaultFileMode: "0644" - defaultDirectoryMode: "0755"