class I18nChecker::RakeTask::UnusedCheck
Attributes
locale_file_paths[RW]
logger[RW]
name[RW]
reporter[RW]
source_paths[RW]
Public Class Methods
new(name = :locale_unused_check) { |self| ... }
click to toggle source
# File lib/i18n_checker/rake_task/unused_check.rb, line 18 def initialize(name = :locale_unused_check) @name = name @source_paths = FileList['app/views/*', 'app/controllers/*', 'app/jobs/*', 'app/models/*', 'app/helpers/*'] @locale_file_paths = FileList['config/locales/*'] @logger = Logger.new(STDOUT) @logger.formatter = proc { |_severity, _datetime, _progname, message| "#{message}\n" } @reporter = I18nChecker::Unused::Reporter::Default.new(logger: logger) yield self if block_given? define end
Private Instance Methods
define()
click to toggle source
# File lib/i18n_checker/rake_task/unused_check.rb, line 33 def define desc 'Display unused translation text.' task(name) { run_task } end
run_task()
click to toggle source
# File lib/i18n_checker/rake_task/unused_check.rb, line 38 def run_task command = I18nChecker::Command::UnusedCheck.new( reporter: reporter, source_paths: source_paths, locale_file_paths: locale_file_paths, ) command.run do |result| exit 1 unless result.empty? end end