Class: Sprinkle::Deployment::Deployment

Inherits:
Object
  • Object
show all
Defined in:
lib/sprinkle/deployment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Deployment

:nodoc:



43
44
45
46
47
# File 'lib/sprinkle/deployment.rb', line 43

def initialize(&block) #:nodoc:
  @defaults = {}
  self.instance_eval(&block)
  raise 'No delivery mechanism defined' unless @style
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object

:nodoc:



62
63
64
# File 'lib/sprinkle/deployment.rb', line 62

def method_missing(sym, *args, &block) #:nodoc:
  @defaults[sym] = block
end

Instance Attribute Details

#defaultsObject

:nodoc:



41
42
43
# File 'lib/sprinkle/deployment.rb', line 41

def defaults
  @defaults
end

#styleObject

:nodoc:



41
42
43
# File 'lib/sprinkle/deployment.rb', line 41

def style
  @style
end

Instance Method Details

#delivery(type, &block) ⇒ Object

Specifies which Sprinkle::Actors to use for delivery. Although all actors jobs are the same: to run remote commands on a server, you may have a personal preference. The block you pass is used to configure the actor. For more information on what configuration options are available, view the corresponding Sprinkle::Actors page.



54
55
56
# File 'lib/sprinkle/deployment.rb', line 54

def delivery(type, &block) #:doc:
  @style = Actors.const_get(type.to_s.titleize).new &block
end

#find_servers(role) ⇒ Object



58
59
60
# File 'lib/sprinkle/deployment.rb', line 58

def find_servers(role)
  style.find_servers(role)
end

#processObject

:nodoc:



70
71
72
73
74
# File 'lib/sprinkle/deployment.rb', line 70

def process #:nodoc:
  POLICIES.each do |policy|
    policy.process(self)
  end
end

#respond_to?(sym) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


66
67
68
# File 'lib/sprinkle/deployment.rb', line 66

def respond_to?(sym) #:nodoc:
  !!@defaults[sym]
end