bolognese 0.9 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/README.md +0 -7
- data/lib/bolognese/cli.rb +2 -3
- data/lib/bolognese/utils.rb +7 -5
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/crossref.ris +13 -0
- data/spec/metadata_spec.rb +41 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d40cf8b928ab072eab3a6754cc530bc5676ac75c
|
4
|
+
data.tar.gz: 49d554f33bae5b3db5f21ccd8e8d213609b6101c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dc8970c946ecef2ef35e01b0fe1879ecc6d9e491eceba3d60702015bfa070a5f9f2c9e11942ca9c317dfcd79f2533c251b6f1179933acb6a68e916ad70d9d06
|
7
|
+
data.tar.gz: c7318840d589c14f1db6ad56cbd0057ad07c66abf3f58457fe77d87ac8ae2f1d11aa9c3b2046985a1d69bb50946155cad169621f965f4f7d5a24186f92ffdfa5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bolognese (0.9)
|
4
|
+
bolognese (0.9.1)
|
5
5
|
activesupport (~> 4.2, >= 4.2.5)
|
6
6
|
bibtex-ruby (~> 4.1)
|
7
7
|
builder (~> 3.2, >= 3.2.2)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
rack-test (0.6.3)
|
96
96
|
rack (>= 1.0)
|
97
97
|
rake (12.0.0)
|
98
|
-
rdf (2.2.
|
98
|
+
rdf (2.2.6)
|
99
99
|
hamster (~> 3.0)
|
100
100
|
link_header (~> 0.0, >= 0.0.8)
|
101
101
|
rdf-aggregate-repo (2.2.0)
|
@@ -169,4 +169,4 @@ DEPENDENCIES
|
|
169
169
|
webmock (~> 1.22, >= 1.22.3)
|
170
170
|
|
171
171
|
BUNDLED WITH
|
172
|
-
1.
|
172
|
+
1.14.6
|
data/README.md
CHANGED
@@ -79,13 +79,6 @@ Bolognese reads and/or writes these metadata formats:
|
|
79
79
|
<td>Yes</td>
|
80
80
|
<td>Yes</td>
|
81
81
|
</tr>
|
82
|
-
<tr>
|
83
|
-
<td><a href='https://github.com/scholix/schema'>Scholix</a></td>
|
84
|
-
<td>scholix</td>
|
85
|
-
<td>application/vnd.scholix+json</td>
|
86
|
-
<td>No</td>
|
87
|
-
<td>Yes</td>
|
88
|
-
</tr>
|
89
82
|
<tr>
|
90
83
|
<td><a href='http://en.wikipedia.org/wiki/BibTeX'>BibTeX</a></td>
|
91
84
|
<td>bibtex</td>
|
data/lib/bolognese/cli.rb
CHANGED
@@ -33,14 +33,13 @@ module Bolognese
|
|
33
33
|
from = options[:from] || find_from_format(id: id)
|
34
34
|
else
|
35
35
|
ext = File.extname(input)
|
36
|
-
|
37
|
-
if %w(.bib .xml).include?(ext) || filename == "codemeta.json"
|
36
|
+
if %w(.bib .ris .xml .json).include?(ext)
|
38
37
|
string = IO.read(input)
|
39
38
|
else
|
40
39
|
$stderr.puts "File type #{ext} not supported"
|
41
40
|
exit 1
|
42
41
|
end
|
43
|
-
from = options[:from] || find_from_format(string: string, ext: ext
|
42
|
+
from = options[:from] || find_from_format(string: string, ext: ext)
|
44
43
|
end
|
45
44
|
|
46
45
|
to = options[:to] || "schema_org"
|
data/lib/bolognese/utils.rb
CHANGED
@@ -35,17 +35,19 @@ module Bolognese
|
|
35
35
|
def find_from_format_by_string(string, options={})
|
36
36
|
if options[:ext] == ".bib"
|
37
37
|
"bibtex"
|
38
|
+
elsif options[:ext] == ".ris"
|
39
|
+
"ris"
|
38
40
|
elsif options[:ext] == ".xml" && Maremma.from_xml(string).dig("doi_records", "doi_record", "crossref")
|
39
41
|
"crossref"
|
40
42
|
elsif options[:ext] == ".xml" && Maremma.from_xml(string).dig("resource", "xmlns").start_with?("http://datacite.org/schema/kernel")
|
41
43
|
"datacite"
|
42
|
-
elsif options[:ext] == ".json" && Maremma.from_json(string).dig("
|
44
|
+
elsif options[:ext] == ".json" && Maremma.from_json(string).dig("schemaVersion").to_s.start_with?("http://datacite.org/schema/kernel")
|
43
45
|
"datacite_json"
|
44
|
-
elsif options[:ext] == ".json" && Maremma.from_json(string).dig("
|
46
|
+
elsif options[:ext] == ".json" && Maremma.from_json(string).dig("issued", "date-parts").present?
|
45
47
|
"citeproc"
|
46
|
-
elsif options[:ext] == ".
|
47
|
-
"
|
48
|
-
elsif options[:
|
48
|
+
elsif options[:ext] == ".json" && Maremma.from_json(string).dig("@context").to_s.start_with?("http://schema.org")
|
49
|
+
"schema_org"
|
50
|
+
elsif options[:ext] == ".json" && Maremma.from_json(string).dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
|
49
51
|
"codemeta"
|
50
52
|
end
|
51
53
|
end
|
data/lib/bolognese/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
TY - JOUR
|
2
|
+
T1 - Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth
|
3
|
+
T2 - eLife
|
4
|
+
AU - Sankar, Martial
|
5
|
+
AU - Nieminen, Kaisa
|
6
|
+
AU - Ragni, Laura
|
7
|
+
AU - Xenarios, Ioannis
|
8
|
+
AU - Hardtke, Christian S
|
9
|
+
DO - 10.7554/eLife.01567
|
10
|
+
UR - http://elifesciences.org/lookup/doi/10.7554/eLife.01567
|
11
|
+
PY - 2014
|
12
|
+
VL - 3
|
13
|
+
ER -
|
data/spec/metadata_spec.rb
CHANGED
@@ -42,27 +42,60 @@ describe Bolognese::Metadata, vcr: true do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
context "find from format from file" do
|
45
|
-
let(:file) { fixture_path + "crossref.bib" }
|
46
|
-
|
47
45
|
it "bibtex" do
|
46
|
+
file = fixture_path + "crossref.bib"
|
48
47
|
string = IO.read(file)
|
49
48
|
ext = File.extname(file)
|
50
49
|
expect(subject.find_from_format(string: string, ext: ext)).to eq("bibtex")
|
51
50
|
end
|
52
51
|
|
52
|
+
it "ris" do
|
53
|
+
file = fixture_path + "crossref.ris"
|
54
|
+
string = IO.read(file)
|
55
|
+
ext = File.extname(file)
|
56
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("ris")
|
57
|
+
end
|
58
|
+
|
53
59
|
it "crossref" do
|
54
|
-
|
55
|
-
|
60
|
+
file = fixture_path + "crossref.xml"
|
61
|
+
string = IO.read(file)
|
62
|
+
ext = File.extname(file)
|
63
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("crossref")
|
56
64
|
end
|
57
65
|
|
58
66
|
it "datacite" do
|
59
|
-
|
60
|
-
|
67
|
+
file = fixture_path + "datacite.xml"
|
68
|
+
string = IO.read(file)
|
69
|
+
ext = File.extname(file)
|
70
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("datacite")
|
71
|
+
end
|
72
|
+
|
73
|
+
it "datacite_json" do
|
74
|
+
file = fixture_path + "datacite.json"
|
75
|
+
string = IO.read(file)
|
76
|
+
ext = File.extname(file)
|
77
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("datacite_json")
|
78
|
+
end
|
79
|
+
|
80
|
+
it "schema_org" do
|
81
|
+
file = fixture_path + "schema_org.json"
|
82
|
+
string = IO.read(file)
|
83
|
+
ext = File.extname(file)
|
84
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("schema_org")
|
85
|
+
end
|
86
|
+
|
87
|
+
it "citeproc" do
|
88
|
+
file = fixture_path + "citeproc.json"
|
89
|
+
string = IO.read(file)
|
90
|
+
ext = File.extname(file)
|
91
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("citeproc")
|
61
92
|
end
|
62
93
|
|
63
94
|
it "codemeta" do
|
64
|
-
|
65
|
-
|
95
|
+
file = fixture_path + "codemeta.json"
|
96
|
+
string = IO.read(file)
|
97
|
+
ext = File.extname(file)
|
98
|
+
expect(subject.find_from_format(string: string, ext: ext)).to eq("codemeta")
|
66
99
|
end
|
67
100
|
end
|
68
101
|
|
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:
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -482,6 +482,7 @@ files:
|
|
482
482
|
- spec/fixtures/citeproc.json
|
483
483
|
- spec/fixtures/codemeta.json
|
484
484
|
- spec/fixtures/crossref.bib
|
485
|
+
- spec/fixtures/crossref.ris
|
485
486
|
- spec/fixtures/crossref.xml
|
486
487
|
- spec/fixtures/datacite.json
|
487
488
|
- spec/fixtures/datacite.xml
|