Class: YamlNormalizer::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- YamlNormalizer::RakeTask
- Defined in:
- lib/yaml_normalizer/rake_task.rb
Overview
Provides Rake task integration
Instance Attribute Summary collapse
-
#files ⇒ Array<String>
The YAML files to process.
-
#name ⇒ String
The name of the rake task.
Instance Method Summary collapse
-
#initialize(name = 'yaml') {|_self| ... } ⇒ RakeTask
constructor
Add YAML Normalizer rake tasks to your project by adding the following line to your Rakefile: YamlNormalizer::RakeTask.new.
Constructor Details
#initialize(name = 'yaml') {|_self| ... } ⇒ RakeTask
Add YAML Normalizer rake tasks to your project by adding the following line to your Rakefile:
YamlNormalizer::RakeTask.new
This gives you the following tasks (run rake -T)
rake yaml:check # Check if configured YAML files are normalized
rake yaml:normalize # Normalize configured YAML files
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/yaml_normalizer/rake_task.rb', line 37 def initialize(name = 'yaml', &block) super() yield(self) if block desc 'Check if configured YAML files are normalized' task("#{name}:check") { abort(check_failed(name)) unless check } desc 'Normalize configured YAML files' task("#{name}:normalize") { normalize } end |
Instance Attribute Details
#files ⇒ Array<String>
The YAML files to process.
21 22 23 |
# File 'lib/yaml_normalizer/rake_task.rb', line 21 def files @files end |
#name ⇒ String
The name of the rake task
13 14 15 |
# File 'lib/yaml_normalizer/rake_task.rb', line 13 def name @name end |