Class: Tailor::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Tailor::RakeTask
- Includes:
- Rake::DSL
- Defined in:
- lib/tailor/rake_task.rb
Overview
This class lets you define Rake tasks to drive tailor. Specifying options is similar to specifying options in a configuration file.
Note that prior to 1.1.4, you could use the #config_file option and specify file_sets or recursive_file_sets; this caused problems (and confusion), so the combination of these was removed in 1.2.0. If you use #config_file, then all file_sets and recursive_file_sets that you specify in the Rake task will be ignored; only those specified in the given config file will be used.
Instance Attribute Summary collapse
-
#config_file ⇒ String
Use a specific configuration file.
-
#formatters ⇒ Array
The list of formatters to use.
-
#tailor_opts ⇒ Object
Specify any extra options (CLI options).
Instance Method Summary collapse
-
#file_set(file_expression, label = :default, &block) ⇒ Object
Add a file set to critique, just like you would in a config file.
-
#initialize(name = 'tailor', desc = 'Check style') {|_self| ... } ⇒ RakeTask
constructor
A new instance of RakeTask.
-
#recursive_file_set(file_expression, label = :default, &block) ⇒ Object
Add a recursive file set to critique, just like you would in a config file.
Constructor Details
#initialize(name = 'tailor', desc = 'Check style') {|_self| ... } ⇒ RakeTask
Returns a new instance of RakeTask.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/tailor/rake_task.rb', line 63 def initialize(name = 'tailor', desc = 'Check style') @name, @desc = name, desc @tailor_opts = [] @file_sets = [] @recursive_file_sets = [] @config_file = nil yield self if block_given? define_task end |
Instance Attribute Details
#config_file ⇒ String
Use a specific configuration file. If you have a .tailor file, your RakeTask will automatically use that.
52 53 54 |
# File 'lib/tailor/rake_task.rb', line 52 def config_file @config_file end |
#formatters ⇒ Array
Returns The list of formatters to use. (not really used yet).
59 60 61 |
# File 'lib/tailor/rake_task.rb', line 59 def formatters @formatters end |
#tailor_opts ⇒ Object
Specify any extra options (CLI options). These will override any options set in your config file.
56 57 58 |
# File 'lib/tailor/rake_task.rb', line 56 def tailor_opts @tailor_opts end |
Instance Method Details
#file_set(file_expression, label = :default, &block) ⇒ Object
Add a file set to critique, just like you would in a config file.
79 80 81 |
# File 'lib/tailor/rake_task.rb', line 79 def file_set(file_expression, label=:default, &block) @file_sets << [file_expression, label, block] end |
#recursive_file_set(file_expression, label = :default, &block) ⇒ Object
Add a recursive file set to critique, just like you would in a config file.
88 89 90 |
# File 'lib/tailor/rake_task.rb', line 88 def recursive_file_set(file_expression, label=:default, &block) @recursive_file_sets << [file_expression, label, block] end |