localer 0.1.1 → 0.2.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: 7a5f69f56228031b0f043199f8dfc2d87a4068fb07b99d1be4e3b541172fa944
4
- data.tar.gz: 0aa61fd219e832a2b594b7c2b05ac4e9694970b7a3ea521fd4376157c1e7e061
3
+ metadata.gz: 3dde5f5dbd5ed5e083207d5bc44407ba5f0148cc7bd6dc5770ad5adfe983ca0f
4
+ data.tar.gz: e4ed2783dda5c702351faa9347de409041d9157cf079d9559d970312d69b6a0d
5
5
  SHA512:
6
- metadata.gz: 82b9a7c4247292d4bc6e8ffed6071a7121d01a390f7fe054e0ade1837220a9f25e5ff7f2669849364da9ec09d570d1eb9ba881d84471d66a720ad4fd7c5c1cc5
7
- data.tar.gz: 5768221a0dd1a4c49df22e2af9ea4fb9acca47f23eefc19d117f679fb4dafef5202d952003a6a050c72acd5c2da83d4e1d0b4b95d8e388bc513ebebb4b93a3e2
6
+ metadata.gz: 6b615376765c4ca87a514054e60407980d45a9d2edeedaa384db193bade7f4ef54324cc3769214e86460201d5492e998f2fe6ad5f7101dae2ead6707cc7ccb83
7
+ data.tar.gz: 017b5416d20b70a389d886b3bb046c2f6b33a4ac02bb11edc7e567a4200b410ffb8d38ee8dda4a9406d23c2d0cbea8865f9ef0f5d4b7534ff8ef35e46d8dd9a0
@@ -1,18 +1,17 @@
1
1
  AllCops:
2
2
  # Include gemspec and Rakefile
3
3
  Include:
4
- - 'lib/**/*.rb'
5
- - 'lib/**/*.rake'
6
- - 'spec/**/*.rb'
4
+ - "lib/**/*.rb"
5
+ - "lib/**/*.rake"
6
+ - "spec/**/*.rb"
7
7
  Exclude:
8
- - 'bin/**/*'
9
- - 'lib/localer/ext/*.rb'
10
- - 'Appraisals'
11
- - 'Gemfile'
12
- - 'Rakefile'
13
- - '*.gemspec'
14
- - 'gemfiles/vendor/**/*'
15
- - 'vendor/**/*'
8
+ - "bin/**/*"
9
+ - "lib/localer/ext/*.rb"
10
+ - "Appraisals"
11
+ - "Gemfile"
12
+ - "Rakefile"
13
+ - "*.gemspec"
14
+ - "spec/dummy_app/"
16
15
  DisplayCopNames: true
17
16
  StyleGuideCopsOnly: false
18
17
  TargetRubyVersion: 2.4
@@ -28,18 +27,27 @@ Style/TrivialAccessors:
28
27
 
29
28
  Style/Documentation:
30
29
  Exclude:
31
- - 'spec/**/*.rb'
30
+ - "spec/**/*.rb"
32
31
 
33
32
  Style/StringLiterals:
34
33
  Enabled: false
35
34
 
36
35
  Style/BlockDelimiters:
37
36
  Exclude:
38
- - 'spec/**/*.rb'
37
+ - "spec/**/*.rb"
39
38
 
40
39
  Style/DoubleNegation:
41
40
  Enabled: false
42
41
 
42
+ Style/HashEachMethods:
43
+ Enabled: true
44
+
45
+ Style/HashTransformKeys:
46
+ Enabled: true
47
+
48
+ Style/HashTransformValues:
49
+ Enabled: true
50
+
43
51
  Layout/SpaceInsideStringInterpolation:
44
52
  EnforcedStyle: no_space
45
53
 
@@ -51,22 +59,16 @@ Lint/AmbiguousBlockAssociation:
51
59
 
52
60
  Metrics/MethodLength:
53
61
  Exclude:
54
- - 'spec/**/*.rb'
62
+ - "spec/**/*.rb"
55
63
 
56
- Metrics/LineLength:
64
+ Layout/LineLength:
57
65
  Max: 120
58
66
  Exclude:
59
- - 'spec/**/*.rb'
67
+ - "spec/**/*.rb"
60
68
 
61
69
  Metrics/BlockLength:
62
70
  Exclude:
63
- - 'spec/**/*.rb'
64
-
65
- Rails/Date:
66
- Enabled: false
67
-
68
- Rails/TimeZone:
69
- Enabled: false
71
+ - "spec/**/*.rb"
70
72
 
71
73
  Security/YAMLLoad:
72
74
  Enabled: false
@@ -1,21 +1,29 @@
1
+ language: ruby
2
+
1
3
  sudo: false
2
4
  dist: trusty
3
- language: ruby
5
+
6
+ notifications:
7
+ email: false
4
8
 
5
9
  before_install:
6
- - gem install bundler
10
+ - gem install bundler:1.17.3
11
+
7
12
  rvm:
