Class: Guard::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/guard/rake_task.rb

Overview

Provides a method to define a Rake task that runs the Guard plugins.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :guard, options = '') {|Guard::RakeTask| ... } ⇒ RakeTask

Initialize the Rake task

Parameters:

  • name (Symbol) (defaults to: :guard)

    the name of the Rake task

  • options (String) (defaults to: '')

    the CLI options

Yields:



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/guard/rake_task.rb', line 27

def initialize(name = :guard, options = '')
  @name = name
  @options = options

  yield self if block_given?

  desc "Starts Guard with options: '#{options}'"
  task name => ["#{name}:start"]

  namespace(name) do

    desc "Starts Guard with options: '#{options}'"
    task(:start) do
      ::Guard::CLI.start(options.split)
    end

  end
end

Instance Attribute Details

#nameObject

Name of the main, top level task



16
17
18
# File 'lib/guard/rake_task.rb', line 16

def name
  @name
end

#optionsObject

CLI options



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

def options
  @options
end