Class: Sanford::Manager
- Inherits:
-
Object
- Object
- Sanford::Manager
- Defined in:
- lib/sanford/manager.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#process_name ⇒ Object
readonly
Returns the value of attribute process_name.
Class Method Summary collapse
Instance Method Summary collapse
- #call(action) ⇒ Object
-
#initialize(service_host, options = {}) ⇒ Manager
constructor
A new instance of Manager.
Constructor Details
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
22 23 24 |
# File 'lib/sanford/manager.rb', line 22 def host @host end |
#process_name ⇒ Object (readonly)
Returns the value of attribute process_name.
22 23 24 |
# File 'lib/sanford/manager.rb', line 22 def process_name @process_name end |
Class Method Details
.call(action, options = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sanford/manager.rb', line 10 def self.call(action, = nil) ||= {} [:ip] ||= ENV['SANFORD_IP'] [:port] ||= ENV['SANFORD_PORT'] name = .delete(:host) || ENV['SANFORD_HOST'] service_host = name ? Sanford.hosts.find(name) : Sanford.hosts.first raise(Sanford::NoHostError.new(name)) if !service_host self.new(service_host, ).call(action) end |
Instance Method Details
#call(action) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/sanford/manager.rb', line 29 def call(action) = self..merge({ :ARGV => [ action.to_s ] }) FileUtils.mkdir_p([:dir]) ::Daemons.run_proc(self.process_name, ) do server = Sanford::Server.new(self.host) server.start server.join_thread end end |