iev 0.2.3 → 0.3.0
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 +3 -2
- data/Rakefile +1 -1
- data/iev.gemspec +9 -9
- data/lib/iev/db.rb +3 -3
- data/lib/iev/db_cache.rb +5 -4
- data/lib/iev/version.rb +1 -1
- data/lib/iev.rb +11 -5
- metadata +19 -22
- data/.travis.yml +0 -18
- data/Gemfile.lock +0 -57
- data/appveyor.yml +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 556b84a09693c2ee27bbe3db275abeec90227e563b7c8c456d2efe913c784e5a
|
4
|
+
data.tar.gz: 8736ff88f0283016ae05afda14f497bf5da19b4d3792473d8853ee4a6617f56c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54b212104edfd071c2be493b20d8bc6c0c3398fffbd1d16c08f838b1200737f370d91d69f84ae5dc5ce1b9e70eb5d155a7d981acfb96ba7949ddbbf9a7d232d3
|
7
|
+
data.tar.gz: 22cd4fcb158f674362a9319ee98b7e973b92fbe2176cdbbd3659b069eb0c9cee3b5d432134e224db8d4100a39a99c6ab1bff68040c90371bf69614efaefb0fe9
|
@@ -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' ]
|
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.5
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -1,9 +1,10 @@
|
|
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://
|
4
|
+
image:https://github.com/metanorma/iev/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/iev/actions?query=workflow%3Arake"]
|
5
5
|
image:https://codeclimate.com/github/metanorma/iev/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/iev"]
|
6
|
-
image:https://
|
6
|
+
image:https://img.shields.io/github/issues-pr-raw/metanorma/iev.svg["Pull Requests", link="https://github.com/metanorma/iev/pulls"]
|
7
|
+
image:https://img.shields.io/github/commits-since/metanorma/iev/latest.svg["Commits since latest",link="https://github.com/metanorma/iev/releases"]
|
7
8
|
|
8
9
|
Fetch and encode IEV term from Electropedia.
|
9
10
|
|
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
|
|
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.bindir = "exe"
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
22
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler"
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency "rake", "~>
|
24
|
+
spec.add_development_dependency "bundler"
|
25
|
+
spec.add_development_dependency "debug"
|
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.12"
|
31
31
|
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
data/lib/iev.rb
CHANGED
@@ -10,13 +10,19 @@ 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}\"]/../../
|
20
|
-
|
21
|
+
xpath = "//table/tr/td/div/font[.=\"#{lang}\"]/../../"\
|
22
|
+
"following-sibling::td[2]"
|
23
|
+
a = doc&.at(xpath)&.children&.to_xml
|
24
|
+
a&.sub(%r{<br/>.*$}, "")
|
25
|
+
&.sub(%r{, <.*$}, "")
|
26
|
+
&.gsub(%r{<[^>]*>}, "")&.strip
|
21
27
|
end
|
22
28
|
end
|
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: debug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
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: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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.12'
|
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.12'
|
97
97
|
description: 'IEV: Fetch and encode IEV term from Electropedia'
|
98
98
|
email:
|
99
99
|
- open.source@ribose.com
|
@@ -101,17 +101,15 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- ".github/workflows/rake.yml"
|
104
105
|
- ".gitignore"
|
105
106
|
- ".hound.yml"
|
106
107
|
- ".rspec"
|
107
108
|
- ".rubocop.yml"
|
108
|
-
- ".travis.yml"
|
109
109
|
- Gemfile
|
110
|
-
- Gemfile.lock
|
111
110
|
- LICENSE.txt
|
112
111
|
- README.adoc
|
113
112
|
- Rakefile
|
114
|
-
- appveyor.yml
|
115
113
|
- bin/console
|
116
114
|
- bin/setup
|
117
115
|
- iev.gemspec
|
@@ -123,7 +121,7 @@ homepage: https://github.com/metanorma/iev
|
|
123
121
|
licenses:
|
124
122
|
- BSD-2-Clause
|
125
123
|
metadata: {}
|
126
|
-
post_install_message:
|
124
|
+
post_install_message:
|
127
125
|
rdoc_options: []
|
128
126
|
require_paths:
|
129
127
|
- lib
|
@@ -131,16 +129,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
131
129
|
requirements:
|
132
130
|
- - ">="
|
133
131
|
- !ruby/object:Gem::Version
|
134
|
-
version: 2.
|
132
|
+
version: 2.5.0
|
135
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
134
|
requirements:
|
137
135
|
- - ">="
|
138
136
|
- !ruby/object:Gem::Version
|
139
137
|
version: '0'
|
140
138
|
requirements: []
|
141
|
-
|
142
|
-
|
143
|
-
signing_key:
|
139
|
+
rubygems_version: 3.2.22
|
140
|
+
signing_key:
|
144
141
|
specification_version: 4
|
145
142
|
summary: 'IEV: Fetch and encode IEV term from Electropedia'
|
146
143
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Auto-generated !!! Do not edit it manually
|
2
|
-
# use ci-master https://github.com/metanorma/metanorma-build-scripts
|
3
|
-
language: ruby
|
4
|
-
cache: bundler
|
5
|
-
os:
|
6
|
-
- linux
|
7
|
-
- osx
|
8
|
-
rvm:
|
9
|
-
- 2.6
|
10
|
-
- 2.5
|
11
|
-
- 2.4
|
12
|
-
- ruby-head
|
13
|
-
before_install:
|
14
|
-
- gem install bundler -v "~> 2"
|
15
|
-
- bundle update
|
16
|
-
matrix:
|
17
|
-
allow_failures:
|
18
|
-
- rvm: ruby-head
|
data/Gemfile.lock
DELETED
@@ -1,57 +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.0.1)
|
11
|
-
coderay (1.1.2)
|
12
|
-
diff-lcs (1.3)
|
13
|
-
docile (1.3.2)
|
14
|
-
json (2.2.0)
|
15
|
-
method_source (0.9.2)
|
16
|
-
mini_portile2 (2.4.0)
|
17
|
-
nokogiri (1.10.4)
|
18
|
-
mini_portile2 (~> 2.4.0)
|
19
|
-
pry (0.12.2)
|
20
|
-
coderay (~> 1.1.0)
|
21
|
-
method_source (~> 0.9.0)
|
22
|
-
pry-byebug (3.7.0)
|
23
|
-
byebug (~> 11.0)
|
24
|
-
pry (~> 0.10)
|
25
|
-
rake (10.5.0)
|
26
|
-
rspec (3.8.0)
|
27
|
-
rspec-core (~> 3.8.0)
|
28
|
-
rspec-expectations (~> 3.8.0)
|
29
|
-
rspec-mocks (~> 3.8.0)
|
30
|
-
rspec-core (3.8.2)
|
31
|
-
rspec-support (~> 3.8.0)
|
32
|
-
rspec-expectations (3.8.4)
|
33
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
-
rspec-support (~> 3.8.0)
|
35
|
-
rspec-mocks (3.8.1)
|
36
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.8.0)
|
38
|
-
rspec-support (3.8.2)
|
39
|
-
simplecov (0.17.1)
|
40
|
-
docile (~> 1.1)
|
41
|
-
json (>= 1.8, < 3)
|
42
|
-
simplecov-html (~> 0.10.0)
|
43
|
-
simplecov-html (0.10.2)
|
44
|
-
|
45
|
-
PLATFORMS
|
46
|
-
ruby
|
47
|
-
|
48
|
-
DEPENDENCIES
|
49
|
-
bundler (~> 2.0.1)
|
50
|
-
iev!
|
51
|
-
pry-byebug
|
52
|
-
rake (~> 10.0)
|
53
|
-
rspec (~> 3.0)
|
54
|
-
simplecov
|
55
|
-
|
56
|
-
BUNDLED WITH
|
57
|
-
2.0.2
|
data/appveyor.yml
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# Auto-generated !!! Do not edit it manually
|
2
|
-
# use ci-master https://github.com/metanorma/metanorma-build-scripts
|
3
|
-
version: '{build}'
|
4
|
-
|
5
|
-
cache:
|
6
|
-
- vendor/bundle
|
7
|
-
|
8
|
-
environment:
|
9
|
-
matrix:
|
10
|
-
- RUBY_VERSION: 26
|
11
|
-
- RUBY_VERSION: 25
|
12
|
-
- RUBY_VERSION: 24
|
13
|
-
- RUBY_VERSION: _trunk
|
14
|
-
|
15
|
-
matrix:
|
16
|
-
allow_failures:
|
17
|
-
- RUBY_VERSION: _trunk
|
18
|
-
|
19
|
-
install:
|
20
|
-
- ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
|
21
|
-
- refreshenv
|
22
|
-
|
23
|
-
build_script:
|
24
|
-
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
25
|
-
- set GIT_TERMINAL_PROMPT=0
|
26
|
-
- gem install bundler -v "~> 2"
|
27
|
-
- bundle config --local path vendor/bundle
|
28
|
-
- bundle update
|
29
|
-
- bundle install
|
30
|
-
|
31
|
-
before_test:
|
32
|
-
- ruby -v
|
33
|
-
- gem -v
|
34
|
-
- bundle -v
|
35
|
-
|
36
|
-
test_script:
|
37
|
-
- bundle exec rake
|