bolognese 1.3.19 → 1.3.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -27
- data/lib/bolognese/author_utils.rb +3 -0
- data/lib/bolognese/cli.rb +6 -4
- data/lib/bolognese/metadata.rb +1 -1
- data/lib/bolognese/metadata_utils.rb +2 -0
- data/lib/bolognese/readers/npm_reader.rb +106 -0
- data/lib/bolognese/version.rb +1 -1
- data/lib/bolognese/writers/codemeta_writer.rb +1 -1
- data/spec/cli_spec.rb +7 -1
- data/spec/fixtures/cgimp_package.json +18 -0
- data/spec/fixtures/cit_package.json +19 -0
- data/spec/fixtures/edam_package.json +12 -0
- data/spec/readers/datacite_json_reader_spec.rb +2 -2
- data/spec/readers/npm_reader_spec.rb +66 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2386c22e800464e8a91916067a08a205859d4f7a2adbc7ffa4d7c3082ea7b23
|
4
|
+
data.tar.gz: 95ee5f47012025a176d2c4eda3230f2dfc1c847544c8e953c1dfd2e0e074e779
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15c0cc56f0ce1a77d2571f4e015efbc8f4f4aa469636c0071c83d99510eb11e11a45094dd9ea44a5c1db42c0b53038e9231027de9d821818ae171954b1c18152
|
7
|
+
data.tar.gz: 3d93f06ed8eb492aafde1a629be051f5aa0666e23f9629a1f191fef856501c62d321fd61ce53e0f8daacd8bb458733cd3496f02d48b1ce4f44c8ad6a196695ec
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (1.3.
|
4
|
+
bolognese (1.3.20)
|
5
5
|
activesupport (>= 4.2.5, < 6)
|
6
6
|
benchmark_methods (~> 0.7)
|
7
7
|
bibtex-ruby (~> 4.1)
|
@@ -60,14 +60,14 @@ GEM
|
|
60
60
|
ebnf (1.1.3)
|
61
61
|
rdf (~> 3.0)
|
62
62
|
sxp (~> 1.0)
|
63
|
-
edtf (3.0.
|
64
|
-
activesupport (>= 3.0, <
|
65
|
-
excon (0.
|
66
|
-
faraday (0.
|
63
|
+
edtf (3.0.5)
|
64
|
+
activesupport (>= 3.0, < 7.0)
|
65
|
+
excon (0.67.0)
|
66
|
+
faraday (0.17.0)
|
67
67
|
multipart-post (>= 1.2, < 3)
|
68
68
|
faraday-encoding (0.0.5)
|
69
69
|
faraday
|
70
|
-
faraday_middleware (0.
|
70
|
+
faraday_middleware (0.13.1)
|
71
71
|
faraday (>= 0.7.4, < 1.0)
|
72
72
|
gender_detector (0.1.2)
|
73
73
|
unicode_utils (>= 1.3.0)
|
@@ -78,7 +78,7 @@ GEM
|
|
78
78
|
concurrent-ruby (~> 1.0)
|
79
79
|
hashdiff (1.0.0)
|
80
80
|
htmlentities (4.3.4)
|
81
|
-
i18n (1.
|
81
|
+
i18n (1.7.0)
|
82
82
|
concurrent-ruby (~> 1.0)
|
83
83
|
iso8601 (0.9.1)
|
84
84
|
json (2.2.0)
|
@@ -94,23 +94,23 @@ GEM
|
|
94
94
|
trollop (~> 2)
|
95
95
|
latex-decode (0.3.1)
|
96
96
|
link_header (0.0.8)
|
97
|
-
loofah (2.
|
97
|
+
loofah (2.3.0)
|
98
98
|
crass (~> 1.0.2)
|
99
99
|
nokogiri (>= 1.5.9)
|
100
|
-
maremma (4.
|
100
|
+
maremma (4.4)
|
101
101
|
activesupport (>= 4.2.5, < 6)
|
102
102
|
addressable (>= 2.3.6)
|
103
103
|
builder (~> 3.2, >= 3.2.2)
|
104
|
-
excon (~> 0.
|
105
|
-
faraday (~> 0.
|
104
|
+
excon (~> 0.67.0)
|
105
|
+
faraday (~> 0.17.0)
|
106
106
|
faraday-encoding (~> 0.0.4)
|
107
|
-
faraday_middleware (~> 0.
|
107
|
+
faraday_middleware (~> 0.13.1)
|
108
108
|
multi_json (~> 1.12)
|
109
109
|
nokogiri (~> 1.10.4)
|
110
110
|
oj (>= 2.8.3)
|
111
111
|
mini_portile2 (2.4.0)
|
112
|
-
minitest (5.
|
113
|
-
multi_json (1.
|
112
|
+
minitest (5.12.2)
|
113
|
+
multi_json (1.14.1)
|
114
114
|
multipart-post (2.1.1)
|
115
115
|
namae (1.0.1)
|
116
116
|
nokogiri (1.10.4)
|
@@ -146,19 +146,19 @@ GEM
|
|
146
146
|
rdf (~> 3.0)
|
147
147
|
rdf-xsd (3.0.1)
|
148
148
|
rdf (~> 3.0)
|
149
|
-
rspec (3.
|
150
|
-
rspec-core (~> 3.
|
151
|
-
rspec-expectations (~> 3.
|
152
|
-
rspec-mocks (~> 3.
|
153
|
-
rspec-core (3.
|
154
|
-
rspec-support (~> 3.
|
155
|
-
rspec-expectations (3.
|
149
|
+
rspec (3.9.0)
|
150
|
+
rspec-core (~> 3.9.0)
|
151
|
+
rspec-expectations (~> 3.9.0)
|
152
|
+
rspec-mocks (~> 3.9.0)
|
153
|
+
rspec-core (3.9.0)
|
154
|
+
rspec-support (~> 3.9.0)
|
155
|
+
rspec-expectations (3.9.0)
|
156
156
|
diff-lcs (>= 1.2.0, < 2.0)
|
157
|
-
rspec-support (~> 3.
|
158
|
-
rspec-mocks (3.
|
157
|
+
rspec-support (~> 3.9.0)
|
158
|
+
rspec-mocks (3.9.0)
|
159
159
|
diff-lcs (>= 1.2.0, < 2.0)
|
160
|
-
rspec-support (~> 3.
|
161
|
-
rspec-support (3.
|
160
|
+
rspec-support (~> 3.9.0)
|
161
|
+
rspec-support (3.9.0)
|
162
162
|
rspec-xsd (0.1.0)
|
163
163
|
nokogiri (~> 1.6)
|
164
164
|
rspec (~> 3)
|
@@ -173,13 +173,13 @@ GEM
|
|
173
173
|
temple (0.8.2)
|
174
174
|
thor (0.20.3)
|
175
175
|
thread_safe (0.3.6)
|
176
|
-
tilt (2.0.
|
176
|
+
tilt (2.0.10)
|
177
177
|
trollop (2.9.9)
|
178
178
|
tzinfo (1.2.5)
|
179
179
|
thread_safe (~> 0.1)
|
180
180
|
unicode_utils (1.4.0)
|
181
181
|
vcr (3.0.3)
|
182
|
-
webmock (3.7.
|
182
|
+
webmock (3.7.6)
|
183
183
|
addressable (>= 2.3.6)
|
184
184
|
crack (>= 0.3.2)
|
185
185
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/lib/bolognese/cli.rb
CHANGED
@@ -29,18 +29,20 @@ module Bolognese
|
|
29
29
|
method_option :regenerate, :type => :boolean, :force => false
|
30
30
|
method_option :style, aliases: "-s", default: "apa"
|
31
31
|
method_option :locale, aliases: "-l", default: "en-US"
|
32
|
+
method_option :show_errors, :type => :boolean, :force => false
|
32
33
|
def convert(input)
|
33
34
|
metadata = Metadata.new(input: input,
|
34
35
|
from: options[:from],
|
35
36
|
regenerate: options[:regenerate],
|
36
37
|
style: options[:style],
|
37
|
-
locale: options[:locale]
|
38
|
+
locale: options[:locale],
|
39
|
+
show_errors: options[:show_errors])
|
38
40
|
to = options[:to] || "schema_org"
|
39
41
|
|
40
|
-
if metadata.valid?
|
41
|
-
puts metadata.send(to)
|
42
|
-
else
|
42
|
+
if options[:show_errors] && !metadata.valid?
|
43
43
|
$stderr.puts metadata.errors
|
44
|
+
else
|
45
|
+
puts metadata.send(to)
|
44
46
|
end
|
45
47
|
end
|
46
48
|
|
data/lib/bolognese/metadata.rb
CHANGED
@@ -6,7 +6,7 @@ module Bolognese
|
|
6
6
|
class Metadata
|
7
7
|
include Bolognese::MetadataUtils
|
8
8
|
|
9
|
-
attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue
|
9
|
+
attr_accessor :string, :from, :sandbox, :meta, :regenerate, :issue, :show_errors
|
10
10
|
attr_reader :doc, :page_start, :page_end
|
11
11
|
attr_writer :id, :provider_id, :client_id, :doi, :identifiers, :creators, :contributors, :titles, :publisher,
|
12
12
|
:rights_list, :dates, :publication_year, :volume, :url, :version_info,
|
@@ -12,6 +12,7 @@ require_relative 'readers/crosscite_reader'
|
|
12
12
|
require_relative 'readers/crossref_reader'
|
13
13
|
require_relative 'readers/datacite_json_reader'
|
14
14
|
require_relative 'readers/datacite_reader'
|
15
|
+
require_relative 'readers/npm_reader'
|
15
16
|
require_relative 'readers/ris_reader'
|
16
17
|
require_relative 'readers/schema_org_reader'
|
17
18
|
|
@@ -45,6 +46,7 @@ module Bolognese
|
|
45
46
|
include Bolognese::Readers::CrossrefReader
|
46
47
|
include Bolognese::Readers::DataciteReader
|
47
48
|
include Bolognese::Readers::DataciteJsonReader
|
49
|
+
include Bolognese::Readers::NpmReader
|
48
50
|
include Bolognese::Readers::RisReader
|
49
51
|
include Bolognese::Readers::SchemaOrgReader
|
50
52
|
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bolognese
|
4
|
+
module Readers
|
5
|
+
module NpmReader
|
6
|
+
def read_npm(string: nil, **options)
|
7
|
+
if string.present?
|
8
|
+
errors = jsonlint(string)
|
9
|
+
return { "errors" => errors } if errors.present?
|
10
|
+
end
|
11
|
+
|
12
|
+
read_options = ActiveSupport::HashWithIndifferentAccess.new(options.except(:doi, :id, :url, :sandbox, :validate, :ra))
|
13
|
+
|
14
|
+
meta = string.present? ? Maremma.from_json(string) : {}
|
15
|
+
|
16
|
+
types = {
|
17
|
+
"resourceTypeGeneral" => "Software",
|
18
|
+
"reourceType" => "NPM Package",
|
19
|
+
"schemaOrg" => "SoftwareSourceCode",
|
20
|
+
"citeproc" => "article",
|
21
|
+
"bibtex" => "misc",
|
22
|
+
"ris" => "GEN"
|
23
|
+
}.compact
|
24
|
+
|
25
|
+
creators = if meta.fetch("author", nil).present?
|
26
|
+
get_authors(Array.wrap(meta.fetch("author", nil)))
|
27
|
+
else
|
28
|
+
[{ "nameType" => "Organizational", "name" => ":(unav)" }]
|
29
|
+
end
|
30
|
+
# contributors = get_authors(from_citeproc(Array.wrap(meta.fetch("editor", nil))))
|
31
|
+
# dates = if date = get_date_from_date_parts(meta.fetch("issued", nil))
|
32
|
+
# if Date.edtf(date).present?
|
33
|
+
# [{ "date" => date,
|
34
|
+
# "dateType" => "Issued" }]
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# publication_year = get_date_from_date_parts(meta.fetch("issued", nil)).to_s[0..3]
|
38
|
+
rights_list = if meta.fetch("license", nil)
|
39
|
+
[{ "rights" => meta.fetch("license") }.compact]
|
40
|
+
end
|
41
|
+
# related_identifiers = if meta.fetch("container-title", nil).present? && meta.fetch("ISSN", nil).present?
|
42
|
+
# [{ "type" => "Periodical",
|
43
|
+
# "relationType" => "IsPartOf",
|
44
|
+
# "relatedIdentifierType" => "ISSN",
|
45
|
+
# "title" => meta.fetch("container-title", nil),
|
46
|
+
# "relatedIdentifier" => meta.fetch("ISSN", nil) }.compact]
|
47
|
+
# end
|
48
|
+
# container = if meta.fetch("container-title", nil).present?
|
49
|
+
# first_page = meta.fetch("page", nil).present? ? meta.fetch("page").split("-").map(&:strip)[0] : nil
|
50
|
+
# last_page = meta.fetch("page", nil).present? ? meta.fetch("page").split("-").map(&:strip)[1] : nil
|
51
|
+
|
52
|
+
# { "type" => "Periodical",
|
53
|
+
# "title" => meta.fetch("container-title", nil),
|
54
|
+
# "identifier" => meta.fetch("ISSN", nil),
|
55
|
+
# "identifierType" => meta.fetch("ISSN", nil).present? ? "ISSN" : nil,
|
56
|
+
# "volume" => meta.fetch("volume", nil),
|
57
|
+
# "issue" => meta.fetch("issue", nil),
|
58
|
+
# "firstPage" => first_page,
|
59
|
+
# "lastPage" => last_page
|
60
|
+
# }.compact
|
61
|
+
# else
|
62
|
+
# nil
|
63
|
+
# end
|
64
|
+
|
65
|
+
# identifiers = [normalize_id(meta.fetch("id", nil)), normalize_doi(meta.fetch("DOI", nil))].compact.map do |r|
|
66
|
+
# r = normalize_id(r)
|
67
|
+
|
68
|
+
# if r.start_with?("https://doi.org")
|
69
|
+
# { "identifierType" => "DOI", "identifier" => r }
|
70
|
+
# else
|
71
|
+
# { "identifierType" => "URL", "identifier" => r }
|
72
|
+
# end
|
73
|
+
# end.uniq
|
74
|
+
|
75
|
+
# id = Array.wrap(identifiers).first.to_h.fetch("identifier", nil)
|
76
|
+
# doi = Array.wrap(identifiers).find { |r| r["identifierType"] == "DOI" }.to_h.fetch("identifier", nil)
|
77
|
+
|
78
|
+
# state = id.present? || read_options.present? ? "findable" : "not_found"
|
79
|
+
subjects = Array.wrap(meta.fetch("keywords", nil)).map do |s|
|
80
|
+
{ "subject" => s }
|
81
|
+
end
|
82
|
+
|
83
|
+
{
|
84
|
+
#"id" => id,
|
85
|
+
#"identifiers" => identifiers,
|
86
|
+
"types" => types,
|
87
|
+
#"doi" => doi_from_url(doi),
|
88
|
+
#"url" => normalize_id(meta.fetch("URL", nil)),
|
89
|
+
"titles" => [{ "title" => meta.fetch("name", nil) }],
|
90
|
+
"creators" => creators,
|
91
|
+
#"contributors" => contributors,
|
92
|
+
#"container" => container,
|
93
|
+
#"publisher" => meta.fetch("publisher", nil),
|
94
|
+
#"related_identifiers" => related_identifiers,
|
95
|
+
#"dates" => dates,
|
96
|
+
#"publication_year" => publication_year,
|
97
|
+
"descriptions" => meta.fetch("description", nil).present? ? [{ "description" => sanitize(meta.fetch("description")), "descriptionType" => "Abstract" }] : [],
|
98
|
+
"rights_list" => rights_list,
|
99
|
+
"version_info" => meta.fetch("version", nil),
|
100
|
+
"subjects" => subjects
|
101
|
+
#"state" => state
|
102
|
+
}.merge(read_options)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
data/lib/bolognese/version.rb
CHANGED
@@ -4,7 +4,7 @@ module Bolognese
|
|
4
4
|
module Writers
|
5
5
|
module CodemetaWriter
|
6
6
|
def codemeta
|
7
|
-
return nil unless valid?
|
7
|
+
return nil unless valid? || show_errors
|
8
8
|
|
9
9
|
hsh = {
|
10
10
|
"@context" => id.present? ? "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld" : nil,
|
data/spec/cli_spec.rb
CHANGED
@@ -180,9 +180,15 @@ describe Bolognese::CLI do
|
|
180
180
|
|
181
181
|
it 'to datacite invalid' do
|
182
182
|
file = fixture_path + "datacite_missing_creator.xml"
|
183
|
-
subject.options = { to: "datacite" }
|
183
|
+
subject.options = { to: "datacite", show_errors: "true" }
|
184
184
|
expect { subject.convert file }.to output("4:0: ERROR: Element '{http://datacite.org/schema/kernel-4}creators': Missing child element(s). Expected is ( {http://datacite.org/schema/kernel-4}creator ).\n").to_stderr
|
185
185
|
end
|
186
|
+
|
187
|
+
it 'to datacite invalid ignore errors' do
|
188
|
+
file = fixture_path + "datacite_missing_creator.xml"
|
189
|
+
subject.options = { to: "datacite" }
|
190
|
+
expect { subject.convert file }.to output(/http:\/\/datacite.org\/schema\/kernel-4/).to_stdout
|
191
|
+
end
|
186
192
|
end
|
187
193
|
|
188
194
|
context "codemeta" do
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "fullstack_app",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"main": "index.js",
|
5
|
+
"scripts": {
|
6
|
+
"start": "concurrently \"sudo -i service elasticsearch start\" \"cd backend && node --max_old_space_size=8000 server.js\" \"cd client && npm start\""
|
7
|
+
},
|
8
|
+
"keywords": [],
|
9
|
+
"author": "",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
"concurrently": "^4.1.0",
|
13
|
+
"d3": "^5.9.2",
|
14
|
+
"monk": "^6.0.6"
|
15
|
+
},
|
16
|
+
"devDependencies": {},
|
17
|
+
"description": ""
|
18
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"name": "CITapp",
|
3
|
+
"description": "Concealed Information Test app",
|
4
|
+
"version": "1.1.0",
|
5
|
+
"scripts": {
|
6
|
+
"test": "karma start test/karma.conf.js --single-run"
|
7
|
+
},
|
8
|
+
"devDependencies": {
|
9
|
+
"jasmine-core": "*",
|
10
|
+
"karma": "*",
|
11
|
+
"karma-chrome-launcher": "^2.2.0",
|
12
|
+
"karma-cli": "*",
|
13
|
+
"karma-fixture": "^0.2.6",
|
14
|
+
"karma-html2js-preprocessor": "*",
|
15
|
+
"karma-jasmine": "*",
|
16
|
+
"karma-phantomjs-launcher": "*",
|
17
|
+
"phantomjs-prebuilt": "*"
|
18
|
+
}
|
19
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"name": "edam-browser",
|
3
|
+
"description": "The EDAM Browser is a client-side web-based visualization javascript widget. Its goals are to help describing bio-related resources and service with EDAM, and to facilitate and foster community contributions to EDAM.",
|
4
|
+
"author": "Bryan Brancotte",
|
5
|
+
"version": "1.0.0",
|
6
|
+
"scripts": {
|
7
|
+
"test": "jshint js/*js"
|
8
|
+
},
|
9
|
+
"devDependencies": {
|
10
|
+
"jshint": "^2.9.5"
|
11
|
+
}
|
12
|
+
}
|
@@ -44,7 +44,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
44
44
|
|
45
45
|
it "SoftwareSourceCode missing_comma" do
|
46
46
|
input = fixture_path + "datacite_software_missing_comma.json"
|
47
|
-
subject = Bolognese::Metadata.new(input: input, from: "datacite_json")
|
47
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true)
|
48
48
|
expect(subject.valid?).to be false
|
49
49
|
expect(subject.errors).to eq(["expected comma, not a string at line 4, column 11 [parse.c:381]"])
|
50
50
|
expect(subject.codemeta).to be_nil
|
@@ -52,7 +52,7 @@ describe Bolognese::Metadata, vcr: true do
|
|
52
52
|
|
53
53
|
it "SoftwareSourceCode overlapping_keys" do
|
54
54
|
input = fixture_path + "datacite_software_overlapping_keys.json"
|
55
|
-
subject = Bolognese::Metadata.new(input: input, from: "datacite_json")
|
55
|
+
subject = Bolognese::Metadata.new(input: input, from: "datacite_json", show_errors: true)
|
56
56
|
expect(subject.valid?).to be false
|
57
57
|
expect(subject.errors).to eq(["The same key is defined more than once: id"])
|
58
58
|
expect(subject.codemeta).to be_nil
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Bolognese::Metadata, vcr: true do
|
6
|
+
let(:input) { fixture_path + "cgimp_package.json" }
|
7
|
+
|
8
|
+
subject { Bolognese::Metadata.new(input: input, from: "npm") }
|
9
|
+
|
10
|
+
context "get npm raw" do
|
11
|
+
it "software" do
|
12
|
+
expect(subject.raw).to eq(IO.read(input).strip)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "get npm metadata" do
|
17
|
+
it "minimal" do
|
18
|
+
expect(subject.valid?).to be false
|
19
|
+
expect(subject.errors.first).to start_with("3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}identifier'")
|
20
|
+
#expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
|
21
|
+
#expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
22
|
+
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "reourceType"=>"NPM Package", "resourceTypeGeneral"=>"Software", "ris"=>"GEN", "schemaOrg"=>"SoftwareSourceCode")
|
23
|
+
expect(subject.creators).to eq([{"name"=>":(unav)", "nameType"=>"Organizational"}])
|
24
|
+
expect(subject.titles).to eq([{"title"=>"fullstack_app"}])
|
25
|
+
expect(subject.descriptions).to be_empty
|
26
|
+
expect(subject.rights_list).to eq([{"rights"=>"ISC"}])
|
27
|
+
expect(subject.version_info).to eq("1.0.0")
|
28
|
+
#expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}])
|
29
|
+
#expect(subject.publication_year).to eq("2016")
|
30
|
+
end
|
31
|
+
|
32
|
+
it "minimal with description" do
|
33
|
+
input = fixture_path + "cit_package.json"
|
34
|
+
subject = Bolognese::Metadata.new(input: input, from: "npm")
|
35
|
+
expect(subject.valid?).to be false
|
36
|
+
expect(subject.errors.first).to start_with("3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}identifier'")
|
37
|
+
#expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
|
38
|
+
#expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
39
|
+
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "reourceType"=>"NPM Package", "resourceTypeGeneral"=>"Software", "ris"=>"GEN", "schemaOrg"=>"SoftwareSourceCode")
|
40
|
+
expect(subject.creators).to eq([{"name"=>":(unav)", "nameType"=>"Organizational"}])
|
41
|
+
expect(subject.titles).to eq([{"title"=>"CITapp"}])
|
42
|
+
expect(subject.descriptions).to eq([{"description"=>"Concealed Information Test app", "descriptionType"=>"Abstract"}])
|
43
|
+
expect(subject.version_info).to eq("1.1.0")
|
44
|
+
#expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}])
|
45
|
+
#expect(subject.publication_year).to eq("2016")
|
46
|
+
end
|
47
|
+
|
48
|
+
it "minimal with description" do
|
49
|
+
input = fixture_path + "edam_package.json"
|
50
|
+
subject = Bolognese::Metadata.new(input: input, from: "npm")
|
51
|
+
expect(subject.valid?).to be false
|
52
|
+
expect(subject.errors.first).to start_with("3:0: ERROR: Element '{http://datacite.org/schema/kernel-4}identifier'")
|
53
|
+
#expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
|
54
|
+
#expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
55
|
+
expect(subject.types).to eq("bibtex"=>"misc", "citeproc"=>"article", "reourceType"=>"NPM Package", "resourceTypeGeneral"=>"Software", "ris"=>"GEN", "schemaOrg"=>"SoftwareSourceCode")
|
56
|
+
expect(subject.creators).to eq([{"affiliation"=>[], "familyName"=>"Brancotte", "givenName"=>"Bryan", "name"=>"Brancotte, Bryan", "nameIdentifiers"=>[], "nameType"=>"Personal"}])
|
57
|
+
expect(subject.titles).to eq([{"title"=>"edam-browser"}])
|
58
|
+
expect(subject.descriptions).to eq([{"description"=>
|
59
|
+
+ "The EDAM Browser is a client-side web-based visualization javascript widget. Its goals are to help describing bio-related resources and service with EDAM, and to facilitate and foster community contributions to EDAM.",
|
60
|
+
"descriptionType"=>"Abstract"}])
|
61
|
+
expect(subject.version_info).to eq("1.0.0")
|
62
|
+
#expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}])
|
63
|
+
#expect(subject.publication_year).to eq("2016")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
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.3.
|
4
|
+
version: 1.3.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -571,6 +571,7 @@ files:
|
|
571
571
|
- lib/bolognese/readers/crossref_reader.rb
|
572
572
|
- lib/bolognese/readers/datacite_json_reader.rb
|
573
573
|
- lib/bolognese/readers/datacite_reader.rb
|
574
|
+
- lib/bolognese/readers/npm_reader.rb
|
574
575
|
- lib/bolognese/readers/ris_reader.rb
|
575
576
|
- lib/bolognese/readers/schema_org_reader.rb
|
576
577
|
- lib/bolognese/string.rb
|
@@ -714,6 +715,8 @@ files:
|
|
714
715
|
- spec/doi_utils_spec.rb
|
715
716
|
- spec/find_from_format_spec.rb
|
716
717
|
- spec/fixtures/aida.json
|
718
|
+
- spec/fixtures/cgimp_package.json
|
719
|
+
- spec/fixtures/cit_package.json
|
717
720
|
- spec/fixtures/citeproc-no-author.json
|
718
721
|
- spec/fixtures/citeproc-no-categories.json
|
719
722
|
- spec/fixtures/citeproc.json
|
@@ -748,6 +751,7 @@ files:
|
|
748
751
|
- spec/fixtures/datacite_software.json
|
749
752
|
- spec/fixtures/datacite_software_missing_comma.json
|
750
753
|
- spec/fixtures/datacite_software_overlapping_keys.json
|
754
|
+
- spec/fixtures/edam_package.json
|
751
755
|
- spec/fixtures/funding_reference.xml
|
752
756
|
- spec/fixtures/gtex.xml
|
753
757
|
- spec/fixtures/maremma/codemeta.json
|
@@ -1131,6 +1135,7 @@ files:
|
|
1131
1135
|
- spec/readers/crossref_reader_spec.rb
|
1132
1136
|
- spec/readers/datacite_json_reader_spec.rb
|
1133
1137
|
- spec/readers/datacite_reader_spec.rb
|
1138
|
+
- spec/readers/npm_reader_spec.rb
|
1134
1139
|
- spec/readers/ris_reader_spec.rb
|
1135
1140
|
- spec/readers/schema_org_reader_spec.rb
|
1136
1141
|
- spec/spec_helper.rb
|