diff options
Diffstat (limited to 'share')
-rw-r--r-- | share/drupal7/drupal.make.yml | 21 | ||||
-rw-r--r-- | share/drupal8/Makefile | 168 | ||||
-rw-r--r-- | share/drupal8/drupal.make.yml | 9 |
3 files changed, 198 insertions, 0 deletions
diff --git a/share/drupal7/drupal.make.yml b/share/drupal7/drupal.make.yml new file mode 100644 index 0000000..5ae7edb --- /dev/null +++ b/share/drupal7/drupal.make.yml @@ -0,0 +1,21 @@ +core: 7.x +api: '2' +projects: + drupal: + version: '' + views: + version: '' + ctools: + version: '' + panels: + version: '' + feeds: + version: '' + libraries: + version: '' + features: + version: '' + strongarm: + version: '' + module_filter: + version: '' diff --git a/share/drupal8/Makefile b/share/drupal8/Makefile new file mode 100644 index 0000000..3ba982f --- /dev/null +++ b/share/drupal8/Makefile @@ -0,0 +1,168 @@ +# +# Makefile for a Drupal 8 Website +# + +# Parameters +CORE = 8 +PROJECT = drupal +ENV = dev +DATE = $(shell date +%Y%m%d) +CWD = $(shell pwd) +DESTDIR ?= vendor +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 vagrant +develop: submodules kvmx + rm -rf $(DRUPAL)/sites/default + ln -s $(PROJECT) $(DRUPAL)/sites/default + vagrant ssh -c "$(DRUSH) pm-enable devel -y" + +# 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 + +# Setup the virtual machine using kvmx +kvmx: + kvmx up + +# 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 8 + +# 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 + test -s settings.dev.php || cp $(DRUPAL)/sites/default/default.settings.php settings.dev.php + test -s services.dev.yml || cp $(DRUPAL)/sites/default/default.services.yml services.dev.yml + +# Setup drupal settings +settings: default_settings + test -s $(DRUPAL)/sites/sites.php || cp sites.php $(DRUPAL)/sites/sites.php + mkdir -p $(DRUPAL)/sites/$(PROJECT) + test -s $(DRUPAL)/sites/$(PROJECT)/settings.$(ENV).php || cp settings.dev.php $(DRUPAL)/sites/$(PROJECT)/settings.$(ENV).php + test -s $(DRUPAL)/sites/$(PROJECT)/settings.php || ln -s settings.$(ENV).php $(DRUPAL)/sites/$(PROJECT)/settings.php + test -s $(DRUPAL)/sites/$(PROJECT)/services.$(ENV).yml || cp services.dev.yml $(DRUPAL)/sites/$(PROJECT)/services.$(ENV).yml + test -s $(DRUPAL)/sites/$(PROJECT)/services.yml || ln -s services.$(ENV).yml $(DRUPAL)/sites/$(PROJECT)/services.yml + chmod 640 $(DRUPAL)/sites/$(PROJECT)/settings.php + chmod 640 $(DRUPAL)/sites/$(PROJECT)/services.yml + +# 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) + +# Update the database +updatedb: + $(DRUSH) updatedb -y + +# Load the database dump, clear the drupal cache and fix image paths +# See https://www.drupal.org/node/628130 +initdb: + test -s sql/dumps/latest && gzip -dc sql/dumps/latest.sql.gz | $(DRUSH) sql-cli || true + test -s sql/dumps/latest && $(DRUSH) updatedb -y || true + +# Dump the database +dumpdb: + 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: + echo "DROP DATABASE $(PROJECT); CREATE DATABASE $(PROJECT);" | $(DRUSH) sql-cli + +# Reinitializes the database +reinitdb: destroydb initdb + +# Cleanup develop environment +clean: + vagrant halt + vagrant destroy -f + 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: + $(DRUSH) config-diff + +# Update the codebase +update: pull submodules + +# Upgrade modules +upgrade-modules: + $(DRUSH) up + +# Upgrade drupal +upgrade-drupal: + BASE=/vagrant/vendor drupal upgrade $(OLD) $(NEW) + +# Configure update hook on remote host +post_receive: + git config receive.denyCurrentBranch ignore + cd .git/hooks && ln -sf ../../bin/post-receive + +# 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 diff --git a/share/drupal8/drupal.make.yml b/share/drupal8/drupal.make.yml new file mode 100644 index 0000000..38154eb --- /dev/null +++ b/share/drupal8/drupal.make.yml @@ -0,0 +1,9 @@ +core: 8.x +api: '2' +projects: + drupal: + version: '' + devel: + version: '' + libraries: + version: '' |