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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 290c7cb9287a0b5e018ff3392821d45d41af4360
4
- data.tar.gz: 9e687bbe98ed2bafc223bb49044b8fc2ea2a44d3
3
+ metadata.gz: d40cf8b928ab072eab3a6754cc530bc5676ac75c
4
+ data.tar.gz: 49d554f33bae5b3db5f21ccd8e8d213609b6101c
5
5
  SHA512:
6
- metadata.gz: 2dcaac0f7918491a15d02f08154e94130cdd2c5579c65669e04bce2ec27643f3a4376c70537a700ea61ce3bc18d634bab3de152555d6c68ac5110ccfa43bf96e
7
- data.tar.gz: 2add919c630f4c2f211337d36366a556b3e9e00c6b41e5a82cf145064c8bf7ca1ad815eeaae155fd20d7fcee3d431af34fd4ed024726cf43a64e3278cc89bc55
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.5)
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.12.5
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
- filename = File.basename(input)
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, filename: filename)
42
+ from = options[:from] || find_from_format(string: string, ext: ext)
44
43
  end
45
44
 
46
45
  to = options[:to] || "schema_org"
@@ -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("resource", "xmlns").to_s.start_with?("http://datacite.org/schema/kernel")
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("resource", "xmlns").to_s.start_with?("http://datacite.org/schema/kernel")
46
+ elsif options[:ext] == ".json" && Maremma.from_json(string).dig("issued", "date-parts").present?
45
47
  "citeproc"
46
- elsif options[:ext] == ".ris"
47
- "ris"
48
- elsif options[:filename] == "codemeta.json"
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
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "0.9"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -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 -
@@ -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
- string = IO.read(fixture_path + "crossref.xml")
55
- expect(subject.find_from_format(string: string, ext: ".xml")).to eq("crossref")
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
- string = IO.read(fixture_path + "datacite.xml")
60
- expect(subject.find_from_format(string: string, ext: ".xml")).to eq("datacite")
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
- string = IO.read(fixture_path + "codemeta.json")
65
- expect(subject.find_from_format(string: string, filename: "codemeta.json")).to eq("codemeta")
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: '0.9'
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-15 00:00:00.000000000 Z
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