Class: I18nFlow::CLI::FormatCommand
- Inherits:
-
CommandBase
- Object
- CommandBase
- I18nFlow::CLI::FormatCommand
- Includes:
- Color
- Defined in:
- lib/i18n_flow/cli/format_command.rb
Constant Summary
Constants included from Color
Instance Method Summary collapse
Methods included from Color
Methods inherited from CommandBase
#color_enabled?, #exit_with_message, #initialize
Constructor Details
This class inherits a constructor from I18nFlow::CLI::CommandBase
Instance Method Details
#invoke! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/i18n_flow/cli/format_command.rb', line 11 def invoke! puts color('==> Correcting', :yellow) repository.asts_by_scope.each do |scope, locale_trees| locale_pairs.each do |(master, slave)| master_tree = locale_trees[master] slave_tree = locale_trees[slave] next unless master_tree && slave_tree puts slave_tree.file_path correct(slave_tree, master_tree) end end puts puts color('==> Formatting', :yellow) repository.asts_by_path.each do |path, tree| puts path format(tree) output_path = I18nFlow.config.base_path.join(tree.file_path) File.write(output_path, tree.to_yaml) end end |