diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2020-07-24 18:33:36 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2020-07-24 18:33:36 -0300 |
commit | c940551f2a33c548eb9d551c010d55ae01788ae7 (patch) | |
tree | 1f891589624765d30a6bf3842b282217cbb55a49 | |
parent | 25549962e31dbc95572b880d323884c2a11dff4d (diff) | |
download | templater-c940551f2a33c548eb9d551c010d55ae01788ae7.tar.gz templater-c940551f2a33c548eb9d551c010d55ae01788ae7.tar.bz2 |
Fix: cleanup drupal-composer makefile
-rw-r--r-- | share/templater/drupal-composer/files/Makefile.drupal-composer | 179 |
1 files changed, 33 insertions, 146 deletions
diff --git a/share/templater/drupal-composer/files/Makefile.drupal-composer b/share/templater/drupal-composer/files/Makefile.drupal-composer index c8f26ec..451f481 100644 --- a/share/templater/drupal-composer/files/Makefile.drupal-composer +++ b/share/templater/drupal-composer/files/Makefile.drupal-composer @@ -8,19 +8,42 @@ DATABASE = $(PROJECT) SITES_FOLDER = web/sites SITE_FOLDER = $(SITES_FOLDER)/default DRUSH = drush +CONTAINER ?= kvmx DATE = $(shell date +%Y%m%d) +# Keep code in sync +sync-code: update composer cache import + +# Initialize and update git submodules +submodules: + git submodule sync --recursive + git submodule update --init --recursive + +# Setup a development environment +develop: submodules $(CONTAINER) + #rm -rf $(DRUPAL)/sites/default + #ln -s $(PROJECT) $(DRUPAL)/sites/default + # Setup production environment production: post_receive composer settings perms +# Setup the virtual machine using vagrant +vagrant: + vagrant up || true + vagrant provision + @#echo '( cd /vagrant && make composer )' | vagrant ssh + @#echo '( cd /vagrant && make settings )' | vagrant ssh + echo '( cd /vagrant && make production )' | vagrant ssh + @#vagrant ssh -c "$(DRUSH) pm-enable devel -y" + # Setup virtual machine using kvmx kvmx: - #kvmx up || true + @#kvmx up || true kvmx provision - #echo '( cd /srv/shared && make drush )' | kvmx ssh - #echo '( cd /srv/shared && make vendor )' | kvmx ssh + @#echo '( cd /srv/shared && make composer )' | kvmx ssh + @#echo '( cd /srv/shared && make settings )' | kvmx ssh echo '( cd /srv/shared && make production)' | kvmx ssh - #kvmx ssh "$(DRUSH) pm-enable devel -y" + @#kvmx ssh "$(DRUSH) pm-enable devel -y" # Run composer composer: @@ -38,6 +61,7 @@ settings: # Permissions perms: + @#chmod 755 . chmod 755 cli chmod 755 web/sites/default chmod 755 web/sites/default/files @@ -48,7 +72,7 @@ reset: git checkout -f # Deploy code pushed on remote host -deploy: perms reset +deploy: perms reset submodules composer install $(DRUSH) updatedb $(DRUSH) cache-rebuild @@ -56,8 +80,8 @@ deploy: perms reset # Load pristine db from the initial upstream developer initdb_pristine: settings - test -s sql/dumps/pristine.zip && unzip -p sql/dumps/pristine.zip | $(DRUSH) sql-cli || true - test -s sql/dumps/pristine.zip && $(DRUSH) updatedb -y || true + test -s sql/dumps/pristinet.sql.gz && gzip -dc sql/dumps/pristinet.sql.gz | $(DRUSH) sql-cli || true + test -s sql/dumps/pristinet.sql.gz && $(DRUSH) updatedb -y || true # Load the database dump, clear the drupal cache and updated database # See https://www.drupal.org/node/628130 @@ -109,7 +133,8 @@ sync_files_to_production: rsync -avz --delete $(SITE_FOLDER)/files/ $(PRODUCTION)/$(SITE_FOLDER)/files/ updatedb: - $(DRUSH) updatedb -y + #$(DRUSH) updatedb -y + $(DRUSH) updatedb -y --entity-updates composer_update: composer update drupal/core --with-dependencies @@ -117,73 +142,6 @@ composer_update: # Upgrade drupal upgrade-drupal: composer_update updatedb -# Parameters -CORE = 8 -PROJECT = drupal -DATABASE ?= $(PROJECT) -ENV ?= dev -DATE = $(shell date +%Y%m%d) -CWD = $(shell pwd) -DESTDIR ?= /var/www/data -DRUPAL = $(DESTDIR)/drupal-$(CORE) -DRUSH = drush -r $(DRUPAL) -l $(PROJECT) - -# Setup production environment -production: submodules post_receive drush settings ownership - -# Setup a development environment -develop: submodules $(CONTAINER) - #rm -rf $(DRUPAL)/sites/default - #ln -s $(PROJECT) $(DRUPAL)/sites/default - -# Old target -# Install the platform -#platform: drupal drush settings symlinks initdb cache - -# Keep code in sync -sync-code: update drush cache import - -# Initialize and update git submodules -submodules: - git submodule sync --recursive - git submodule update --init --recursive - -# Setup the virtual machine using vagrant -vagrant: - vagrant up || true - vagrant provision - echo '( cd /vagrant && make drush )' | vagrant ssh - echo '( cd /vagrant && make settings )' | vagrant ssh - #vagrant ssh -c "$(DRUSH) pm-enable devel -y" - -# Setup the virtual machine using kvmx -kvmx: - #kvmx up || true - kvmx provision - echo '( cd /srv/shared && make drush )' | kvmx ssh - echo '( cd /srv/shared && make settings )' | kvmx ssh - #kvmx ssh "$(DRUSH) pm-enable devel -y" - -# Old target -# Download drupal, setup folder structure and config file -# -# You might want to use "-n" to avoid _drush_recursive_copy cpu hog if previous -# installation already exists when using 9p filesystem -#drupal: -# #rm -rf $(DESTDIR)/drupal-$(CORE)* && drush pm-download -y -v drupal-$(CORE) --destination=/tmp/drupal && mv /tmp/drupal/drupal-$(CORE).* $(DESTDIR)/ -# #drush pm-download -y -v drupal-$(CORE) --destination=$(DESTDIR) -# #( cd $(DRUPAL)/.. && ln -s drupal-$(CORE).* drupal-$(CORE) ) -# BASE=$(DESTDIR) drupal download $(CORE) - -# Old target -# Make the needed symlinks -#symlinks: -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/files -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/config -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/themes -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/modules -# ln -sf -t $(DRUPAL)/sites/$(PROJECT)/ $(CWD)/libraries - # Default settings default_settings: test -s sites.php || cp $(DRUPAL)/sites/example.sites.php sites.php @@ -207,19 +165,11 @@ custom_settings: chmod 640 settings.php chmod 640 services.yml -# Setup drupal settings -settings: default_settings custom_settings - test -s $(DRUPAL)/sites/sites.php || sudo cp sites.php $(DRUPAL)/sites/sites.php - # Fix ownership ownership: sudo chown -R $(PROJECT). $(DRUPAL)/sites/$(PROJECT) sudo chmod 755 $(DRUPAL)/sites/$(PROJECT) -# Run drush makefile -drush: - sudo drush make -n --no-core drupal.make.yml $(DRUPAL) - # Run drush site-install site_install: settings $(DRUSH) site-install -y @@ -231,35 +181,6 @@ site_install_sqlite: settings touch sql/dumps/.ht.sqlite $(DRUSH) site-install --db-url=sqlite://$(CWD)/sql/dumps/.ht.sqlite -# Update the database -updatedb: - $(DRUSH) updatedb -y --entity-updates - -# Load the database dump, clear the drupal cache and fix image paths -# See https://www.drupal.org/node/628130 -initdb: settings - test -s sql/dumps/latest.sql.gz && gzip -dc sql/dumps/latest.sql.gz | $(DRUSH) sql-cli || true - test -s sql/dumps/latest.sql.gz && $(DRUSH) updatedb -y || true - -# Dump the database, clearing the cache to ensure a small package -dumpdb: settings cache - mkdir -p sql/dumps - rm -f sql/dumps/latest.sql.gz - rm -f sql/dumps/$(DATE).sql.gz - $(DRUSH) sql-dump > sql/dumps/$(DATE).sql - ( cd sql/dumps && gzip $(DATE).sql && ln -s $(DATE).sql.gz latest.sql.gz ) - -# Clear drupal cache -cache: - $(DRUSH) cache-rebuild - -# Destroy the database -destroydb: settings - echo "DROP DATABASE $(DATABASE); CREATE DATABASE $(DATABASE);" | $(DRUSH) sql-cli - -# Reinitializes the database -reinitdb: destroydb initdb - # Cleanup develop environment clean: vagrant halt || true @@ -268,14 +189,6 @@ clean: kvmx destroy || true rm -rf vendor/drupal* -# Export configuration -export: - $(DRUSH) config-export -y - -# Import configuration -import: - $(DRUSH) config-import -y - # Diff configuration # Needs https://github.com/eriktufvesson/drush-config-diff diff: @@ -288,10 +201,6 @@ update: pull submodules upgrade-modules: sudo $(DRUSH) up -# Upgrade drupal -upgrade-drupal: - BASE=$(DESTDIR) sudo drupal upgrade $(CORE) - # Configure update hook on remote host #post_receive: # git config receive.denyCurrentBranch ignore @@ -300,25 +209,3 @@ upgrade-drupal: # Pull changes pull: git pull - -# Reset the working copy -reset: - #git reset HEAD - git checkout -f - -# Fix local folder permission -perms: - chmod 755 . - -# Deploy code pushed on remote host -deploy: perms reset submodules - drush cache-rebuild - drush config-import -y - -sync_files_from_development: - rsync -avz --delete $(DEVELOPMENT)/sql/dumps/ sql/dumps/ - rsync -avz --delete $(DEVELOPMENT)/files/ files/ - -sync_files_from_production: - rsync -avz --delete $(PRODUCTION)/sql/dumps/ sql/dumps/ - rsync -avz --delete $(PRODUCTION)/files/ files/ |