relaton-bipm 1.7.0 → 1.7.1
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 +4 -4
- data/.github/workflows/rake.yml +46 -0
- data/README.adoc +153 -0
- data/lib/relaton_bipm/bipm_bibliographic_item.rb +1 -1
- data/lib/relaton_bipm/bipm_bibliography.rb +304 -23
- data/lib/relaton_bipm/hash_converter.rb +8 -8
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm/xml_parser.rb +1 -1
- data/relaton_bipm.gemspec +4 -2
- metadata +28 -30
- data/.github/workflows/macos.yml +0 -34
- data/.github/workflows/ubuntu.yml +0 -32
- data/.github/workflows/windows.yml +0 -35
- data/README.md +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4c652a640cdcb04816ae94cdd687b3f083cce7d93f8f9991b5175e4df8f12ef
|
4
|
+
data.tar.gz: 77eeadcdb4ac0a15b5ded03d25ee8c9c0fff368750bbedf228d97f2679db3a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3f6946a1f5896f90bb56dcbf79566a96c54ed1c5dce313995d6ab7de4de9875c7ff6458f8a7b53c810273d59fb4684ab8e1e789a974cbebe59704793ee8b6aa
|
7
|
+
data.tar.gz: e93576e6162aed338841e7c6ddbef08283616168e595218371dd2d842cfd154b73c0eb13d6f7d670676f956271c9beaf5f1def8ffdaa947fd5e86fbf78cf96df
|
@@ -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/README.adoc
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
= RelatonBipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem model
|
2
|
+
|
3
|
+
image:https://img.shields.io/gem/v/relaton-bipm.svg["Gem Version", link="https://rubygems.org/gems/relaton-bipm"]
|
4
|
+
image:https://github.com/relaton/relaton-bipm/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-bipm/actions?workflow=macos"]
|
5
|
+
image:https://github.com/relaton/relaton-bipm/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-bipm/actions?workflow=windows"]
|
6
|
+
image:https://github.com/relaton/relaton-bipm/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-bipm/actions?workflow=ubuntu"]
|
7
|
+
image:https://codeclimate.com/github/relaton/relaton-bipm/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bipm"]
|
8
|
+
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bipm.svg["Pull Requests", link="https://github.com/relaton/relaton-bipm/pulls"]
|
9
|
+
image:https://img.shields.io/github/commits-since/relaton/relaton-bipm/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bipm/releases"]
|
10
|
+
|
11
|
+
RelatonIec is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
|
12
|
+
|
13
|
+
You can use it to retrieve metadata of BIPM Standards from https://www.bipm.org, and access such metadata through the `BipmBibliographicItem` object.
|
14
|
+
|
15
|
+
== Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
[source,ruby]
|
20
|
+
----
|
21
|
+
gem 'relaton-bipm'
|
22
|
+
----
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle install
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install relaton-bipm
|
31
|
+
|
32
|
+
== Usage
|
33
|
+
|
34
|
+
=== Search for a standard using keywords
|
35
|
+
|
36
|
+
[source,ruby]
|
37
|
+
----
|
38
|
+
require 'relaton_bipm'
|
39
|
+
=> true
|
40
|
+
|
41
|
+
# get BIPM brochure
|
42
|
+
item = RelatonBipm::BipmBibliography.get "BIPM si-brochure"
|
43
|
+
[relaton-bipm] ("BIPM si-brochure") fetching...
|
44
|
+
[relaton-bipm] ("BIPM si-brochure") found si-brochure
|
45
|
+
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb83982fe8
|
46
|
+
...
|
47
|
+
|
48
|
+
# get BIPM Metrologia article
|
49
|
+
RelatonBipm::BipmBibliography.get "BIPM Metrologia 29 6 373"
|
50
|
+
[relaton-bipm] ("BIPM Metrologia 29 6 373") fetching...
|
51
|
+
[relaton-bipm] ("BIPM Metrologia 29 6 373") found Metrologia 29 6 373
|
52
|
+
=> #<RelatonBipm::BipmBibliographicItem:0x007f8857f94d40
|
53
|
+
...
|
54
|
+
----
|
55
|
+
|
56
|
+
=== XML serialization
|
57
|
+
|
58
|
+
[source,ruby]
|
59
|
+
----
|
60
|
+
item.to_xml
|
61
|
+
=> "<bibitem id="si-brochure" type="standard">
|
62
|
+
<fetched>2021-01-10</fetched>
|
63
|
+
<title format="text/plain" language="en" script="Latn">The International System of Units (SI)</title>
|
64
|
+
<title format="text/plain" language="fr" script="Latn">Le Système international d’unités (SI)</title>
|
65
|
+
<docidentifier type="BIPM">si-brochure</docidentifier>
|
66
|
+
<date type="updated">
|
67
|
+
<on>2019-05-20</on>
|
68
|
+
</date>
|
69
|
+
<edition>9</edition>
|
70
|
+
<abstract format="text/plain" language="en" script="Latn">The BIPM and the Metre Convention</abstract>
|
71
|
+
<abstract format="text/plain" language="fr" script="Latn">Le BIPM et la Convention du Mètre</abstract>
|
72
|
+
<copyright>
|
73
|
+
<from>2019</from>
|
74
|
+
<owner>
|
75
|
+
<organization>
|
76
|
+
<name>Bureau International des ponds et mesures</name>
|
77
|
+
<abbreviation>BIPM</abbreviation>
|
78
|
+
</organization>
|
79
|
+
</owner>
|
80
|
+
</copyright>
|
81
|
+
</bibitem>"
|
82
|
+
----
|
83
|
+
|
84
|
+
With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and adds flavour `ext` element.
|
85
|
+
|
86
|
+
[source,ruby]
|
87
|
+
----
|
88
|
+
item.to_xml bibdata: true
|
89
|
+
=> "<bibdata type="standard">
|
90
|
+
<fetched>2021-01-10</fetched>
|
91
|
+
<title format="text/plain" language="en" script="Latn">The International System of Units (SI)</title>
|
92
|
+
<title format="text/plain" language="fr" script="Latn">Le Système international d’unités (SI)</title>
|
93
|
+
<docidentifier type="BIPM">si-brochure</docidentifier>
|
94
|
+
<date type="updated">
|
95
|
+
<on>2019-05-20</on>
|
96
|
+
</date>
|
97
|
+
<edition>9</edition>
|
98
|
+
<abstract format="text/plain" language="en" script="Latn">The BIPM and the Metre Convention</abstract>
|
99
|
+
<abstract format="text/plain" language="fr" script="Latn">Le BIPM et la Convention du Mètre</abstract>
|
100
|
+
<copyright>
|
101
|
+
<from>2019</from>
|
102
|
+
<owner>
|
103
|
+
<organization>
|
104
|
+
<name>Bureau International des ponds et mesures</name>
|
105
|
+
<abbreviation>BIPM</abbreviation>
|
106
|
+
</organization>
|
107
|
+
</owner>
|
108
|
+
</copyright>
|
109
|
+
<ext>
|
110
|
+
<doctype>brochure</doctype>
|
111
|
+
</ext>
|
112
|
+
</bibdata>"
|
113
|
+
----
|
114
|
+
|
115
|
+
=== Create bibliographic item from XML
|
116
|
+
|
117
|
+
[source,ruby]
|
118
|
+
----
|
119
|
+
RelatonBipm::XMLParser.from_xml File.read('spec/fixtures/bipm_item.xml')
|
120
|
+
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb83827a90
|
121
|
+
...
|
122
|
+
----
|
123
|
+
|
124
|
+
=== Create bibliographic item from YAML
|
125
|
+
[source,ruby]
|
126
|
+
----
|
127
|
+
hash = YAML.load_file 'spec/fixtures/bipm_item.yml'
|
128
|
+
=> {"id"=>"Draft-Agenda-NMI-Dir-Meeting-2017-v10",
|
129
|
+
...
|
130
|
+
|
131
|
+
bib_hash = RelatonBipm::HashConverter.hash_to_bib hash
|
132
|
+
=> {:id=>"Draft-Agenda-NMI-Dir-Meeting-2017-v10",
|
133
|
+
...
|
134
|
+
|
135
|
+
RelatonBipm::BipmBibliographicItem.new bib_hash
|
136
|
+
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb668755a0
|
137
|
+
...
|
138
|
+
----
|
139
|
+
|
140
|
+
== Development
|
141
|
+
|
142
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
143
|
+
|
144
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
145
|
+
|
146
|
+
== Contributing
|
147
|
+
|
148
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-bipm.
|
149
|
+
|
150
|
+
|
151
|
+
== License
|
152
|
+
|
153
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
@@ -27,7 +27,7 @@ module RelatonBipm
|
|
27
27
|
# @param structuredidentifier [RelatonBipm::StructuredIdentifier]
|
28
28
|
def initialize(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
29
29
|
if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage.value)
|
30
|
-
warn "[relaton-bipm] Warning: invalid docstatus: #{args[:docstatus]}. "\
|
30
|
+
warn "[relaton-bipm] Warning: invalid docstatus: #{args[:docstatus].stage.value}. "\
|
31
31
|
"It should be one of: #{STATUSES}"
|
32
32
|
end
|
33
33
|
|
@@ -1,39 +1,320 @@
|
|
1
|
-
require "
|
1
|
+
require "mechanize"
|
2
2
|
|
3
3
|
module RelatonBipm
|
4
4
|
class BipmBibliography
|
5
|
-
|
6
|
-
|
5
|
+
GH_ENDPOINT = "https://raw.githubusercontent.com/relaton/relaton-data-bipm/master/data/".freeze
|
6
|
+
IOP_DOMAIN = "https://iopscience.iop.org".freeze
|
7
|
+
USERAGENTS = [
|
8
|
+
"Mozilla/5.0 CK={} (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
9
|
+
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
|
10
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",
|
11
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)",
|
12
|
+
"Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
13
|
+
"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; KTXN)",
|
14
|
+
"Mozilla/5.0 (Windows NT 5.1; rv:7.0.1) Gecko/20100101 Firefox/7.0.1",
|
15
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
|
16
|
+
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0",
|
17
|
+
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1",
|
18
|
+
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36",
|
19
|
+
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)",
|
20
|
+
"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
|
21
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko)",
|
22
|
+
"Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
23
|
+
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",
|
24
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
|
25
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko)",
|
26
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)",
|
27
|
+
"Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko",
|
28
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)",
|
29
|
+
"Mozilla/5.0 (Linux; U; Android 2.2) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
|
30
|
+
"Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36",
|
31
|
+
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1",
|
32
|
+
"Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1)",
|
33
|
+
].freeze
|
7
34
|
|
8
35
|
class << self
|
9
36
|
# @param text [String]
|
10
37
|
# @return [RelatonBipm::BipmBibliographicItem]
|
11
|
-
def search(text, _year = nil, _opts = {})
|
38
|
+
def search(text, _year = nil, _opts = {})
|
12
39
|
warn "[relaton-bipm] (\"#{text}\") fetching..."
|
13
|
-
ref = text.sub(/^BIPM\s/, "")
|
14
|
-
|
15
|
-
|
16
|
-
return unless resp.code == "200"
|
40
|
+
ref = text.sub(/^BIPM\s/, "")
|
41
|
+
item = ref.match?(/^Metrologia/i) ? get_metrologia(ref, magent) : get_bipm(ref, magent)
|
42
|
+
return unless item
|
17
43
|
|
18
|
-
|
19
|
-
item = BipmBibliographicItem.new hash
|
20
|
-
warn "[relaton-bipm] (\"#{text}\") found #{item.docidentifier.first.id}"
|
44
|
+
warn("[relaton-bipm] (\"#{text}\") found #{item.docidentifier[0].id}")
|
21
45
|
item
|
22
|
-
rescue
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
46
|
+
rescue Mechanize::ResponseCodeError => e
|
47
|
+
raise RelatonBib::RequestError, e.message unless e.response_code == "404"
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [Mechanize]
|
51
|
+
def magent
|
52
|
+
a = Mechanize.new
|
53
|
+
a.request_headers = {
|
54
|
+
"Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,"\
|
55
|
+
"*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
56
|
+
"Accept-Encoding" => "gzip, deflate, br",
|
57
|
+
"Accept-Language" => "en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7",
|
58
|
+
"Cache-Control" => "max-age=0",
|
59
|
+
"Upgrade-Insecure-Requests" => "1",
|
60
|
+
"User-Agent" => USERAGENTS.shuffle.first,
|
61
|
+
}
|
62
|
+
a
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param ref [String]
|
66
|
+
# @param agent [Mechanize]
|
67
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
68
|
+
def get_bipm(ref, agent)
|
69
|
+
url = "#{GH_ENDPOINT}#{ref.downcase.split(' ').join '-'}.yaml"
|
70
|
+
resp = agent.get url
|
71
|
+
return unless resp.code == "200"
|
72
|
+
|
73
|
+
bib_hash = HashConverter.hash_to_bib YAML.safe_load(resp.body, [Date])
|
74
|
+
BipmBibliographicItem.new **bib_hash
|
75
|
+
end
|
76
|
+
|
77
|
+
# @param ref [String]
|
78
|
+
# @param agent [Mechanize]
|
79
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
80
|
+
def get_metrologia(ref, agent)
|
81
|
+
agent.redirect_ok = false
|
82
|
+
ref_arr = ref.split(" ")
|
83
|
+
case ref_arr.size
|
84
|
+
when 1 then get_journal agent
|
85
|
+
when 2 then get_volume ref_arr[1], agent
|
86
|
+
when 3 then get_issue(*ref_arr[1..2], agent)
|
87
|
+
when 4 then get_article_from_issue(*ref_arr[1..3], agent)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# @param agent [Mechanize]
|
92
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
93
|
+
def get_journal(agent)
|
94
|
+
url = IOP_DOMAIN + "/journal/0026-1394"
|
95
|
+
rsp = agent.get url
|
96
|
+
rel = rsp.xpath('//select[@id="allVolumesSelector"]/option').map do |v|
|
97
|
+
{ type: "partOf", bibitem: journal_rel(v) }
|
98
|
+
end
|
99
|
+
did = doc_id []
|
100
|
+
bibitem(formattedref: fref(did.id), docid: [did], link: blink(url), relation: rel)
|
101
|
+
end
|
102
|
+
|
103
|
+
# @param elm [Nokogiri::XML::Element]
|
104
|
+
def journal_rel(elm)
|
105
|
+
vol = elm[:value].split("/").last
|
106
|
+
did = doc_id [vol]
|
107
|
+
url = IOP_DOMAIN + elm[:value]
|
108
|
+
BipmBibliographicItem.new(formattedref: fref(did.id), docid: [did], link: blink(url))
|
109
|
+
end
|
110
|
+
|
111
|
+
# @param vol [String]
|
112
|
+
# @param agent [Mechanize]
|
113
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
114
|
+
def get_volume(vol, agent)
|
115
|
+
url = "#{IOP_DOMAIN}/volume/0026-1394/#{vol}"
|
116
|
+
rsp = agent.get url
|
117
|
+
rel = rsp.xpath('//li[@itemprop="hasPart"]').map do |i|
|
118
|
+
{ type: "partOf", bibitem: volume_rel(i, vol) }
|
119
|
+
end
|
120
|
+
did = doc_id [vol]
|
121
|
+
bibitem(formattedref: fref(did.id), docid: [did], link: blink(url), date: bdate(rsp), relation: rel,
|
122
|
+
extent: btextent(vol), series: series)
|
123
|
+
end
|
124
|
+
|
125
|
+
def volume_rel(elm, vol) # rubocop:disable Metrics/AbcSize
|
126
|
+
a = elm.at 'a[@itemprop="issueNumber"]'
|
127
|
+
ish = a[:href].split("/").last
|
128
|
+
url = IOP_DOMAIN + a[:href]
|
129
|
+
docid = doc_id [vol, ish]
|
130
|
+
t = elm.at "p"
|
131
|
+
title_fref = t ? { title: titles(t.text) } : { formattedref: fref(docid.id) }
|
132
|
+
BipmBibliographicItem.new **title_fref, docid: [docid], link: blink(url)
|
133
|
+
end
|
134
|
+
|
135
|
+
# @param title [String]
|
136
|
+
# @return [RelatonBib::TypedTitleStringCollection]
|
137
|
+
def titles(title)
|
138
|
+
RelatonBib::TypedTitleString.from_string title, "en", "Latn"
|
139
|
+
end
|
140
|
+
|
141
|
+
# @param vol [String]
|
142
|
+
# @param ish [String]
|
143
|
+
# @param agent [Mechanize]
|
144
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
145
|
+
def get_issue(vol, ish, agent) # rubocop:disable Metrics/AbcSize
|
146
|
+
url = issue_url vol, ish
|
147
|
+
rsp = agent.get url
|
148
|
+
rel = rsp.xpath('//div[@class="art-list-item-body"]').map do |a|
|
149
|
+
{ type: "partOf", bibitem: issue_rel(a, vol, ish) }
|
150
|
+
end
|
151
|
+
did = doc_id [vol, ish]
|
152
|
+
title_fref = { title: issue_title(rsp) }
|
153
|
+
title_fref[:formattedref] = fref did.id unless title_fref[:title].any?
|
154
|
+
bibitem(**title_fref, link: blink(url), relation: rel, docid: [did],
|
155
|
+
date: bdate(rsp), extent: btextent(vol, ish), series: series)
|
156
|
+
end
|
157
|
+
|
158
|
+
# @param ref [String]
|
159
|
+
# @return [RelatonBib::FormattedRef]
|
160
|
+
def fref(ref)
|
161
|
+
RelatonBib::FormattedRef.new content: ref, language: "en", script: "Latn"
|
162
|
+
end
|
163
|
+
|
164
|
+
# @param rsp [Mechanize::Page]
|
165
|
+
# @return [RelatonBib::TypedTitleStringCollection]
|
166
|
+
def issue_title(rsp)
|
167
|
+
t = rsp.at('//div[@id="wd-jnl-issue-title"]/h4')
|
168
|
+
return RelatonBib::TypedTitleStringCollection.new [] unless t
|
169
|
+
|
170
|
+
titles(t.text)
|
171
|
+
end
|
172
|
+
|
173
|
+
# @oaran vol [String]
|
174
|
+
# @param ish [String]
|
175
|
+
# @return [String]
|
176
|
+
def issue_url(vol, ish)
|
177
|
+
"#{IOP_DOMAIN}/issue/0026-1394/#{vol}/#{ish}"
|
178
|
+
end
|
179
|
+
|
180
|
+
# @param elm [Nokogiri::XML::Element]
|
181
|
+
# @param vol [String]
|
182
|
+
# @param ish [String]
|
183
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
184
|
+
def issue_rel(elm, vol, ish)
|
185
|
+
art = elm.at('div[@class="indexer"]').text
|
186
|
+
ref = elm.at('div/a[@class="art-list-item-title"]')
|
187
|
+
title = titles ref.text.strip
|
188
|
+
docid = doc_id [vol, ish, art]
|
189
|
+
link = blink IOP_DOMAIN + ref[:href]
|
190
|
+
BipmBibliographicItem.new(title: title, docid: [docid], link: link)
|
191
|
+
end
|
192
|
+
|
193
|
+
# @param content [RelatonBib::TypedTitleString]
|
194
|
+
# @return [RelatonBib::TypedTitleString]
|
195
|
+
def btitle(content)
|
196
|
+
RelatonBib::TypedTitleString.new type: "main", content: content, language: "en", script: "Latn"
|
197
|
+
end
|
198
|
+
|
199
|
+
# @param url [String]
|
200
|
+
# @return [String]
|
201
|
+
def blink(url)
|
202
|
+
[RelatonBib::TypedUri.new(type: "src", content: url)]
|
203
|
+
end
|
204
|
+
|
205
|
+
# @param rsp [Mechanize::Page]
|
206
|
+
# @return [Array<RelatonBib::BibliographicDate>]
|
207
|
+
def bdate(rsp)
|
208
|
+
date = rsp.at('//p[@itemprop="issueNumber"]|//h2[@itemprop="volumeNumber"]').text.split(", ").last
|
209
|
+
on = date.match?(/^\d{4}$/) ? date : Date.parse(date).strftime("%Y-%m")
|
210
|
+
[RelatonBib::BibliographicDate.new(type: "published", on: on)]
|
211
|
+
end
|
212
|
+
|
213
|
+
# @param args [Array<String>]
|
214
|
+
# @return [RelatonBib::DocumentIdentifier]
|
215
|
+
def doc_id(args)
|
216
|
+
id = args.clone.unshift "Metrologia"
|
217
|
+
RelatonBib::DocumentIdentifier.new(type: "BIPM", id: id.join(" "))
|
218
|
+
end
|
219
|
+
|
220
|
+
# @param vol [String]
|
221
|
+
# @param ish [String]
|
222
|
+
# @param art [String]
|
223
|
+
# @param agent [Mechanize]
|
224
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
225
|
+
def get_article_from_issue(vol, ish, art, agent)
|
226
|
+
url = issue_url vol, ish
|
227
|
+
rsp = agent.get url
|
228
|
+
get_article rsp.at("//div[@class='indexer'][.='#{art}']/../div/a")[:href], vol, ish, agent
|
229
|
+
end
|
230
|
+
|
231
|
+
# @param path [String]
|
232
|
+
# @param vol [String]
|
233
|
+
# @param ish [String]
|
234
|
+
# @param agent [Mechanize]
|
235
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
236
|
+
def get_article(path, vol, ish, agent) # rubocop:disable Metrics/AbcSize
|
237
|
+
url = URI IOP_DOMAIN + path
|
238
|
+
rsp = agent.get url
|
239
|
+
bib = rsp.link_with(text: "BibTeX").href
|
240
|
+
rsp = agent.get URI IOP_DOMAIN + bib
|
241
|
+
bt = BibTeX.parse(rsp.body).first
|
242
|
+
bibitem(docid: btdocid(bt), title: titles(bt.title.to_s), abstract: btabstract(bt), doctype: bt.type.to_s,
|
243
|
+
link: btlink(bt, url), date: btdate(bt), contributor: btcontrib(bt), series: series,
|
244
|
+
extent: btextent(vol, ish, bt))
|
245
|
+
end
|
246
|
+
|
247
|
+
# @param args [Hash]
|
248
|
+
# @return [RelatonBipm::BipmBibliographicItem]
|
249
|
+
def bibitem(**args)
|
250
|
+
BipmBibliographicItem.new(
|
251
|
+
fetched: Date.today.to_s, type: "standard", language: ["en"], script: ["Latn"], **args
|
252
|
+
)
|
253
|
+
end
|
254
|
+
|
255
|
+
# @return [Array<RelatonBib::Series>]
|
256
|
+
def series
|
257
|
+
[RelatonBib::Series.new(title: btitle("Metrologia"))]
|
258
|
+
end
|
259
|
+
|
260
|
+
# @param bibtex [BibTeX::Entry]
|
261
|
+
# @return [Array<RelatonBib::DocumentIdentifier>]
|
262
|
+
def btdocid(bibtex)
|
263
|
+
id = "#{bibtex.journal} #{bibtex.volume} #{bibtex.number} #{bibtex.pages.match(/^\d+/)}"
|
264
|
+
[RelatonBib::DocumentIdentifier.new(type: "BIPM", id: id)]
|
265
|
+
end
|
266
|
+
|
267
|
+
# @param bibtex [BibTeX::Entry]
|
268
|
+
# @return [Array<RelatonBib::FormattedString>]
|
269
|
+
def btabstract(bibtex)
|
270
|
+
[RelatonBib::FormattedString.new(content: bibtex.abstract.to_s, language: "en", script: "Latn")]
|
271
|
+
end
|
272
|
+
|
273
|
+
# @param bibtex [BibTeX::Entry]
|
274
|
+
# @param ref [URI]
|
275
|
+
# @return [Array<RelatonBib::TypedUri>]
|
276
|
+
def btlink(bibtex, ref)
|
277
|
+
[
|
278
|
+
RelatonBib::TypedUri.new(type: "src", content: ref.to_s),
|
279
|
+
RelatonBib::TypedUri.new(type: "doi", content: bibtex.url.to_s),
|
280
|
+
]
|
281
|
+
end
|
282
|
+
|
283
|
+
# @param bibtex [BibTeX::Entry]
|
284
|
+
# @return [Array<RelatonBib::BibliographicDate>]
|
285
|
+
def btdate(bibtex)
|
286
|
+
on = Date.new(bibtex.year.to_i, bibtex.month_numeric)
|
287
|
+
[RelatonBib::BibliographicDate.new(type: "published", on: on)]
|
288
|
+
end
|
289
|
+
|
290
|
+
# @param bibtex [BibTeX::Entry]
|
291
|
+
# @return [Array<Hash>]
|
292
|
+
def btcontrib(bibtex)
|
293
|
+
surname, initial = bibtex.author.split ", "
|
294
|
+
initial = initial.split(" ").map { |i| RelatonBib::LocalizedString.new i, "en", "Latn" }
|
295
|
+
surname = RelatonBib::LocalizedString.new surname, "en", "Latn"
|
296
|
+
name = RelatonBib::FullName.new surname: surname, initial: initial
|
297
|
+
author = RelatonBib::Person.new name: name
|
298
|
+
[
|
299
|
+
{ entity: { name: bibtex.publisher.to_s }, role: [{ type: "publisher" }] },
|
300
|
+
{ entity: author, role: [{ type: "author" }] },
|
301
|
+
]
|
302
|
+
end
|
303
|
+
|
304
|
+
# @param vol [String]
|
305
|
+
# @param ish [String]
|
306
|
+
# @param bibtex [BibTeX::Entry]
|
307
|
+
# @return [Array<RelatonBib::BibItemLocality>]
|
308
|
+
def btextent(vol, ish = nil, bibtex = nil)
|
309
|
+
ext = [RelatonBib::BibItemLocality.new("volume", vol)]
|
310
|
+
ext << RelatonBib::BibItemLocality.new("issue", ish) if ish
|
311
|
+
ext << RelatonBib::BibItemLocality.new("page", *bibtex.pages.split("--")) if bibtex
|
312
|
+
ext
|
27
313
|
end
|
28
314
|
|
29
315
|
# @param ref [String] the BIPM standard Code to look up (e..g "BIPM B-11")
|
30
|
-
# @param year [String]
|
31
|
-
#
|
32
|
-
# @param opts [Hash] options
|
33
|
-
# @option opts [TrueClass, FalseClass] :all_parts restricted to all parts
|
34
|
-
# if all-parts reference is required
|
35
|
-
# @option opts [TrueClass, FalseClass] :bibdata
|
36
|
-
#
|
316
|
+
# @param year [String] not used
|
317
|
+
# @param opts [Hash] not used
|
37
318
|
# @return [RelatonBipm::BipmBibliographicItem]
|
38
319
|
def get(ref, year = nil, opts = {})
|
39
320
|
search(ref, year, opts)
|
@@ -23,7 +23,7 @@ module RelatonBipm
|
|
23
23
|
# @param item_hash [Hash]
|
24
24
|
# @return [RelatonBib::BibliographicItem]
|
25
25
|
def bib_item(item_hash)
|
26
|
-
BipmBibliographicItem.new item_hash
|
26
|
+
BipmBibliographicItem.new **item_hash
|
27
27
|
end
|
28
28
|
|
29
29
|
# @param ret [Hash]
|
@@ -32,7 +32,7 @@ module RelatonBipm
|
|
32
32
|
RelatonBib::TypedTitleStringCollection.new
|
33
33
|
) do |m, t|
|
34
34
|
m << if t.is_a? Hash
|
35
|
-
RelatonBib::TypedTitleString.new(t)
|
35
|
+
RelatonBib::TypedTitleString.new(**t)
|
36
36
|
else
|
37
37
|
RelatonBib::TypedTitleString.new(content: t)
|
38
38
|
end
|
@@ -41,7 +41,7 @@ module RelatonBipm
|
|
41
41
|
|
42
42
|
# @param ret [Hash]
|
43
43
|
def commentperiod_hash_to_bib(ret)
|
44
|
-
ret[:comment_period] &&= CommentPeriond.new(ret[:comment_period])
|
44
|
+
ret[:comment_period] &&= CommentPeriond.new(**ret[:comment_period])
|
45
45
|
end
|
46
46
|
|
47
47
|
# @param ret [Hash]
|
@@ -56,7 +56,7 @@ module RelatonBipm
|
|
56
56
|
def dates_hash_to_bib(ret)
|
57
57
|
super
|
58
58
|
ret[:date] &&= ret[:date].map do |d|
|
59
|
-
BibliographicDate.new d
|
59
|
+
BibliographicDate.new **d
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -64,12 +64,12 @@ module RelatonBipm
|
|
64
64
|
def relations_hash_to_bib(ret)
|
65
65
|
super
|
66
66
|
ret[:relation] &&= ret[:relation].map do |r|
|
67
|
-
RelatonBipm::DocumentRelation.new r
|
67
|
+
RelatonBipm::DocumentRelation.new **r
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
# @param ret [Hash]
|
72
|
-
def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize
|
72
|
+
def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
73
73
|
return unless ret[:editorialgroup]
|
74
74
|
|
75
75
|
cmt = ret[:editorialgroup][:committee].map do |c|
|
@@ -77,11 +77,11 @@ module RelatonBipm
|
|
77
77
|
content = RelatonBib::LocalizedString.new vars
|
78
78
|
Committee.new acronym: c[:acronym], content: content
|
79
79
|
else
|
80
|
-
Committee.new c
|
80
|
+
Committee.new **c
|
81
81
|
end
|
82
82
|
end
|
83
83
|
wg = array(ret[:editorialgroup][:workgroup]).map do |w|
|
84
|
-
w.is_a?(Hash) ? WorkGroup.new(w) : WorkGroup.new(content: w)
|
84
|
+
w.is_a?(Hash) ? WorkGroup.new(**w) : WorkGroup.new(content: w)
|
85
85
|
end
|
86
86
|
ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
|
87
87
|
end
|
data/lib/relaton_bipm/version.rb
CHANGED
data/relaton_bipm.gemspec
CHANGED
@@ -33,15 +33,17 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
35
|
spec.add_development_dependency "byebug"
|
36
|
-
spec.add_development_dependency "debase"
|
36
|
+
# spec.add_development_dependency "debase"
|
37
37
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
38
38
|
spec.add_development_dependency "pry-byebug"
|
39
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
-
spec.add_development_dependency "ruby-debug-ide"
|
40
|
+
# spec.add_development_dependency "ruby-debug-ide"
|
41
41
|
spec.add_development_dependency "ruby-jing"
|
42
42
|
spec.add_development_dependency "simplecov"
|
43
43
|
spec.add_development_dependency "vcr"
|
44
44
|
spec.add_development_dependency "webmock"
|
45
45
|
|
46
|
+
spec.add_dependency "mechanize", "~> 2.7.6"
|
46
47
|
spec.add_dependency "relaton-bib", "~> 1.7.0"
|
48
|
+
spec.add_dependency "serrano", "~> 1.0"
|
47
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bipm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.1
|
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-03-18 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
|
@@ -81,7 +67,7 @@ dependencies:
|
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '10.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: ruby-
|
70
|
+
name: ruby-jing
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - ">="
|
@@ -95,7 +81,7 @@ dependencies:
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: simplecov
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - ">="
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: vcr
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -123,7 +109,7 @@ dependencies:
|
|
123
109
|
- !ruby/object:Gem::Version
|
124
110
|
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: webmock
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -137,19 +123,19 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: mechanize
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
|
-
- - "
|
129
|
+
- - "~>"
|
144
130
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
146
|
-
type: :
|
131
|
+
version: 2.7.6
|
132
|
+
type: :runtime
|
147
133
|
prerelease: false
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
149
135
|
requirements:
|
150
|
-
- - "
|
136
|
+
- - "~>"
|
151
137
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
138
|
+
version: 2.7.6
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: relaton-bib
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +150,20 @@ dependencies:
|
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
152
|
version: 1.7.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: serrano
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.0'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.0'
|
167
167
|
description: 'RelatonBipm: retrieve BIPM Standards for bibliographic use using the
|
168
168
|
BibliographicItem model'
|
169
169
|
email:
|
@@ -172,15 +172,13 @@ executables: []
|
|
172
172
|
extensions: []
|
173
173
|
extra_rdoc_files: []
|
174
174
|
files:
|
175
|
-
- ".github/workflows/
|
176
|
-
- ".github/workflows/ubuntu.yml"
|
177
|
-
- ".github/workflows/windows.yml"
|
175
|
+
- ".github/workflows/rake.yml"
|
178
176
|
- ".gitignore"
|
179
177
|
- ".rspec"
|
180
178
|
- ".rubocop.yml"
|
181
179
|
- Gemfile
|
182
180
|
- LICENSE.txt
|
183
|
-
- README.
|
181
|
+
- README.adoc
|
184
182
|
- Rakefile
|
185
183
|
- bin/console
|
186
184
|
- bin/rspec
|
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,32 +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
|
-
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
|
data/README.md
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# RelatonBipm
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/relaton_bipm`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'relaton-bipm'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install relaton-bipm
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/relaton_bipm.
|
36
|
-
|
37
|
-
|
38
|
-
## License
|
39
|
-
|
40
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|