class Guard::Rack

Constants

DEFAULT_OPTIONS

Attributes

options[R]
runner[R]

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method
# File lib/guard/rack.rb, line 22
def initialize(options = {})
  super
  @options = DEFAULT_OPTIONS.merge(options)
  @runner = ::Guard::RackRunner.new(@options)
end

Public Instance Methods

reload() click to toggle source
# File lib/guard/rack.rb, line 34
def reload
  UI.info 'Restarting Rack...'
  Notifier.notify("Rack restarting on port #{options[:port]} in #{options[:environment]} environment...", title: 'Restarting Rack...', image: :pending)
  if runner.restart
    UI.info "Rack restarted, pid #{runner.pid}"
    Notifier.notify("Rack restarted on port #{options[:port]}.", title: 'Rack restarted!', image: :success)
  else
    UI.info 'Rack NOT restarted, check your log files.'
    Notifier.notify('Rack NOT restarted, check your log files.', title: 'Rack NOT restarted!', image: :failed)
  end
end
run_on_changes(_paths) click to toggle source
# File lib/guard/rack.rb, line 51
def run_on_changes(_paths)
  reload
end
start() click to toggle source
# File lib/guard/rack.rb, line 28
def start
  server = options[:server] ? "#{options[:server]} and " : ''
  UI.info "Guard::Rack will now restart your app on port #{options[:port]} using #{server}#{options[:environment]} environment."
  reload if options[:start_on_start]
end
stop() click to toggle source
# File lib/guard/rack.rb, line 46
def stop
  Notifier.notify('Until next time...', title: 'Rack shutting down.', image: :pending)
  runner.stop
end