require'mina/bundler'require'mina/rails'require'mina/git'require'mina/rvm'# for rvm support. (http://rvm.io)set:domain,'foobar.com'#设置你的服务ip地址,或者域名set:deploy_to,'/var/www/foobar.com'#部署的文件目录set:repository,'git://...'# git 地址set:branch,'master'# 确定分支set:shared_paths,['config/database.yml','log']# Optional settings:set:user,'foobar'# ssh 用的用户名.# set :port, '30000' # SSH 端口,默认22.task:environmentdoinvoke:'rvm:use[ruby-1.9.3-p125@default]'end#mina setup 时会执行的操作task:setup=>:environmentdoqueue!%[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"]# 目录权限设置queue!%[touch "#{deploy_to}/shared/config/database.yml"]# 生成服务器的database.ymlqueue%[-----> Be sure to edit 'shared/config/database.yml'.]#提示编辑服务器的database.yml, 可以删除 end# 进行mina deploy会进行的操作desc"Deploys the current version to the server."task:deploy=>:environmentdodeploydo# 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'to:launchdoqueue'touch tmp/restart.txt'# 服务器重启服务器用的endendend