Skip to content

Instantly share code, notes, and snippets.

View mitramejia's full-sized avatar

Mitra Mejia mitramejia

View GitHub Profile
@mitramejia
mitramejia / deploy.rb
Created December 24, 2016 16:18
Deploy trellis projects in a Continuous Integration manner
#!/usr/bin/env ruby
require 'colorize'
require 'git'
# Public: A Class to deploy trellis projects in a Continuous Integration manner.
class Deployment
# Modify these to match your project
TESTS_DIR = '/your/behat/tests/directory'.freeze
TRELLIS_DEPLOY_SCRIPT_DIR = '/path/to/trellis/deploy.sh/script'.freeze
@mitramejia
mitramejia / pre-push
Created December 4, 2016 17:08
pre-push git hook, a ruby script to run behat tests before a git push is executed. If tests pass git push will be allowed
#!/usr/bin/env ruby
require 'colorize'
require 'git'
# Get working directory and make git read it
working_dir = "/Users/yourname/app"
git = Git.open working_dir
# Get current git branch
current_branch = git.branches.select { |branch| branch.current == true }.first
@mitramejia
mitramejia / docker-compose.staging.yml
Last active October 26, 2016 21:53
Docker Compose config file for production apps using Geniem's wp-project template
##
# Nodejs container which installs and builds all frontend assets
##
#frontend:
# image: devgeniem/node-assets-builder
# volumes_from:
# - data
# command: /bin/bash -c "cd /var/www/project/web/app/themes/THEMENAME && npm install && ./node_modules/webpack/bin/webpack.js"
##
@mitramejia
mitramejia / post-recieve
Last active April 15, 2016 18:37
post-receive
#!/usr/bin/env ruby
# post-receive
# 1. Read STDIN (Format: "from_commit to_commit branch_name")
from, to, branch = ARGF.read.split " "
# 2. Only deploy if master branch was pushed
if (branch =~ /master$/) == nil
puts "Received branch #{branch}, not deploying."
exit