i18n-tasks 0.4.0.beta1 → 0.4.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
  SHA1:
3
- metadata.gz: 328ef834a8ef2756aa154f9e4eb5207df02486d4
4
- data.tar.gz: d3d0d63e4fb566037f64606cdfd2a140928492c1
3
+ metadata.gz: efe7070e53b66680ce9137f81c21755823c27cb2
4
+ data.tar.gz: 925f44e4027a20cff615a97b2ad2dcf3c8e10ff1
5
5
  SHA512:
6
- metadata.gz: 0ea465b2b3799df29d77c5db1c7fdbb5deb824b838399f663ef82411f62dee84f14fef9e34498b958e06e53deacd91bbf53252933f9792ef4ad2f0cd3b2c0a5f
7
- data.tar.gz: f0e8d5a760021dd976741f28f06bc5aa2e4fcdc2158573b2eeb9795f8984f6c15c39a46a717f7de44a4bcd8757e858541b74a08230c9433534eb148922d831b2
6
+ metadata.gz: e079e4bb84bde0365ac3628c63670317b7827db35fc1eef6789e1ce3eb82144a42de4e7ace9240e737c0b08db5e711b13a7be38465881f49b5989f856beb0cf9
7
+ data.tar.gz: 1878f3455bb41be8824e5dd59a235f4afafd1ca0830e1b881fc9e0f26688c50b7e7e95de97d8ee0a38f10b416f8bab7f3de4fb011237e3378586efc014e9ca81
data/.travis.yml CHANGED
@@ -2,8 +2,8 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1.1
4
4
  - 2.0.0
5
- - jruby
6
- - rbx
5
+ - jruby-head
6
+ - rbx-2
7
7
  matrix:
8
8
  allow_failures:
9
9
  # no keyword argument support in rbx
data/README.md CHANGED
@@ -18,7 +18,7 @@ i18n-tasks can be used with any project using [i18n][i18n-gem] (default in Rails
18
18
  Add to Gemfile:
19
19
 
20
20
  ```ruby
21
- gem 'i18n-tasks', '~> 0.3.11'
21
+ gem 'i18n-tasks', '~> 0.4.0'
22
22
  ```
23
23
 
24
24
  i18n-tasks does not load or execute any of the application's code but performs static-only analysic.
@@ -188,7 +188,7 @@ data:
188
188
  - 'config/locales/%{locale}.yml'
189
189
  ```
190
190
 
191
- ##### Conservative router (v0.4.0+)
191
+ ##### Conservative router
192
192
 
193
193
  Conservative router keeps the keys where they are found, or infers the path from base locale.
194
194
  If the key is completely new, conservative router will fall back to the pattern router behaviour.
data/i18n-tasks.gemspec CHANGED
@@ -37,6 +37,6 @@ It can also can pre-fill missing keys, including from Google Translate, and it c
37
37
  s.add_development_dependency 'axlsx', '~> 2.0'
38
38
  s.add_development_dependency 'bundler', '~> 1.3'
39
39
  s.add_development_dependency 'rake'
40
- s.add_development_dependency 'rspec'
40
+ s.add_development_dependency 'rspec', '~> 3.0'
41
41
  s.add_development_dependency 'yard'
42
42
  end
@@ -119,7 +119,7 @@ module I18n::Tasks::Scanners
119
119
  key
120
120
  end
121
121
 
122
- VALID_KEY_RE = /^[\w.\#{}]+$/
122
+ VALID_KEY_RE = /^[-\w.\#{}]+$/
123
123
 
124
124
  def valid_key?(key)
125
125
  key =~ VALID_KEY_RE && !(@key_filter && @key_filter_pattern !~ key)
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Tasks
3
- VERSION = '0.4.0.beta1'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ describe 'Conservative router' do
26
26
  TestCodebase.in_test_app_dir do
27
27
  data['es'] = data['es']
28
28
  data.reload
29
- data['es']['es.c'].data[:path].should == 'config/locales/other.es.yml'
29
+ expect(data['es']['es.c'].data[:path]).to eq('config/locales/other.es.yml')
30
30
  end
31
31
  end
32
32
 
@@ -34,8 +34,8 @@ describe 'Conservative router' do
34
34
  TestCodebase.in_test_app_dir do
35
35
  data['es'] = data['es'].merge!(build_tree(es: {a: 1, b: 2}))
36
36
  data.reload
37
- data['es']['es.a'].data[:path].should == 'config/locales/es.yml'
38
- data['es']['es.b'].data[:path].should == 'config/locales/other.es.yml'
37
+ expect(data['es']['es.a'].data[:path]).to eq('config/locales/es.yml')
38
+ expect(data['es']['es.b'].data[:path]).to eq('config/locales/other.es.yml')
39
39
  end
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ describe 'Conservative router' do
43
43
  TestCodebase.in_test_app_dir do
44
44
  data['es'] = data['es'].merge!(build_tree(es: {z: 2}))
45
45
  data.reload
46
- data['es']['es.z'].data[:path].should == 'config/locales/not_found.es.yml'
46
+ expect(data['es']['es.z'].data[:path]).to eq('config/locales/not_found.es.yml')
47
47
  end
48
48
  end
49
49
  end
@@ -58,8 +58,8 @@ describe 'File system i18n' do
58
58
  TestCodebase.in_test_app_dir {
59
59
  data[:en] = data[:en].merge!('en' => locale_data)
60
60
  files = %w(pizza.en.yml sushi.en.yml)
61
- Dir['*.yml'].sort.should == files.sort
62
- files.each { |f| YAML.load_file(f)['en'].should == {File.basename(f, '.en.yml') => keys} }
61
+ expect(Dir['*.yml'].sort).to eq(files.sort)
62
+ files.each { |f| expect(YAML.load_file(f)['en']).to eq({File.basename(f, '.en.yml') => keys}) }
63
63
  }
64
64
  end
65
65
  end
@@ -93,8 +93,8 @@ describe 'File system i18n' do
93
93
  TestCodebase.in_test_app_dir {
94
94
  data[:en] = data[:en].merge!('en' => locale_data)
95
95
  files = %w(pizza.en.json sushi.en.json)
96
- Dir['*.json'].sort.should == files.sort
97
- files.each { |f| JSON.parse(File.read f)['en'].should == {File.basename(f, '.en.json') => keys} }
96
+ expect(Dir['*.json'].sort).to eq(files.sort)
97
+ files.each { |f| expect(JSON.parse(File.read f)['en']).to eq({File.basename(f, '.en.json') => keys}) }
98
98
  }
99
99
  end
100
100
  end
@@ -2,6 +2,7 @@ p #{t('ca.a')} #{t 'ca.b'} #{t "ca.c"}
2
2
  p #{t 'ca.d'} #{t 'ca.f', i: 'world'} #{t 'ca.e', i: 'world'}
3
3
  p #{t 'missing_in_es.a'} #{t 'same_in_es.a'} #{t 'blank_in_es.a'}
4
4
  p = t 'used_but_missing.key'
5
+ p = t 'missing-key-with-a-dash.key'
5
6
  p = t 'x', scope: 'scoped'
6
7
  p = t 'x', scope: [:very, :scoped]
7
8
  p = t 'x', scope: [:scoped, code]
@@ -13,9 +13,9 @@ describe 'Google Translation' do
13
13
 
14
14
  context 'API' do
15
15
  it 'works' do
16
- google_translate(
16
+ expect(google_translate(
17
17
  [['common.hello', TEST_STRING]], from: :en, to: :es, key: ENV['GOOGLE_TRANSLATE_API_KEY']
18
- ).should == [['common.hello', TEST_RESULT]]
18
+ )).to eq([['common.hello', TEST_RESULT]])
19
19
  end
20
20
  end
21
21
 
@@ -12,7 +12,9 @@ describe 'i18n-tasks' do
12
12
  es.missing_in_es.a es.same_in_es.a
13
13
  en.hash.pattern_missing.a en.hash.pattern_missing.b
14
14
  en.missing_symbol_key en.missing_symbol.key_two en.missing_symbol.key_three
15
- es.missing_in_es_plural_1.a es.missing_in_es_plural_2.a)
15
+ es.missing_in_es_plural_1.a es.missing_in_es_plural_2.a
16
+ en.missing-key-with-a-dash.key
17
+ )
16
18
  }
17
19
  it 'detects missing or identical' do
18
20
  capture_stderr do
@@ -39,8 +41,8 @@ describe 'i18n-tasks' do
39
41
  in_test_app_dir do
40
42
  t = i18n_task
41
43
  expected_unused_keys.each do |key|
42
- expect(t.key_value?(key, :en)).to be_true
43
- expect(t.key_value?(key, :es)).to be_true
44
+ expect(t.key_value?(key, :en)).to be true
45
+ expect(t.key_value?(key, :es)).to be true
44
46
  end
45
47
  ENV['CONFIRM'] = '1'
46
48
  capture_stderr {
@@ -48,8 +50,8 @@ describe 'i18n-tasks' do
48
50
  }
49
51
  t.data.reload
50
52
  expected_unused_keys.each do |key|
51
- expect(t.key_value?(key, :en)).to be_false
52
- expect(t.key_value?(key, :es)).to be_false
53
+ expect(t.key_value?(key, :en)).to be false
54
+ expect(t.key_value?(key, :es)).to be false
53
55
  end
54
56
  end
55
57
  end
@@ -6,58 +6,58 @@ describe 'Key pattern' do
6
6
  describe 'matching' do
7
7
  describe '*' do
8
8
  it 'as suffix' do
9
- 'devise.*'.should match_key 'devise.some.key'
9
+ expect('devise.*').to match_key 'devise.some.key'
10
10
  end
11
11
  it 'as prefix' do
12
- '*.some.key'.should match_key 'devise.some.key'
12
+ expect('*.some.key').to match_key 'devise.some.key'
13
13
  end
14
14
  it 'as infix' do
15
- '*.some.*'.should match_key 'devise.some.key'
15
+ expect('*.some.*').to match_key 'devise.some.key'
16
16
  end
17
17
  it 'matches multiple namespaces' do
18
- 'a.*.e*'.should match_key 'a.b.c.d.eeee'
18
+ expect('a.*.e*').to match_key 'a.b.c.d.eeee'
19
19
  end
20
20
  end
21
21
 
22
22
  describe ':' do
23
23
  it 'as suffix' do
24
- 'a.b.:'.should match_key 'a.b.c'
25
- 'a.b.:'.should_not match_key 'a.b.c.d'
24
+ expect('a.b.:').to match_key 'a.b.c'
25
+ expect('a.b.:').not_to match_key 'a.b.c.d'
26
26
  end
27
27
 
28
28
  it 'as prefix' do
29
- ':.b.c'.should match_key 'a.b.c'
30
- ':.b.c'.should_not match_key 'x.a.b.c'
29
+ expect(':.b.c').to match_key 'a.b.c'
30
+ expect(':.b.c').not_to match_key 'x.a.b.c'
31
31
  end
32
32
 
33
33
  it 'as infix' do
34
- 'a.:.c'.should match_key 'a.b.c'
35
- 'a.:.c'.should_not match_key 'a.b.x.c'
34
+ expect('a.:.c').to match_key 'a.b.c'
35
+ expect('a.:.c').not_to match_key 'a.b.x.c'
36
36
  end
37
37
  end
38
38
 
39
39
  describe '{sets}' do
40
40
  it 'matches' do
41
41
  p = 'a.{x,y}.b'
42
- p.should match_key 'a.x.b'
43
- p.should match_key 'a.y.b'
44
- p.should_not match_key 'a.z.b'
42
+ expect(p).to match_key 'a.x.b'
43
+ expect(p).to match_key 'a.y.b'
44
+ expect(p).not_to match_key 'a.z.b'
45
45
  end
46
46
 
47
47
  it 'supports :' do
48
- 'a.{:}.c'.should match_key 'a.b.c'
49
- 'a.{:}.c'.should_not match_key 'a.b.x.c'
48
+ expect('a.{:}.c').to match_key 'a.b.c'
49
+ expect('a.{:}.c').not_to match_key 'a.b.x.c'
50
50
  end
51
51
 
52
52
  it 'supports *' do
53
- 'a.{*}.c'.should match_key 'a.b.c'
54
- 'a.{*}.c'.should match_key 'a.b.x.y.c'
53
+ expect('a.{*}.c').to match_key 'a.b.c'
54
+ expect('a.{*}.c').to match_key 'a.b.x.y.c'
55
55
  end
56
56
 
57
57
  it 'captures' do
58
58
  p = 'a.{x,y}.{:}'
59
59
  compile_key_pattern(p) =~ 'a.x.c'
60
- [$1, $2].should == ['x', 'c']
60
+ expect([$1, $2]).to eq(['x', 'c'])
61
61
  end
62
62
  end
63
63
  end
@@ -6,13 +6,13 @@ describe 'Relative keys' do
6
6
 
7
7
  context 'default settings' do
8
8
  it 'works' do
9
- scanner.absolutize_key('.title', 'app/views/movies/show.html.slim', %w(app/views)).should == 'movies.show.title'
9
+ expect(scanner.absolutize_key('.title', 'app/views/movies/show.html.slim', %w(app/views))).to eq('movies.show.title')
10
10
  end
11
11
  end
12
12
 
13
13
  context 'custom roots' do
14
14
  it 'works' do
15
- scanner.absolutize_key('.title', 'app/views-mobile/movies/show.html.slim', %w(app/views app/views-mobile)).should == 'movies.show.title'
15
+ expect(scanner.absolutize_key('.title', 'app/views-mobile/movies/show.html.slim', %w(app/views app/views-mobile))).to eq('movies.show.title')
16
16
  end
17
17
  end
18
18
 
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,6 @@ unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
5
5
  Coveralls.wear! 'rails'
6
6
  end
7
7
 
8
- require 'rspec/autorun'
9
8
  $: << File.expand_path('../lib', __FILE__)
10
9
 
11
10
  require 'i18n/tasks'
@@ -26,10 +26,10 @@ RSpec::Matchers.define :be_i18n_keys do |expected|
26
26
  end
27
27
 
28
28
  match do |actual|
29
- extract_keys(actual).sort.should == expected.sort
29
+ expect(extract_keys(actual).sort).to eq(expected.sort)
30
30
  end
31
31
 
32
- failure_message_for_should do |actual|
32
+ failure_message do |actual|
33
33
  e = expected.sort
34
34
  a = extract_keys(actual).sort
35
35
 
@@ -3,6 +3,6 @@ RSpec::Matchers.define :match_key do |key|
3
3
  include I18n::Tasks::KeyPatternMatching
4
4
 
5
5
  match do |pattern|
6
- compile_key_pattern(pattern).should =~ key
6
+ expect(compile_key_pattern(pattern)).to match(key)
7
7
  end
8
8
  end
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.4.0.beta1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-31 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -154,16 +154,16 @@ dependencies:
154
154
  name: rspec
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '3.0'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '3.0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: yard
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -285,9 +285,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
285
285
  version: '0'
286
286
  required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - ">"
288
+ - - ">="
289
289
  - !ruby/object:Gem::Version
290
- version: 1.3.1
290
+ version: '0'
291
291
  requirements: []
292
292
  rubyforge_project:
293
293
  rubygems_version: 2.2.2