我的部署脚本抛出错误。我使用capistrano和gem railsless-deploy
错误:
/var/lib/gems/1.9.1/gems/capistrano-2.15.5/lib/capistrano/configuration/namespaces.rb:193:in `method_missing': undefined method `map' for #<Capistrano::Configuration::Namespaces::Namespace:0x00000001a634b0> (NoMethodError)
我的Capfile
require 'rubygems'
require 'railsless-deploy'
# load 'deploy'
load 'app/config/deploy'
我的deploy.rb
#...more code...#
set :myfiles, ["path/to/file.ext","path/to/another/file.ext"]
#...more code...#
namespace :myfiles do
task :check do
myfiles.map do |file|
#...more code...#
end
end
end
ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
cap -V
Capistrano v2.15.5
答案 0 :(得分:0)
你有一个变量myfiles
,然后几行之后的范围会覆盖它。这就是为什么capistrano尝试将map
方法发送到命名空间并失败。将列表名称更改为其他内容:
set :file_list, ["path/to/file.ext","path/to/another/file.ext"]
#...more code...#
namespace :myfiles do
task :check do
file_list.map do |file|
#...more code...#
end
end
end