最佳答案
Capistrano 对我来说是个新手,我曾经尝试使用 Capistrano 的 DSL 在服务器上运行 shell 命令(‘ run’,‘ execute’等) ,但是它似乎已经被弃用了。在搜索了一遍又一遍的功能等价物之后,我还是迷路了。
目前代码:
desc 'Do something'
task :do_something
execute 'echo sometext'
end
产出:
cap aborted!
undefined method `execute' for main:Object
/Users/Justin/Dropbox/xxxx/xxxx/xxxx/Capfile:45:in `block (2 levels) in <top (required)>'
/Users/Justin/.rvm/gems/ruby-2.0.0-p247/bundler/gems/capistrano-2dc1627838f9/lib/capistrano/application.rb:12:in `run'
/Users/Justin/.rvm/gems/ruby-2.0.0-p247/bundler/gems/capistrano-2dc1627838f9/bin/cap:3:in `<top (required)>'
/Users/Justin/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `load'
/Users/Justin/.rvm/gems/ruby-2.0.0-p247/bin/cap:23:in `<main>'
/Users/Justin/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
/Users/Justin/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => deploy:do_something