Class: Wakame::Configuration
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Wakame::Configuration
show all
- Defined in:
- lib/wakame/configuration.rb
Overview
System wide configuration parameters
Defined Under Namespace
Classes: DefaultSet, EC2, StandAlone
Constant Summary
collapse
- PARAMS =
{
:config_root => nil,
:cluster_class => 'WebCluster',
:load_paths => [],
:ssh_private_key => nil,
:drb_command_server_uri => 'druby://localhost:12345',
:amqp_server_uri => nil,
:unused_vm_live_period => 60 * 10,
:eventmachine_use_epoll => true
}
Instance Method Summary
collapse
Constructor Details
#initialize(env = WAKAME_ENV) ⇒ Configuration
Returns a new instance of Configuration.
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/wakame/configuration.rb', line 22
def initialize(env=WAKAME_ENV)
super(PARAMS)
if root_path.nil?
root_path = Object.const_defined?(:WAKAME_ROOT) ? WAKAME_ROOT : '../'
end
@root_path = root_path
self.class.const_get(env).new.process(self)
end
|
Instance Method Details
#config_tmp_root ⇒ Object
54
55
56
|
# File 'lib/wakame/configuration.rb', line 54
def config_tmp_root
File.join(self.config_root, "tmp")
end
|
#environment ⇒ Object
Also known as:
vm_environment
33
34
35
|
# File 'lib/wakame/configuration.rb', line 33
def environment
::WAKAME_ENV.to_sym
end
|
#environment_path(key = environment) ⇒ Object
38
39
40
|
# File 'lib/wakame/configuration.rb', line 38
def environment_path(key=environment)
File.expand_path("config/environments/#{Util.snake_case(key.to_s)}.rb", root_path)
end
|
#framework_paths ⇒ Object
62
63
64
65
66
|
# File 'lib/wakame/configuration.rb', line 62
def framework_paths
paths = %w(lib)
paths.map{|dir| File.join(framework_root_path, dir) }.select{|path| File.directory?(path) }
end
|
#framework_root_path ⇒ Object
58
59
60
|
# File 'lib/wakame/configuration.rb', line 58
def framework_root_path
defined?(::WAKAME_FRAMEWORK_ROOT) ? ::WAKAME_FRAMEWORK_ROOT : "#{root_path}/vendor/wakame"
end
|
#root_path ⇒ Object
42
43
44
|
# File 'lib/wakame/configuration.rb', line 42
def root_path
::WAKAME_ROOT
end
|
#ssh_known_hosts ⇒ Object
50
51
52
|
# File 'lib/wakame/configuration.rb', line 50
def ssh_known_hosts
File.join(self.config_root, "ssh", "known_hosts")
end
|
#tmp_path ⇒ Object
46
47
48
|
# File 'lib/wakame/configuration.rb', line 46
def tmp_path
File.join(root_path, 'tmp')
end
|