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:



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

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



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

def name
  @name
end

#optionsObject

CLI options



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

def options
  @options
end