i18n_def_scanner 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.rubocop.yml +52 -0
- data/.travis.yml +7 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +89 -0
- data/LICENSE.txt +21 -0
- data/README.md +74 -0
- data/Rakefile +10 -0
- data/exe/i18n_def_scanner +13 -0
- data/i18n_def_scanner.gemspec +38 -0
- data/lib/i18n_def_scanner.rb +10 -0
- data/lib/i18n_def_scanner/cli_arguments.rb +35 -0
- data/lib/i18n_def_scanner/help.rb +11 -0
- data/lib/i18n_def_scanner/scanning.rb +37 -0
- data/lib/i18n_def_scanner/version.rb +5 -0
- data/lib/i18n_def_scanner/yaml.rb +117 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9b51a0a791a94023e300bcb4ce4adbec22ca89b727676a3bfdc3ee4c250a91d4
|
4
|
+
data.tar.gz: b16613c9edc828aedd3c83c906293fea403b4b4807b716c9092da34a46f3f6f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38334e257d1210d5e64a2f7b28ab8a944b450370faecfbde5219c95d0ffdaf714650c15e3dca2bce0d337c5f2f155f131e5980b76e96be659b34a8a807ba4ed3
|
7
|
+
data.tar.gz: 47e57861ba53e686d830c8eddeb12ac48a0f309c3d7af0c2c8223cd7da8ac263edc836fc7594ee83c3522d68b3d7c53da13c65940b667b6cf47fb153014786c8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
require: rubocop-rspec
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
TargetRubyVersion: 2.6.3
|
7
|
+
|
8
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
9
|
+
Enabled: true
|
10
|
+
Layout/SpaceAroundMethodCallOperator:
|
11
|
+
Enabled: true
|
12
|
+
|
13
|
+
Lint/DeprecatedOpenSSLConstant:
|
14
|
+
Enabled: true
|
15
|
+
Lint/MixedRegexpCaptureTypes:
|
16
|
+
Enabled: true
|
17
|
+
Lint/RaiseException:
|
18
|
+
Enabled: true
|
19
|
+
Lint/StructNewOverride:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
Metrics/BlockLength:
|
23
|
+
Exclude:
|
24
|
+
- 'spec/**/*.*'
|
25
|
+
Naming/MethodName:
|
26
|
+
IgnoredPatterns:
|
27
|
+
- 'visit_I18nDefScanner_YAML_Nodes_/*'
|
28
|
+
|
29
|
+
RSpec/DescribeClass:
|
30
|
+
Exclude:
|
31
|
+
- 'spec/exe/**/*.*'
|
32
|
+
RSpec/NestedGroups:
|
33
|
+
Max: 4
|
34
|
+
|
35
|
+
Style/Documentation:
|
36
|
+
Enabled: false
|
37
|
+
Style/ExponentialNotation:
|
38
|
+
Enabled: true
|
39
|
+
Style/HashEachMethods:
|
40
|
+
Enabled: true
|
41
|
+
Style/HashTransformKeys:
|
42
|
+
Enabled: true
|
43
|
+
Style/HashTransformValues:
|
44
|
+
Enabled: true
|
45
|
+
Style/RedundantFetchBlock:
|
46
|
+
Enabled: true
|
47
|
+
Style/RedundantRegexpCharacterClass:
|
48
|
+
Enabled: true
|
49
|
+
Style/RedundantRegexpEscape:
|
50
|
+
Enabled: true
|
51
|
+
Style/SlicingWithRange:
|
52
|
+
Enabled: true
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
i18n_def_scanner (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.1)
|
10
|
+
byebug (11.1.3)
|
11
|
+
coderay (1.1.3)
|
12
|
+
coveralls (0.8.23)
|
13
|
+
json (>= 1.8, < 3)
|
14
|
+
simplecov (~> 0.16.1)
|
15
|
+
term-ansicolor (~> 1.3)
|
16
|
+
thor (>= 0.19.4, < 2.0)
|
17
|
+
tins (~> 1.6)
|
18
|
+
diff-lcs (1.4.2)
|
19
|
+
docile (1.3.2)
|
20
|
+
json (2.3.1)
|
21
|
+
method_source (1.0.0)
|
22
|
+
parallel (1.19.2)
|
23
|
+
parser (2.7.1.4)
|
24
|
+
ast (~> 2.4.1)
|
25
|
+
pry (0.13.1)
|
26
|
+
coderay (~> 1.1)
|
27
|
+
method_source (~> 1.0)
|
28
|
+
pry-byebug (3.9.0)
|
29
|
+
byebug (~> 11.0)
|
30
|
+
pry (~> 0.13.0)
|
31
|
+
rainbow (3.0.0)
|
32
|
+
rake (10.5.0)
|
33
|
+
regexp_parser (1.7.1)
|
34
|
+
rexml (3.2.4)
|
35
|
+
rspec (3.9.0)
|
36
|
+
rspec-core (~> 3.9.0)
|
37
|
+
rspec-expectations (~> 3.9.0)
|
38
|
+
rspec-mocks (~> 3.9.0)
|
39
|
+
rspec-core (3.9.2)
|
40
|
+
rspec-support (~> 3.9.3)
|
41
|
+
rspec-expectations (3.9.2)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.9.0)
|
44
|
+
rspec-mocks (3.9.1)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.9.0)
|
47
|
+
rspec-support (3.9.3)
|
48
|
+
rubocop (0.86.0)
|
49
|
+
parallel (~> 1.10)
|
50
|
+
parser (>= 2.7.0.1)
|
51
|
+
rainbow (>= 2.2.2, < 4.0)
|
52
|
+
regexp_parser (>= 1.7)
|
53
|
+
rexml
|
54
|
+
rubocop-ast (>= 0.0.3, < 1.0)
|
55
|
+
ruby-progressbar (~> 1.7)
|
56
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
57
|
+
rubocop-ast (0.1.0)
|
58
|
+
parser (>= 2.7.0.1)
|
59
|
+
rubocop-rspec (1.40.0)
|
60
|
+
rubocop (>= 0.68.1)
|
61
|
+
ruby-progressbar (1.10.1)
|
62
|
+
simplecov (0.16.1)
|
63
|
+
docile (~> 1.1)
|
64
|
+
json (>= 1.8, < 3)
|
65
|
+
simplecov-html (~> 0.10.0)
|
66
|
+
simplecov-html (0.10.2)
|
67
|
+
sync (0.5.0)
|
68
|
+
term-ansicolor (1.7.1)
|
69
|
+
tins (~> 1.0)
|
70
|
+
thor (1.0.1)
|
71
|
+
tins (1.25.0)
|
72
|
+
sync
|
73
|
+
unicode-display_width (1.7.0)
|
74
|
+
|
75
|
+
PLATFORMS
|
76
|
+
ruby
|
77
|
+
|
78
|
+
DEPENDENCIES
|
79
|
+
bundler (~> 1.17)
|
80
|
+
coveralls
|
81
|
+
i18n_def_scanner!
|
82
|
+
pry-byebug (~> 3.9.0)
|
83
|
+
rake (~> 10.0)
|
84
|
+
rspec (~> 3.0)
|
85
|
+
rubocop (~> 0.86.0)
|
86
|
+
rubocop-rspec (~> 1.40.0)
|
87
|
+
|
88
|
+
BUNDLED WITH
|
89
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 GeorgeGorbanev
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# I18nDefScanner
|
2
|
+
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/github/GeorgeGorbanev/i18n_def_scanner/badge.svg?branch=master)](https://coveralls.io/github/GeorgeGorbanev/i18n_def_scanner?branch=master)
|
4
|
+
|
5
|
+
I18nDefScanner is a CLI tool that helps to find where i18n translations defined. It accepts yaml key as argument and returns file path with line number where translation defined.
|
6
|
+
|
7
|
+
## Motivation
|
8
|
+
|
9
|
+
When rails-applications grows it becomes harder to maintain order in your translation files. Is it just one file with thousands of lines or hundreds files and directories it will always take time to find definition of translation you need to update if your code editor not configured to do it. So you can find plugin for your code editor or use this gem. Or configure your code editor to use this gem? :)
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'i18n_def_scanner', require: false
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install i18n_def_scanner
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
All you need is to pass yaml key to executable
|
30
|
+
``` sh
|
31
|
+
bundle exec i18n_def_scanner en.my.deeply.nested.yaml.key
|
32
|
+
```
|
33
|
+
and it will print file path and definition number of line:
|
34
|
+
```
|
35
|
+
config/locales/en.yml:42
|
36
|
+
```
|
37
|
+
|
38
|
+
### Custom locales path
|
39
|
+
|
40
|
+
Most of code editors plugins can't analyze rails-application config and consider with custom locales path. As this gem. But this gem has execution options with for locales path:
|
41
|
+
|
42
|
+
``` sh
|
43
|
+
bundle exec i18n_def_scanner en.my.deeply.nested.yaml.key --path=custom_locales_directory/**/*.yml
|
44
|
+
```
|
45
|
+
|
46
|
+
### As a lib
|
47
|
+
|
48
|
+
If you need to locate any yaml definitions in your ruby code you can use this gem as lib, it has:
|
49
|
+
|
50
|
+
1) Simple public API;
|
51
|
+
2) No dependencies, using only ruby standard lib;
|
52
|
+
3) No monkey patching.
|
53
|
+
|
54
|
+
Example of usage:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
require 'i18n_def_scanner'
|
58
|
+
|
59
|
+
scanning = I18nDefScanner::Scanning.new(query_path: 'some.key',load_path: 'locales/**/*.yml')
|
60
|
+
puts scanning.result
|
61
|
+
# locales/filename.yml:42
|
62
|
+
```
|
63
|
+
|
64
|
+
## Compatibility
|
65
|
+
|
66
|
+
Ruby 2.6.3
|
67
|
+
|
68
|
+
## Contributing
|
69
|
+
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/GeorgeGorbanev/i18n_def_scanner.
|
71
|
+
|
72
|
+
## License
|
73
|
+
|
74
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'i18n_def_scanner'
|
5
|
+
|
6
|
+
scanning_params = I18nDefScanner::CliArguments.new(ARGV)
|
7
|
+
|
8
|
+
if scanning_params.help?
|
9
|
+
puts I18nDefScanner::HELP
|
10
|
+
else
|
11
|
+
scanning = I18nDefScanner::Scanning.new(scanning_params.to_hash)
|
12
|
+
puts scanning.result
|
13
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
|
6
|
+
require 'i18n_def_scanner/version'
|
7
|
+
|
8
|
+
Gem::Specification.new do |spec|
|
9
|
+
spec.name = 'i18n_def_scanner'
|
10
|
+
spec.version = I18nDefScanner::VERSION
|
11
|
+
spec.authors = ['GeorgeGorbanev']
|
12
|
+
spec.email = ['georgegorbanev@gmail.com']
|
13
|
+
|
14
|
+
spec.summary = 'CLI tool to find where i18n translations defined.'
|
15
|
+
spec.description = 'CLI tool accepts yaml key as argument and returns file path with' \
|
16
|
+
'line number where translation defined.'
|
17
|
+
spec.homepage = 'https://github.com/GeorgeGorbanev/i18n_def_scanner'
|
18
|
+
spec.license = 'MIT'
|
19
|
+
|
20
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.' unless spec.respond_to?(:metadata)
|
21
|
+
|
22
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
23
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
24
|
+
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = 'exe'
|
29
|
+
spec.executables = ['i18n_def_scanner']
|
30
|
+
spec.require_paths = ['lib']
|
31
|
+
|
32
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
33
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.9.0'
|
34
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
|
+
spec.add_development_dependency 'rubocop', '~> 0.86.0'
|
37
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.40.0'
|
38
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module I18nDefScanner
|
4
|
+
class CliArguments
|
5
|
+
NAMED_ARGS_RE = /--?([^=\s]+)(?:=(\S+))?/.freeze
|
6
|
+
|
7
|
+
attr_accessor :argv_array
|
8
|
+
|
9
|
+
def initialize(argv_array)
|
10
|
+
self.argv_array = argv_array
|
11
|
+
end
|
12
|
+
|
13
|
+
def to_hash
|
14
|
+
{ query_path: query_path, load_path: load_path }.compact
|
15
|
+
end
|
16
|
+
|
17
|
+
def help?
|
18
|
+
named_args.key?('help') || query_path.nil?
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def query_path
|
24
|
+
argv_array[0]
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_path
|
28
|
+
named_args['path']
|
29
|
+
end
|
30
|
+
|
31
|
+
def named_args
|
32
|
+
@named_args ||= Hash[argv_array.join(' ').scan(NAMED_ARGS_RE)]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module I18nDefScanner
|
4
|
+
HELP = <<-HELP
|
5
|
+
Usage: i18n_def_scanner [yml key to find definition] [options]
|
6
|
+
|
7
|
+
Options:
|
8
|
+
--path=YMLS_PATH Pattern of files to find definition,
|
9
|
+
default value is "config/locales/**/*.yml"
|
10
|
+
HELP
|
11
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module I18nDefScanner
|
4
|
+
class Scanning
|
5
|
+
DEFAULT_LOAD_PATH = 'config/locales/**/*.yml'
|
6
|
+
NOT_FOUND_MESSAGE = 'yml key not found'
|
7
|
+
|
8
|
+
attr_accessor :load_path, :query_path
|
9
|
+
|
10
|
+
def initialize(load_path: DEFAULT_LOAD_PATH, query_path:)
|
11
|
+
self.load_path = load_path
|
12
|
+
self.query_path = query_path
|
13
|
+
end
|
14
|
+
|
15
|
+
def result
|
16
|
+
definition = nil
|
17
|
+
|
18
|
+
files.each do |file_path|
|
19
|
+
document_hash = I18nDefScanner::YAML.load_file(file_path)
|
20
|
+
string_number = document_hash.dig(*query_keys)
|
21
|
+
definition = "#{file_path}:#{string_number}" if string_number
|
22
|
+
end
|
23
|
+
|
24
|
+
definition || NOT_FOUND_MESSAGE
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def query_keys
|
30
|
+
@query_keys ||= query_path.split('.')
|
31
|
+
end
|
32
|
+
|
33
|
+
def files
|
34
|
+
Dir[load_path]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module I18nDefScanner
|
6
|
+
module YAML
|
7
|
+
def self.load_file(filename)
|
8
|
+
File.open(filename, 'r:bom|utf-8') do |f|
|
9
|
+
load(f, filename: filename)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.load(yaml, filename: nil)
|
14
|
+
result = parse(yaml, filename: filename)
|
15
|
+
result = result.to_ruby if result
|
16
|
+
result
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.parse(yaml, filename: nil)
|
20
|
+
parse_stream(yaml, filename: filename) do |node|
|
21
|
+
return node
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.parse_stream(yaml, filename: nil, &block)
|
26
|
+
handler = YAML::Handlers::DocumentStream.new(&block)
|
27
|
+
parser = Psych::Parser.new(handler)
|
28
|
+
parser.parse(yaml, filename)
|
29
|
+
end
|
30
|
+
|
31
|
+
module Handlers
|
32
|
+
class DocumentStream < ::YAML::Handlers::DocumentStream
|
33
|
+
def start_document(version, tag_directives, implicit)
|
34
|
+
n = YAML::Nodes::Document.new(version, tag_directives, implicit)
|
35
|
+
push(n)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
module Nodes
|
41
|
+
module ToRubyOverride
|
42
|
+
def to_ruby
|
43
|
+
YAML::Visitors::ToRuby.create.accept(self)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Alias < ::YAML::Nodes::Alias
|
48
|
+
include ToRubyOverride
|
49
|
+
end
|
50
|
+
|
51
|
+
class Document < ::YAML::Nodes::Document
|
52
|
+
include ToRubyOverride
|
53
|
+
end
|
54
|
+
|
55
|
+
class Mapping < ::YAML::Nodes::Mapping
|
56
|
+
include ToRubyOverride
|
57
|
+
end
|
58
|
+
|
59
|
+
class Node < ::YAML::Nodes::Node
|
60
|
+
include ToRubyOverride
|
61
|
+
end
|
62
|
+
|
63
|
+
class Scalar < ::YAML::Nodes::Scalar
|
64
|
+
include ToRubyOverride
|
65
|
+
end
|
66
|
+
|
67
|
+
class Sequence < ::YAML::Nodes::Sequence
|
68
|
+
include ToRubyOverride
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
module Visitors
|
73
|
+
class ToRuby < ::YAML::Visitors::ToRuby
|
74
|
+
def self.create
|
75
|
+
class_loader = ::YAML::ClassLoader.new
|
76
|
+
scanner = ::YAML::ScalarScanner.new(class_loader)
|
77
|
+
YAML::Visitors::ToRuby.new(scanner, class_loader)
|
78
|
+
end
|
79
|
+
|
80
|
+
def visit_I18nDefScanner_YAML_Nodes_Scalar(obj)
|
81
|
+
visit_Psych_Nodes_Scalar(obj)
|
82
|
+
end
|
83
|
+
|
84
|
+
def visit_I18nDefScanner_YAML_Nodes_Sequence(obj)
|
85
|
+
visit_Psych_Nodes_Sequence(obj)
|
86
|
+
end
|
87
|
+
|
88
|
+
def visit_I18nDefScanner_YAML_Nodes_Mapping(obj)
|
89
|
+
visit_Psych_Nodes_Mapping(obj)
|
90
|
+
end
|
91
|
+
|
92
|
+
def visit_I18nDefScanner_YAML_Nodes_Document(obj)
|
93
|
+
visit_Psych_Nodes_Document(obj)
|
94
|
+
end
|
95
|
+
|
96
|
+
def visit_I18nDefScanner_YAML_Nodes_Stream(obj)
|
97
|
+
visit_Psych_Nodes_Stream(obj)
|
98
|
+
end
|
99
|
+
|
100
|
+
def visit_I18nDefScanner_YAML_Nodes_Alias(obj)
|
101
|
+
visit_Psych_Nodes_Alias(obj)
|
102
|
+
end
|
103
|
+
|
104
|
+
def revive_hash(hash, obj)
|
105
|
+
obj.children.each_slice(2) do |key_node, value_node|
|
106
|
+
key = accept(key_node)
|
107
|
+
val = accept(value_node)
|
108
|
+
val = key_node.start_line + 1 unless val.is_a?(Hash)
|
109
|
+
hash[key] = val
|
110
|
+
end
|
111
|
+
|
112
|
+
hash
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: i18n_def_scanner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- GeorgeGorbanev
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry-byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.9.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.9.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.86.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.86.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.40.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.40.0
|
97
|
+
description: CLI tool accepts yaml key as argument and returns file path withline
|
98
|
+
number where translation defined.
|
99
|
+
email:
|
100
|
+
- georgegorbanev@gmail.com
|
101
|
+
executables:
|
102
|
+
- i18n_def_scanner
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".rubocop.yml"
|
109
|
+
- ".travis.yml"
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- exe/i18n_def_scanner
|
116
|
+
- i18n_def_scanner.gemspec
|
117
|
+
- lib/i18n_def_scanner.rb
|
118
|
+
- lib/i18n_def_scanner/cli_arguments.rb
|
119
|
+
- lib/i18n_def_scanner/help.rb
|
120
|
+
- lib/i18n_def_scanner/scanning.rb
|
121
|
+
- lib/i18n_def_scanner/version.rb
|
122
|
+
- lib/i18n_def_scanner/yaml.rb
|
123
|
+
homepage: https://github.com/GeorgeGorbanev/i18n_def_scanner
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata:
|
127
|
+
homepage_uri: https://github.com/GeorgeGorbanev/i18n_def_scanner
|
128
|
+
source_code_uri: https://github.com/GeorgeGorbanev/i18n_def_scanner
|
129
|
+
post_install_message:
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubygems_version: 3.0.3
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: CLI tool to find where i18n translations defined.
|
148
|
+
test_files: []
|