Skip to content

Instantly share code, notes, and snippets.

@q0rban
Last active March 7, 2016 14:24
Show Gist options
  • Save q0rban/0a8f95fd197c60058e69 to your computer and use it in GitHub Desktop.
Save q0rban/0a8f95fd197c60058e69 to your computer and use it in GitHub Desktop.
Example Project Makefile and shell scripts for use with Tugboat.
#
# Makefile for Project Foo
#
# Includes commands for Tugboat. Feel free to expand with custom project
# commands.
#
# This is called during "tugboat init", after all of the service containers have
# been built, and the git repo has been cloned. This can be used for things like
# installing additional libraries that don't come built-in to the tugboat
# containers.
#tugboat-init:
# util/tugboat-init.sh
# When a Tugboat Preview is being built or rebuilt, this command will be called
# immediately following the git merge. The tugboat-build.sh script can execute
# any deployment commands or scripts that might be required on your project.
tugboat-build:
util/tugboat-build.sh
# This command is used to update the Base Preview that all Previews are built
# from. This can be used to synchronize any data or other assets from a
# production or staging source, so that your Previews roughly match prod.
tugboat-update:
util/tugboat-update.sh
# This is called by Tugboat to run a project's test suite. It is used during
# "tugboat test", if the "testall" config option is set to true, and if --test
# is specified during "tugboat build".
#tugboat-test:
# util/tugboat-test.sh
#!/usr/bin/env bash
# Example tugboat-build.sh for a Drupal site.
# Turn on error detection and xtracing.
set -ex
# This assumes the Drupal root is found in the docroot directory of the repo.
cd /var/lib/tugboat/docroot
# Clear drush caches to start.
drush cc drush || /bin/true
# This command might run drush registry-rebuild, updb, fra, and perhaps
# compile SCSS and minify JS files.
drush build
# Remove CSS and JS to start fresh; drush cc all doesn't remove them.
rm -Rf sites/default/files/css sites/default/files/js
# cURLing localhost will warm any caches on the site.
curl -s http://localhost/ > /dev/null
#!/usr/bin/env bash
# Example tugboat-update.sh for a Drupal site.
# Turn on error detection and xtracing.
set -ex
# This assumes the Drupal root is found in the docroot directory of the repo.
cd /var/lib/tugboat/docroot
# Clear drush caches to start.
drush cc drush || /bin/true
# Sync down the database from dev. This uses syncdb, which is helpful for large
# databases, but a sql-sync could be fine for smaller databases.
drush syncdb @example.dev
# Now set up the Drupal site with a custom command to enable modules such as
# Stage File Proxy, et. al.
drush devify
@q0rban
Copy link
Author

q0rban commented Jan 5, 2016

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment