iev 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +32 -0
- data/.hound.yml +3 -1
- data/.rubocop.yml +7 -7
- data/Gemfile +1 -1
- data/README.adoc +1 -3
- data/Rakefile +1 -1
- data/iev.gemspec +6 -6
- data/lib/iev.rb +7 -4
- data/lib/iev/db.rb +3 -3
- data/lib/iev/db_cache.rb +5 -4
- data/lib/iev/version.rb +1 -1
- metadata +8 -11
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -56
- data/.github/workflows/windows.yml +0 -40
- data/Gemfile.lock +0 -55
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ecaba7215dbd4d5e7881ef64bd5efb2977acf8a30d3bece44e2c915f485997e
|
4
|
+
data.tar.gz: a9a5ae122e5cf87ff01ff8e7929daa6816b314842078d1c0b875d2ca78a7c7b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f748be53f10d3889f4c331b0ec46b265d9233797672185149134f2d56d133172337400968ce9a357e949e3bee3119eec5abd8df7e6f255e60ef1dac50aa72cd
|
7
|
+
data.tar.gz: 134e28259355bfc46f6ac2110bcf01544e9e9acaccb917f2f1c0e72ef3d4b27b79b874d5e82cde6d54e261843a07ae71b2add7544de5d0f3f160af2986cc7f12
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: rake
|
4
|
+
|
5
|
+
on:
|
6
|
+
push:
|
7
|
+
branches: [ master, main ]
|
8
|
+
tags: [ v* ]
|
9
|
+
pull_request:
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
rake:
|
13
|
+
name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
continue-on-error: ${{ matrix.experimental }}
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5', '2.4' ]
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
+
experimental: [ false ]
|
22
|
+
steps:
|
23
|
+
- uses: actions/checkout@v2
|
24
|
+
with:
|
25
|
+
submodules: true
|
26
|
+
|
27
|
+
- uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
bundler-cache: true
|
31
|
+
|
32
|
+
- run: bundle exec rake
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
#
|
2
|
-
# https://github.com/
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
4
|
-
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
5
3
|
inherit_from:
|
6
4
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
5
|
+
|
6
|
+
# local repo-specific modifications
|
7
|
+
# ...
|
8
|
+
|
7
9
|
AllCops:
|
8
|
-
TargetRubyVersion: 2.
|
9
|
-
Rails:
|
10
|
-
Enabled: true
|
10
|
+
TargetRubyVersion: 2.4
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
= Iev
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/iev.svg["Gem Version", link="https://rubygems.org/gems/iev"]
|
4
|
-
image:https://github.com/metanorma/iev/workflows/
|
5
|
-
image:https://github.com/metanorma/iev/workflows/macos/badge.svg["OSX Build Status", link="https://github.com/metanorma/iev/actions?query=workflow%3Amacos"]
|
6
|
-
image:https://github.com/metanorma/iev/workflows/windows/badge.svg["Windows Build Status", link="https://github.com/metanorma/iev/actions?query=workflow%3Awindows"]
|
4
|
+
image:https://github.com/metanorma/iev/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/iev/actions?query=workflow%3Arake"]
|
7
5
|
image:https://codeclimate.com/github/metanorma/iev/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/iev"]
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/metanorma/iev.svg["Pull Requests", link="https://github.com/metanorma/iev/pulls"]
|
9
7
|
image:https://img.shields.io/github/commits-since/metanorma/iev/latest.svg["Commits since latest",link="https://github.com/metanorma/iev/releases"]
|
data/Rakefile
CHANGED
data/iev.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
lib = File.expand_path("
|
1
|
+
lib = File.expand_path("lib", __dir__)
|
2
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
3
|
require "iev/version"
|
4
4
|
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Ribose Inc."]
|
9
9
|
spec.email = ["open.source@ribose.com"]
|
10
10
|
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
11
|
+
spec.summary = "IEV: Fetch and encode IEV term from Electropedia"
|
12
|
+
spec.description = "IEV: Fetch and encode IEV term from Electropedia"
|
13
13
|
spec.homepage = "https://github.com/metanorma/iev"
|
14
14
|
spec.license = "BSD-2-Clause"
|
15
15
|
|
@@ -22,10 +22,10 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency
|
25
|
+
spec.add_development_dependency "pry-byebug"
|
26
26
|
spec.add_development_dependency "rake", "~> 13.0"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
|
-
spec.add_development_dependency
|
28
|
+
spec.add_development_dependency "simplecov"
|
29
29
|
|
30
|
-
spec.add_dependency
|
30
|
+
spec.add_dependency "nokogiri", "~> 1.11"
|
31
31
|
end
|
data/lib/iev.rb
CHANGED
@@ -10,13 +10,16 @@ module Iev
|
|
10
10
|
# @param [String] code for example "103-01-02"
|
11
11
|
# @param [String] lang language code, for examle "en"
|
12
12
|
#
|
13
|
-
# @return [String, nil] if found than term,
|
14
|
-
#
|
13
|
+
# @return [String, nil] if found than term,
|
14
|
+
# if code not found then empty string,
|
15
|
+
# if language not found then nil.
|
15
16
|
#
|
16
17
|
def self.get(code, lang)
|
17
|
-
url = "http://www.electropedia.org/iev/iev.nsf/
|
18
|
+
url = "http://www.electropedia.org/iev/iev.nsf/"\
|
19
|
+
"display?openform&ievref=#{code}"
|
18
20
|
doc = Nokogiri::HTML OpenURI.open_uri(url), nil, "UTF-8"
|
19
|
-
xpath = "//table/tr/td/div/font[.=\"#{lang}\"]/../../
|
21
|
+
xpath = "//table/tr/td/div/font[.=\"#{lang}\"]/../../"\
|
22
|
+
"following-sibling::td[2]"
|
20
23
|
doc.at(xpath)&.text&.strip
|
21
24
|
end
|
22
25
|
end
|
data/lib/iev/db.rb
CHANGED
@@ -23,7 +23,7 @@ module Iev
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def check_bibliocache(code, lang)
|
26
|
-
id = code
|
26
|
+
id = "#{code}/#{lang}"
|
27
27
|
return bib_retval(new_bib_entry(code, lang)) if @db.nil?
|
28
28
|
|
29
29
|
# @db.delete(id) unless valid_bib_entry?(@db[id])
|
@@ -38,7 +38,7 @@ module Iev
|
|
38
38
|
def bib_retval(entry)
|
39
39
|
# entry['term'] == 'not_found' ? '' : entry['term']
|
40
40
|
# entry["term"]
|
41
|
-
|
41
|
+
/^not_found/.match?(entry) ? nil : entry
|
42
42
|
end
|
43
43
|
|
44
44
|
# @return [Hash]
|
@@ -55,7 +55,7 @@ module Iev
|
|
55
55
|
db = DbCache.new dir
|
56
56
|
if global
|
57
57
|
unless db.check_version?
|
58
|
-
FileUtils.rm_rf(Dir.glob(File.join(dir,
|
58
|
+
FileUtils.rm_rf(Dir.glob(File.join(dir, "*")), secure: true)
|
59
59
|
warn "Global cache version is obsolete and cleared."
|
60
60
|
end
|
61
61
|
db.set_version
|
data/lib/iev/db_cache.rb
CHANGED
@@ -10,7 +10,8 @@ module Iev
|
|
10
10
|
@dir = dir
|
11
11
|
FileUtils::mkdir_p @dir
|
12
12
|
file_version = "#{@dir}/version"
|
13
|
-
File.
|
13
|
+
File.exist? file_version or
|
14
|
+
File.write file_version, VERSION, encoding: "utf-8"
|
14
15
|
end
|
15
16
|
|
16
17
|
# Save item
|
@@ -67,14 +68,14 @@ module Iev
|
|
67
68
|
# Check if version of the DB match to the gem version.
|
68
69
|
# @return [TrueClass, FalseClass]
|
69
70
|
def check_version?
|
70
|
-
v = File.read @dir
|
71
|
+
v = File.read "#{@dir}/version", encoding: "utf-8"
|
71
72
|
v == VERSION
|
72
73
|
end
|
73
74
|
|
74
75
|
# Set version of the DB to the gem version.
|
75
76
|
# @return [Iev::DbCache]
|
76
77
|
def set_version
|
77
|
-
File.write @dir
|
78
|
+
File.write "#{@dir}/version", VERSION, encoding: "utf-8"
|
78
79
|
self
|
79
80
|
end
|
80
81
|
|
@@ -110,7 +111,7 @@ module Iev
|
|
110
111
|
# @registry.processors.detect do |_n, p|
|
111
112
|
# /^#{p.prefix}/.match(key) || processor.defaultprefix.match(key)
|
112
113
|
# end[1].prefix.downcase
|
113
|
-
key.downcase.match(/^[
|
114
|
+
key.downcase.match(/^[^(]+(?=\()/).to_s
|
114
115
|
end
|
115
116
|
end
|
116
117
|
end
|
data/lib/iev/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: nokogiri
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.
|
89
|
+
version: '1.11'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: '1.11'
|
97
97
|
description: 'IEV: Fetch and encode IEV term from Electropedia'
|
98
98
|
email:
|
99
99
|
- open.source@ribose.com
|
@@ -101,15 +101,12 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
-
- ".github/workflows/
|
105
|
-
- ".github/workflows/ubuntu.yml"
|
106
|
-
- ".github/workflows/windows.yml"
|
104
|
+
- ".github/workflows/rake.yml"
|
107
105
|
- ".gitignore"
|
108
106
|
- ".hound.yml"
|
109
107
|
- ".rspec"
|
110
108
|
- ".rubocop.yml"
|
111
109
|
- Gemfile
|
112
|
-
- Gemfile.lock
|
113
110
|
- LICENSE.txt
|
114
111
|
- README.adoc
|
115
112
|
- Rakefile
|
@@ -139,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
136
|
- !ruby/object:Gem::Version
|
140
137
|
version: '0'
|
141
138
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
139
|
+
rubygems_version: 3.1.4
|
143
140
|
signing_key:
|
144
141
|
specification_version: 4
|
145
142
|
summary: 'IEV: Fetch and encode IEV term from Electropedia'
|
data/.github/workflows/macos.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: macos
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/ubuntu.yml
|
11
|
-
- .github/workflows/windows.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-macos:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
16
|
-
runs-on: macos-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
- name: Update gems
|
33
|
-
run: |
|
34
|
-
sudo gem install bundler --force
|
35
|
-
bundle install --jobs 4 --retry 3
|
36
|
-
- name: Run specs
|
37
|
-
run: |
|
38
|
-
bundle exec rake
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: ubuntu
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
tags:
|
9
|
-
- '*'
|
10
|
-
pull_request:
|
11
|
-
paths-ignore:
|
12
|
-
- .github/workflows/macos.yml
|
13
|
-
- .github/workflows/windows.yml
|
14
|
-
|
15
|
-
jobs:
|
16
|
-
test-linux:
|
17
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
continue-on-error: ${{ matrix.experimental }}
|
20
|
-
strategy:
|
21
|
-
fail-fast: false
|
22
|
-
matrix:
|
23
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
24
|
-
experimental: [false]
|
25
|
-
include:
|
26
|
-
- ruby: '2.7'
|
27
|
-
experimental: true
|
28
|
-
steps:
|
29
|
-
- uses: actions/checkout@master
|
30
|
-
- name: Use Ruby
|
31
|
-
uses: actions/setup-ruby@v1
|
32
|
-
with:
|
33
|
-
ruby-version: ${{ matrix.ruby }}
|
34
|
-
- name: Update gems
|
35
|
-
run: |
|
36
|
-
gem install bundler
|
37
|
-
bundle install --jobs 4 --retry 3
|
38
|
-
- name: Run specs
|
39
|
-
run: |
|
40
|
-
bundle exec rake
|
41
|
-
- name: Trigger repositories
|
42
|
-
if: matrix.ruby == '2.6'
|
43
|
-
env:
|
44
|
-
GH_USERNAME: metanorma-ci
|
45
|
-
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
|
46
|
-
run: |
|
47
|
-
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/trigger-gh-actions.sh
|
48
|
-
[[ -f ".github/workflows/dependent_repos.env" ]] && source .github/workflows/dependent_repos.env
|
49
|
-
CLIENT_PAYLOAD=$(cat <<EOF
|
50
|
-
"{ "ref": "${GITHUB_REF}", "repo": "${GITHUB_REPOSITORY}" }"
|
51
|
-
EOF
|
52
|
-
)
|
53
|
-
for repo in $REPOS
|
54
|
-
do
|
55
|
-
sh trigger-gh-actions.sh $ORGANISATION $repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY "$CLIENT_PAYLOAD"
|
56
|
-
done
|
@@ -1,40 +0,0 @@
|
|
1
|
-
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
-
# See https://github.com/metanorma/cimas
|
3
|
-
name: windows
|
4
|
-
|
5
|
-
on:
|
6
|
-
push:
|
7
|
-
branches: [ master ]
|
8
|
-
pull_request:
|
9
|
-
paths-ignore:
|
10
|
-
- .github/workflows/macos.yml
|
11
|
-
- .github/workflows/ubuntu.yml
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
test-windows:
|
15
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
16
|
-
runs-on: windows-latest
|
17
|
-
continue-on-error: ${{ matrix.experimental }}
|
18
|
-
strategy:
|
19
|
-
fail-fast: false
|
20
|
-
matrix:
|
21
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
22
|
-
experimental: [false]
|
23
|
-
include:
|
24
|
-
- ruby: '2.7'
|
25
|
-
experimental: true
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@master
|
28
|
-
- name: Use Ruby
|
29
|
-
uses: actions/setup-ruby@v1
|
30
|
-
with:
|
31
|
-
ruby-version: ${{ matrix.ruby }}
|
32
|
-
- name: Update gems
|
33
|
-
shell: pwsh
|
34
|
-
run: |
|
35
|
-
gem install bundler
|
36
|
-
bundle config --local path vendor/bundle
|
37
|
-
bundle install --jobs 4 --retry 3
|
38
|
-
- name: Run specs
|
39
|
-
run: |
|
40
|
-
bundle exec rake
|
data/Gemfile.lock
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
iev (0.2.3)
|
5
|
-
nokogiri (>= 1.10.4)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
byebug (11.1.3)
|
11
|
-
coderay (1.1.3)
|
12
|
-
diff-lcs (1.4.4)
|
13
|
-
docile (1.3.2)
|
14
|
-
method_source (1.0.0)
|
15
|
-
mini_portile2 (2.4.0)
|
16
|
-
nokogiri (1.10.10)
|
17
|
-
mini_portile2 (~> 2.4.0)
|
18
|
-
pry (0.13.1)
|
19
|
-
coderay (~> 1.1)
|
20
|
-
method_source (~> 1.0)
|
21
|
-
pry-byebug (3.9.0)
|
22
|
-
byebug (~> 11.0)
|
23
|
-
pry (~> 0.13.0)
|
24
|
-
rake (13.0.1)
|
25
|
-
rspec (3.9.0)
|
26
|
-
rspec-core (~> 3.9.0)
|
27
|
-
rspec-expectations (~> 3.9.0)
|
28
|
-
rspec-mocks (~> 3.9.0)
|
29
|
-
rspec-core (3.9.2)
|
30
|
-
rspec-support (~> 3.9.3)
|
31
|
-
rspec-expectations (3.9.2)
|
32
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
-
rspec-support (~> 3.9.0)
|
34
|
-
rspec-mocks (3.9.1)
|
35
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
-
rspec-support (~> 3.9.0)
|
37
|
-
rspec-support (3.9.3)
|
38
|
-
simplecov (0.18.5)
|
39
|
-
docile (~> 1.1)
|
40
|
-
simplecov-html (~> 0.11)
|
41
|
-
simplecov-html (0.12.2)
|
42
|
-
|
43
|
-
PLATFORMS
|
44
|
-
ruby
|
45
|
-
|
46
|
-
DEPENDENCIES
|
47
|
-
bundler
|
48
|
-
iev!
|
49
|
-
pry-byebug
|
50
|
-
rake (~> 13.0)
|
51
|
-
rspec (~> 3.0)
|
52
|
-
simplecov
|
53
|
-
|
54
|
-
BUNDLED WITH
|
55
|
-
2.1.4
|