i18n-tasks 0.9.0.rc1 → 0.9.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -47
  3. data/bin/i18n-tasks +4 -0
  4. data/config/locales/en.yml +103 -103
  5. data/config/locales/ru.yml +1 -1
  6. data/i18n-tasks.gemspec +6 -5
  7. data/lib/i18n/tasks/cli.rb +10 -6
  8. data/lib/i18n/tasks/command/commander.rb +2 -2
  9. data/lib/i18n/tasks/command/commands/missing.rb +17 -5
  10. data/lib/i18n/tasks/command/option_parsers/locale.rb +8 -1
  11. data/lib/i18n/tasks/command_error.rb +1 -1
  12. data/lib/i18n/tasks/configuration.rb +12 -5
  13. data/lib/i18n/tasks/data.rb +5 -2
  14. data/lib/i18n/tasks/data/file_system_base.rb +7 -5
  15. data/lib/i18n/tasks/data/tree/siblings.rb +3 -3
  16. data/lib/i18n/tasks/data/tree/traversal.rb +9 -3
  17. data/lib/i18n/tasks/google_translation.rb +2 -2
  18. data/lib/i18n/tasks/key_pattern_matching.rb +9 -9
  19. data/lib/i18n/tasks/logging.rb +2 -2
  20. data/lib/i18n/tasks/missing_keys.rb +5 -5
  21. data/lib/i18n/tasks/scanners/file_scanner.rb +62 -0
  22. data/lib/i18n/tasks/scanners/files/caching_file_finder_provider.rb +10 -2
  23. data/lib/i18n/tasks/scanners/files/file_finder.rb +3 -3
  24. data/lib/i18n/tasks/scanners/occurrence_from_position.rb +25 -0
  25. data/lib/i18n/tasks/scanners/pattern_scanner.rb +18 -62
  26. data/lib/i18n/tasks/scanners/pattern_with_scope_scanner.rb +3 -10
  27. data/lib/i18n/tasks/scanners/relative_keys.rb +28 -28
  28. data/lib/i18n/tasks/scanners/results/key_occurrences.rb +53 -0
  29. data/lib/i18n/tasks/scanners/results/occurrence.rb +59 -0
  30. data/lib/i18n/tasks/scanners/ruby_ast_call_finder.rb +62 -0
  31. data/lib/i18n/tasks/scanners/ruby_ast_scanner.rb +193 -0
  32. data/lib/i18n/tasks/scanners/scanner.rb +3 -3
  33. data/lib/i18n/tasks/scanners/scanner_multiplexer.rb +2 -12
  34. data/lib/i18n/tasks/scanners/slim_temple_scanner.rb +24 -0
  35. data/lib/i18n/tasks/scanners/temple_scanner.rb +33 -0
  36. data/lib/i18n/tasks/used_keys.rb +67 -43
  37. data/lib/i18n/tasks/version.rb +1 -1
  38. data/templates/config/i18n-tasks.yml +2 -5
  39. metadata +46 -108
  40. data/.coveralls.yml +0 -1
  41. data/.gitattributes +0 -2
  42. data/.gitignore +0 -35
  43. data/.travis.yml +0 -18
  44. data/CHANGES.md +0 -351
  45. data/Gemfile +0 -13
  46. data/config/i18n-tasks.yml +0 -22
  47. data/lib/i18n/tasks/scanners/key_occurrences.rb +0 -35
  48. data/lib/i18n/tasks/scanners/occurence.rb +0 -50
  49. data/spec/commands/data_commands_spec.rb +0 -38
  50. data/spec/commands/tree_commands_spec.rb +0 -69
  51. data/spec/conservative_router_spec.rb +0 -50
  52. data/spec/file_system_data_spec.rb +0 -101
  53. data/spec/fixtures/app/assets/javascripts/application.js +0 -3
  54. data/spec/fixtures/app/controllers/events_controller.rb +0 -38
  55. data/spec/fixtures/app/views/index.html.slim +0 -29
  56. data/spec/fixtures/app/views/relative/index.html.slim +0 -3
  57. data/spec/fixtures/app/views/usages.html.slim +0 -2
  58. data/spec/fixtures/config/i18n-tasks.yml +0 -63
  59. data/spec/fixtures/lib/test_i18n_plugin.rb +0 -12
  60. data/spec/google_translate_spec.rb +0 -69
  61. data/spec/i18n_spec.rb +0 -17
  62. data/spec/i18n_tasks_spec.rb +0 -302
  63. data/spec/key_pattern_matching_spec.rb +0 -63
  64. data/spec/locale_pathname_spec.rb +0 -24
  65. data/spec/locale_tree/siblings_spec.rb +0 -115
  66. data/spec/pattern_scanner_spec.rb +0 -57
  67. data/spec/plural_keys_spec.rb +0 -44
  68. data/spec/readme_spec.rb +0 -9
  69. data/spec/relative_keys_spec.rb +0 -103
  70. data/spec/scanners/files/caching_file_finder_provider_spec.rb +0 -18
  71. data/spec/scanners/files/caching_file_finder_spec.rb +0 -39
  72. data/spec/scanners/files/caching_file_reader_spec.rb +0 -18
  73. data/spec/scanners/files/file_finder_spec.rb +0 -52
  74. data/spec/scanners/files/file_reader_spec.rb +0 -15
  75. data/spec/scanners/scanner_multiplexer_spec.rb +0 -26
  76. data/spec/spec_helper.rb +0 -24
  77. data/spec/split_key_spec.rb +0 -33
  78. data/spec/support/capture_std.rb +0 -22
  79. data/spec/support/fixtures.rb +0 -14
  80. data/spec/support/i18n_tasks_output_matcher.rb +0 -37
  81. data/spec/support/key_pattern_matcher.rb +0 -7
  82. data/spec/support/keys_and_occurrences.rb +0 -27
  83. data/spec/support/test_codebase.rb +0 -82
  84. data/spec/support/trees.rb +0 -20
  85. data/spec/used_keys_spec.rb +0 -74
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- * -lf
2
- *.cmd -crlf
data/.gitignore DELETED
@@ -1,35 +0,0 @@
1
- *.rbc
2
- *.sassc
3
- .sass-cache
4
- capybara-*.html
5
- .rspec
6
- /.bundle
7
- /vendor/bundle
8
- /log/*
9
- /tmp/*
10
- /db/*.sqlite3
11
- /public/system/*
12
- /coverage/
13
- /spec/tmp/*
14
- **.orig
15
- rerun.txt
16
- pickle-email-*.html
17
- *.gem
18
- *.rbc
19
- .bundle
20
- .config
21
- .yardoc
22
- Gemfile.lock
23
- InstalledFiles
24
- _yardoc
25
- coverage
26
- lib/bundler/man
27
- pkg
28
- rdoc
29
- spec/reports
30
- test/tmp
31
- test/version_tmp
32
- tmp
33
- .ruby-version
34
- .ruby-gemset
35
- *~
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.2
4
- - jruby-9000
5
- - rbx
6
- matrix:
7
- allow_failures:
8
- - rvm: rbx
9
- cache: bundler
10
- script: bundle exec rspec
11
- sudo: false
12
- env:
13
- global:
14
- - TRAVIS=1
15
- # google translate api key:
16
- - secure: Clln+r2rG6adnmVjS0zGMVHs1hOq58UPIqRE73xW3MPLOdozGUyIZ0RrAU2new1h4sqk/5HVwG5NSW7AsUJDGgkNCDx4saJbf/G+oKIity1zNxlHZu5ijZOZGyxYNzGGM4cb2OO6RS6lfzA6TFv2TQtw8DDfKjzG2gpuJOje8sU=
17
- # codeclimate repo token:
18
- - secure: Qz5xzCujPHN5jGZYiCcsZ73BN5DzJTQwDMuj0kJ+W2nBzGQuQDvADT0rHFsHOhdQ/epZe89pVL8wEbr5GaCZ+iZCt1JfasZpvyvCtwMUkPtjrLxpWwVKlH3u7xqAzyYj7Z8ru0VqHni19d6DPzAaNGyV3gaiI1pR6Y63Ux+msM0=
data/CHANGES.md DELETED
@@ -1,351 +0,0 @@
1
- ## 0.9.0.rc1
2
-
3
- * Support for multiple scanners.
4
- * Strict mode enabled by default, can be configured via `search.strict`. New argument: `--no-strict`.
5
-
6
- ## 0.8.6
7
-
8
- * Report missing keys found in source in all the locales. [#162](https://github.com/glebm/i18n-tasks/issues/162)
9
- * Fix `data-remove` task. [#140](https://github.com/glebm/i18n-tasks/issues/140)
10
- * Non-zero exit code on `health`, `missing`, and `unused` if such keys are present. [#151](https://github.com/glebm/i18n-tasks/issues/151)
11
- * XLSX report compatibility with the OSX Numbers App. [#159](https://github.com/glebm/i18n-tasks/issues/159)
12
- * RSpec template compatibility with `config.expose_dsl_globally = false`. [#148](https://github.com/glebm/i18n-tasks/issues/148)
13
- * `bundle show vagrant` example in the config template is no longer interpolated .[#161](https://github.com/glebm/i18n-tasks/issues/161)
14
-
15
- ## 0.8.5
16
-
17
- * Fix regression: Plugin support [#153](https://github.com/glebm/i18n-tasks/issues/153).
18
-
19
- ## 0.8.4
20
-
21
- * Support relative keys in mailers [#155](https://github.com/glebm/i18n-tasks/issues/155).
22
-
23
- ## 0.8.3
24
-
25
- * Fix regression: ActiveSupport < 4 support [#143](https://github.com/glebm/i18n-tasks/issues/143).
26
-
27
- ## 0.8.2
28
-
29
- * Fix failure on nil values in the data config [#142](https://github.com/glebm/i18n-tasks/issues/142).
30
-
31
- ## 0.8.1
32
-
33
- * The default config file now excludes `app/assets/images` and `app/assets/fonts`. Add `*.otf` to ignored extensions.
34
- * If an error message occurs when scanning, the error message now includes the filename [#141](https://github.com/glebm/i18n-tasks/issues/141).
35
-
36
- ## 0.8.0
37
-
38
- * Parse command line arguments with `optparse`. Remove dependency on Slop.
39
- Simplified commands DSL: options are mostly passed directly to optparse.
40
- * `search.relative_roots` default changed from from `%w(app/views)` to
41
- `%w(app/views app/controllers app/helpers app/presenters)`.
42
- * `add-missing` now adds keys detected in source to all locales (previously just base) [#134](https://github.com/glebm/i18n-tasks/issues/134).
43
- * The default spec template no long requires `spec_helper` by default [Daniel Levenson](https://github.com/dleve123) [#135](https://github.com/glebm/i18n-tasks/pull/135).
44
- * `search.exclude` now appends to and not overrides the default exclude list. More extensions excluded by default:
45
- *.css, *.sass, *.scss, *.less, *.yml, and *.json. [#137](https://github.com/glebm/i18n-tasks/issues/137).
46
-
47
- ## 0.7.13
48
-
49
- * Fix relative keys when controller name consists of more than one word by [Yuji Nakayama](https://github.com/yujinakayama) [#132](https://github.com/glebm/i18n-tasks/pull/132).
50
- * Support keys with UTF8 word characters in the name. [#133](https://github.com/glebm/i18n-tasks/issues/133).
51
- * Change missing report column title from "Details" to "Value in other locales or source", display the locale [#130](https://github.com/glebm/i18n-tasks/issues/130).
52
-
53
- ## 0.7.12
54
-
55
- * Handle relative keys in controllers nested in modules by [Alexander Tipugin](https://github.com/atipugin). [#128](https://github.com/glebm/i18n-tasks/issues/128).
56
- * Only write files that changed [#125](https://github.com/glebm/i18n-tasks/issues/125).
57
- * Allow `[]` in the non-strict scanner pattern [#127](https://github.com/glebm/i18n-tasks/issues/127).
58
-
59
- ## 0.7.11
60
-
61
- * Set slop dependency to 3.5 to ensure Ruby 1.9 compatibility ([#121](https://github.com/glebm/i18n-tasks/pull/121)).
62
- MRI 1.9 EOL is [February 23, 2015](https://www.ruby-lang.org/en/news/2014/01/10/ruby-1-9-3-will-end-on-2015/).
63
- We will support 1.9 until rbx and jruby support 2.0.
64
-
65
- ## 0.7.10
66
-
67
- * Support relative keys in controller action with argument
68
-
69
- ## 0.7.9
70
-
71
- * Support relative keys in Rails controller actions by [Jessie A. Young](https://github.com/jessieay). [#46](https://github.com/glebm/i18n-tasks/issues/46).
72
- * Minor fixes
73
-
74
- ## 0.7.8
75
-
76
- * Fix Google Translate issues with non-string keys [#100](https://github.com/glebm/i18n-tasks/pull/100)
77
- * Fix an issue with certain HAML not being parsed [#96](https://github.com/glebm/i18n-tasks/issues/96) [#102](https://github.com/glebm/i18n-tasks/pull/102)
78
- * Fix other minor issues
79
-
80
- ## 0.7.7
81
-
82
- * Fix regression: keys are sorted once again [#92](https://github.com/glebm/i18n-tasks/issues/92).
83
-
84
- ## 0.7.6
85
-
86
- * Add a post-install notice with setup commands
87
- * Fix a small typo in the config template [#91](https://github.com/glebm/i18n-tasks/pull/91).
88
- * Fix `find` crashing on relative keys (regression)
89
-
90
- ## 0.7.5
91
-
92
- Dynamic key usage inference fixes by [Mikko Koski](https://github.com/rap1ds):
93
-
94
- * Append `:` to keys ending with dot '.' (to scan `t('category.' + cat)` as `t('category.:')`)
95
- * Consider keys ending with `:` as match expressions
96
- * Make `@` a valid character for keys (to allow `t("category.#{@cat}"`)
97
-
98
- ## 0.7.4
99
-
100
- * Fix `add-missing --help`
101
- * Fix a minor issue with `health` [#88](https://github.com/glebm/i18n-tasks/issues/88)
102
-
103
- ## 0.7.3
104
-
105
- * New task `translate-tree`
106
- * Bugs fixed: [nil values and Google Translate](https://github.com/glebm/i18n-tasks/issues/85), [config file encoding issue](#82).
107
-
108
- ## 0.7.2
109
-
110
- * i18n-tasks now analyses itself! `internal_locale` setting has been added, that controls i18n-tasks reporting language.
111
- English and Russian are available in this release.
112
-
113
- ## 0.7.1
114
-
115
- * 1.9.3 compatibility
116
-
117
- ## 0.7.0
118
-
119
- New tasks:
120
-
121
- * `i18n-tasks health` to display missing and unused keys along with other information
122
- * `i18n-tasks tree-` to manipulate trees
123
- * `i18n-tasks data-` to look up and manipulate locale data
124
- * Better `help` for all commands
125
- * Minor bug fixes
126
-
127
- Internally:
128
-
129
- * Refactored commands DSL
130
- * `add-missing`, `remove-unused` implemented in terms of the new `tree-` commands
131
-
132
- ## 0.6.3
133
-
134
- * Strict mode added for `unused` and `remove-unused`. When passed `-s` or `--strict`, these tasks will not attempt to infer dynamic key usages, such as `t("category.#{category.key}")`.
135
- * Arrays are now supported as values for Google Translate [#77](https://github.com/glebm/i18n-tasks/issues/77)
136
-
137
- ## 0.6.2
138
-
139
- * New task to show locale data: `i18n-tasks data`
140
- * New output format: `keys`, e.g. `i18n-tasks data -fkeys`
141
- * Fix an issue with a top-level dynamic key breaking unused detection [#75](https://github.com/glebm/i18n-tasks/issues/75)
142
- * Document [magic comment hints](https://github.com/glebm/i18n-tasks#fine-tuning)
143
-
144
- ## 0.6.1
145
-
146
- * Fix Google Translate issue with plural keys and missing billing info error
147
-
148
- ## 0.6.0
149
-
150
- * New output format options for reports: yaml, json, and inspect.
151
- * Templates for config and rspec.
152
- * Keys with values same as base locale have been moved from `missing` into a separate task, `eq-base`.
153
- * `missing` now also shows keys that are present in some locale but not in base locale.
154
- * Terminal output: no more Type column in `missing`, first code usage shown for keys missing base value.
155
- * `relative_roots` configuration key moved to `search.relative_roots`, deprecation warning (removed in the next minor).
156
-
157
- ## 0.5.4
158
-
159
- * ActiveSupport 3 compatibility
160
-
161
- ## 0.5.3
162
-
163
- * Fix Google translate regression
164
- * More robust config output
165
-
166
- ## 0.5.2
167
-
168
- * Ignore lines during search with `config.search.ignore_lines`. Ignores comments by default.
169
- * Fixed minor issues with `i18-tasks config` output.
170
-
171
- ## 0.5.1
172
-
173
- * Fix [conservative router](https://github.com/glebm/i18n-tasks#conservative-router).
174
- * Conservative router is now the default.
175
-
176
- ## 0.5.0
177
-
178
- * internals refactored to use trees everywhere
179
- * type `guide` in `i18n-tasks irb` to learn more about the commands
180
- * (remove-)unused tasks now work per locale
181
- * `ignore` settings are shown on `i18n-tasks config`
182
- * Rubinius 2.2.7 compatibility
183
-
184
- ## 0.4.5
185
-
186
- * Respect tty color setting
187
-
188
- ## 0.4.4
189
-
190
- * Fix google translate issues with plural keys and translating from non-base locale
191
-
192
- ## 0.4.3
193
-
194
- * Ruby 1.9 compatibility
195
-
196
- ## 0.4.2
197
-
198
- * Ruby 1.9.3-compatible again
199
-
200
- ## 0.4.1
201
-
202
- * Improved error messages across the board
203
- * Fixed google translate issue with _html keys [#67](https://github.com/glebm/i18n-tasks/issues/67).
204
-
205
- ## 0.4.0
206
-
207
- * In addition to pattern router, a new conservative router that keeps the keys in place. (See [#57](https://github.com/glebm/i18n-tasks/issues/57))
208
- * `i18n-tasks irb` for debugging
209
- * This release is a major refactoring to use real trees internally (as opposed to nested hashes).
210
- Real trees allow for much easier [traversal](/lib/i18n/tasks/data/tree/traversal.rb).
211
- With these trees, information can be associated with each node, which allows for things like the conservative router.
212
- * Accept keys with dashes (`-`) [#64](https://github.com/glebm/i18n-tasks/issues/64).
213
-
214
- ## 0.3.11
215
-
216
- * Improve plural key handling
217
-
218
- ## 0.3.10
219
-
220
- * New (de)serialization options in config
221
- * `add-missing` placeholder argument can now use %{base_value}.
222
-
223
- ## 0.3.9
224
-
225
- * Fix regression: Remove ActiveSupport::HashWithIndifferentAccess from locale data output
226
-
227
- ## 0.3.8
228
-
229
- * Fix activesupport ~3.x compatibility issue (#45).
230
-
231
- ## 0.3.7
232
-
233
- * Catch Errno::EPIPE to allow `i18n-tasks <command> | head` for large reports
234
- * Improved i18n-tasks config output
235
-
236
- ## v0.3.6
237
-
238
- * fix issue with Google Translate
239
-
240
- ## v0.3.5
241
-
242
- * `config.locales` is now picked up by default from paths do data files. `base_locale` defaults to `en`.
243
-
244
- ## v0.3.3..v0.3.4
245
-
246
- * Bugfixes
247
-
248
- ## v0.3.2
249
-
250
- * Tasks that accept locales now accept them as the first argument(s)
251
-
252
- ## v0.3.0
253
-
254
- * i18n-tasks is a binary now (instead of rake tasks). All tasks / commands now accept various options, and there is no need for as many of them as before.
255
- * Works faster on Rails as it doesn't load anything but the gem, but now requires `base_locale` and `locales` to be set in config.
256
-
257
- ## v0.2.21..v0.2.22
258
-
259
- * `rake i18n:usages[pattern]`
260
- * performance regression fixes
261
-
262
- ## v0.2.20
263
-
264
- * `rake i18n:usages` report
265
-
266
- ## v0.2.17..v0.2.19
267
-
268
- * Bugfixes
269
-
270
- ## v0.2.16
271
-
272
- * Key search extracted into its own class, and a custom scanner can now be provided.
273
- * Removed support for deprecated settings
274
-
275
- ## v0.2.15
276
-
277
- * More robust I18n.t call detection (detect I18n.translate and multiline calls)
278
-
279
- ## v0.2.14
280
-
281
- * Google Translate fixes: preserve interpolations, set correct format based on the key (text or html).
282
-
283
- ## v0.2.13
284
-
285
- * New setting relative_roots for relative key resolution (default: %w(app/views))
286
- * fix google translation attempts to translate non-string keys
287
-
288
- ## v0.2.11 .. v0.2.12
289
-
290
- * New task: `i18n:remove_unused`
291
-
292
- ## v0.2.5..0.2.10
293
-
294
- * config/i18n-tasks.yml now processed with ERB
295
- * can now be used with any ruby apps, not just Rails
296
- * more locale formats are considered valid
297
- * `i18n:missing` accepts locales
298
- * `i18n:missing` supports plural keys
299
-
300
- ## v0.2.4
301
-
302
- * more powerful key pattern matching with sets and backtracking
303
-
304
- ## v0.2.3
305
-
306
- * spreadsheet report, tests run on rbx
307
-
308
- ## v0.2.2
309
-
310
- * improved output with terminal-table
311
-
312
- ## v0.2.1
313
-
314
- * fill tasks renamed, fix symbol key search
315
-
316
- ## v0.2.0
317
-
318
- * 3 more prefill tasks, including Google Translate
319
- * tasks renamed
320
-
321
- ## v0.1.8
322
-
323
- * improved search: no longer uses grep, more robust detection (@natano)
324
-
325
- ## v0.1.7
326
-
327
- * ability to route prefill output via data.write config
328
- * multiple configuration variables renamed (still understands old syntax with deprecation warnings)
329
-
330
- ## v0.1.6
331
-
332
- * New key pattern syntax for i18n-tasks.yml a la globbing
333
-
334
- ## v0.1.5
335
-
336
- * Removed get_locale_data, added data configuration options
337
-
338
- ## v0.1.4
339
-
340
- * Fix relative keys in partials (@paulfioravanti)
341
- * Fix i18n:missing when nothing is missing (@tamtamchik)
342
-
343
- ## v0.1.3
344
-
345
- * detect countable keys as used for unused task
346
- * account for non-string keys coming from yaml (thanks @lichtamberg)
347
-
348
- ## v0.1.2
349
-
350
- * added grep config options (thanks @dmke)
351
- * improved terminal output
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in i18n-tasks.gemspec
4
- gemspec
5
-
6
- unless ENV['TRAVIS']
7
- group :development do
8
- gem 'byebug', platforms: [:mri_21, :mri_22, :mswin, :x64_mingw_21, :x64_mingw_22], require: false
9
- gem 'rubinius-debugger', platform: :rbx, require: false
10
- end
11
- end
12
-
13
- gem 'codeclimate-test-reporter', group: :test, require: nil
@@ -1,22 +0,0 @@
1
- # i18n-tasks works on itself! this is the internal config
2
-
3
- # This is not the default config for new apps, but is the internal config for i18n-tasks to analyze itself.
4
- # You can find the default config here: https://github.com/glebm/i18n-tasks/blob/master/templates/config/i18n-tasks.yml
5
-
6
- base_locale: en
7
- internal_locale: en
8
-
9
- data:
10
- read:
11
- - config/locales/%{locale}.yml
12
- write:
13
- - config/locales/%{locale}.yml
14
- yaml:
15
- write:
16
- ## do not wrap lines at 80 characters (override default)
17
- line_width: 96
18
-
19
- # Find translate calls
20
- search:
21
- paths:
22
- - lib/