Class: Stove::RakeTask

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

Overview

Run Stove tasks from your Rakefile.

Examples:

desc "Run stove tasks"
Stove::RakeTask.new(:release) do |stove|
  stove.git = true
  stove.devodd = true
end

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(task_name = nil) {|_self| ... } ⇒ RakeTask

Returns a new instance of RakeTask.

Yields:

  • (_self)

Yield Parameters:



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/stove/rake_task.rb', line 39

def initialize(task_name = nil)
  @options = {}
  @name    = (task_name || :publish).to_sym

  yield self if block_given?

  desc 'Publish this cookbook' unless ::Rake.application.last_comment
  task name do |t, args|
    require 'stove'
    Stove::Cookbook.new(options).release!
  end
end

Instance Attribute Details

#nameSymbol

Returns:

  • (Symbol)


34
35
36
# File 'lib/stove/rake_task.rb', line 34

def name
  @name
end

#optionsHash (readonly)

Returns:

  • (Hash)


37
38
39
# File 'lib/stove/rake_task.rb', line 37

def options
  @options
end

Class Method Details

.cli_option(option) ⇒ Object

Define a CLI option.

Parameters:

  • option (Symbol)


22
23
24
25
26
27
28
29
30
# File 'lib/stove/rake_task.rb', line 22

def cli_option(option)
  define_method("#{option}=".to_sym) do |value|
    options[option] = value
  end

  define_method(option.to_sym) do
    options[option]
  end
end