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 =
{
:status_db_dsn => nil,
:config_root => nil,
:cluster_class => 'WebCluster',
:load_paths => [],
:ssh_private_key => nil,
:http_command_server_uri => 'http://localhost:3000',
: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.
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/wakame/configuration.rb', line 23
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
#cluster_config_path ⇒ Object
78
79
80
|
# File 'lib/wakame/configuration.rb', line 78
def cluster_config_path
File.expand_path('config/cluster.rb', root_path)
end
|
#cluster_env ⇒ Object
48
49
50
|
# File 'lib/wakame/configuration.rb', line 48
def cluster_env
ENV['WAKAME_CLUSTER_ENV'] ? ENV['WAKAME_CLUSTER_ENV'] : 'development'
end
|
#config_tmp_root ⇒ Object
60
61
62
|
# File 'lib/wakame/configuration.rb', line 60
def config_tmp_root
File.join(self.config_root, "tmp")
end
|
#environment ⇒ Object
Also known as:
vm_environment
35
36
37
|
# File 'lib/wakame/configuration.rb', line 35
def environment
::WAKAME_ENV.to_sym
end
|
#environment_path(key = environment) ⇒ Object
40
41
42
|
# File 'lib/wakame/configuration.rb', line 40
def environment_path(key=environment)
File.expand_path("config/environments/#{Util.snake_case(key.to_s)}.rb", root_path)
end
|
#framework_paths ⇒ Object
68
69
70
71
72
|
# File 'lib/wakame/configuration.rb', line 68
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
64
65
66
|
# File 'lib/wakame/configuration.rb', line 64
def framework_root_path
defined?(::WAKAME_FRAMEWORK_ROOT) ? ::WAKAME_FRAMEWORK_ROOT : "#{root_path}/vendor/wakame"
end
|
#project_paths ⇒ Object
74
75
76
|
# File 'lib/wakame/configuration.rb', line 74
def project_paths
%w(lib).map{|dir| File.join(root_path, dir) }.select{|path| File.directory?(path)}
end
|
#root_path ⇒ Object
44
45
46
|
# File 'lib/wakame/configuration.rb', line 44
def root_path
::WAKAME_ROOT
end
|
#ssh_known_hosts ⇒ Object
56
57
58
|
# File 'lib/wakame/configuration.rb', line 56
def ssh_known_hosts
File.join(self.config_root, "ssh", "known_hosts")
end
|
#tmp_path ⇒ Object
52
53
54
|
# File 'lib/wakame/configuration.rb', line 52
def tmp_path
File.join(root_path, 'tmp')
end
|