Module: Rubber

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.configObject



52
53
54
# File 'lib/rubber.rb', line 52

def self.config
  Rubber::Configuration.rubber_env
end

.envObject



40
41
42
# File 'lib/rubber.rb', line 40

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
# 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))

  # 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.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



56
57
58
# File 'lib/rubber.rb', line 56

def self.instances
  Rubber::Configuration.rubber_instances
end

.loggerObject



48
49
50
# File 'lib/rubber.rb', line 48

def self.logger
  @@logger
end

.rootObject



36
37
38
# File 'lib/rubber.rb', line 36

def self.root
  @@root
end

.versionObject



44
45
46
# File 'lib/rubber.rb', line 44

def self.version
  @@version
end