Module: Rubber

Defined in:
lib/rubber.rb,
lib/rubber/dns.rb,
lib/rubber/util.rb,
lib/rubber/cloud.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, Util

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.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
# File 'lib/rubber.rb', line 7

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

  Object.const_set('RUBBER_ENV', project_env)
  Object.const_set('RUBBER_ROOT', File.expand_path(project_root))

  # 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

  if defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER
    Object.const_set('LOGGER', RAILS_DEFAULT_LOGGER)
  else
    Object.const_set('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
end