lois 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: a368db62e247243f8deadef990f463985b43e82a579a948852be13ed38310313
4
- data.tar.gz: e2576a5b18afac0b9a95953750efdff674ccc52b0116194a37ed4a026cc0a1d7
3
+ metadata.gz: c13a021299827c59af7e05aad3dc9f372c875a0011838d6201f8cffa134f8625
4
+ data.tar.gz: ba95fc6c1c3c749dbbdf57a31d99542d581eb963477ba9e84e47be801e94d7fa
5
5
  SHA512:
6
- metadata.gz: 97dbbba17f9e7fed7be56c7bef1fbcfee01b6503aefc11a7fde6144ab6aed40af3e19812bb5705d74df46f96cdc77dc13a5f9b064ff0f6034ce25da1886b9511
7
- data.tar.gz: 9ad1a48f117e80ef3a709b0d118f7f368b6086d4ac9f8147bc62e5425582e129c917d4f0185d35d8dbd4aaf41fa0271a42ee0cfd4be6ff4761c81aa68dbfb228
6
+ metadata.gz: '0259ae1363000c995fe8f595b7f53256b991a19ee80c06f0a0f003b3c4578de78d8c783f292088292d35020a2240ee35262509461e32d0dc1c79e05a956a514a'
7
+ data.tar.gz: 4a461927242ea5c90b3ce82af87bb74df7aa37739de3cd6b845373ae79af946eb2f2acffa0fbe15e4584b6b7f7782715ae8611fb23bb0ab3b650cea7cc4ab132
@@ -7,14 +7,9 @@ jobs:
7
7
  build:
8
8
  docker:
9
9
  # specify the version you desire here
10
- - image: circleci/ruby:2.4.1-node-browsers
11
- environment:
12
- COVERAGE: true
13
-
14
- # Specify service dependencies here if necessary
15
- # CircleCI maintains a library of pre-built images
16
- # documented at https://circleci.com/docs/2.0/circleci-images/
17
- # - image: circleci/postgres:9.4
10
+ - image: circleci/ruby:2.6.3
11
+ environment:
12
+ COVERAGE: true
18
13
 
19
14
  working_directory: ~/repo
20
15
 
@@ -24,9 +19,9 @@ jobs:
24
19
  # Download and cache dependencies
25
20
  - restore_cache:
26
21
  keys:
27
- - v2-dependencies-{{ checksum "lois.gemspec" }}
28
- # fallback to using the latest cache if no exact match is found
29
- - v2-dependencies-
22
+ - v2-dependencies-{{ checksum "lois.gemspec" }}
23
+ # fallback to using the latest cache if no exact match is found
24
+ - v2-dependencies-
30
25
 
31
26
  - run:
32
27
  name: install dependencies
@@ -44,6 +39,11 @@ jobs:
44
39
  command: |
45
40
  bin/rake install
46
41
 
42
+ - run:
43
+ name: i18n-tasks
44
+ command: |
45
+ lois i18n-tasks -g $GITHUB_CREDENTIALS -c circleci
46
+
47
47
  - run:
48
48
  name: Bundler-Audit
49
49
  command: |
data/README.md CHANGED
@@ -30,6 +30,7 @@ Commands:
30
30
  lois reek -g, --github-credentials=GITHUB_CREDENTIALS # Run reek
31
31
  lois rubocop -g, --github-credentials=GITHUB_CREDENTIALS # Run Rubocop
32
32
  lois simplecov -g, --github-credentials=GITHUB_CREDENTIALS # Run simplecov
