Skip to content

Instantly share code, notes, and snippets.

@christianmagill
Created August 26, 2016 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianmagill/cd8e802f0eea2017a53021f7e9d8bb3c to your computer and use it in GitHub Desktop.
Save christianmagill/cd8e802f0eea2017a53021f7e9d8bb3c to your computer and use it in GitHub Desktop.
if fetch(:stage) == 'production'
set :application, 'example.com'
else
set :application, 'staging.example.com'
end
set :repo_url, 'git@bitbucket.org:example/example.com.git'
# Branch options
# Prompts for the branch name (defaults to current branch)
# ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
set :branch, :master
SSHKit.config.command_map[:npm] = '/home/example01/bin/npm'
SSHKit.config.command_map[:bash] = "/usr/local/bin/bash"
SSHKit.config.command_map[:composer] = "/usr/local/php70/bin/php-cli /home/example01/composer.phar"
set :deploy_to, -> { "/home/example01/public_html/#{fetch(:application)}" }
def theme_path(release_path) "#{release_path}/web/app/themes/example" end
set :tmp_dir, "/home/example01/capistrano_tmp"
set :log_level, :debug
set :linked_files, fetch(:linked_files, []).push('.env', 'web/.htaccess')
set :linked_dirs, fetch(:linked_dirs, []).push('web/app/uploads')
namespace :deploy do
desc 'NPM Build Production'
task :npm_build_production do
on roles(:app) do
within theme_path(release_path) do
execute :npm, "install --silent --no-progress"
execute :npm, "run build:production"
end;
end
end
end
before 'deploy:updated', 'deploy:npm_build_production'
namespace :deploy do
desc 'Composer Theme Dependencies'
task :composer_theme_dependencies do
on roles(:app) do
within theme_path(release_path) do
execute :composer, "install"
end;
end
end
end
before 'deploy:updated', 'deploy:composer_theme_dependencies'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment