module Guard::Commander

def pause(expected = nil)


Pause Guard listening to file changes.
def pause(expected = nil)
  paused = listener.paused?
  states = { paused: true, unpaused: false, toggle: !paused }
  pause = states[expected || :toggle]
  fail ArgumentError, "invalid mode: #{expected.inspect}" if pause.nil?
  return if pause == paused
  listener.public_send(pause ? :pause : :start)
  UI.info "File event handling has been #{pause ? 'paused' : 'resumed'}"
end

def reload(scopes = {})

Parameters:
  • scopes (Hash) -- hash with a Guard plugin or a group scope
def reload(scopes = {})
  UI.clear(force: true)
  UI.action_with_scopes("Reload", scopes)
  Runner.new.run(:reload, scopes)
end

def run_all(scopes = {})

Parameters:
  • scopes (Hash) -- hash with a Guard plugin or a group scope
def run_all(scopes = {})
  UI.clear(force: true)
  UI.action_with_scopes("Run", scopes)
  Runner.new.run(:run_all, scopes)
end

def show

def show
  DslDescriber.new.show
end

def start(options = {})

Other tags:
    See: CLI#start -

Options Hash: (**options)
  • guardfile (String) -- the path to the Guardfile
  • watchdir (String) -- the director to watch
  • group (Array) -- the list of groups to start
  • debug (Boolean) -- if debug output should be shown
  • notify (Boolean) -- if system notifications should be shown
  • clear (Boolean) -- if auto clear the UI should be done
def start(options = {})
  setup(options)
  UI.debug "Guard starts all plugins"
  Runner.new.run(:start)
  listener.start
  watched = Guard.state.session.watchdirs.join("', '")
  UI.info "Guard is now watching at '#{ watched }'"
  exitcode = 0
  begin
    while interactor.foreground != :exit
      Guard.queue.process while Guard.queue.pending?
    end
  rescue Interrupt
  rescue SystemExit => e
    exitcode = e.status
  end
  exitcode
ensure
  stop
end

def stop

def stop
  listener&.stop
  interactor&.background
  UI.debug "Guard stops all plugins"
  Runner.new.run(:stop)
  Notifier.disconnect
  UI.info "Bye bye...", reset: true
end