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:



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

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



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

def name
  @name
end

#optionsObject

CLI options



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

def options
  @options
end