i18n-tasks 0.9.12 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -8
  3. data/Rakefile +1 -0
  4. data/i18n-tasks.gemspec +2 -1
  5. data/lib/i18n/tasks.rb +2 -1
  6. data/lib/i18n/tasks/base_task.rb +1 -0
  7. data/lib/i18n/tasks/cli.rb +4 -3
  8. data/lib/i18n/tasks/command/collection.rb +1 -0
  9. data/lib/i18n/tasks/command/commander.rb +1 -0
  10. data/lib/i18n/tasks/command/commands/data.rb +6 -5
  11. data/lib/i18n/tasks/command/commands/eq_base.rb +2 -1
  12. data/lib/i18n/tasks/command/commands/health.rb +2 -1
  13. data/lib/i18n/tasks/command/commands/meta.rb +2 -1
  14. data/lib/i18n/tasks/command/commands/missing.rb +2 -1
  15. data/lib/i18n/tasks/command/commands/tree.rb +5 -4
  16. data/lib/i18n/tasks/command/commands/usages.rb +9 -8
  17. data/lib/i18n/tasks/command/commands/xlsx.rb +2 -1
  18. data/lib/i18n/tasks/command/dsl.rb +1 -0
  19. data/lib/i18n/tasks/command/option_parsers/enum.rb +1 -0
  20. data/lib/i18n/tasks/command/option_parsers/locale.rb +2 -1
  21. data/lib/i18n/tasks/command/options/common.rb +1 -0
  22. data/lib/i18n/tasks/command/options/data.rb +1 -0
  23. data/lib/i18n/tasks/command/options/locales.rb +1 -0
  24. data/lib/i18n/tasks/command_error.rb +1 -0
  25. data/lib/i18n/tasks/commands.rb +1 -1
  26. data/lib/i18n/tasks/configuration.rb +1 -0
  27. data/lib/i18n/tasks/console_context.rb +9 -10
  28. data/lib/i18n/tasks/data.rb +1 -0
  29. data/lib/i18n/tasks/data/adapter/json_adapter.rb +1 -0
  30. data/lib/i18n/tasks/data/adapter/yaml_adapter.rb +1 -0
  31. data/lib/i18n/tasks/data/file_formats.rb +1 -0
  32. data/lib/i18n/tasks/data/file_system.rb +1 -0
  33. data/lib/i18n/tasks/data/file_system_base.rb +1 -0
  34. data/lib/i18n/tasks/data/router/conservative_router.rb +1 -0
  35. data/lib/i18n/tasks/data/router/pattern_router.rb +1 -0
  36. data/lib/i18n/tasks/data/tree/node.rb +5 -4
  37. data/lib/i18n/tasks/data/tree/nodes.rb +2 -1
  38. data/lib/i18n/tasks/data/tree/siblings.rb +1 -0
  39. data/lib/i18n/tasks/data/tree/traversal.rb +1 -0
  40. data/lib/i18n/tasks/google_translation.rb +1 -0
  41. data/lib/i18n/tasks/html_keys.rb +1 -0
  42. data/lib/i18n/tasks/ignore_keys.rb +1 -0
  43. data/lib/i18n/tasks/key_pattern_matching.rb +1 -0
  44. data/lib/i18n/tasks/locale_list.rb +1 -0
  45. data/lib/i18n/tasks/locale_pathname.rb +1 -0
  46. data/lib/i18n/tasks/logging.rb +5 -6
  47. data/lib/i18n/tasks/missing_keys.rb +1 -0
  48. data/lib/i18n/tasks/plural_keys.rb +1 -0
  49. data/lib/i18n/tasks/rainbow_utils.rb +15 -0
  50. data/lib/i18n/tasks/references.rb +1 -0
  51. data/lib/i18n/tasks/reports/base.rb +1 -0
  52. data/lib/i18n/tasks/reports/spreadsheet.rb +2 -1
  53. data/lib/i18n/tasks/reports/terminal.rb +33 -31
  54. data/lib/i18n/tasks/scanners/file_scanner.rb +1 -0
  55. data/lib/i18n/tasks/scanners/files/caching_file_finder.rb +1 -0
  56. data/lib/i18n/tasks/scanners/files/caching_file_finder_provider.rb +1 -0
  57. data/lib/i18n/tasks/scanners/files/caching_file_reader.rb +1 -0
  58. data/lib/i18n/tasks/scanners/files/file_finder.rb +1 -0
  59. data/lib/i18n/tasks/scanners/files/file_reader.rb +1 -0
  60. data/lib/i18n/tasks/scanners/occurrence_from_position.rb +1 -0
  61. data/lib/i18n/tasks/scanners/pattern_mapper.rb +1 -0
  62. data/lib/i18n/tasks/scanners/pattern_scanner.rb +1 -0
  63. data/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb +1 -0
  64. data/lib/i18n/tasks/scanners/relative_keys.rb +1 -0
  65. data/lib/i18n/tasks/scanners/results/key_occurrences.rb +1 -0
  66. data/lib/i18n/tasks/scanners/results/occurrence.rb +1 -0
  67. data/lib/i18n/tasks/scanners/ruby_ast_call_finder.rb +1 -0
  68. data/lib/i18n/tasks/scanners/ruby_ast_scanner.rb +3 -2
  69. data/lib/i18n/tasks/scanners/ruby_key_literals.rb +1 -0
  70. data/lib/i18n/tasks/scanners/scanner.rb +1 -0
  71. data/lib/i18n/tasks/scanners/scanner_multiplexer.rb +1 -0
  72. data/lib/i18n/tasks/split_key.rb +1 -0
  73. data/lib/i18n/tasks/stats.rb +1 -0
  74. data/lib/i18n/tasks/string_interpolation.rb +1 -0
  75. data/lib/i18n/tasks/unused_keys.rb +3 -2
  76. data/lib/i18n/tasks/used_keys.rb +3 -2
  77. data/lib/i18n/tasks/version.rb +2 -1
  78. data/templates/rspec/i18n_spec.rb +1 -0
  79. metadata +9 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8fdd3b0e7a3f582d6ebf37b2fa35117f626ce72
