Class: Guard::RemoteRails

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/rrails.rb

Constant Summary

Constants included from Guard

Rrails

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = { :rails_env => "development" }) ⇒ RemoteRails

Returns a new instance of RemoteRails.



7
8
9
10
# File 'lib/guard/rrails.rb', line 7

def initialize(watchers=[], options={ :rails_env => "development" })
  super
  @options = options
end

Instance Method Details

#reloadObject



19
20
21
22
# File 'lib/guard/rrails.rb', line 19

def reload
  self.stop
  self.start
end

#run_on_changes(paths_or_symbol) ⇒ Object



24
25
26
# File 'lib/guard/rrails.rb', line 24

def run_on_changes(paths_or_symbol)
  self.reload
end

#startObject



12
13
14
15
16
17
# File 'lib/guard/rrails.rb', line 12

def start
  @pid = fork do
    $0 = "guard[rrails][#{@options[:rails_env]}]"
    ::RemoteRails::Server.new(@options).start
  end
end

#stopObject



28
29
30
31
# File 'lib/guard/rrails.rb', line 28

def stop
  Process.kill('TERM', @pid)
  @pid = nil
end