Class: Guard::Websocketrails

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/websocket-rails.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Websocketrails

Returns a new instance of Websocketrails.



9
10
11
12
# File 'lib/guard/websocket-rails.rb', line 9

def initialize(watchers=[], options={})
  super
  @environment = options[:environment] || 'development'
end

Instance Method Details

#reloadObject



24
25
26
27
# File 'lib/guard/websocket-rails.rb', line 24

def reload
  stop
  start
end

#run_on_change(path) ⇒ Object



29
30
31
# File 'lib/guard/websocket-rails.rb', line 29

def run_on_change(path)
  reload
end

#startObject



14
15
16
17
# File 'lib/guard/websocket-rails.rb', line 14

def start
  system("rake websocket_rails:start_server RAILS_ENV=#{@environment}")
  UI.info "Websocket standalone server started (#{@environment})"
end

#stopObject



19
20
21
22
# File 'lib/guard/websocket-rails.rb', line 19

def stop
  system("rake websocket_rails:stop_server RAILS_ENV=#{@environment}")
  UI.info "Websocket standalone server stopped (#{@environment})"
end