rails_translation_manager 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/rails_translation_manager/version.rb +1 -1
- data/lib/tasks/translation.rake +10 -0
- data/spec/tasks/translation_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7345dfdb610385c480d9434eda36b6be02c37617046eb0029393fe250a37fe4f
|
4
|
+
data.tar.gz: c7d42c8eeb4268b289f96377f5dcee785c97c8c67b1895c53cb7a9b4d984f99d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27a9d0906d1fff39bec4c877368c7118a9e95d209251433f2fa3890c270aeb9d58a2479153c768069aaf2834fd28b74b916f4a0ed36d58ec844a53c2a3cedf2f
|
7
|
+
data.tar.gz: d2ce1ff2d3e9253b2109d4ee6db895ff80476f39b881dc8a9775766936d4b2092429e036d5fe0ed1d9c995a02b2204f06ac6d5fcdfcd064a82fc08b8c3b43a8d
|
data/CHANGELOG.md
CHANGED
data/lib/tasks/translation.rake
CHANGED
@@ -84,4 +84,14 @@ namespace :translation do
|
|
84
84
|
I18n::Tasks::CLI.start(option_parser)
|
85
85
|
RailsTranslationManager::Cleaner.new(Rails.root.join("config", "locales")).clean
|
86
86
|
end
|
87
|
+
|
88
|
+
desc "Remove unused keys"
|
89
|
+
task(:remove_unused, [:locale] => [:environment]) do |t, args|
|
90
|
+
option_parser = RailsTranslationManager::I18nTasksOptionParser.new(
|
91
|
+
["remove-unused"], args[:locale]
|
92
|
+
).with_optional_locale
|
93
|
+
|
94
|
+
I18n::Tasks::CLI.start(option_parser)
|
95
|
+
RailsTranslationManager::Cleaner.new(Rails.root.join("config", "locales")).clean
|
96
|
+
end
|
87
97
|
end
|
@@ -106,6 +106,28 @@ describe "rake tasks" do
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
describe "translation:remove_unused", type: :task do
|
110
|
+
let(:task) { Rake::Task["translation:remove_unused"] }
|
111
|
+
let!(:cleaner_instance) { stub_cleaner }
|
112
|
+
|
113
|
+
before do
|
114
|
+
allow(I18n::Tasks::CLI).to receive(:start)
|
115
|
+
end
|
116
|
+
|
117
|
+
it "triggers Cleaner and allows to receive the right arguments" do
|
118
|
+
task.execute(locale_directory: "config/locales")
|
119
|
+
expect(RailsTranslationManager::Cleaner)
|
120
|
+
.to have_received(:new)
|
121
|
+
.with(Rails.root.join("config", "locales"))
|
122
|
+
expect(cleaner_instance).to have_received(:clean)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "triggers i18n task and allows to receive the right arguments" do
|
126
|
+
task.execute
|
127
|
+
expect(I18n::Tasks::CLI).to have_received(:start).with(["remove-unused"])
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
109
131
|
def stub_importer
|
110
132
|
importer_instance = instance_double(RailsTranslationManager::Importer)
|
111
133
|
allow(RailsTranslationManager::Importer).to receive(:new)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_translation_manager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edd Sowden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|