Class: GitValidation::Task

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
FileUtils
Defined in:
lib/git_validation/task.rb

Overview

Task implements the task for the git-validation tool.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :"git-validation", *args, &block) ⇒ Task

Returns a new instance of Task.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/git_validation/task.rb', line 33

def initialize(name = :"git-validation", *args, &block)
  set_ivars

  desc "Run git-validation" unless ::Rake.application.last_description

  task(name, *args) do |_, task_args|
    abort("The git-validation command could not be found") unless git_validation?

    yield(*[self, task_args].slice(0, block.arity)) if block_given?

    abort("Bad type for 'from' option") unless @from.is_a?(String)
    execute!
  end
end

Instance Attribute Details

#fromObject

Returns the value of attribute from.



29
30
31
# File 'lib/git_validation/task.rb', line 29

def from
  @from
end

#quietObject

Returns the value of attribute quiet.



31
32
33
# File 'lib/git_validation/task.rb', line 31

def quiet
  @quiet
end

#runObject

Returns the value of attribute run.



30
31
32
# File 'lib/git_validation/task.rb', line 30

def run
  @run
end