我已经切换到使用环境variables进行configuration ,并且工作得非常好 – 除非我必须使用capistrano部署或运行任务。 Capistrano 3似乎执行了前缀为/usr/bin/env每个命令,这会清除通过.bashrc设置的所有环境variables。 编辑 – 在做更多的研究,这可能不是问题,这个问题可能是因为capistrano作为非login,非交互式shell执行,不加载.bashrc或.bash_profile 。 但是,仍然卡住了。 当capistrano执行任务时,确定环境variables的最佳方法是什么?
我是Capistrano的新手,我尝试过使用Capistrano的DSL在服务器上运行shell命令('运行','执行'等),但似乎已经被弃用了。 经过search和searchfunction相当,我仍然迷路了。 当前代码: 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
INFO [050fe961] Running mkdir -p /home/rails/rails- capistrano/releases/20140114234157 on staging-rails DEBUG [050fe961] Command: cd /home/rails/rails-capistrano/repo && ( PATH=/opt/ruby/bin:$PATH GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/rails/git-ssh.sh mkdir -p /home/rails/rails-capistrano/releases/20140114234157 ) INFO [050fe961] Finished in 0.142 seconds with exit status 0 (successful). INFO [2dea2fe5] Running git archive feature/Capistrano | tar -x -C /home/rails/rails-capistrano/releases/20140114234157 on staging-rails DEBUG [2dea2fe5] Command: cd /home/rails/rails-capistrano/repo && ( PATH=/opt/ruby/bin:$PATH […]