Module: Mcrain
- Defined in:
- lib/mcrain/mysql.rb,
lib/mcrain.rb,
lib/mcrain/base.rb,
lib/mcrain/riak.rb,
lib/mcrain/hbase.rb,
lib/mcrain/redis.rb,
lib/mcrain/version.rb,
lib/mcrain/rabbitmq.rb,
lib/mcrain/configuration.rb,
lib/mcrain/docker_machine.rb,
lib/mcrain/client_provider.rb,
lib/mcrain/container_controller.rb
Overview
don’t require ‘rabbitmq/http/client’ here in order to use mcrain without ‘rabbitmq_http_api_client’ gem require ‘rabbitmq/http/client’
Defined Under Namespace
Modules: ClientProvider, ContainerController, DockerMachine
Classes: Base, Configuration, Hbase, Mysql, Rabbitmq, Redis, Riak
Constant Summary
collapse
- VERSION =
"0.8.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.before_setup ⇒ Object
Returns the value of attribute before_setup.
68
69
70
|
# File 'lib/mcrain.rb', line 68
def before_setup
@before_setup
end
|
.configuration ⇒ Object
39
40
41
|
# File 'lib/mcrain.rb', line 39
def configuration
@configuration ||= Mcrain::Configuration.new
end
|
.home_dir ⇒ Object
71
72
73
|
# File 'lib/mcrain.rb', line 71
def home_dir
@home_dir ||= (ENV['MCRAIN_HOME'] || File.join(ENV['HOME'], '.mcrain'))
end
|
.logger ⇒ Object
49
50
51
|
# File 'lib/mcrain.rb', line 49
def logger
@logger ||= Logger.new($stderr)
end
|
Class Method Details
.class_for(name) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/mcrain.rb', line 19
def class_for(name)
if class_name = class_names[name]
class_name.constantize
else
if klass = Mcrain::Base.descendants.detect{|c| c.server_name == name}
class_names[name] = klass.name
end
klass
end
end
|
.class_names ⇒ Object
15
16
17
|
# File 'lib/mcrain.rb', line 15
def class_names
@class_names ||= {}
end
|
43
44
45
46
|
# File 'lib/mcrain.rb', line 43
def configure
yield configuration
configuration
end
|
.load_config(file) ⇒ Object
34
35
36
|
# File 'lib/mcrain.rb', line 34
def load_config(file)
@configuration = Mcrain::Configuration.load_config(file)
end
|
.register(name, class_name) ⇒ Object
30
31
32
|
# File 'lib/mcrain.rb', line 30
def register(name, class_name)
class_names[name] = class_name
end
|
.wait_port_opened(host, port, options = {}) ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/mcrain.rb', line 53
def wait_port_opened(host, port, options = {})
logger.debug("wait_port_opened(#{host.inspect}, #{port.inspect}, #{options.inspect})")
interval = options[:interval] || 10
Timeout.timeout(options[:timeout] || 60) do
begin
s = TCPSocket.open(host, port)
s.close
return true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
sleep(interval)
retry
end
end
end
|