未定义的capistrano通过我的模块

时间:2017-02-22 08:31:06

标签: ruby rake capistrano

我在capistrano写作rake任务。

我认为我可以在info method1method2 run_locally中使用method2方法,但我在info中收到了错误。< / p>

发生了什么......

如何解决此问题?

我应该在run_locally再次将Sample:method2namespace :sample do task :task1 do run_locally do method1('task1') Sample::method2('task1') end end def method1(str) info "> called method1 str:#{str}" end end module Sample extend Rake::DSL extend self def method2(str) info "> called method2 str:#{str}" end public :method2 end 一起包裹吗? (但我拒绝了......)

环境

  • Capistrano版本:3.4.0(耙子版本:10.4.2)

$ bundle exec cap beta sample:task1
INFO > called method1 str:task1
(Backtrace restricted to imported tasks)
cap aborted!
NoMethodError: undefined method `info' for Sample:Module
/capistrano/lib/capistrano/tasks/util.rake:22:in `method2'
/capistrano/lib/capistrano/tasks/util.rake:8:in `block (3 levels) in <top (required)>'
/capistrano/lib/capistrano/tasks/util.rake:6:in `block (2 levels) in <top (required)>'
Tasks: TOP => sample:task1
(See full trace by running task with --trace)

输出

index.html

0 个答案:

没有答案