8
- - 2.3.3
9
- - 2.4.3
10
- - 2.5.0
13
+ - 2.4
14
+ - 2.5
15
+ - 2.6
16
+ - 2.7
17
+
11
18
  gemfile:
12
19
  - gemfiles/rails50.gemfile
13
20
  - gemfiles/rails51.gemfile
14
- matrix:
15
- include:
16
- - rvm: 2.5.0
17
- env: RUBOCOP=true
18
- - rvm: 2.3.3
19
- gemfile: gemfiles/rails40.gemfile
20
- - rvm: 2.3.3
21
- gemfile: gemfiles/rails41.gemfile
21
+ - gemfiles/rails52.gemfile
22
+ - gemfiles/rails60.gemfile
23
+
24
+ jobs:
25
+ exclude:
26
+ - rvm: 2.4
27
+ gemfile: gemfiles/rails52.gemfile
28
+ - rvm: 2.4
29
+ gemfile: gemfiles/rails60.gemfile
data/Appraisals CHANGED
@@ -1,15 +1,15 @@
1
- appraise 'rails41' do
2
- gem 'rails', '~> 4.1.0'
1
+ appraise 'rails50' do
2
+ gem 'rails', '~> 5.0'
3
3
  end
4
4
 
5
- appraise 'rails42' do
6
- gem 'rails', '~> 4.2.0'
5
+ appraise 'rails51' do
6
+ gem 'rails', '~> 5.1'
7
7
  end
8
8
 
9
- appraise 'rails50' do
10
- gem 'rails', '5.0.0'
9
+ appraise 'rails52' do
10
+ gem 'rails', '~> 5.2'
11
11
  end
12
12
 
13
- appraise 'rails51' do
14
- gem 'rails', '5.1.0'
13
+ appraise 'rails60' do
14
+ gem 'rails', '~> 6.0'
15
15
  end
