Module: Rubber

Defined in:
lib/rubber.rb,
lib/rubber.rb,
lib/rubber/dns.rb,
lib/rubber/tag.rb,
lib/rubber/util.rb,
lib/rubber/cloud.rb,
lib/rubber/railtie.rb,
lib/rubber/dns/base.rb,
lib/rubber/instance.rb,
lib/rubber/cloud/aws.rb,
lib/rubber/generator.rb,
lib/rubber/cloud/base.rb,
lib/rubber/dns/dyndns.rb,
lib/rubber/dns/zerigo.rb,
lib/rubber/dns/nettica.rb,
lib/rubber/environment.rb,
lib/rubber/configuration.rb

Defined Under Namespace

Modules: Cloud, Configuration, Dns, Tag, Util Classes: Railtie

Constant Summary collapse

@@version =
File.read(File.join(File.dirname(__FILE__), '..', 'VERSION')).chomp

Class Method Summary collapse

Class Method Details

.configObject



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

def self.config
  Rubber::Configuration.rubber_env
end

.envObject



42
43
44
# File 'lib/rubber.rb', line 42

def self.env
  @@env
end

.initialize(project_root, project_env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rubber.rb', line 7

def self.initialize(project_root, project_env)
  return if defined?(RUBBER_ROOT) && defined?(RUBBER_ENV)

  @@root = project_root
  @@env = project_env
  Object.const_set('RUBBER_ENV', project_env)
  Object.const_set('RUBBER_ROOT', File.expand_path(project_root))

  if ! defined?(Rails) && ! Rubber::Util::is_bundler?
    # pull in basic rails env.  rubber only needs RAILS_ROOT and RAILS_ENV.
    # We actually do NOT want the entire rails environment because it
    # complicates bootstrap (i.e. can't run config to create db because full
    # rails env needs db to exist as some plugin accesses model or something)
    rails_boot_file = File.join(RUBBER_ROOT, 'config', 'boot.rb')
    require(rails_boot_file) if File.exists? rails_boot_file
  end

  if defined?(Rails.logger) && Rails.logger
    @@logger = Rails.logger
  else
    @@logger = Logger.new($stdout)
    @@logger.level = Logger::INFO
    @@logger.formatter = lambda {|severity, time, progname, msg| "Rubber[%s]: %s\n" % [severity, msg.to_s.lstrip]}
  end

  # conveniences for backwards compatibility with old names
  Object.const_set('RUBBER_CONFIG', self.config)
  Object.const_set('RUBBER_INSTANCES', self.instances)

end

.instancesObject



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

def self.instances
  Rubber::Configuration.rubber_instances
end

.loggerObject



50
51
52
# File 'lib/rubber.rb', line 50

def self.logger
  @@logger
end

.rootObject



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

def self.root
  @@root
end

.versionObject



46
47
48
# File 'lib/rubber.rb', line 46

def self.version
  @@version
end