Sha256: ea9d4aed2a2bcfa64565c9e095f7a7798ea3ac6cc919aba611fc19194af8c88d
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require 'capistrano/cli' require 'pp' module Sprinkle module Actors class Dummy < Actor #:nodoc: def initialize(&block) #:nodoc: # @config.set(:_sprinkle_actor, self) @roles={} self.instance_eval &block end def role(role, server, opts={}) @roles[role]||=[] @roles[role] << [ server, opts ] end # Determines if there are any servers for the given roles def servers_for_role?(roles) roles=Array(roles) roles.any? { |r| @roles.keys.include? (r) } end def install(installer, roles, opts={}) if per_host=opts.delete(:per_host) servers_per_role(roles).each do |server| installer.reconfigure_for(server) installer.announce process(installer.package.name, installer.install_sequence, server, opts) end else process(installer.package, installer.install_sequence, roles, opts) end end def verify(verifier, roles, opts = {}) process(verifier.package.name, verifier.commands, roles, opts = {}) end def servers_per_role(role) @roles[role] end def process(name, commands, roles, opts = {}) #:nodoc: # puts "PROCESS: #{name} on #{roles}" pp commands # return false if suppress_and_return_failures true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sprinkle-0.5.2 | lib/sprinkle/actors/dummy.rb |
sprinkle-0.5.1.1 | lib/sprinkle/actors/dummy.rb |
sprinkle-0.5.1 | lib/sprinkle/actors/dummy.rb |