Class: Command::Critic::Task

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/command-set/critic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :critique) {|_self| ... } ⇒ Task

Returns a new instance of Task.

Yields:

  • (_self)

Yield Parameters:



68
69
70
71
72
73
74
75
76
77
# File 'lib/command-set/critic.rb', line 68

def initialize(name = :critique)
  @name = name
  @spec_opts = []
  @ruby_opts = []

  @command_set_file = nil
  @command_set_module = nil
  yield self if block_given?
  define
end

Instance Attribute Details

#command_set_fileObject

Returns the value of attribute command_set_file.



79
80
81
# File 'lib/command-set/critic.rb', line 79

def command_set_file
  @command_set_file
end

#command_set_moduleObject

Returns the value of attribute command_set_module.



79
80
81
# File 'lib/command-set/critic.rb', line 79

def command_set_module
  @command_set_module
end

#ruby_optsObject

Returns the value of attribute ruby_opts.



79
80
81
# File 'lib/command-set/critic.rb', line 79

def ruby_opts
  @ruby_opts
end

#spec_optsObject

Returns the value of attribute spec_opts.



79
80
81
# File 'lib/command-set/critic.rb', line 79

def spec_opts
  @spec_opts
end

Instance Method Details

#defineObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/command-set/critic.rb', line 81

def define
  spec_opts = @spec_opts
  unless spec_opts.include?("-f") or spec_opts.include?("--format")
    spec_opts += %w{--format specdoc}
  end

  spec_opts = @spec_opts + ["-r", @command_set_file, 
  "-r", __FILE__,
  "-U", "Command::CritiqueLoader:" + @command_set_module,
  "--color"] #Because color is nice...

  csf = @command_set_file

  desc "Critique the command set defined in #@command_set_module"
  Spec::Rake::SpecTask.new(@name) do |t|
    t.spec_opts = spec_opts
    t.ruby_opts = self.ruby_opts
    t.spec_files = [csf]
  end
end