Skip to content

Instantly share code, notes, and snippets.

@mjason
Created May 29, 2013 03:28
Show Gist options
  • Save mjason/5667779 to your computer and use it in GitHub Desktop.
Save mjason/5667779 to your computer and use it in GitHub Desktop.
mina部署脚本
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm' # for rvm support. (http://rvm.io)
set :domain, 'xxx.xxx.xxx'
set :deploy_to, '/home/xxxx/xxxx'
set :repository, 'git@xxxx'
set :branch, 'master'
set :shared_paths, ['config/database.yml', 'log']
set :user, 'xxxx' # Username in the server to SSH to.
task :environment do
invoke :'rvm:use[ruby-2.0.0-p0]'
end
task :setup => :environment do
queue! %[mkdir -p "#{deploy_to}/shared/log"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/log"]
queue! %[mkdir -p "#{deploy_to}/shared/config"]
queue! %[chmod g+rx,u+rwx "#{deploy_to}/shared/config"]
end
desc "Deploys the current version to the server."
task :deploy => :environment do
deploy do
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
end
end
task :restart => :environment do
queue """
if [ -d #{deploy_to}/current/tmp ]
then
touch #{deploy_to}/current/tmp/restart.txt
else
mkdir #{deploy_to}/current/tmp
touch #{deploy_to}/current/tmp/restart.txt
fi
"""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment