ruby on rails - Capistrano task from another task with parameters -


my question similar how invoke 1 capistrano task another?

the thing want being able pass parameters bar when calling foo:

task :foo   # calls bar, pass params (i.e n = 10)   # if calling cap bar -s n=10   # bar not take arguments   bar end  task :bar   if exists?(:n)     puts "n is: #{n}"   end end 

capistrano tasks can't parameterized. can define helper method, follows:

task :foo   bar(10) end  def bar(n=variables[:n])   puts "n #{n}"   end 

if you're dead set on having :bar task well, try trick:

task :foo   bar(10) end  task :bar { bar }  def bar(n=variables[:n])   puts "n #{n}"   end 

note task must declared before method.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -