Class: Guard::Passenger
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Passenger
- Defined in:
- lib/guard/passenger.rb,
lib/guard/passenger/pinger.rb,
lib/guard/passenger/runner.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#cli_start ⇒ Object
readonly
Returns the value of attribute cli_start.
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
-
#ping ⇒ Object
readonly
Returns the value of attribute ping.
-
#running ⇒ Object
readonly
Returns the value of attribute running.
-
#sudo ⇒ Object
readonly
Returns the value of attribute sudo.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Passenger
constructor
= Guard methods = =================.
-
#reload ⇒ Object
Call with Ctrl-Z signal.
-
#run_on_changes(paths = {}) ⇒ Object
Call on file(s) modifications.
- #running? ⇒ Boolean
- #standalone? ⇒ Boolean
-
#start ⇒ Object
Call once when guard starts.
-
#stop ⇒ Object
Call with Ctrl-C signal (when Guard quit).
Constructor Details
#initialize(options = {}) ⇒ Passenger
Guard methods =
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/guard/passenger.rb', line 26 def initialize( = {}) super @standalone = [:standalone].nil? ? true : [:standalone] @cli_start = init_cli() @cli_stop = cli_stop @notification = [:notification].nil? ? true : [:notification] @ping = [:ping].eql?(true) ? '/' : [:ping] @sudo = [:sudo] || '' @sudo = @sudo.eql?(true) ? 'sudo' : @sudo end |
Instance Attribute Details
#cli_start ⇒ Object (readonly)
Returns the value of attribute cli_start.
12 13 14 |
# File 'lib/guard/passenger.rb', line 12 def cli_start @cli_start end |
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
12 13 14 |
# File 'lib/guard/passenger.rb', line 12 def notification @notification end |
#ping ⇒ Object (readonly)
Returns the value of attribute ping.
12 13 14 |
# File 'lib/guard/passenger.rb', line 12 def ping @ping end |
#running ⇒ Object (readonly)
Returns the value of attribute running.
12 13 14 |
# File 'lib/guard/passenger.rb', line 12 def running @running end |
#sudo ⇒ Object (readonly)
Returns the value of attribute sudo.
12 13 14 |
# File 'lib/guard/passenger.rb', line 12 def sudo @sudo end |
Instance Method Details
#reload ⇒ Object
Call with Ctrl-Z signal
60 61 62 |
# File 'lib/guard/passenger.rb', line 60 def reload restart_and_ping end |
#run_on_changes(paths = {}) ⇒ Object
Call on file(s) modifications
65 66 67 |
# File 'lib/guard/passenger.rb', line 65 def run_on_changes(paths = {}) restart_and_ping end |
#running? ⇒ Boolean
18 19 20 |
# File 'lib/guard/passenger.rb', line 18 def running? @running end |
#standalone? ⇒ Boolean
14 15 16 |
# File 'lib/guard/passenger.rb', line 14 def standalone? @standalone end |
#start ⇒ Object
Call once when guard starts
41 42 43 44 45 46 47 48 |
# File 'lib/guard/passenger.rb', line 41 def start UI.info 'Guard::Passenger is running!' if standalone? running = Runner.start_passenger(cli_start, @sudo) else true end end |
#stop ⇒ Object
Call with Ctrl-C signal (when Guard quit)
51 52 53 54 55 56 57 |
# File 'lib/guard/passenger.rb', line 51 def stop if standalone? && running? UI.info 'Stopping Passenger...' Runner.stop_passenger(cli_stop, @sudo) end true end |