Class: VCAP::Spec::ForkedComponent::NatsServer
- Defined in:
- lib/vcap/spec/forked_component/nats_server.rb
Instance Attribute Summary collapse
-
#parsed_uri ⇒ Object
readonly
Returns the value of attribute parsed_uri.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Attributes inherited from Base
#cmd, #daemon, #name, #output_basedir, #pid, #pid_filename, #reopen_stdio
Instance Method Summary collapse
-
#initialize(pid_filename, port, output_basedir = 'tmp') ⇒ NatsServer
constructor
A new instance of NatsServer.
- #ready? ⇒ Boolean
Methods inherited from Base
#running?, #start, #stop, #wait_ready
Constructor Details
#initialize(pid_filename, port, output_basedir = 'tmp') ⇒ NatsServer
Returns a new instance of NatsServer.
17 18 19 20 21 22 23 |
# File 'lib/vcap/spec/forked_component/nats_server.rb', line 17 def initialize(pid_filename, port, output_basedir='tmp') cmd = "ruby -S bundle exec nats-server -p #{port} -P #{pid_filename} -V -D" super(cmd, 'nats', output_basedir, pid_filename) @port = port @uri = "nats://127.0.0.1:#{@port}" @parsed_uri = URI.parse(@uri) end |
Instance Attribute Details
#parsed_uri ⇒ Object (readonly)
Returns the value of attribute parsed_uri.
15 16 17 |
# File 'lib/vcap/spec/forked_component/nats_server.rb', line 15 def parsed_uri @parsed_uri end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
15 16 17 |
# File 'lib/vcap/spec/forked_component/nats_server.rb', line 15 def port @port end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
15 16 17 |
# File 'lib/vcap/spec/forked_component/nats_server.rb', line 15 def uri @uri end |
Instance Method Details
#ready? ⇒ Boolean
25 26 27 |
# File 'lib/vcap/spec/forked_component/nats_server.rb', line 25 def ready? running? && NATS.server_running?(@parsed_uri) end |