data/README.md CHANGED
@@ -1,19 +1,16 @@
1
- [![Build Status](https://travis-ci.org/aderyabin/localer.svg?branch=master)](https://travis-ci.org/aderyabin/localer) [![Gem Version](https://badge.fury.io/rb/localer.svg)](https://rubygems.org/gems/localer)
2
1
 
3
- # Localer
2
+ <p align="center">
3
+ <img title="Localer logo" width="384" height="100" src="https://gist.githubusercontent.com/aderyabin/cb0512cbcd6cb4c79a4d84a4831109a5/raw/localer-logo.png">
4
+ </p>
5
+
6
+ [![Gem Version](https://badge.fury.io/rb/localer.svg)](https://rubygems.org/gems/localer) [![Build Status](https://travis-ci.org/aderyabin/localer.svg?branch=master)](https://travis-ci.org/aderyabin/localer)
7
+
4
8
  Localer is a tool that automatically detects missing I18n translations.
5
9
 
6
10
  The goal is to preserve the integrity of translations. Localer parses and merges all application locales’ keys. At the next step, it searches for missing translations among the calculated keys.
7
11
 
8
- <p align="center">
9
- <img align="center" height="500" src="https://gist.githubusercontent.com/aderyabin/cb0512cbcd6cb4c79a4d84a4831109a5/raw/localer2.png">
10
- </p>
11
-
12
- <p align="center">
13
- <a href="https://evilmartians.com/?utm_source=localer">
14
- <img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg"
15
- alt="Sponsored by Evil Martians" width="236" height="54">
16
- </a>
12
+ <p align="left">
13
+ <img height="500" src="https://gist.githubusercontent.com/aderyabin/cb0512cbcd6cb4c79a4d84a4831109a5/raw/localer2.png">
17
14
  </p>
18
15
 
19
16
  ## Installation
@@ -42,9 +39,38 @@ or for specific Rails path:
42
39
 
43
40
  $ localer check /path/to/rails/application
44
41
 
42
+ ## CI integration
43
+
44
+ Localer is easy to integrate into your favorite CI workflow:
45
+ ```yml
46
+ # .travis.yml
47
+
48
+ # other configuration options
49
+ script:
50
+ - bundle exec bundle-audit
51
+ - bundle exec rubocop
52
+ - bundle exec rspec
53
+ - bundle exec localer
54
+ ```
55
+
56
+ or
57
+
58
+ ```ruby
59
+ # Rakefile
60
+
61
+ # other requirements
62
+ require 'localer/rake_task'
63
+ Localer::RakeTask.new()
64
+
65
+ task(:default).clear
66
+ task default: [:rubocop, :spec, :localer]
67
+ ```
68
+
45
69
  ## Support
46
70
 
47
- Localer supports Ruby 2.3+, Rails. 4.1+
71
+ Localer supports
72
+ * Ruby: 2.4, 2.5, 2.6, 2.7
73
+ * Rails: 5.0, 5.1, 5.2, 6.0
48
74
 
49
75
  ## Configuration
50
76
 
@@ -80,7 +106,7 @@ Locale:
80
106
 
81
107
  ## Using Rake
82
108
 
83
- Localer ships with a rake task. To use Localers's rake task you simply need to require the task file and define a task with it. Below is a rake task that will run `localer`:
109
+ Localer ships with a rake task. To use Localer's rake task you simply need to require the task file and define a task with it. Below is a rake task that will run `localer`:
84
110
 
85
111
  ```ruby
86
112
  require 'rubygems'
@@ -100,8 +126,6 @@ you should see
100
126
  rake localer # Run Localer
101
127
  ```
102
128
 
103
- ####
104
-
105
129
  ## Development
106
130
 
107
131
  After checking out the repo, run `bundle exec appraisal install` to install dependencies for each appraisal. Then, run `bundle exec appraisal rake` to run the tests.
@@ -112,6 +136,9 @@ After checking out the repo, run `bundle exec appraisal install` to install depe
112
136
  * [Appraisal](https://github.com/thoughtbot/appraisal) - Used for testing against different versions of dependencies
113
137
  * [Cucumber](https://github.com/cucumber/cucumber) + [Aruba](https://github.com/cucumber/aruba) - Used for testing command-line commands
114
138
 
139
+ ## Acknowledge
140
+ Special thanks to [Roman Shamin](https://www.facebook.com/romanshamin) for the logo.
141
+
115
142
  ## Contributing
116
143
 
117
144
  Bug reports and pull requests are welcome on GitHub at https://github.com/aderyabin/localer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -29,6 +29,8 @@ module Localer # :nodoc:
29
29
  def file_config(filename, path)
30
30
  filename = File.expand_path(filename, path)
31
31
  return {} unless File.exist?(filename)
32
+ return {} if File.zero?(filename)
33
+
32
34
  YAML
33
35
  .load_file(filename)
34
36
  .deep_downcase_keys
@@ -18,7 +18,8 @@ module Localer # :nodoc:
18
18
  @data = Hash.new { |hsh, key| hsh[key] = {} }
19
19
  @locales = []
20
20
  translations.each do |(locale, translation)|
21
- next unless config.locale[locale].enabled
21
+ next unless config.locale[locale.downcase].enabled
22
+
22
23
  @locales.push locale
23
24
  prepare(locale, translation)
24
25
  end
@@ -32,6 +33,7 @@ module Localer # :nodoc:
32
33
  translation.each do |(key, value)|
33
34
  full_key = prefix + ".#{key}"
34
35
  next if exclude?(full_key, locale)
36
+
35
37
  prepare(locale, value, full_key)
36
38
  end
37
39
  else
@@ -41,7 +43,7 @@ module Localer # :nodoc:
41
43
  end
42
44
 
43
45
  def exclude?(key, locale)
44
- (config.exclude + config.locale[locale].exclude).any? do |pattern|
46
+ (config.exclude + config.locale[locale.downcase].exclude).any? do |pattern|
45
47
  match?(key, pattern)
46
48
  end
47
49
  end
@@ -12,6 +12,7 @@ module Localer
12
12
 
13
13
  def translations
14
14
  return {} unless connect!
15
+
15
16
  I18n.backend.send(:init_translations)
16
17
  I18n.backend.send(:translations)
17
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Localer
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -21,13 +21,13 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_development_dependency "appraisal"
24
- spec.add_development_dependency "bundler", "~> 1.16"
25
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "bundler", "~> 1.17"
25
+ spec.add_development_dependency "rake", ">= 12.3.3"
26
26
  spec.add_development_dependency "rspec", "~> 3.0"
27
27
  spec.add_development_dependency "rubocop", "~> 0.50"
28
28
  spec.add_development_dependency "cucumber"
29
29
  spec.add_development_dependency "aruba"
30
30
 
31
- spec.add_dependency "thor", "~> 0.20.0"
32
- spec.add_dependency "dry-initializer", "~> 2.3.0"
31
+ spec.add_dependency "thor", ">= 0.19"
32
+ spec.add_dependency "dry-initializer", ">= 2.0"
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Deryabin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-29 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.16'
33
+ version: '1.17'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.16'
40
+ version: '1.17'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: 12.3.3
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: 12.3.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -112,30 +112,30 @@ dependencies:
112
112
  name: thor
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 0.20.0
117
+ version: '0.19'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 0.20.0
124
+ version: '0.19'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: dry-initializer
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: 2.3.0
131
+ version: '2.0'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: 2.3.0
138
+ version: '2.0'
139
139
  description: Automatic detecting missing I18n translations tool.
140
140
  email:
141
141
  - deriabin@gmail.com
@@ -151,6 +151,7 @@ files:
151
151
  - Appraisals
152
152
  - CODE_OF_CONDUCT.md
153
153
  - Gemfile
154
+ - Gemfile.lock
154
155
  - LICENSE.txt
155
156
  - README.md
156
157
  - Rakefile
@@ -189,8 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  - !ruby/object:Gem::Version
190
191
  version: '0'
191
192
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.7.4
193
+ rubygems_version: 3.0.3
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: Automatic detecting missing I18n translations tool.