Module: PinchHitter::Service::Runner
- Included in:
- PinchHitter
- Defined in:
- lib/pinch_hitter/service/runner.rb
Defined Under Namespace
Classes: SilentLogger
Instance Method Summary collapse
- #no_cache ⇒ Object
- #service_options(host, port) ⇒ Object
- #silence_console ⇒ Object
- #start_service(host, port, timeout = 10) ⇒ Object
- #stop_service ⇒ Object
Instance Method Details
#no_cache ⇒ Object
11 12 13 14 |
# File 'lib/pinch_hitter/service/runner.rb', line 11 def no_cache @no_cache = true @app.settings.enable :no_cache if @app end |
#service_options(host, port) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/pinch_hitter/service/runner.rb', line 26 def (host, port) {}.tap do |hash| hash[:Host] = host hash[:Port] = port hash[:AccessLog] = [] if @silent_console hash[:Logger] = SilentLogger.new if @silent_console end end |
#silence_console ⇒ Object
7 8 9 |
# File 'lib/pinch_hitter/service/runner.rb', line 7 def silence_console @silent_console = true end |
#start_service(host, port, timeout = 10) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/pinch_hitter/service/runner.rb', line 16 def start_service(host, port, timeout=10) Thread.abort_on_exception = true @app = PinchHitter::Service::ReplayWs.new @app.settings.enable :no_cache if @no_cache @replay_service = Thread.new do Rack::Handler::WEBrick.run @app, **(host, port) end wait_for_replay(timeout) end |
#stop_service ⇒ Object
35 36 37 |
# File 'lib/pinch_hitter/service/runner.rb', line 35 def stop_service @replay_service.kill end |