bolognese 1.7.3 → 1.8
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/Gemfile.lock +2 -2
- data/lib/bolognese/metadata.rb +11 -10
- data/lib/bolognese/version.rb +1 -1
- data/spec/metadata_spec.rb +1 -1
- data/spec/readers/datacite_json_reader_spec.rb +1 -1
- data/spec/readers/datacite_reader_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db42ab310128e14958777f979522287564747fcd8888350b05d0c1447f3b322
|
4
|
+
data.tar.gz: 1595844b30af956ab7c1d778b0c1ee13b8fa7bbfdb44d64c96360d1ab6e55262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28f7e14d5536470ff45df9d47705fecf70ca29c11ad5e77af7842f38614e664d6bc4b6989c3b5018c3cff64d649ceef1426736d99abb44b5b2f3bf400d04a41
|
7
|
+
data.tar.gz: 4eb706157bf726ab4c56282f8826b467414a1bb25df6aae29e7a4eab2780573a5c24406d82ed3ebf00c326a1df28cdc8036a8680001bac02e1a2e021e4b0613e
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (1.
|
4
|
+
bolognese (1.8)
|
5
5
|
activesupport (>= 4.2.5)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (>= 5.1.0)
|
@@ -119,7 +119,7 @@ GEM
|
|
119
119
|
namae (1.0.1)
|
120
120
|
nokogiri (1.10.10)
|
121
121
|
mini_portile2 (~> 2.4.0)
|
122
|
-
oj (3.10.
|
122
|
+
oj (3.10.7)
|
123
123
|
oj_mimic_json (1.0.1)
|
124
124
|
optimist (3.0.1)
|
125
125
|
postrank-uri (1.0.24)
|
data/lib/bolognese/metadata.rb
CHANGED
@@ -15,12 +15,13 @@ module Bolognese
|
|
15
15
|
:format, :funding_references, :state, :geo_locations,
|
16
16
|
:types, :content_url, :related_identifiers, :style, :locale, :date_registered
|
17
17
|
|
18
|
-
def initialize(
|
19
|
-
|
18
|
+
def initialize(options={})
|
19
|
+
options.symbolize_keys!
|
20
|
+
id = normalize_id(options[:input], options)
|
20
21
|
ra = nil
|
21
22
|
|
22
23
|
if id.present?
|
23
|
-
@from = from || find_from_format(id: id)
|
24
|
+
@from = options[:from] || find_from_format(id: id)
|
24
25
|
|
25
26
|
# mEDRA, KISTI, JaLC and OP DOIs are found in the Crossref index
|
26
27
|
if @from == "medra"
|
@@ -37,9 +38,9 @@ module Bolognese
|
|
37
38
|
hsh = @from.present? ? send("get_" + @from, id: id, sandbox: options[:sandbox]) : {}
|
38
39
|
string = hsh.fetch("string", nil)
|
39
40
|
|
40
|
-
elsif input.present? && File.exist?(input)
|
41
|
-
filename = File.basename(input)
|
42
|
-
ext = File.extname(input)
|
41
|
+
elsif options[:input].present? && File.exist?(options[:input])
|
42
|
+
filename = File.basename(options[:input])
|
43
|
+
ext = File.extname(options[:input])
|
43
44
|
if %w(.bib .ris .xml .json).include?(ext)
|
44
45
|
hsh = {
|
45
46
|
"url" => options[:url],
|
@@ -49,8 +50,8 @@ module Bolognese
|
|
49
50
|
"provider_id" => options[:provider_id],
|
50
51
|
"client_id" => options[:client_id],
|
51
52
|
"content_url" => options[:content_url] }
|
52
|
-
string = IO.read(input)
|
53
|
-
@from = from || find_from_format(string: string, filename: filename, ext: ext)
|
53
|
+
string = IO.read(options[:input])
|
54
|
+
@from = options[:from] || find_from_format(string: string, filename: filename, ext: ext)
|
54
55
|
else
|
55
56
|
$stderr.puts "File type #{ext} not supported"
|
56
57
|
exit 1
|
@@ -69,8 +70,8 @@ module Bolognese
|
|
69
70
|
"titles" => options[:titles],
|
70
71
|
"publisher" => options[:publisher],
|
71
72
|
"publication_year" => options[:publication_year] }
|
72
|
-
string = input
|
73
|
-
@from = from || find_from_format(string: string)
|
73
|
+
string = options[:input]
|
74
|
+
@from = options[:from] || find_from_format(string: string)
|
74
75
|
end
|
75
76
|
|
76
77
|
# make sure input is encoded as utf8
|
data/lib/bolognese/version.rb
CHANGED
data/spec/metadata_spec.rb
CHANGED
@@ -153,7 +153,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
153
153
|
it "missing_comma" do
|
154
154
|
json = IO.read(fixture_path + "datacite_software_missing_comma.json")
|
155
155
|
response = subject.jsonlint(json)
|
156
|
-
expect(response).to eq(["expected comma, not a string (doi) at line 4, column 11 [parse.c:373]"])
|
156
|
+
expect(response).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"])
|
157
157
|
end
|
158
158
|
|
159
159
|
it "overlapping_keys" do
|
@@ -46,7 +46,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
46
46
|
input = fixture_path + "datacite_software_missing_comma.json"
|
47
47
|
subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true)
|
48
48
|
expect(subject.valid?).to be false
|
49
|
-
expect(subject.errors).to eq(["expected comma, not a string (doi) at line 4, column 11 [parse.c:373]"])
|
49
|
+
expect(subject.errors).to eq(["expected comma, not a string (after doi) at line 4, column 11 [parse.c:373]"])
|
50
50
|
expect(subject.codemeta).to be_nil
|
51
51
|
end
|
52
52
|
|
@@ -340,7 +340,8 @@ describe Bolognese::Metadata, vcr: true do
|
|
340
340
|
"funderIdentifier"=>"https://doi.org/10.13039/501100000780",
|
341
341
|
"funderIdentifierType"=>"Crossref Funder ID",
|
342
342
|
"funderName"=>"European Commission"}],
|
343
|
-
types: { "resourceTypeGeneral" => "Dataset", "schemaOrg" => "Dataset" }
|
343
|
+
types: { "resourceTypeGeneral" => "Dataset", "schemaOrg" => "Dataset" },
|
344
|
+
"identifiers" => [{ "identifierType"=>"Repository ID", "identifier"=>"123" }])
|
344
345
|
|
345
346
|
expect(subject.valid?).to be true
|
346
347
|
expect(subject.doi).to eq("10.5281/zenodo.1239")
|
@@ -359,6 +360,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
359
360
|
"funderIdentifier"=>"https://doi.org/10.13039/501100000780",
|
360
361
|
"funderIdentifierType"=>"Crossref Funder ID",
|
361
362
|
"funderName"=>"European Commission"}])
|
363
|
+
expect(subject.identifiers).to eq([{"identifier"=>"123", "identifierType"=>"Repository ID"}])
|
362
364
|
expect(subject.agency).to eq("DataCite")
|
363
365
|
expect(subject.schema_version).to eq("http://datacite.org/schema/kernel-4")
|
364
366
|
expect(subject.state).to eq("findable")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.8'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|