我正在运行capistrano 3。
我如何才能使下面的行为正确?
我期待cap deploy:test_symbols
返回“你是男人!”
task :test_symbols do
set :what, 'the man!'
puts "you are #{:what}"
# below causes error:
# undefined local variable or method `what' for main:Object
puts "you are #{what}"
end
答案 0 :(得分:3)
当您set
变量时,您需要fetch
使用它:
task :test_symbols do
set :what, 'the man!'
puts "you are #{fetch(:what)}"
end