copy_tuner_client 1.1.5 → 1.2.1

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 (26) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +32 -0
  3. data/README.md +42 -0
  4. data/lib/copy_tuner_client/cache.rb +4 -0
  5. data/lib/copy_tuner_client/configuration.rb +34 -2
  6. data/lib/copy_tuner_client/copyray.rb +4 -0
  7. data/lib/copy_tuner_client/i18n_backend.rb +12 -0
  8. data/lib/copy_tuner_client/translation_log.rb +5 -0
  9. data/lib/copy_tuner_client/version.rb +1 -1
  10. data/skills/copy-tuner/SKILL.md +39 -15
  11. data/skills/copy-tuner-to-locales-cleanup/SKILL.md +165 -0
  12. data/skills/copy-tuner-to-locales-cleanup/references/example-touchpoints.md +111 -0
  13. data/skills/copy-tuner-to-locales-cleanup/references/verification-final.md +73 -0
  14. data/skills/copy-tuner-to-locales-migrate-prefix/SKILL.md +265 -0
  15. data/skills/copy-tuner-to-locales-migrate-prefix/references/example-touchpoints.md +126 -0
  16. data/skills/copy-tuner-to-locales-migrate-prefix/references/export-and-split.md +126 -0
  17. data/skills/copy-tuner-to-locales-migrate-prefix/references/local-first-regexp.md +72 -0
  18. data/skills/copy-tuner-to-locales-migrate-prefix/references/verification-per-prefix.md +63 -0
  19. data/skills/copy-tuner-to-locales-migrate-prefix/scripts/migrate_prefix.rb +279 -0
  20. data/spec/copy_tuner_client/cache_spec.rb +21 -0
  21. data/spec/copy_tuner_client/configuration_spec.rb +53 -0
  22. data/spec/copy_tuner_client/copyray_spec.rb +11 -0
  23. data/spec/copy_tuner_client/helper_extension_spec.rb +6 -0
  24. data/spec/copy_tuner_client/i18n_backend_spec.rb +81 -0
  25. data/spec/copy_tuner_client/translation_log_spec.rb +51 -0
  26. metadata +12 -1
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+ require 'copy_tuner_client/translation_log'
3
+
4
+ describe CopyTunerClient::TranslationLog do
5
+ before { described_class.clear }
6
+
7
+ describe '.add' do
8
+ context 'when initialized' do
9
+ it 'records the key' do
10
+ described_class.add('views.foo', 'Hello')
11
+ expect(described_class.translations).to eq('views.foo' => 'Hello')
12
+ end
13
+
14
+ it 'does not overwrite an existing key' do
15
+ described_class.add('views.foo', 'Hello')
16
+ described_class.add('views.foo', 'World')
17
+ expect(described_class.translations['views.foo']).to eq 'Hello'
18
+ end
19
+
20
+ context 'when the key matches local_first_key_regexp' do
21
+ before { CopyTunerClient.configuration.local_first_key_regexp = /\Aviews\./ }
22
+
23
+ it 'does not record the matching key' do
24
+ described_class.add('views.foo', 'Hello')
25
+ expect(described_class.translations).to be_empty
26
+ end
27
+
28
+ it 'records keys that do not match' do
29
+ described_class.add('messages.greeting', 'Hi')
30
+ expect(described_class.translations).to eq('messages.greeting' => 'Hi')
31
+ end
32
+ end
33
+
34
+ context 'when local_first_key_regexp is not set' do
35
+ it 'records all keys' do
36
+ described_class.add('views.foo', 'Hello')
37
+ expect(described_class.translations).to eq('views.foo' => 'Hello')
38
+ end
39
+ end
40
+ end
41
+
42
+ context 'when not initialized' do
43
+ before { Thread.current[:translations] = nil }
44
+
45
+ it 'ignores the key' do
46
+ described_class.add('views.foo', 'Hello')
47
+ expect(described_class.initialized?).to be false
48
+ end
49
+ end
50
+ end
51
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
@@ -192,6 +192,7 @@ files:
192
192
  - ".ruby-version"
193
193
  - ".vscode/settings.json"
194
194
  - CHANGELOG.md
195
+ - CLAUDE.md
195
196
  - Gemfile
196
197
  - LICENSE.txt
197
198
  - README.md
@@ -227,6 +228,15 @@ files:
227
228
  - lib/copy_tuner_client/version.rb
228
229
  - lib/tasks/copy_tuner_client_tasks.rake
229
230
  - package.json
231
+ - skills/copy-tuner-to-locales-cleanup/SKILL.md
232
+ - skills/copy-tuner-to-locales-cleanup/references/example-touchpoints.md
233
+ - skills/copy-tuner-to-locales-cleanup/references/verification-final.md
234
+ - skills/copy-tuner-to-locales-migrate-prefix/SKILL.md
235
+ - skills/copy-tuner-to-locales-migrate-prefix/references/example-touchpoints.md
236
+ - skills/copy-tuner-to-locales-migrate-prefix/references/export-and-split.md
237
+ - skills/copy-tuner-to-locales-migrate-prefix/references/local-first-regexp.md
238
+ - skills/copy-tuner-to-locales-migrate-prefix/references/verification-per-prefix.md
239
+ - skills/copy-tuner-to-locales-migrate-prefix/scripts/migrate_prefix.rb
230
240
  - skills/copy-tuner/SKILL.md
231
241
  - spec/copy_tuner_client/cache_spec.rb
232
242
  - spec/copy_tuner_client/client_spec.rb
@@ -239,6 +249,7 @@ files:
239
249
  - spec/copy_tuner_client/prefixed_logger_spec.rb
240
250
  - spec/copy_tuner_client/process_guard_spec.rb
241
251
  - spec/copy_tuner_client/request_sync_spec.rb
252
+ - spec/copy_tuner_client/translation_log_spec.rb
242
253
  - spec/copy_tuner_client_spec.rb
243
254
  - spec/spec_helper.rb
244
255
  - spec/support/client_spec_helpers.rb