subl Gemfile
group :development do
gem 'mina', group: :development
gem 'mina-puma', require: false
gem 'mina-logs', require: false
end
bundle
mina --version
Mina, version v1.0.6
subl config/deploy.rb
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
require 'mina/puma'
require 'mina/logs'
set :domain, 'www.chejj.com.cn'
set :user, 'deploy'
set :deploy_to, '/home/deploy/www.chejj.com.cn/chejj'
set :repository, '[email protected]:chinakr/chejj.git' # private repository
set :branch, 'master'
set :shared_dirs, ['log']
set :shared_files, ['config/database.yml', 'config/secrets.yml']
desc 'Set up environment.'
task :environment do
invoke :'rvm:use', 'ruby-2.3.3@rails5'
end
desc 'Prepare for deployment.'
task :setup do
['log', 'config', 'public/upload', 'tmp/pids', 'tmp/sockets'].each do |dir|
command %{mkdir -p "#{deploy_to}/shared/#{dir}"}
command %{chmod g+rx,u+rwx "#{deploy_to}/shared/#{dir}"}
end
['config/database.yml', 'config/secrets.yml', 'config/puma.rb'].each do |file|
command %{touch "#{deploy_to}/shared/#{file}"}
comment %{Be sure to edit 'shared/#{file}'.}
end
end
desc 'Deploy 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'
invoke :'deploy:cleanup'
on :launch do
invoke :'puma:start'
invoke :'puma:phased_restart'
end
end
end
mina setup
mina aborted!
NameError: undefined local variable or method `deploy_to' for main:Object
Did you mean? deploy
/Users/chinakr/workspace/ruby/rails/chejj/config/deploy.rb:30:in `block (2 levels) in <top (required)>'
/Users/chinakr/workspace/ruby/rails/chejj/config/deploy.rb:29:in `each'
/Users/chinakr/workspace/ruby/rails/chejj/config/deploy.rb:29:in `block in <top (required)>'
/Users/chinakr/.rvm/gems/ruby-2.3.1@rails5/gems/mina-1.0.6/lib/mina/application.rb:16:in `run'
/Users/chinakr/.rvm/gems/ruby-2.3.1@rails5/gems/mina-1.0.6/bin/mina:4:in `<top (required)>'
/Users/chinakr/.rvm/gems/ruby-2.3.1@rails5/bin/mina:23:in `load'
/Users/chinakr/.rvm/gems/ruby-2.3.1@rails5/bin/mina:23:in `<main>'
/Users/chinakr/.rvm/gems/ruby-2.3.1@rails5/bin/ruby_executable_hooks:15:in `eval'
/Users/chinakr/.rvm/gems/ruby-2.3.1@rails5/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => setup
看错误提示是deploy_to
未定义,为什么呢?