33
+ lois i18n-tasks -g, --github-credentials=GITHUB_CREDENTIALS # Run i18n-tasks
33
34
  ```
34
35
 
35
36
  Lois has commands to run and report ruby quality metrics to GitHub PR Statuses. All it requires is
@@ -62,6 +63,10 @@ A sample `.circleci/config.yml` would look like:
62
63
  - run:
63
64
  name: Reek
64
65
  command: bundle exec lois reek -c circleci -g $GITHUB_CREDENTIALS
66
+
67
+ - run:
68
+ name: i18n-tasks
69
+ command: bundle exec lois i18n-tasks -c circleci -g $GITHUB_CREDENTIALS
65
70
 
66
71
  - store_artifacts:
67
72
  path: lois
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'i18n-tasks' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('i18n-tasks', 'i18n-tasks')
@@ -0,0 +1,133 @@
1
+ # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
+
3
+ # The "main" locale.
4
+ base_locale: en
5
+ ## All available locales are inferred from the data by default. Alternatively, specify them explicitly:
6
+ # locales: [es, fr]
7
+ ## Reporting locale, default: en. Available: en, ru.
8
+ # internal_locale: en
9
+
10
+ # Read and write translations.
11
+ data:
12
+ ## Translations are read from the file system. Supported format: YAML, JSON.
13
+ ## Provide a custom adapter:
14
+ # adapter: I18n::Tasks::Data::FileSystem
15
+
16
+ # Locale files or `File.find` patterns where translations are read from:
17
+ read:
18
+ ## Default:
19
+ - spec/locales/%{locale}.yml
20
+ ## More files:
21
+ # - config/locales/**/*.%{locale}.yml
22
+
23
+ # Locale files to write new keys to, based on a list of key pattern => file rules. Matched from top to bottom:
24
+ # `i18n-tasks normalize -p` will force move the keys according to these rules
25
+ write:
26
+ ## For example, write devise and simple form keys to their respective files:
27
+ # - ['{devise, simple_form}.*', 'config/locales/\1.%{locale}.yml']
28
+ ## Catch-all default:
29
+ # - config/locales/%{locale}.yml
30
+
31
+ # External locale data (e.g. gems).
32
+ # This data is not considered unused and is never written to.
33
+ external:
34
+ ## Example (replace %#= with %=):
35
+ # - "<%#= %x[bundle show vagrant].chomp %>/templates/locales/%{locale}.yml"
36
+
37
+ ## Specify the router (see Readme for details). Valid values: conservative_router, pattern_router, or a custom class.
38
+ # router: conservative_router
39
+
40
+ yaml:
41
+ write:
42
+ # do not wrap lines at 80 characters
43
+ line_width: -1
44
+
45
+ ## Pretty-print JSON:
46
+ # json:
47
+ # write:
48
+ # indent: ' '
49
+ # space: ' '
50
+ # object_nl: "\n"
51
+ # array_nl: "\n"
52
+
53
+ # Find translate calls
54
+ search:
55
+ ## Paths or `File.find` patterns to search in:
56
+ paths:
57
+ - spec/dummy_app/
58
+
59
+ ## Root directories for relative keys resolution.
60
+ # relative_roots:
61
+ # - app/controllers
62
+ # - app/helpers
63
+ # - app/mailers
64
+ # - app/presenters
65
+ # - app/views
66
+
67
+ ## Files or `File.fnmatch` patterns to exclude from search. Some files are always excluded regardless of this setting:
68
+ ## %w(*.jpg *.png *.gif *.svg *.ico *.eot *.otf *.ttf *.woff *.woff2 *.pdf *.css *.sass *.scss *.less *.yml *.json)
69
+ exclude:
70
+ - app/assets/images
71
+ - app/assets/fonts
72
+ - app/assets/videos
73
+
74
+ ## Alternatively, the only files or `File.fnmatch patterns` to search in `paths`:
75
+ ## If specified, this settings takes priority over `exclude`, but `exclude` still applies.
76
+ # only: ["*.rb", "*.html.slim"]
77
+
78
+ ## If `strict` is `false`, guess usages such as t("categories.#{category}.title"). The default is `true`.
79
+ # strict: true
80
+
81
+ ## Multiple scanners can be used. Their results are merged.
82
+ ## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
83
+ ## See this example of a custom scanner: https://github.com/glebm/i18n-tasks/wiki/A-custom-scanner-example
84
+
85
+ ## Translation Services
86
+ # translation:
87
+ # # Google Translate
88
+ # # Get an API key and set billing info at https://code.google.com/apis/console to use Google Translate
89
+ # google_translate_api_key: "AbC-dEf5"
90
+ # # DeepL Pro Translate
91
+ # # Get an API key and subscription at https://www.deepl.com/pro to use DeepL Pro
92
+ # deepl_api_key: "48E92789-57A3-466A-9959-1A1A1A1A1A1A"
93
+
94
+ ## Do not consider these keys missing:
95
+ # ignore_missing:
96
+ # - 'errors.messages.{accepted,blank,invalid,too_short,too_long}'
97
+ # - '{devise,simple_form}.*'
98
+
99
+ ## Consider these keys used:
100
+ # ignore_unused:
101
+ # - 'activerecord.attributes.*'
102
+ # - '{devise,kaminari,will_paginate}.*'
103
+ # - 'simple_form.{yes,no}'
104
+ # - 'simple_form.{placeholders,hints,labels}.*'
105
+ # - 'simple_form.{error_notification,required}.:'
106
+
107
+ ## Exclude these keys from the `i18n-tasks eq-base' report:
108
+ # ignore_eq_base:
109
+ # all:
110
+ # - common.ok
111
+ # fr,es:
112
+ # - common.brand
113
+
114
+ ## Exclude these keys from the `i18n-tasks check-consistent-interpolations` report:
115
+ # ignore_inconsistent_interpolations:
116
+ # - 'activerecord.attributes.*'
117
+
118
+ ## Ignore these keys completely:
119
+ # ignore:
120
+ # - kaminari.*
121
+
122
+ ## Sometimes, it isn't possible for i18n-tasks to match the key correctly,
123
+ ## e.g. in case of a relative key defined in a helper method.
124
+ ## In these cases you can use the built-in PatternMapper to map patterns to keys, e.g.:
125
+ #
126
+ # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
127
+ # only: %w(*.html.haml *.html.slim),
128
+ # patterns: [['= title\b', '.page_title']] %>
129
+ #
130
+ # The PatternMapper can also match key literals via a special %{key} interpolation, e.g.:
131
+ #
132
+ # <%# I18n::Tasks.add_scanner 'I18n::Tasks::Scanners::PatternMapper',
133
+ # patterns: [['\bSpree\.t[( ]\s*%{key}', 'spree.%{key}']] %>
@@ -11,7 +11,7 @@ module Lois
11
11
 
