lib/rubber/recipes/rubber.rb in axtro-rubber-1.0.2.8 vs lib/rubber/recipes/rubber.rb in axtro-rubber-1.2.0

- old
+ new

@@ -8,20 +8,27 @@ require 'pp' require 'rubber' namespace :rubber do - # advise capistrano's task method so that tasks for non-existant roles don't + # Disable connecting to any Windows instance. + alias :original_task :task + def task(name, options={}, &block) + original_task(name, options.merge(:except => { :platform => 'windows' }), &block) + end + + # advise capistrano's task method so that tasks for non-existent roles don't # fail when roles isn't defined due to using a FILTER for load_roles # If you have a task you need to execute even when there are no # roles, you have to use required_task instead of task - see rubber:create # as an example of this role bootstrapping problem. def allow_optional_tasks(ns) class << ns alias :required_task :task def task(name, options={}, &block) - required_task(name, options) do + # Disable connecting to any Windows instance. + required_task(name, options.merge(:except => { :platform => 'windows' })) do # define empty roles for the case when a task has a role that we don't define anywhere [*options[:roles]].each do |r| roles[r] ||= [] end @@ -71,10 +78,10 @@ all_roles.each {|name| top.roles[name.to_sym] = []} # define capistrano host => role mapping for all instances rubber_instances.filtered.each do |ic| ic.roles.each do |role| - opts = Rubber::Util::symbolize_keys(role.options) + opts = Rubber::Util::symbolize_keys(role.options).merge(:platform => ic.platform) msg = "Auto role: #{role.name.to_sym} => #{ic.full_name}" msg << ", #{opts.inspect}" if opts.inspect.size > 0 logger.info msg top.role role.name.to_sym, ic.full_name, opts end