Skip to content

Instantly share code, notes, and snippets.

@lnikell
Created April 4, 2016 06:41
Show Gist options
  • Save lnikell/7380d235f3040b5260bc5f75dd14749f to your computer and use it in GitHub Desktop.
Save lnikell/7380d235f3040b5260bc5f75dd14749f to your computer and use it in GitHub Desktop.
require 'mina/multistage'
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina/puma'
set :shared_paths, ['config/database.yml', 'config/secrets.yml', 'config/puma.rb', 'log', 'tmp/pids', 'tmp/sockets', 'public/uploads', 'public/spree']
task :environment do
invoke :'rvm:use[ruby-2.2.2@default]'
end
task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/log"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/config"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/public/uploads"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/public/uploads"]
queue! %[mkdir -p "#{deploy_to}/#{shared_path}/public/spree"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/public/spree"]
queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/sockets")
queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/sockets")
queue! %(mkdir -p "#{deploy_to}/#{shared_path}/tmp/pids")
queue! %(chmod g+rx,u+rwx "#{deploy_to}/#{shared_path}/tmp/pids")
queue! %[touch "#{deploy_to}/#{shared_path}/config/database.yml"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/secrets.yml"]
queue! %[touch "#{deploy_to}/#{shared_path}/config/puma.rb"]
queue %[echo "-----> Be sure to edit '#{deploy_to}/#{shared_path}/config/database.yml', 'secrets.yml' and puma.rb."]
end
desc "Deploys the current version to the server."
task :deploy => :environment do
to :before_hook do
# Put things to run locally before ssh
end
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment