i18n-tasks 0.9.10 → 0.9.11

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: 8aaee1c5ad26d0ecf8e4b35f358ffb96092b4f58
4
- data.tar.gz: 82e7baa6d2b38e4628ba7cd77b27291e7cc2f04b
3
+ metadata.gz: 43ba419e2a8a2c55b5a06ae4bebd614498107330
4
+ data.tar.gz: 1f61d868e4ed17245c9932eb2a0fc7e5d79ecb7b
5
5
  SHA512:
6
- metadata.gz: 262a49e458e4bdf8e26a29acad82bb5f568b9dd6ed2c19753bdde6d228629dae539c2dcca05730b5e80a2d23a8188d5dc9197cbd8a8f4f721d0686a66dac58ea
7
- data.tar.gz: 7e67b2dfb0cbe9be2445bbecb7ee2805bee09d171e50e8b05a7ba0e95f520ce08ada1c729c0e7229f82f92aa4402bb904a7f9ce140bed1b469fd6809943f819e
6
+ metadata.gz: 013ee29af74037df89abd7e74c9bede1423d7274fa752fba8aca4d0f04c13408dc509df796cacd817ed090e766c89d7e3df5562543cec87aa58c6d288c1fe761
7
+ data.tar.gz: ef12279c48c34e3691ad826569d30b88b01cc9a082756c0d8d7bb5f3807de0fbd6c2076ad9bf66e5b2a59b3dde225752c7ebb752013b9958c58130f628b83a69
data/README.md CHANGED
@@ -24,7 +24,7 @@ i18n-tasks can be used with any project using the ruby [i18n gem][i18n-gem] (def
24
24
  Add i18n-tasks to the Gemfile:
25
25
 
26
26
  ```ruby
27
- gem 'i18n-tasks', '~> 0.9.10'
27
+ gem 'i18n-tasks', '~> 0.9.11'
28
28
  ```
29
29
 
30
30
  Copy the default [configuration file](#configuration):
@@ -7,7 +7,7 @@ require 'i18n/tasks/key_pattern_matching'
7
7
 
8
8
  module I18n::Tasks
9
9
  module Data
10
- class FileSystemBase
10
+ class FileSystemBase # rubocop:disable Metrics/ClassLength
11
11
  include ::I18n::Tasks::Data::FileFormats
12
12
  include ::I18n::Tasks::Logging
13
13
 
@@ -142,11 +142,31 @@ module I18n::Tasks
142
142
  end.reduce(:+).map do |path|
143
143
  [path.freeze, load_file(path) || {}]
144
144
  end.map do |path, data|
145
+ filter_nil_keys! path, data
145
146
  Data::Tree::Siblings.from_nested_hash(data).tap do |s|
146
147
  s.leaves { |x| x.data.update(path: path, locale: locale) }
147
148
  end
148
149
  end.reduce(:merge!) || Tree::Siblings.null
149
150
  end
151
+
152
+ def filter_nil_keys!(path, data, suffix = [])
153
+ data.each do |key, value|
154
+ if key.nil?
155
+ data.delete(key)
156
+ log_warn <<-TEXT
157
+ Skipping a nil key found in #{path.inspect}:
158
+ key: #{suffix.join('.')}.`nil`
159
+ value: #{value.inspect}
160
+ Nil keys are not supported by i18n.
161
+ The following unquoted YAML keys result in a nil key:
162
+ #{%w(null Null NULL ~).join(', ')}
163
+ See http://yaml.org/type/null.html
164
+ TEXT
165
+ elsif value.is_a?(Hash)
166
+ filter_nil_keys! path, value, suffix + [key]
167
+ end
168
+ end
169
+ end
150
170
  end
151
171
  end
152
172
  end
@@ -45,7 +45,7 @@ module I18n::Tasks::Scanners
45
45
  /(?:
46
46
  :scope\s*=>\s* | (?# :scope => :home )
47
47
  scope:\s* (?# scope: :home )
48
- ) ([^\n)]*)/x
48
+ ) ([^\n)%#]*)/x
49
49
  end
50
50
 
51
51
  # match code expression
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module I18n
3
3
  module Tasks
4
- VERSION = '0.9.10'
4
+ VERSION = '0.9.11'
5
5
  end
6
6
  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.9.10
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - glebm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport