Class: Soyuz::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/soyuz/environment.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, defaults = {}) ⇒ Environment

Returns a new instance of Environment.



5
6
7
8
9
10
11
12
13
# File 'lib/soyuz/environment.rb', line 5

def initialize(attributes={}, defaults={})
  set_attributes(attributes, defaults)

  if [:deploy_cmds, :deploy_cmd].all?{ |attr| @attributes.has_key?(attr) }
    raise ArgumentError, "Only one definiton of deploy_cmd or deploy_cmds is allowed"
  end

  build
end

Instance Method Details

#after_callbacksObject



26
27
28
29
30
# File 'lib/soyuz/environment.rb', line 26

def after_callbacks
  @after_callbacks.each do|cmd|
    cmd.run
  end
end

#before_callbacksObject



20
21
22
23
24
# File 'lib/soyuz/environment.rb', line 20

def before_callbacks
  @before_callbacks.each do|cmd|
    cmd.run
  end
end

#deployObject



32
33
34
35
36
# File 'lib/soyuz/environment.rb', line 32

def deploy
  @deploy_cmds.each do |cmd|
    cmd.run
  end
end

#nameObject



38
39
40
# File 'lib/soyuz/environment.rb', line 38

def name
  @name
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/soyuz/environment.rb', line 15

def valid?
  # If the environment built then it's valid
  true
end