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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1698a9fc00bbc68d6a07e11ab9a61fa009cdf11ab0556c1634e6586ea7f8043f
4
- data.tar.gz: b93eba9d7309f7e7184a548487592a684bc508afd87af84a6270a4abaa66f624
3
+ metadata.gz: 7345dfdb610385c480d9434eda36b6be02c37617046eb0029393fe250a37fe4f
4
+ data.tar.gz: c7d42c8eeb4268b289f96377f5dcee785c97c8c67b1895c53cb7a9b4d984f99d
5
5
  SHA512:
6
- metadata.gz: e8877d5f9a8b3baff02a1f62df4b5b8645297774cbb6fc583ff04b3c23c41298d093f8455253f803f7d21fbdbdf4a832b93d5b0582dda96df0a67eff49041be5
7
- data.tar.gz: bd9f568b8f7c330c005b9c897179d3a37d0f4a88dd718af7135544fd47cd7719329139799c4d050f2a85de20a134b62bb85ad771017002f408faac92a3097e34
6
+ metadata.gz: 27a9d0906d1fff39bec4c877368c7118a9e95d209251433f2fa3890c270aeb9d58a2479153c768069aaf2834fd28b74b916f4a0ed36d58ec844a53c2a3cedf2f
7
+ data.tar.gz: d2ce1ff2d3e9253b2109d4ee6db895ff80476f39b881dc8a9775766936d4b2092429e036d5fe0ed1d9c995a02b2204f06ac6d5fcdfcd064a82fc08b8c3b43a8d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.3.0
2
+
3
+ Add remove-unused task wrapper. https://github.com/alphagov/rails_translation_manager/pull/32
4
+
1
5
  ## 1.2.0
2
6
 
3
7
  Add two new checker classes. https://github.com/alphagov/rails_translation_manager/pull/30
@@ -1,3 +1,3 @@
1
1
  module RailsTranslationManager
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
@@ -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.2.0
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-07 00:00:00.000000000 Z
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport