In Files

Parent

Files

Guard::CLI

Facade for the Guard command line interface managed by [Thor](github.com/wycats/thor). This is the main interface to Guard that is called by the Guard binary `bin/guard`. Do not put any logic in here, create a class and delegate instead.

Public Instance Methods

init(*guard_names) click to toggle source

Initializes the templates of all installed Guard plugins and adds them to the `Guardfile` when no Guard name is passed. When passing Guard plugin names it does the same but only for those Guard plugins.

@see Guard::Guard.initialize_template @see Guard::Guard.initialize_all_templates

@param [Array<String>] guard_names the name of the Guard plugins to initialize

# File lib/guard/cli.rb, line 158
def init(*guard_names)
  verify_bundler_presence

  ::Guard::Guardfile.create_guardfile(:abort_on_existence => options[:bare])

  return if options[:bare]

  if guard_names.empty?
    ::Guard::Guardfile.initialize_all_templates
  else
    guard_names.each do |guard_name|
      ::Guard::Guardfile.initialize_template(guard_name)
    end
  end
end
list() click to toggle source

List the Guard plugins that are available for use in your system and marks those that are currently used in your `Guardfile`.

@see Guard::DslDescriber.list

# File lib/guard/cli.rb, line 126
def list
  ::Guard::DslDescriber.list(options)
end
show() click to toggle source

Shows all Guard plugins and their options that are defined in the `Guardfile`

@see Guard::DslDescriber.show

# File lib/guard/cli.rb, line 182
def show
  ::Guard::DslDescriber.show(options)
end
start() click to toggle source

Start Guard by initializing the defined Guard plugins and watch the file system. This is the default task, so calling `guard` is the same as calling `guard start`.

@see Guard.start

# File lib/guard/cli.rb, line 108
def start
  verify_bundler_presence unless options[:no_bundler_warning]
  ::Guard.start(options)

  return if ENV['GUARD_ENV'] == 'test'

  while ::Guard.running do
    sleep 0.5
  end
end
version() click to toggle source

Shows the current version of Guard.

@see Guard::VERSION

# File lib/guard/cli.rb, line 137
def version
  puts "Guard version #{ ::Guard::VERSION }"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.