relaton-omg 1.6.pre1 → 1.7.3
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 +46 -0
- data/Gemfile +1 -1
- data/bin/bundle +114 -0
- data/lib/relaton_omg/omg_bibliographic_item.rb +2 -1
- data/lib/relaton_omg/scrapper.rb +6 -6
- data/lib/relaton_omg/version.rb +1 -1
- data/lib/relaton_omg/xml_parser.rb +1 -1
- data/relaton_omg.gemspec +3 -4
- metadata +8 -51
- data/.github/workflows/macos.yml +0 -34
- data/.github/workflows/ubuntu.yml +0 -33
- data/.github/workflows/windows.yml +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3b0a5ffff840bd561fa694ef65b560833675404aebbbbf5b1fe2aede4d78f9c
|
4
|
+
data.tar.gz: 0010cb2fca5d9d2652d8a12336e385dcc4cfff8b228af356c95eef531ab6ce99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bff9107061019e111fd8e9fb20cea4b172c01977db25acf46a585c20bfcd67b166df4ffe0205b5889e7b45a9c639e2e58efa326a79e89c8a8a7bca2f9309949
|
7
|
+
data.tar.gz: e8b9e613d354cc0fca62e48d655f9c8dc81bd2e409fbdfea79f430c0433b416fb967162b6fb9d13dbd2211b25ba46e8910d2637ae0216dfc27293adff51b8c88
|
@@ -0,0 +1,46 @@
|
|
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: [ '2.7', '2.6', '2.5', '2.4' ]
|
20
|
+
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
+
experimental: [ false ]
|
22
|
+
include:
|
23
|
+
- ruby: '3.0'
|
24
|
+
os: 'ubuntu-latest'
|
25
|
+
experimental: true
|
26
|
+
- ruby: '3.0'
|
27
|
+
os: 'windows-latest'
|
28
|
+
experimental: true
|
29
|
+
- ruby: '3.0'
|
30
|
+
os: 'macos-latest'
|
31
|
+
experimental: true
|
32
|
+
steps:
|
33
|
+
- uses: actions/checkout@v2
|
34
|
+
with:
|
35
|
+
submodules: true
|
36
|
+
|
37
|
+
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
38
|
+
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
39
|
+
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
40
|
+
|
41
|
+
- uses: ruby/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
bundler-cache: true
|
45
|
+
|
46
|
+
- run: bundle exec rake
|
data/Gemfile
CHANGED
data/bin/bundle
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'bundle' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "rubygems"
|
12
|
+
|
13
|
+
m = Module.new do
|
14
|
+
module_function
|
15
|
+
|
16
|
+
def invoked_as_script?
|
17
|
+
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def env_var_version
|
21
|
+
ENV["BUNDLER_VERSION"]
|
22
|
+
end
|
23
|
+
|
24
|
+
def cli_arg_version
|
25
|
+
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
+
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
+
bundler_version = nil
|
28
|
+
update_index = nil
|
29
|
+
ARGV.each_with_index do |a, i|
|
30
|
+
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
+
bundler_version = a
|
32
|
+
end
|
33
|
+
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
+
bundler_version = $1
|
35
|
+
update_index = i
|
36
|
+
end
|
37
|
+
bundler_version
|
38
|
+
end
|
39
|
+
|
40
|
+
def gemfile
|
41
|
+
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
+
return gemfile if gemfile && !gemfile.empty?
|
43
|
+
|
44
|
+
File.expand_path("../../Gemfile", __FILE__)
|
45
|
+
end
|
46
|
+
|
47
|
+
def lockfile
|
48
|
+
lockfile =
|
49
|
+
case File.basename(gemfile)
|
50
|
+
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
|
51
|
+
else "#{gemfile}.lock"
|
52
|
+
end
|
53
|
+
File.expand_path(lockfile)
|
54
|
+
end
|
55
|
+
|
56
|
+
def lockfile_version
|
57
|
+
return unless File.file?(lockfile)
|
58
|
+
lockfile_contents = File.read(lockfile)
|
59
|
+
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
+
Regexp.last_match(1)
|
61
|
+
end
|
62
|
+
|
63
|
+
def bundler_version
|
64
|
+
@bundler_version ||=
|
65
|
+
env_var_version || cli_arg_version ||
|
66
|
+
lockfile_version
|
67
|
+
end
|
68
|
+
|
69
|
+
def bundler_requirement
|
70
|
+
return "#{Gem::Requirement.default}.a" unless bundler_version
|
71
|
+
|
72
|
+
bundler_gem_version = Gem::Version.new(bundler_version)
|
73
|
+
|
74
|
+
requirement = bundler_gem_version.approximate_recommendation
|
75
|
+
|
76
|
+
return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
|
77
|
+
|
78
|
+
requirement += ".a" if bundler_gem_version.prerelease?
|
79
|
+
|
80
|
+
requirement
|
81
|
+
end
|
82
|
+
|
83
|
+
def load_bundler!
|
84
|
+
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
85
|
+
|
86
|
+
activate_bundler
|
87
|
+
end
|
88
|
+
|
89
|
+
def activate_bundler
|
90
|
+
gem_error = activation_error_handling do
|
91
|
+
gem "bundler", bundler_requirement
|
92
|
+
end
|
93
|
+
return if gem_error.nil?
|
94
|
+
require_error = activation_error_handling do
|
95
|
+
require "bundler/version"
|
96
|
+
end
|
97
|
+
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
98
|
+
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
99
|
+
exit 42
|
100
|
+
end
|
101
|
+
|
102
|
+
def activation_error_handling
|
103
|
+
yield
|
104
|
+
nil
|
105
|
+
rescue StandardError, LoadError => e
|
106
|
+
e
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
m.load_bundler!
|
111
|
+
|
112
|
+
if m.invoked_as_script?
|
113
|
+
load Gem.bin_path("bundler", "bundle")
|
114
|
+
end
|
@@ -11,7 +11,8 @@ module RelatonOmg
|
|
11
11
|
# @param hash [Hash]
|
12
12
|
# @return [RelatonOmg::OmgBibliographicItem]
|
13
13
|
def from_hash(hash)
|
14
|
-
|
14
|
+
bib_hash = RelatonOmg::HashConverter.hash_to_bib(hash)
|
15
|
+
new **bib_hash
|
15
16
|
end
|
16
17
|
|
17
18
|
# @param file [String] path to XML file
|
data/lib/relaton_omg/scrapper.rb
CHANGED
@@ -11,10 +11,10 @@ module RelatonOmg
|
|
11
11
|
|
12
12
|
url = URL_PATTERN + acronym
|
13
13
|
url += "/" + version if version
|
14
|
-
doc = Nokogiri::HTML
|
15
|
-
OmgBibliographicItem.new item(doc, acronym)
|
16
|
-
rescue OpenURI::HTTPError => e
|
17
|
-
if e.io.status[0] == "404"
|
14
|
+
doc = Nokogiri::HTML OpenURI.open_uri(URI(url))
|
15
|
+
OmgBibliographicItem.new **item(doc, acronym)
|
16
|
+
rescue OpenURI::HTTPError, URI::InvalidURIError => e
|
17
|
+
if e.is_a?(URI::InvalidURIError) || e.io.status[0] == "404"
|
18
18
|
warn %{[relaton-omg] no document found for "#{ref}" reference.}
|
19
19
|
return
|
20
20
|
end
|
@@ -60,7 +60,7 @@ module RelatonOmg
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def fetch_abstract(doc)
|
63
|
-
content = doc.at('//section[@id="document-metadata"]/p').text
|
63
|
+
content = doc.at('//section[@id="document-metadata"]/div/div/p').text
|
64
64
|
[{ content: content, language: "en", script: "Latn" }]
|
65
65
|
end
|
66
66
|
|
@@ -69,7 +69,7 @@ module RelatonOmg
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def version(doc)
|
72
|
-
doc.at('//dt[.="Version:"]/following-sibling::dd/p/
|
72
|
+
doc.at('//dt[.="Version:"]/following-sibling::dd/p/span').text
|
73
73
|
end
|
74
74
|
|
75
75
|
def fetch_date(doc)
|
data/lib/relaton_omg/version.rb
CHANGED
data/relaton_omg.gemspec
CHANGED
@@ -27,15 +27,14 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
spec.add_development_dependency "byebug"
|
30
|
-
spec.add_development_dependency "debase"
|
30
|
+
# spec.add_development_dependency "debase"
|
31
31
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
32
32
|
spec.add_development_dependency "pry-byebug"
|
33
|
-
spec.add_development_dependency "
|
34
|
-
spec.add_development_dependency "ruby-debug-ide"
|
33
|
+
# spec.add_development_dependency "ruby-debug-ide"
|
35
34
|
spec.add_development_dependency "ruby-jing"
|
36
35
|
spec.add_development_dependency "simplecov"
|
37
36
|
spec.add_development_dependency "vcr"
|
38
37
|
spec.add_development_dependency "webmock"
|
39
38
|
|
40
|
-
spec.add_dependency "relaton-bib", "~> 1.
|
39
|
+
spec.add_dependency "relaton-bib", "~> 1.7.0"
|
41
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-omg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.3
|
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-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: debase
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: equivalent-xml
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,34 +52,6 @@ dependencies:
|
|
66
52
|
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '10.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '10.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: ruby-debug-ide
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
55
|
- !ruby/object:Gem::Dependency
|
98
56
|
name: ruby-jing
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +114,14 @@ dependencies:
|
|
156
114
|
requirements:
|
157
115
|
- - "~>"
|
158
116
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
117
|
+
version: 1.7.0
|
160
118
|
type: :runtime
|
161
119
|
prerelease: false
|
162
120
|
version_requirements: !ruby/object:Gem::Requirement
|
163
121
|
requirements:
|
164
122
|
- - "~>"
|
165
123
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
124
|
+
version: 1.7.0
|
167
125
|
description: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
|
168
126
|
model'
|
169
127
|
email:
|
@@ -172,9 +130,7 @@ executables: []
|
|
172
130
|
extensions: []
|
173
131
|
extra_rdoc_files: []
|
174
132
|
files:
|
175
|
-
- ".github/workflows/
|
176
|
-
- ".github/workflows/ubuntu.yml"
|
177
|
-
- ".github/workflows/windows.yml"
|
133
|
+
- ".github/workflows/rake.yml"
|
178
134
|
- ".gitignore"
|
179
135
|
- ".rspec"
|
180
136
|
- ".rubocop.yml"
|
@@ -182,6 +138,7 @@ files:
|
|
182
138
|
- LICENSE.txt
|
183
139
|
- README.adoc
|
184
140
|
- Rakefile
|
141
|
+
- bin/bundle
|
185
142
|
- bin/console
|
186
143
|
- bin/rspec
|
187
144
|
- bin/setup
|
@@ -212,9 +169,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
212
169
|
version: 2.4.0
|
213
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
171
|
requirements:
|
215
|
-
- - "
|
172
|
+
- - ">="
|
216
173
|
- !ruby/object:Gem::Version
|
217
|
-
version:
|
174
|
+
version: '0'
|
218
175
|
requirements: []
|
219
176
|
rubygems_version: 3.0.6
|
220
177
|
signing_key:
|
data/.github/workflows/macos.yml
DELETED
@@ -1,34 +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
|
-
branches: [ '**' ]
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test-macos:
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} macOS
|
14
|
-
runs-on: macos-latest
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@master
|
21
|
-
- name: Use Ruby
|
22
|
-
uses: actions/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
architecture: 'x64'
|
26
|
-
- name: Update gems
|
27
|
-
run: |
|
28
|
-
sudo gem install bundler --force
|
29
|
-
ruby -v | grep 2.5 && bundle config set build.debase --with-cflags="-Wno-error=implicit-function-declaration"
|
30
|
-
ruby -v | grep 2.5 && bundle config set build.ruby-debug-ide --with-cflags="-Wno-error=implicit-function-declaration"
|
31
|
-
bundle install --jobs 4 --retry 3
|
32
|
-
- name: Run specs
|
33
|
-
run: |
|
34
|
-
bundle exec rake
|
@@ -1,33 +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
|
-
pull_request:
|
9
|
-
branches: [ '**' ]
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test-linux:
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} Ubuntu
|
14
|
-
runs-on: ubuntu-latest
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@master
|
21
|
-
- name: Use Ruby
|
22
|
-
uses: actions/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
architecture: 'x64'
|
26
|
-
- name: Update gems
|
27
|
-
run: |
|
28
|
-
gem install bundler
|
29
|
-
bundle install --jobs 4 --retry 3
|
30
|
-
- name: Run specs
|
31
|
-
run: |
|
32
|
-
unset JAVA_TOOL_OPTIONS
|
33
|
-
bundle exec rake
|
@@ -1,35 +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
|
-
branches: [ '**' ]
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
test-windows:
|
13
|
-
name: Test on Ruby ${{ matrix.ruby }} Windows
|
14
|
-
runs-on: windows-latest
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ '2.6', '2.5', '2.4' ]
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@master
|
21
|
-
- name: Use Ruby
|
22
|
-
uses: actions/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
25
|
-
architecture: 'x64'
|
26
|
-
- name: Update gems
|
27
|
-
shell: pwsh
|
28
|
-
run: |
|
29
|
-
gem install bundler
|
30
|
-
bundle config --local path vendor/bundle
|
31
|
-
bundle update
|
32
|
-
bundle install --jobs 4 --retry 3
|
33
|
-
- name: Run specs
|
34
|
-
run: |
|
35
|
-
bundle exec rake
|