iev 0.2.2 → 0.2.6

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: 720a6fffeaa72634aae0ef4e96b0334e332d09e7b5d9afb07fbbfc81bc1c888e
4
- data.tar.gz: 34f839524299a48a4019e50cdf5d3c25eb3d591b8d097386526dfb55b54a4738
3
+ metadata.gz: e7a1cf0837831b0eb46dd20eeb33d685937009868a0408e11bfe104595d5b45d
4
+ data.tar.gz: 4319dc55d6dcd32e0bbecb809b41b0a940fc730f639cfc69479b354906994720
5
5
  SHA512:
6
- metadata.gz: 580cb981a5819ba7d707c0db7ef44c6ad9495ccb8bdc5b9741a631422567ce7b1e9466a92f3f560b0f97b9f20f5d9ff9f7f8da8f37b67a713a649f3d00fab503
7
- data.tar.gz: f47344d9a2c59deb0df8c2dc9591cb09e080a44fbc2593c14783791aeb774a679be93b28c190762fe6c7dbac7915226caf35e0a1238d90f415eb154a5e8f0f6e
6
+ metadata.gz: b86cc0fcce90baff1dd850b06e96587ffee870ee878d09342ea2bcb1dfa1b7b15a9f9eec108ce20a3be8be389d7888002080ee7fc575fd8dc779b935715f03cd
7
+ data.tar.gz: 1f2ff2666b32274846a7e06232af7e28aa250c02efc5b8ee14b135dea0ab10f6b64bfe81ec6a686295e6ab0e369a5fd9930dec3576d5c11adf9a3d7614ef8c48
@@ -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
@@ -1,3 +1,5 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
1
3
  ruby:
2
- Enabled: true
4
+ enabled: true
3
5
  config_file: .rubocop.yml
data/.rubocop.yml CHANGED
@@ -1,10 +1,10 @@
1
- # This project follows the Ribose OSS style guide.
2
- # https://github.com/riboseinc/oss-guides
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.3
9
- Rails:
10
- Enabled: true
10
+ TargetRubyVersion: 2.5
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in iev.gemspec
6
6
  gemspec
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://img.shields.io/travis/metanorma/iev/master.svg["Build Status", link="https://travis-ci.com/metanorma/iev"]
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://ci.appveyor.com/api/projects/status/qifxbnyscgwgca0y?svg=true["Appveyor Build Status", link="https://ci.appveyor.com/project/ribose/iev"]
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
@@ -3,4 +3,4 @@ require "rspec/core/rake_task"
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/iev.gemspec CHANGED
@@ -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 "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 = %q{IEV: Fetch and encode IEV term from Electropedia}
12
- spec.description = %q{IEV: Fetch and encode IEV term from Electropedia}
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.3.0")
22
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
23
23
 
24
- spec.add_development_dependency "bundler", "~> 2.0.1"
25
- spec.add_development_dependency 'pry-byebug'
26
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "bundler"
25
+ spec.add_development_dependency "pry-byebug"
26
+ spec.add_development_dependency "rake", "~> 13.0"
27
27
  spec.add_development_dependency "rspec", "~> 3.0"
28
- spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency "simplecov"
29
29
 
30
- spec.add_dependency 'nokogiri'
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 + "/" + lang
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
- entry =~ /^not_found/ ? nil : entry
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, '*')), secure: true)
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.write file_version, VERSION, encoding: "utf-8" unless File.exist? file_version
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 + "/version", encoding: "utf-8"
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 + "/version", VERSION, encoding: "utf-8"
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(/^[^\(]+(?=\()/).to_s
114
+ key.downcase.match(/^[^(]+(?=\()/).to_s
114
115
  end
115
116
  end
116
117
  end
data/lib/iev/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Iev
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.6".freeze
3
3
  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, if code not found then empty string,
14
- # if langguage not fiund then nil.
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/display?openform&ievref=#{code}"
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}\"]/../../following-sibling::td[2]"
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
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.6
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: 2019-04-03 00:00:00.000000000 Z
11
+ date: 2021-09-23 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: 2.0.1
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: 2.0.1
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry-byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
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: '10.0'
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: '0'
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: '0'
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.3.0
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
- rubyforge_project:
142
- rubygems_version: 2.7.6
143
- signing_key:
139
+ rubygems_version: 3.1.4
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,14 +0,0 @@
1
- sudo: false
2
- language: ruby
3
-
4
- rvm:
5
- - 2.5
6
- - 2.4
7
- - 2.3
8
- - ruby-head
9
-
10
- before_install: gem install bundler -v 1.16.1
11
-
12
- matrix:
13
- allow_failures:
14
- - rvm: ruby-head
data/Gemfile.lock DELETED
@@ -1,57 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- iev (0.2.2)
5
- nokogiri
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.1)
14
- json (2.2.0)
15
- method_source (0.9.2)
16
- mini_portile2 (2.4.0)
17
- nokogiri (1.10.2)
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.0)
31
- rspec-support (~> 3.8.0)
32
- rspec-expectations (3.8.2)
33
- diff-lcs (>= 1.2.0, < 2.0)
34
- rspec-support (~> 3.8.0)
35
- rspec-mocks (3.8.0)
36
- diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.8.0)
38
- rspec-support (3.8.0)
39
- simplecov (0.16.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.1
data/appveyor.yml DELETED
@@ -1,30 +0,0 @@
1
- version: '{build}'
2
-
3
- environment:
4
- matrix:
5
- - RUBY_VERSION: 25
6
- - RUBY_VERSION: 24
7
- - RUBY_VERSION: 23
8
- - RUBY_VERSION: _trunk
9
-
10
- matrix:
11
- allow_failures:
12
- - RUBY_VERSION: _trunk
13
-
14
- install:
15
- - ps: . { iwr -useb https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/master/appveyor.ps1 } | iex
16
- - refreshenv
17
-
18
- build_script:
19
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
20
- - bundle update
21
- - bundle install
22
-
23
- before_test:
24
- - ruby -v
25
- - gem -v
26
- - bundle -v
27
-
28
- test_script:
29
- - bundle exec rake
30
-