Class: I18n::Hygiene::RakeTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- I18n::Hygiene::RakeTask
- Defined in:
- lib/i18n/hygiene/rake_task.rb
Constant Summary collapse
- CHECKS =
[ I18n::Hygiene::Checks::KeyUsage, I18n::Hygiene::Checks::MissingInterpolationVariable, I18n::Hygiene::Checks::HtmlEntity, I18n::Hygiene::Checks::ScriptTag, I18n::Hygiene::Checks::UnexpectedReturnSymbol, ]
Instance Method Summary collapse
-
#initialize(task_name = :hygiene, &block) ⇒ RakeTask
constructor
A new instance of RakeTask.
Constructor Details
#initialize(task_name = :hygiene, &block) ⇒ RakeTask
Returns a new instance of RakeTask.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/i18n/hygiene/rake_task.rb', line 22 def initialize(task_name = :hygiene, &block) config = Config.new if block block.call(config) # We always want to exclude the file that is configuring this rake task config.exclude_files = config.exclude_files + [relative_path_for(block.source_location)] end unless ::Rake.application.last_description desc %(Check i18n hygiene) end task(task_name => dependencies) do checks = configure_checks(config) checks.each do |check| check.run do |result| reporter.concat(result) end end reporter.report exit(1) unless reporter.passed? end end |