lib/cape/capistrano.rb in cape-1.0.3 vs lib/cape/capistrano.rb in cape-1.1.0
- old
+ new
@@ -56,14 +56,18 @@
description = [task[:description]]
description << '.' unless task[:description].end_with?('.')
unless (parameters = Array(task[:parameters])).empty?
noun = Util.pluralize('variable', parameters.length)
parameters_list = Util.to_list_phrase(parameters.collect(&:upcase))
+ singular = 'Rake task argument'
+ noun_phrase = (parameters.length == 1) ?
+ "a #{singular}" :
+ Util.pluralize(singular)
description << <<-end_description
-You must set environment #{noun} #{parameters_list}.
+Set environment #{noun} #{parameters_list} to pass #{noun_phrase}.
end_description
end
description.join
end
@@ -71,13 +75,13 @@
name = task[:name].split(':')
# Define the task.
block = lambda { |context|
context.task name.last, :roles => roles do
arguments = Array(task[:parameters]).collect do |a|
- unless (value = ENV[a.upcase])
- fail "Environment variable #{a.upcase} must be set"
+ if (value = ENV[a.upcase])
+ value = value.inspect
end
- value.inspect
+ value
end
if arguments.empty?
arguments = nil
else
arguments = "[#{arguments.join ','}]"