i18n-tasks 0.8.4 → 0.8.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6927148f79d82a7dfc85f9ed1551c65ab5534e34
4
- data.tar.gz: 16af9b34933d2e3101c55e8c0edd0da014faa286
3
+ metadata.gz: 82cf5495a5f1756309ed77f51f8425c0b0c6d86e
4
+ data.tar.gz: 5169466a107b4260ee26d43e6f25126d3a9a88b0
5
5
  SHA512:
6
- metadata.gz: 2fac88101d8d8087cf436299a25be28a56e70305f28b2c15c43d0888e1b3da34bb6ca23683d7dca216ecc27b7fa32324645882a77ee87b76c7dc7ead85e81b87
7
- data.tar.gz: 4692ca4f35efcce3f1069f6d6068c4db6e492f99be500f57c4c88bf2bdf57d31ca7215edc23f8cdc5d16e3213c4c1ff3fded90378cf71a653638253cc368c11d
6
+ metadata.gz: 8c80cedb3419bf2b25b4de1331ad74be439db29f93526f7f9e66a853b873e8e331357b64f55ffb9a9fed987f01648a8baa39cfd9cb22ee7d7f1c35d2cdf72ac3
7
+ data.tar.gz: b9894a72294a25dd552d2ad5dcd44df63687df41a2c22ae067ab1f0f0927abc8d60f9bdba623079a654b1c2f3b4baf1182973c47c7db84627cbcdf2147b047bd
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.8.5
2
+
3
+ * Fix regression: Plugin support [#153](https://github.com/glebm/i18n-tasks/issues/153).
4
+
1
5
  ## 0.8.4
2
6
 
3
7
  * Support relative keys in mailers [#155](https://github.com/glebm/i18n-tasks/issues/155).
data/Rakefile CHANGED
@@ -7,5 +7,5 @@ task :irb do
7
7
  # $: << File.expand_path('lib', __FILE__)
8
8
  require 'i18n/tasks'
9
9
  require 'i18n/tasks/commands'
10
- ::I18n::Tasks::Commands.new.irb
10
+ ::I18n::Tasks::Commands.new(::I18n::Tasks::BaseTask.new).irb
11
11
  end
data/i18n-tasks.gemspec CHANGED
@@ -37,7 +37,7 @@ TEXT
37
37
  s.add_dependency 'activesupport'
38
38
  s.add_dependency 'easy_translate', '>= 0.5.0'
39
39
  s.add_dependency 'term-ansicolor'
40
- s.add_dependency 'terminal-table', '~> 1.4.5'
40
+ s.add_dependency 'terminal-table', '>= 1.5.1'
41
41
  s.add_dependency 'highline'
42
42
  s.add_dependency 'i18n'
43
43
  s.add_development_dependency 'axlsx', '~> 2.0'
@@ -40,10 +40,12 @@ class I18n::Tasks::CLI
40
40
  end
41
41
 
42
42
  def context
43
- @context ||= ::I18n::Tasks::Commands.new.tap(&:set_internal_locale!)
43
+ @context ||= ::I18n::Tasks::Commands.new(base_task).tap(&:set_internal_locale!)
44
44
  end
45
45
 
46
46
  def commands
47
+ # load base task to initialize plugins
48
+ base_task
47
49
  @commands ||= ::I18n::Tasks::Commands.cmds.dup.tap do |cmds|
48
50
  # Hash#transform_keys is only available since activesupport v4.0.0
49
51
  cmds.keys.each { |k| cmds[k.to_s.tr('_', '-')] = cmds.delete(k) }
@@ -52,6 +54,10 @@ class I18n::Tasks::CLI
52
54
 
53
55
  private
54
56
 
57
+ def base_task
58
+ @base_task ||= I18n::Tasks::BaseTask.new
59
+ end
60
+
55
61
  def parse!(argv)
56
62
  command = parse_command! argv
57
63
  options = optparse! command, argv
@@ -8,7 +8,11 @@ module I18n::Tasks
8
8
  class Commander
9
9
  include ::I18n::Tasks::Logging
10
10
 
11
- def initialize(i18n = nil)
11
+ attr_reader :i18n
12
+
13
+
14
+ # @param [I18n::Tasks::BaseTask] i18n
15
+ def initialize(i18n)
12
16
  @i18n = i18n
13
17
  end
14
18
 
@@ -37,10 +41,6 @@ module I18n::Tasks
37
41
  @spreadsheet_report ||= I18n::Tasks::Reports::Spreadsheet.new(i18n)
38
42
  end
39
43
 
40
- def i18n
41
- @i18n ||= I18n::Tasks::BaseTask.new
42
- end
43
-
44
44
  delegate :base_locale, :locales, :t, to: :i18n
45
45
  end
46
46
  end
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
  module I18n
3
3
  module Tasks
4
- VERSION = '0.8.4'
4
+ VERSION = '0.8.5'
5
5
  end
6
6
  end
@@ -1,3 +1,6 @@
1
+ <% require './lib/test_i18n_plugin'
2
+ ::I18n::Tasks::Commands.send :include, TestI18nPlugin %>
3
+
1
4
  base_locale: en
2
5
  locales: [es]
3
6
 
@@ -0,0 +1,12 @@
1
+ # An i18n-tasks plugin to test that the plugin system works.
2
+ module TestI18nPlugin
3
+ include ::I18n::Tasks::Command::Collection
4
+
5
+ cmd :greet,
6
+ desc: 'print "Hello, %{name}"',
7
+ args: [['-n', '--name NAME', 'name']]
8
+
9
+ def greet(opts = {})
10
+ puts "Hello, #{opts[:name]}"
11
+ end
12
+ end
@@ -10,18 +10,22 @@ describe 'i18n-tasks' do
10
10
  describe 'bin/i18n-tasks' do
11
11
  it 'shows help when invoked with no arguments, shows version on --version' do
12
12
  # These bin/i18n-tasks tests are executed in parallel for performance
13
- [
14
- proc {
15
- out, err, status = Open3.capture3('bin/i18n-tasks')
16
- expect(status).to be_success
17
- expect(out).to be_empty
18
- expect(err).to start_with('Usage: i18n-tasks [command] [options]')
19
- expect(err).to include('Available commands', 'add-missing')
20
- },
21
- proc {
22
- expect(%x[bin/i18n-tasks --version].chomp).to eq(I18n::Tasks::VERSION)
23
- }
24
- ].map { |test| Thread.start(&test) }.each(&:join)
13
+ in_test_app_dir do
14
+ [
15
+ proc {
16
+ out, err, status = Open3.capture3('../../bin/i18n-tasks')
17
+ expect(status).to be_success
18
+ expect(out).to be_empty
19
+ expect(err).to start_with('Usage: i18n-tasks [command] [options]')
20
+ expect(err).to include('Available commands', 'add-missing')
21
+ # a task from a plugin
22
+ expect(err).to include('greet')
23
+ },
24
+ proc {
25
+ expect(%x[../../bin/i18n-tasks --version].chomp).to eq(I18n::Tasks::VERSION)
26
+ }
27
+ ].map { |test| Thread.start(&test) }.each(&:join)
28
+ end
25
29
  end
26
30
  end
27
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-27 00:00:00.000000000 Z
11
+ date: 2015-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: terminal-table
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.4.5
75
+ version: 1.5.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 1.4.5
82
+ version: 1.5.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: highline
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -270,6 +270,7 @@ files:
270
270
  - spec/fixtures/app/views/relative/index.html.slim
271
271
  - spec/fixtures/app/views/usages.html.slim
272
272
  - spec/fixtures/config/i18n-tasks.yml
273
+ - spec/fixtures/lib/test_i18n_plugin.rb
273
274
  - spec/google_translate_spec.rb
274
275
  - spec/i18n_spec.rb
275
276
  - spec/i18n_tasks_spec.rb
@@ -316,7 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
317
  version: '0'
317
318
  requirements: []
318
319
  rubyforge_project:
319
- rubygems_version: 2.4.5
320
+ rubygems_version: 2.4.6
320
321
  signing_key:
321
322
  specification_version: 4
322
323
  summary: Manage localization and translation with the awesome power of static analysis
@@ -331,6 +332,7 @@ test_files:
331
332
  - spec/fixtures/app/views/relative/index.html.slim
332
333
  - spec/fixtures/app/views/usages.html.slim
333
334
  - spec/fixtures/config/i18n-tasks.yml
335
+ - spec/fixtures/lib/test_i18n_plugin.rb
334
336
  - spec/google_translate_spec.rb
335
337
  - spec/i18n_spec.rb
336
338
  - spec/i18n_tasks_spec.rb