ruby - deploy.rb: undefined local variable or method `home` for main:Object -
i know there lot of questions regarding error message, couldn't find 1 error happening in same context mine.
i'm trying migrate working capistrano configuration version 2 capistrano 3. unfortunately, calling cap production deploy --dry-run
generates error
cap aborted! undefined local variable or method `home' main:object /myapp/config/deploy.rb:6:in `<top (required)>'
here's content of deploy.rb
line 6 error occurs:
set :user, "myuser" set :application, "myapp" set :domain, "mydomain" set :repository, "git@github.com:acme/myapp.git" set :home, "/home/myuser" set :deploy_to, "#{home}/#{domain}"
i don't know ruby, i've gathered, colon means these symbols, not variables, , in capistrano documentation they're using same syntax define "variables" (see paragraph 5 "set shared information in deploy.rb")?
the deploy script ran flawlessly on os x ruby 2.0.0p247 , capistrano 2.9.0. on centos ruby 1.9.3p545 , capistrano 3.1.0, error mentioned above occurs. i've made several changes capfile
running capistrano 3, left deploy.rb
untouched, hoping work.
i don't think capistrano create local variables you, can yourself:
domain = "mydomain" home = "/home/myuser" set :domain, domain set :home, home set :deploy_to, "#{home}/#{domain}"
alternatively, can use fetch
, counterpart set
:
set :domain, "mydomain" set :home, "/home/myuser" set :deploy_to, "#{fetch(:home)}/#{fetch(:domain)}"
Comments
Post a Comment