I\'m looking into the possibility of using Capistrano as a generic deploy solution. By \"generic\", I mean not-rails. I\'m not happy with the quality of the documentation I\'m f
As Jamie already showed, you can pass parameters to tasks with the -s
flag. I want to show you how you additionally can use a default value.
If you want to work with default values, you have to use fetch
instead of ||=
or checking for nil
:
namespace :logs do
task :tail do
file = fetch(:file, 'production') # sets 'production' as default value
puts "I would use #{file}.log now"
end
end
You can either run this task by (uses the default value production
for file
)
$ cap logs:tail
or (uses the value cron
for file
$ cap logs:tail -s file=cron