12
12
  def commit_sha
13
13
  sha = ENV.fetch('TRAVIS_PULL_REQUEST_SHA')
14
- sha.length == 0 ? ENV.fetch('TRAVIS_COMMIT') : sha
14
+ sha.empty? ? ENV.fetch('TRAVIS_COMMIT') : sha
15
15
  end
16
16
  end
17
17
  end
@@ -2,6 +2,30 @@ require 'thor'
2
2
 
3
3
  module Lois
4
4
  class CLI < Thor
5
+ desc 'i18n-tasks', 'Run i18n-tasks'
6
+ method_option :github_credentials,
7
+ aliases: '-g',
8
+ required: true,
9
+ desc: 'Github credentials to log PR Status.'
10
+ method_option :ci,
11
+ default: 'circleci',
12
+ aliases: '-c',
13
+ desc: 'CI to load env vars from.'
14
+ method_option :locale,
15
+ default: nil,
16
+ aliases: '-l',
17
+ desc: 'Specific locale to validate'
18
+ def i18n_tasks
19
+ puts 'Checking i18n-tasks'
20
+ configure(options)
21
+ locale_param = (" -l #{options[:locale]}" if options[:locale].to_s.length.positive?)
22
+ if system("i18n-tasks health#{locale_param}")
23
+ Lois.config.github.success('i18n-tasks', 'The translation files are healthy.')
24
+ else
25
+ Lois.config.github.failure('i18n-tasks', 'The translation files are not healthy')
26
+ end
27
+ end
28
+
5
29
  desc 'rubocop', 'Run Rubocop'
6
30
  method_option :github_credentials,
7
31
  aliases: '-g',
@@ -1,3 +1,3 @@
1
1
  module Lois
2
- VERSION = '0.1.7'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
@@ -1,4 +1,4 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'lois/version'
4
4
 
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency 'brakeman'
33
33
  spec.add_dependency 'bundler-audit'
34
34
  spec.add_dependency 'httparty'
35
+ spec.add_dependency 'i18n-tasks'
35
36
  spec.add_dependency 'reek'
36
37
  spec.add_dependency 'rubocop'
37
38
  spec.add_dependency 'simplecov'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lois
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Hansen
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: i18n-tasks
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: reek
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -256,11 +270,13 @@ files:
256
270
  - bin/bundler-audit
257
271
  - bin/code_climate_reek
258
272
  - bin/console
273
+ - bin/i18n-tasks
259
274
  - bin/rake
260
275
  - bin/reek
261
276
  - bin/rspec
262
277
  - bin/rubocop
263
278
  - bin/setup
279
+ - config/i18n-tasks.yml
264
280
  - exe/lois
265
281
  - lib/lois.rb
266
282
  - lib/lois/ci.rb