|
Local Variable Problems: msg#00010lang.ruby.capistrano.general
I am trying to write my deploy script that will work for multiple deployment environments (sandbox, dev, staging, production). While working on this I ran into a problem with variable assignment. I wrote some debug scripts to check on somethings and got the strangest results. Here is what I wrote in my deploy.rb: puts "tier: #{tier}" if !tier.nil? puts tier.nil?.to_s puts "tier: #{tier}" if !tier.nil? puts tier.nil?.to_s if tier.nil? tier = 'sandbox' end puts "tier: #{tier}" #puts "ENV[]: " + ENV["TIER"] if !ENV["TIER"] raise "stop" I then run the following command from my command line: cap -S tier=dev deploy This is what is outputted to my console: C:\Ruby\InstantRails\rails_apps\video_content_manager>cap -S tier=dev deploy loading configuration C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capis trano-1.2.0/lib/capistrano/recipes/standard.rb loading configuration ./config/deploy.rb loading configuration C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongr el_cluster-0.2.0/lib/mongrel_cluster/recipes.rb tier: dev false tier: dev false tier: ./config/deploy.rb:35:in `load': stop (RuntimeError) from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/configuration.rb:146:in `load' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/configuration.rb:125:in `load' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/configuration.rb:125:in `load' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:252:in `execute_recipes!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:252:in `execute_recipes!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:233:in `execute!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:12:in `execute!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/b in/cap:11 from C:/Ruby/InstantRails/ruby/bin/cap:18 As you can see on the last line before the exception is thrown the variable tier suddenly goes to nil. If I then comment out the following line: if tier.nil? # tier = 'sandbox' end I get the following output: C:\Ruby\InstantRails\rails_apps\video_content_manager>cap -S tier=dev deploy loading configuration C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capis trano-1.2.0/lib/capistrano/recipes/standard.rb loading configuration ./config/deploy.rb loading configuration C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongr el_cluster-0.2.0/lib/mongrel_cluster/recipes.rb tier: dev false tier: dev false tier: dev ./config/deploy.rb:35:in `load': stop (RuntimeError) from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/configuration.rb:146:in `load' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/configuration.rb:125:in `load' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/configuration.rb:125:in `load' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:252:in `execute_recipes!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:252:in `execute_recipes!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:233:in `execute!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/l ib/capistrano/cli.rb:12:in `execute!' from C:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/capistrano-1.2.0/b in/cap:11 from C:/Ruby/InstantRails/ruby/bin/cap:18 The problem has disappeared. It seems like capistrano is doing something weird for an assignment to a local variable that it should not even be executing. Please Help!?!?!? --~--~---------~--~----~------------~-------~--~----~ To unsubscribe from this group, send email to capistrano-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@xxxxxxxxxxxxxxxx For more options, visit this group at http://groups.google.com/group/capistrano -~----------~----~----~----~------~----~------~--~--- |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: ssh agent forwarding to svn box failing?: 00010, Jamis Buck |
|---|---|
| Next by Date: | dispatch.fcgi restarts but still app is showing the old code: 00010, Siva Jagadeesan |
| Previous by Thread: | ssh agent forwarding to svn box failing?i: 00010, mbailey |
| Next by Thread: | Re: Local Variable Problems: 00010, Jamis Buck |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |