Module: Rubber::Configuration

Defined in:
lib/rubber/instance.rb,
lib/rubber/generator.rb,
lib/rubber/environment.rb,
lib/rubber/configuration.rb

Defined Under Namespace

Classes: ConfigDescriptor, ConfigHolder, Environment, Generator, Instance, InstanceItem, RoleItem

Constant Summary collapse

@@configurations =
{}

Class Method Summary collapse

Class Method Details

.get_configuration(env = nil, root = nil) ⇒ Object


11
12
13
14
# File 'lib/rubber/configuration.rb', line 11

def self.get_configuration(env=nil, root=nil)
  key = "#{env}-#{root}"
  @@configurations[key] ||= ConfigHolder.new(env, root)
end

.rubber_envObject


16
17
18
19
20
21
22
# File 'lib/rubber/configuration.rb', line 16

def self.rubber_env
  raise "This convenience method needs RUBBER_ENV to be set" unless RUBBER_ENV
  cfg = Rubber::Configuration.get_configuration(RUBBER_ENV)
  host = cfg.environment.current_host
  roles = cfg.instance[host].role_names rescue nil
  cfg.environment.bind(roles, host)
end

.rubber_instancesObject


24
25
26
27
# File 'lib/rubber/configuration.rb', line 24

def self.rubber_instances
  raise "This convenience method needs RUBBER_ENV to be set" unless RUBBER_ENV
  Rubber::Configuration.get_configuration(RUBBER_ENV).instance
end