Module: Trooper::Config::Environment

Included in:
Trooper::Configuration
Defined in:
lib/trooper/config/environment.rb

Instance Method Summary collapse

Instance Method Details

#env(environment_name, &block) ⇒ Object



12
13
14
# File 'lib/trooper/config/environment.rb', line 12

def env(environment_name, &block)
  instance_variable_set "@#{environment_name.to_s}_configuration", block
end

#hosts(*arg) ⇒ Object



20
21
22
# File 'lib/trooper/config/environment.rb', line 20

def hosts(*arg)
  set :hosts => [*arg] 
end

#load_environment!Object



5
6
7
8
9
10
# File 'lib/trooper/config/environment.rb', line 5

def load_environment!
  instance_variable = instance_variable_get("@#{self[:environment].to_s}_configuration")
  unless instance_variable.nil?
    instance_eval(&instance_variable)
  end
end

#path(arg) ⇒ Object



28
29
30
31
32
33
# File 'lib/trooper/config/environment.rb', line 28

def path(arg)
  set :application_path => "#{arg}/application" 
  set :trooper_path => "#{arg}/trooper"
  set :prerequisite_list => "#{arg}/trooper/prerequisite_list"
  set :path => arg 
end

#repository(arg) ⇒ Object



24
25
26
# File 'lib/trooper/config/environment.rb', line 24

def repository(arg)
  set :repository => arg 
end

#ruby_bin_path(arg) ⇒ Object



35
36
37
# File 'lib/trooper/config/environment.rb', line 35

def ruby_bin_path(arg)
  set :ruby_bin_path => arg.gsub(/[^\/]$/, '\1/') # /usr/local/bin/
end

#user(arg) ⇒ Object



16
17
18
# File 'lib/trooper/config/environment.rb', line 16

def user(arg)
  set :user => arg 
end