lib/screwcap/task.rb in screwcap-0.6.3 vs lib/screwcap/task.rb in screwcap-0.7
- old
+ new
@@ -9,10 +9,11 @@
self.__local_before_command_sets = []
self.__local_after_command_sets = []
self.__servers = opts.delete(:servers)
self.__callback = opts.delete(:callback)
self.__block = block
+ self.__built_commands = []
if self.__options[:before] and self.__options[:before].class != Array
self.__options[:before] = [self.__options[:before]]
end
if self.__options[:after] and self.__options[:after].class != Array
@@ -209,23 +210,16 @@
after.clone_from(self)
commands << after.__build_commands(command_sets, self)
end
end
- commands.flatten
+ commands.flatten!
+ self.__built_commands = commands
end
def validate(servers)
- raise Screwcap::ConfigurationError, "Could not find a server to run this task on. Please specify :server => :servername or :servers => [:server1, :server2] in the task_for directive." if servers == [] or servers.nil?
-
- # marshal :server into :servers
self.__servers = [self.__options.delete(:server)] if self.__options[:server]
self.__servers = [self.__servers] if self.__servers.class != Array
-
- server_names = servers.map {|s| s.__name }
- self.__servers.each do |server_name|
- raise Screwcap::ConfigurationError, "Could not find a server to run this task on. Please specify :server => :servername or :servers => [:server1, :server2] in the task_for directive." unless server_names.include?(server_name)
- end
end
private
def method_missing(m, *args) # :nodoc