4
- data.tar.gz: 2e487915be57d0b7392bba89bb666a28fd143d23
3
+ metadata.gz: 414af08a4707037cdb353bba1ed426fd44852906
4
+ data.tar.gz: 986fd27c576e0763f1980ba70fa45e7cad81ce95
5
5
  SHA512:
6
- metadata.gz: 445084513fabeddd582963ed14d6fbb8345f45781c294b7d20bd97aeb5fa88820dcd75d268a9a1e701175d982ef9f3e1f2f46e31e07f1bae03b1af6b82978772
7
- data.tar.gz: 23e916f594cd903f57d9b130a39d2ee89b834c319db8e15c9791caa963bb183f9161718079d81c1b8ce2318fb01a25a94027836fa9794b85bf4c6a85acb7662c
6
+ metadata.gz: 9cd51331aa6e088f79d0d06d28c88b1b32b5321c25af2821c638639ebf40ea28b121ad1ac056f37d1ace4e702589282df29957d9e0be9877fc444b97e31daa39
7
+ data.tar.gz: 46339dd43fcb62d8630bb348df8ceee774d90ced3eab072f0565e66df1ae426228ad81e5584b28e3d346e5bac81f2f4988c04879ca594d63c74175d3e8b59e38
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coverage]][coverage] [![Code Climate][badge-code-climate]][code-climate] [![Gemnasium][badge-gemnasium]][gemnasium] [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/glebm/i18n-tasks?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
+ # i18n-tasks [![Build Status][badge-travis]][travis] [![Coverage Status][badge-coverage]][coverage] [![Code Climate][badge-code-climate]][code-climate] [![Gemnasium][badge-gemnasium]][gemnasium] [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/glebm/i18n-tasks?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
2
 
3
3
  <a href='https://pledgie.com/campaigns/28570'><img alt='Click here to lend your support to: i18n-tasks for Ruby and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/28570.png?skin_name=chrome' border='0' ></a>
4
4
 
@@ -24,7 +24,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
24
24
  Add i18n-tasks to the Gemfile:
25
25
 
26
26
  ```ruby
27
- gem 'i18n-tasks', '~> 0.9.12'
27
+ gem 'i18n-tasks', '~> 0.9.13'
28
28
  ```
29
29
 
30
30
  Copy the default [configuration file](#configuration):
@@ -354,13 +354,9 @@ translation:
354
354
 
355
355
  `i18n-tasks irb` starts an IRB session in i18n-tasks context. Type `guide` for more information.
356
356
 
357
- ### XLSX
357
+ ### Import / export to a CSV spreadsheet
358
358
 
359
- Export missing and unused data to XLSX:
360
-
361
- ```console
362
- $ i18n-tasks xlsx-report
363
- ```
359
+ See [i18n-tasks wiki: CSV import and export tasks](https://github.com/glebm/i18n-tasks/wiki/Custom-CSV-import-and-export-tasks).
364
360
 
365
361
  ## Add new tasks
366
362
 
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
  RSpec::Core::RakeTask.new(:rspec)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'i18n/tasks/version'
@@ -41,7 +42,7 @@ TEXT
41
42
  s.add_dependency 'highline', '>= 1.7.3'
42
43
  s.add_dependency 'i18n'
43
44
  s.add_dependency 'parser', '>= 2.2.3.0'
44
- s.add_dependency 'term-ansicolor', '>= 1.3.2'
45
+ s.add_dependency 'rainbow', '~> 2.2'
45
46
  s.add_dependency 'terminal-table', '>= 1.5.1'
46
47
  s.add_development_dependency 'axlsx', '~> 2.0'
47
48
  s.add_development_dependency 'bundler', '~> 1.3'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # define all the modules to be able to use ::
3
4
  module I18n
4
5
  module Tasks
@@ -55,7 +56,7 @@ rescue LoadError => _e
55
56
  # activesupport ~> 2.3.2
56
57
  require 'active_support/core_ext/try'
57
58
  end
58
- require 'term/ansicolor'
59
+ require 'rainbow'
59
60
  require 'erubis'
60
61
 
61
62
  require 'i18n/tasks/version'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command_error'
3
4
  require 'i18n/tasks/split_key'
4
5
  require 'i18n/tasks/key_pattern_matching'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks'
3
4
  require 'i18n/tasks/commands'
4
5
  require 'optparse'
@@ -197,10 +198,10 @@ class I18n::Tasks::CLI
197
198
  end
198
199
 
199
200
  def auto_output_coloring(coloring = ENV['I18N_TASKS_COLOR'] || STDOUT.isatty)
200
- coloring_was = Term::ANSIColor.coloring?
201
- Term::ANSIColor.coloring = coloring
201
+ coloring_was = Rainbow.enabled
202
+ Rainbow.enabled = coloring
202
203
  yield
203
204
  ensure
204
- Term::ANSIColor.coloring = coloring_was
205
+ Rainbow.enabled = coloring_was
205
206
  end
206
207
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command/dsl'
3
4
  require 'i18n/tasks/command/options/common'
4
5
  require 'i18n/tasks/command/options/locales'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/cli'
3
4
  require 'i18n/tasks/reports/terminal'
4
5
  require 'i18n/tasks/reports/spreadsheet'
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -13,7 +14,7 @@ module I18n::Tasks
13
14
  cmd :normalize,
14
15
  pos: '[locale ...]',
15
16
  desc: t('i18n_tasks.cmd.desc.normalize'),
16
- args: [:locales, :pattern_router]
17
+ args: %i(locales pattern_router)
17
18
 
18
19
  def normalize(opt = {})
19
20
  i18n.normalize_store! opt[:locales], opt[:pattern_router]
@@ -48,7 +49,7 @@ module I18n::Tasks
48
49
  cmd :data,
49
50
  pos: '[locale ...]',
50
51
  desc: t('i18n_tasks.cmd.desc.data'),
51
- args: [:locales, :out_format]
52
+ args: %i(locales out_format)
52
53
 
53
54
  def data(opt = {})
54
55
  print_forest i18n.data_forest(opt[:locales]), opt
@@ -57,7 +58,7 @@ module I18n::Tasks
57
58
  cmd :data_merge,
58
59
  pos: '[tree ...]',
59
60
  desc: t('i18n_tasks.cmd.desc.data_merge'),
60
- args: [:data_format, :nostdin]
61
+ args: %i(data_format nostdin)
61
62
 
62
63
  def data_merge(opt = {})
63
64
  forest = merge_forests_stdin_and_pos!(opt)
@@ -68,7 +69,7 @@ module I18n::Tasks
68
69
  cmd :data_write,
69
70
  pos: '[tree]',
70
71
  desc: t('i18n_tasks.cmd.desc.data_write'),
71
- args: [:data_format, :nostdin]
72
+ args: %i(data_format nostdin)
72
73
 
73
74
  def data_write(opt = {})
74
75
  forest = forest_pos_or_stdin!(opt)
@@ -79,7 +80,7 @@ module I18n::Tasks
79
80
  cmd :data_remove,
80
81
  pos: '[tree]',
81
82
  desc: t('i18n_tasks.cmd.desc.data_remove'),
82
- args: [:data_format, :nostdin]
83
+ args: %i(data_format nostdin)
83
84
 
84
85
  def data_remove(opt = {})
85
86
  removed = i18n.data.remove_by_key!(forest_pos_or_stdin!(opt))
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -8,7 +9,7 @@ module I18n::Tasks
8
9
  cmd :eq_base,
9
10
  pos: '[locale ...]',
10
11
  desc: t('i18n_tasks.cmd.desc.eq_base'),
11
- args: [:locales, :out_format]
12
+ args: %i(locales out_format)
12
13
 
13
14
  def eq_base(opt = {})
14
15
  print_forest i18n.eq_base_keys(opt), opt, :eq_base_keys
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -8,7 +9,7 @@ module I18n::Tasks
8
9
  cmd :health,
9
10
  pos: '[locale ...]',
10
11
  desc: t('i18n_tasks.cmd.desc.health'),
11
- args: [:locales, :out_format]
12
+ args: %i(locales out_format)
12
13
 
13
14
  def health(opt = {})
14
15
  forest = i18n.data_forest(opt[:locales])
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -14,7 +15,7 @@ module I18n::Tasks
14
15
  cfg = cfg.slice(*opts[:arguments]) if opts[:arguments].present?
15
16
  cfg = cfg.to_yaml
16
17
  cfg.sub!(/\A---\n/, '')
17
- cfg.gsub!(/^([^\s-].+?:)/, Term::ANSIColor.cyan(Term::ANSIColor.bold('\1')))
18
+ cfg.gsub!(/^([^\s-].+?:)/, Rainbow('\1').cyan.bright)
18
19
  puts cfg
19
20
  end
20
21
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command/collection'
3
4
 
4
5
  module I18n::Tasks
@@ -24,7 +25,7 @@ module I18n::Tasks
24
25
  cmd :missing,
25
26
  pos: '[locale ...]',
26
27
  desc: t('i18n_tasks.cmd.desc.missing'),
27
- args: [:locales, :out_format, :missing_types]
28
+ args: %i(locales out_format missing_types)
28
29
 
29
30
  def missing(opt = {})
30
31
  forest = i18n.missing_keys(opt.slice(:locales, :base_locale, :missing_types))
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -19,7 +20,7 @@ module I18n::Tasks
19
20
  cmd :tree_merge,
20
21
  pos: '[[tree] [tree] ... (or stdin)]',
21
22
  desc: t('i18n_tasks.cmd.desc.tree_merge'),
22
- args: [:data_format, :nostdin]
23
+ args: %i(data_format nostdin)
23
24
 
24
25
  def tree_merge(opts = {})
25
26
  print_forest merge_forests_stdin_and_pos!(opts), opts
@@ -28,7 +29,7 @@ module I18n::Tasks
28
29
  cmd :tree_filter,
29
30
  pos: '[pattern] [tree (or stdin)]',
30
31
  desc: t('i18n_tasks.cmd.desc.tree_filter'),
31
- args: [:data_format, :pattern]
32
+ args: %i(data_format pattern)
32
33
 
33
34
  def tree_filter(opts = {})
34
35
  pattern = arg_or_pos! :pattern, opts
@@ -74,7 +75,7 @@ module I18n::Tasks
74
75
  cmd :tree_subtract,
75
76
  pos: '[[tree] [tree] ... (or stdin)]',
76
77
  desc: t('i18n_tasks.cmd.desc.tree_subtract'),
77
- args: [:data_format, :nostdin]
78
+ args: %i(data_format nostdin)
78
79
 
79
80
  def tree_subtract(opt = {})
80
81
  forests = forests_stdin_and_pos! opt, 2
@@ -85,7 +86,7 @@ module I18n::Tasks
85
86
  cmd :tree_set_value,
86
87
  pos: '[VALUE] [tree (or stdin)]',
87
88
  desc: t('i18n_tasks.cmd.desc.tree_set_value'),
88
- args: [:value, :data_format, :nostdin, :pattern]
89
+ args: %i(value data_format nostdin pattern)
89
90
 
90
91
  def tree_set_value(opt = {})
91
92
  value = arg_or_pos! :value, opt
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -12,7 +13,7 @@ module I18n::Tasks
12
13
  cmd :find,
13
14
  pos: '[pattern]',
14
15
  desc: t('i18n_tasks.cmd.desc.find'),
15
- args: [:out_format, :pattern, :strict]
16
+ args: %i(out_format pattern strict)
16
17
 
17
18
  def find(opt = {})
18
19
  opt[:filter] ||= opt.delete(:pattern) || opt[:arguments].try(:first)
@@ -23,7 +24,7 @@ module I18n::Tasks
23
24
  cmd :unused,
24
25
  pos: '[locale ...]',
25
26
  desc: t('i18n_tasks.cmd.desc.unused'),
26
- args: [:locales, :out_format, :strict]
27
+ args: %i(locales out_format strict)
27
28
 
28
29
  def unused(opt = {})
29
30
  forest = i18n.unused_keys(opt.slice(:locales, :strict))
@@ -34,7 +35,7 @@ module I18n::Tasks
34
35
  cmd :remove_unused,
35
36
  pos: '[locale ...]',
36
37
  desc: t('i18n_tasks.cmd.desc.remove_unused'),
37
- args: [:locales, :out_format, :strict, :confirm]
38
+ args: %i(locales out_format strict confirm)
38
39
 
39
40
  def remove_unused(opt = {})
40
41
  unused_keys = i18n.unused_keys(opt.slice(:locales, :strict))
@@ -45,7 +46,7 @@ module I18n::Tasks
45
46
  log_stderr t('i18n_tasks.remove_unused.removed', count: unused_keys.leaves.count)
46
47
  print_forest removed, opt
47
48
  else
48
- log_stderr bold green t('i18n_tasks.remove_unused.noop')
49
+ log_stderr Rainbow(t('i18n_tasks.remove_unused.noop')).green.bright
49
50
  end
50
51
  end
51
52
 
@@ -53,11 +54,11 @@ module I18n::Tasks
53
54
 
54
55
  def confirm_remove_unused!(unused_keys, opt)
55
56
  return if ENV['CONFIRM'] || opt[:confirm]
56
- locales = bold(unused_keys.flat_map { |root| root.key.split('+') }.sort.uniq * ', ')
57
+ locales = Rainbow(unused_keys.flat_map { |root| root.key.split('+') }.sort.uniq * ', ').bright
57
58
  msg = [
58
- red(t('i18n_tasks.remove_unused.confirm', count: unused_keys.leaves.count, locales: locales)),
59
- yellow(t('i18n_tasks.common.continue_q')),
60
- yellow('(yes/no)')
59
+ Rainbow(t('i18n_tasks.remove_unused.confirm', count: unused_keys.leaves.count, locales: locales)).red,
60
+ Rainbow(t('i18n_tasks.common.continue_q')).yellow,
61
+ Rainbow('(yes/no)').yellow
61
62
  ].join(' ')
62
63
  exit 1 unless agree msg
63
64
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module Commands
@@ -16,7 +17,7 @@ module I18n::Tasks
16
17
  require 'axlsx'
17
18
  rescue LoadError
18
19
  message = %(For spreadsheet report please add axlsx gem to Gemfile:\ngem 'axlsx', '~> 2.0')
19
- log_stderr Term::ANSIColor.red Term::ANSIColor.bold message
20
+ log_stderr Rainbow(message).red.bright
20
21
  exit 1
21
22
  end
22
23
  spreadsheet_report.save_report opt[:path], opt.except(:path)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module DSL
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module OptionParsers
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  module Command
4
5
  module OptionParsers
@@ -39,7 +40,7 @@ module I18n::Tasks
39
40
  if vals == %w(all) || vals.blank?
40
41
  context.locales
41
42
  else
42
- move_base_locale_to_front! vals.map { |v| v == 'base' ? context.base_locale : v }, context.base_locale
43
+ move_base_locale_to_front!(vals.map { |v| v == 'base' ? context.base_locale : v }, context.base_locale)
43
44
  end.tap do |locales|
44
45
  locales.each { |locale| validate! locale }
45
46
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command/dsl'
3
4
 
4
5
  module I18n::Tasks
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command/option_parsers/enum'
3
4
 
4
5
  module I18n::Tasks
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command/option_parsers/locale'
3
4
 
4
5
  module I18n::Tasks
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n
3
4
  module Tasks
4
5
  # When this type of error is caught:
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'i18n/tasks/command/dsl'
3
4
  require 'i18n/tasks/command/collection'
4
5
  require 'i18n/tasks/command/commands/health'
@@ -23,7 +24,6 @@ module I18n::Tasks
23
24
  include Command::Commands::Meta
24
25
  include Command::Commands::XLSX
25
26
 
26
- include Term::ANSIColor
27
27
  require 'highline/import'
28
28
  end
29
29
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks::Configuration # rubocop:disable Metrics/ModuleLength
3
4
  DEFAULTS = {
4
5
  base_locale: 'en',
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module I18n::Tasks
3
4
  class ConsoleContext < BaseTask
4
5
  def to_s
@@ -28,21 +29,19 @@ module I18n::Tasks
28
29
  module Messages
29
30
  module_function
30
31
 
31
- extend Term::ANSIColor
32
-
33
32
  def banner
34
- bold("i18n-tasks v#{I18n::Tasks::VERSION} IRB") + "\nType #{green 'guide'} to learn more"
33
+ Rainbow("i18n-tasks v#{I18n::Tasks::VERSION} IRB").bright + "\nType #{Rainbow('guide').green} to learn more"
35
34
  end
36
35
 
37
36
  def guide
38
- green(bold('i18n-tasks IRB Quick Start guide')) + "\n" + <<-TEXT
39
- #{yellow 'Data as trees'}
37
+ Rainbow('i18n-tasks IRB Quick Start guide').green.bright + "\n" + <<-TEXT
38
+ #{Rainbow('Data as trees').yellow}
40
39
  tree(locale)
41
40
  used_tree(key_filter: nil, strict: nil)
42
41
  unused_tree(locale: base_locale, strict: nil)
43
42
  build_tree('es' => {'hello' => 'Hola'})
44
43
 
45
- #{yellow 'Traversal'}
44
+ #{Rainbow('Traversal').yellow}
46
45
  tree = missing_diff_tree('es')
47
46
  tree.nodes { |node| }
48
47
  tree.nodes.to_a
@@ -50,23 +49,23 @@ module I18n::Tasks
50
49
  tree.each { |root_node| }
51
50
  # also levels, depth_first, and breadth_first
52
51
 
53
- #{yellow 'Select nodes'}
52
+ #{Rainbow('Select nodes').yellow}
54
53
  tree.select_nodes { |node| } # new tree with only selected nodes
55
54
 
56
- #{yellow 'Match by full key'}
55
+ #{Rainbow('Match by full key').yellow}
57
56
  tree.select_keys { |key, leaf| } # new tree with only selected keys
58
57
  tree.grep_keys(/hello/) # grep, using ===
59
58
  tree.keys { |key, leaf| } # enumerate over [full_key, leaf_node]
60
59
  # Pass {root: true} to include root node in full_key (usually locale)
61
60
 
62
- #{yellow 'Nodes'}
61
+ #{Rainbow('Nodes').yellow}
63
62
  node = node(key, locale)
64
63
  node.key # only the part after the last dot
65
64
  node.full_key # full key. Includes root key, pass {root: false} to override.
66
65
  # also: value, value_or_children_hash, data, walk_to_root, walk_from_root
67
66
  Tree::Node.new(key: 'en')
68
67
 
69
- #{yellow 'Keys'}
68
+ #{Rainbow('Keys').yellow}
70
69
  t(key, locale)
71
70
  key_value?(key, locale)
72
71
  depluralize_key(key, locale) # convert 'hat.one' to 'hat'