briard 2.4.1 → 2.6.0

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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +72 -0
  3. data/.github/workflows/rubocop.yml +50 -0
  4. data/.rubocop.yml +144 -620
  5. data/.rubocop_todo.yml +76 -0
  6. data/CHANGELOG.md +22 -0
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +43 -6
  9. data/Rakefile +1 -1
  10. data/{bolognese.gemspec → briard.gemspec} +46 -38
  11. data/lib/briard/array.rb +2 -2
  12. data/lib/briard/author_utils.rb +79 -71
  13. data/lib/briard/cli.rb +12 -13
  14. data/lib/briard/crossref_utils.rb +73 -61
  15. data/lib/briard/datacite_utils.rb +132 -106
  16. data/lib/briard/doi_utils.rb +10 -10
  17. data/lib/briard/metadata.rb +96 -106
  18. data/lib/briard/metadata_utils.rb +87 -78
  19. data/lib/briard/readers/bibtex_reader.rb +65 -65
  20. data/lib/briard/readers/cff_reader.rb +88 -70
  21. data/lib/briard/readers/citeproc_reader.rb +90 -84
  22. data/lib/briard/readers/codemeta_reader.rb +68 -50
  23. data/lib/briard/readers/crosscite_reader.rb +2 -2
  24. data/lib/briard/readers/crossref_reader.rb +249 -210
  25. data/lib/briard/readers/datacite_json_reader.rb +3 -3
  26. data/lib/briard/readers/datacite_reader.rb +225 -189
  27. data/lib/briard/readers/npm_reader.rb +49 -42
  28. data/lib/briard/readers/ris_reader.rb +82 -80
  29. data/lib/briard/readers/schema_org_reader.rb +182 -159
  30. data/lib/briard/string.rb +1 -1
  31. data/lib/briard/utils.rb +4 -4
  32. data/lib/briard/version.rb +3 -1
  33. data/lib/briard/whitelist_scrubber.rb +11 -4
  34. data/lib/briard/writers/bibtex_writer.rb +14 -8
  35. data/lib/briard/writers/cff_writer.rb +33 -26
  36. data/lib/briard/writers/codemeta_writer.rb +19 -15
  37. data/lib/briard/writers/csv_writer.rb +6 -4
  38. data/lib/briard/writers/datacite_json_writer.rb +8 -2
  39. data/lib/briard/writers/jats_writer.rb +33 -28
  40. data/lib/briard/writers/rdf_xml_writer.rb +1 -1
  41. data/lib/briard/writers/ris_writer.rb +30 -18
  42. data/lib/briard/writers/turtle_writer.rb +1 -1
  43. data/lib/briard.rb +6 -6
  44. data/rubocop.sarif +0 -0
  45. data/spec/array_spec.rb +5 -5
  46. data/spec/author_utils_spec.rb +151 -132
  47. data/spec/datacite_utils_spec.rb +135 -83
  48. data/spec/doi_utils_spec.rb +168 -164
  49. data/spec/find_from_format_spec.rb +69 -69
  50. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/onlies_keep_specific_tags.yml +65 -0
  51. data/spec/fixtures/vcr_cassettes/Briard_Metadata/sanitize/removes_a_tags.yml +65 -0
  52. data/spec/metadata_spec.rb +91 -90
  53. data/spec/readers/bibtex_reader_spec.rb +43 -38
  54. data/spec/readers/cff_reader_spec.rb +165 -153
  55. data/spec/readers/citeproc_reader_spec.rb +45 -40
  56. data/spec/readers/codemeta_reader_spec.rb +128 -115
  57. data/spec/readers/crosscite_reader_spec.rb +34 -24
  58. data/spec/readers/crossref_reader_spec.rb +1098 -939
  59. data/spec/readers/datacite_json_reader_spec.rb +53 -40
  60. data/spec/readers/datacite_reader_spec.rb +1541 -1337
  61. data/spec/readers/npm_reader_spec.rb +48 -43
  62. data/spec/readers/ris_reader_spec.rb +53 -47
  63. data/spec/readers/schema_org_reader_spec.rb +329 -267
  64. data/spec/spec_helper.rb +6 -5
  65. data/spec/utils_spec.rb +371 -347
  66. data/spec/writers/bibtex_writer_spec.rb +143 -143
  67. data/spec/writers/cff_writer_spec.rb +96 -90
  68. data/spec/writers/citation_writer_spec.rb +34 -33
  69. data/spec/writers/citeproc_writer_spec.rb +226 -224
  70. data/spec/writers/codemeta_writer_spec.rb +18 -16
  71. data/spec/writers/crosscite_writer_spec.rb +91 -73
  72. data/spec/writers/crossref_writer_spec.rb +99 -91
  73. data/spec/writers/csv_writer_spec.rb +70 -70
  74. data/spec/writers/datacite_json_writer_spec.rb +78 -68
  75. data/spec/writers/datacite_writer_spec.rb +417 -322
  76. data/spec/writers/jats_writer_spec.rb +177 -161
  77. data/spec/writers/rdf_xml_writer_spec.rb +68 -63
  78. data/spec/writers/ris_writer_spec.rb +162 -162
  79. data/spec/writers/turtle_writer_spec.rb +47 -47
  80. metadata +250 -160
  81. data/.github/workflows/release.yml +0 -47
@@ -3,193 +3,193 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Briard::Metadata, vcr: true do
6
- context "write metadata as bibtex" do
7
- it "with data citation" do
8
- input = "10.7554/eLife.01567"
9
- subject = Briard::Metadata.new(input: input, from: "crossref")
6
+ context 'write metadata as bibtex' do
7
+ it 'with data citation' do
8
+ input = '10.7554/eLife.01567'
9
+ subject = described_class.new(input: input, from: 'crossref')
10
10
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
11
- expect(bibtex[:bibtex_type].to_s).to eq("article")
12
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.7554/elife.01567")
13
- expect(bibtex[:doi]).to eq("10.7554/elife.01567")
14
- expect(bibtex[:url]).to eq("https://elifesciences.org/articles/01567")
15
- expect(bibtex[:title]).to eq("Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth")
16
- expect(bibtex[:author]).to eq("Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S")
17
- expect(bibtex[:journal]).to eq("eLife")
18
- expect(bibtex[:year]).to eq("2014")
19
- expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
11
+ expect(bibtex[:bibtex_type].to_s).to eq('article')
12
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.7554/elife.01567')
13
+ expect(bibtex[:doi]).to eq('10.7554/elife.01567')
14
+ expect(bibtex[:url]).to eq('https://elifesciences.org/articles/01567')
15
+ expect(bibtex[:title]).to eq('Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth')
16
+ expect(bibtex[:author]).to eq('Sankar, Martial and Nieminen, Kaisa and Ragni, Laura and Xenarios, Ioannis and Hardtke, Christian S')
17
+ expect(bibtex[:journal]).to eq('eLife')
18
+ expect(bibtex[:year]).to eq('2014')
19
+ expect(bibtex[:copyright]).to eq('Creative Commons Attribution 3.0 Unported')
20
20
  end
21
21
 
22
- it "with schema_3" do
22
+ it 'with schema_3' do
23
23
  # input = fixture_path + "datacite_kernel_3.json"
24
- input = fixture_path + "datacite_schema_3.xml"
25
- json = Briard::Metadata.new(input: input, from: "datacite")
26
- subject = Briard::Metadata.new(input: json.meta.to_json, from: "datacite_json")
24
+ input = "#{fixture_path}datacite_schema_3.xml"
25
+ json = described_class.new(input: input, from: 'datacite')
26
+ subject = described_class.new(input: json.meta.to_json, from: 'datacite_json')
27
27
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
28
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
29
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5061/dryad.8515")
30
- expect(bibtex[:doi]).to eq("10.5061/dryad.8515")
31
- expect(bibtex[:year]).to eq("2011")
28
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
29
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.5061/dryad.8515')
30
+ expect(bibtex[:doi]).to eq('10.5061/dryad.8515')
31
+ expect(bibtex[:year]).to eq('2011')
32
32
  end
33
33
 
34
- it "with pages" do
35
- input = "https://doi.org/10.1155/2012/291294"
36
- subject = Briard::Metadata.new(input: input, from: "crossref")
34
+ it 'with pages' do
35
+ input = 'https://doi.org/10.1155/2012/291294'
36
+ subject = described_class.new(input: input, from: 'crossref')
37
37
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
38
- expect(bibtex[:bibtex_type].to_s).to eq("article")
39
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.1155/2012/291294")
40
- expect(bibtex[:doi]).to eq("10.1155/2012/291294")
41
- expect(bibtex[:url]).to eq("http://www.hindawi.com/journals/pm/2012/291294/")
42
- expect(bibtex[:title]).to eq("Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers")
43
- expect(bibtex[:author]).to eq("Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.")
44
- expect(bibtex[:journal]).to eq("Pulmonary Medicine")
45
- expect(bibtex[:pages]).to eq("1-7")
46
- expect(bibtex[:year]).to eq("2012")
47
- expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
38
+ expect(bibtex[:bibtex_type].to_s).to eq('article')
39
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.1155/2012/291294')
40
+ expect(bibtex[:doi]).to eq('10.1155/2012/291294')
41
+ expect(bibtex[:url]).to eq('http://www.hindawi.com/journals/pm/2012/291294/')
42
+ expect(bibtex[:title]).to eq('Delineating a Retesting Zone Using Receiver Operating Characteristic Analysis on Serial QuantiFERON Tuberculosis Test Results in US Healthcare Workers')
43
+ expect(bibtex[:author]).to eq('Thanassi, Wendy and Noda, Art and Hernandez, Beatriz and Newell, Jeffery and Terpeluk, Paul and Marder, David and Yesavage, Jerome A.')
44
+ expect(bibtex[:journal]).to eq('Pulmonary Medicine')
45
+ expect(bibtex[:pages]).to eq('1-7')
46
+ expect(bibtex[:year]).to eq('2012')
47
+ expect(bibtex[:copyright]).to eq('Creative Commons Attribution 3.0 Unported')
48
48
  end
49
49
 
50
- it "text" do
51
- input = "10.3204/desy-2014-01645"
52
- subject = Briard::Metadata.new(input: input, from: "datacite")
50
+ it 'text' do
51
+ input = '10.3204/desy-2014-01645'
52
+ subject = described_class.new(input: input, from: 'datacite')
53
53
  expect(subject.valid?).to be true
54
54
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
55
- expect(bibtex[:bibtex_type].to_s).to eq("phdthesis")
56
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.3204/desy-2014-01645")
57
- expect(bibtex[:doi]).to eq("10.3204/desy-2014-01645")
58
- expect(bibtex[:title]).to eq("Dynamics of colloids in molecular glass forming liquids studied via X-ray photon correlation spectroscopy")
59
- expect(bibtex[:pages]).to eq("2014")
60
- expect(bibtex[:year]).to eq("2014")
55
+ expect(bibtex[:bibtex_type].to_s).to eq('phdthesis')
56
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.3204/desy-2014-01645')
57
+ expect(bibtex[:doi]).to eq('10.3204/desy-2014-01645')
58
+ expect(bibtex[:title]).to eq('Dynamics of colloids in molecular glass forming liquids studied via X-ray photon correlation spectroscopy')
59
+ expect(bibtex[:pages]).to eq('2014')
60
+ expect(bibtex[:year]).to eq('2014')
61
61
  end
62
62
 
63
- it "climate data" do
64
- input = "https://doi.org/10.5067/altcy-tj122"
65
- subject = Briard::Metadata.new(input: input, from: "datacite")
63
+ it 'climate data' do
64
+ input = 'https://doi.org/10.5067/altcy-tj122'
65
+ subject = described_class.new(input: input, from: 'datacite')
66
66
  expect(subject.valid?).to be true
67
67
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
68
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
69
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5067/altcy-tj122")
70
- expect(bibtex[:doi]).to eq("10.5067/altcy-tj122")
71
- expect(bibtex[:title]).to eq("Integrated Multi-Mission Ocean Altimeter Data for Climate Research Version 2")
72
- expect(bibtex[:pages]).to be_nil
68
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
69
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.5067/altcy-tj122')
70
+ expect(bibtex[:doi]).to eq('10.5067/altcy-tj122')
71
+ expect(bibtex[:title]).to eq('Integrated Multi-Mission Ocean Altimeter Data for Climate Research Version 2')
72
+ expect(bibtex[:pages].nil?).to be(true)
73
73
  end
74
-
75
- it "maremma" do
76
- input = "https://github.com/datacite/maremma"
77
- subject = Briard::Metadata.new(input: input, from: "codemeta")
74
+
75
+ it 'maremma' do
76
+ input = 'https://github.com/datacite/maremma'
77
+ subject = described_class.new(input: input, from: 'codemeta')
78
78
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
79
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
80
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/qeg0-3gm3")
81
- expect(bibtex[:doi]).to eq("10.5438/qeg0-3gm3")
82
- expect(bibtex[:url]).to eq("https://github.com/datacite/maremma")
83
- expect(bibtex[:title]).to eq("Maremma: a Ruby library for simplified network calls")
84
- expect(bibtex[:author]).to eq("Fenner, Martin")
85
- expect(bibtex[:publisher]).to eq("DataCite")
86
- expect(bibtex[:keywords]).to eq("faraday, excon, net/http")
87
- expect(bibtex[:year]).to eq("2017")
88
- expect(bibtex[:copyright]).to eq("MIT License")
79
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
80
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.5438/qeg0-3gm3')
81
+ expect(bibtex[:doi]).to eq('10.5438/qeg0-3gm3')
82
+ expect(bibtex[:url]).to eq('https://github.com/datacite/maremma')
83
+ expect(bibtex[:title]).to eq('Maremma: a Ruby library for simplified network calls')
84
+ expect(bibtex[:author]).to eq('Fenner, Martin')
85
+ expect(bibtex[:publisher]).to eq('DataCite')
86
+ expect(bibtex[:keywords]).to eq('faraday, excon, net/http')
87
+ expect(bibtex[:year]).to eq('2017')
88
+ expect(bibtex[:copyright]).to eq('MIT License')
89
89
  end
90
90
 
91
- it "BlogPosting from string" do
92
- input = fixture_path + "datacite.json"
93
- subject = Briard::Metadata.new(input: input, from: "datacite_json")
91
+ it 'BlogPosting from string' do
92
+ input = "#{fixture_path}datacite.json"
93
+ subject = described_class.new(input: input, from: 'datacite_json')
94
94
  expect(subject.valid?).to be true
95
95
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
96
- expect(bibtex[:bibtex_type].to_s).to eq("article")
97
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/4k3m-nyvg")
98
- expect(bibtex[:doi]).to eq("10.5438/4k3m-nyvg")
99
- expect(bibtex[:title]).to eq("Eating your own Dog Food")
100
- expect(bibtex[:author]).to eq("Fenner, Martin")
101
- expect(bibtex[:publisher]).to eq("DataCite")
102
- expect(bibtex[:year]).to eq("2016")
96
+ expect(bibtex[:bibtex_type].to_s).to eq('article')
97
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.5438/4k3m-nyvg')
98
+ expect(bibtex[:doi]).to eq('10.5438/4k3m-nyvg')
99
+ expect(bibtex[:title]).to eq('Eating your own Dog Food')
100
+ expect(bibtex[:author]).to eq('Fenner, Martin')
101
+ expect(bibtex[:publisher]).to eq('DataCite')
102
+ expect(bibtex[:year]).to eq('2016')
103
103
  end
104
104
 
105
- it "BlogPosting" do
106
- input = "https://doi.org/10.5438/4K3M-NYVG"
107
- subject = Briard::Metadata.new(input: input, from: "datacite")
105
+ it 'BlogPosting' do
106
+ input = 'https://doi.org/10.5438/4K3M-NYVG'
107
+ subject = described_class.new(input: input, from: 'datacite')
108
108
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
109
- expect(bibtex[:bibtex_type].to_s).to eq("article")
110
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5438/4k3m-nyvg")
111
- expect(bibtex[:doi]).to eq("10.5438/4k3m-nyvg")
112
- expect(bibtex[:title]).to eq("Eating your own Dog Food")
113
- expect(bibtex[:author]).to eq("Fenner, Martin")
114
- expect(bibtex[:publisher]).to eq("DataCite")
115
- expect(bibtex[:year]).to eq("2016")
109
+ expect(bibtex[:bibtex_type].to_s).to eq('article')
110
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.5438/4k3m-nyvg')
111
+ expect(bibtex[:doi]).to eq('10.5438/4k3m-nyvg')
112
+ expect(bibtex[:title]).to eq('Eating your own Dog Food')
113
+ expect(bibtex[:author]).to eq('Fenner, Martin')
114
+ expect(bibtex[:publisher]).to eq('DataCite')
115
+ expect(bibtex[:year]).to eq('2016')
116
116
  end
117
117
 
118
- it "Dataset" do
119
- input = "https://doi.org/10.5061/dryad.8515"
120
- subject = Briard::Metadata.new(input: input, from: "datacite")
118
+ it 'Dataset' do
119
+ input = 'https://doi.org/10.5061/dryad.8515'
120
+ subject = described_class.new(input: input, from: 'datacite')
121
121
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
122
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
123
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.5061/dryad.8515")
124
- expect(bibtex[:doi]).to eq("10.5061/dryad.8515")
125
- expect(bibtex[:title]).to eq("Data from: A new malaria agent in African hominids.")
126
- expect(bibtex[:author]).to eq("Ollomo, Benjamin and Durand, Patrick and Prugnolle, Franck and Douzery, Emmanuel J. P. and Arnathau, Céline and Nkoghe, Dieudonné and Leroy, Eric and Renaud, François")
127
- expect(bibtex[:publisher]).to eq("Dryad")
128
- expect(bibtex[:year]).to eq("2011")
129
- expect(bibtex[:copyright]).to eq("Creative Commons Zero v1.0 Universal")
122
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
123
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.5061/dryad.8515')
124
+ expect(bibtex[:doi]).to eq('10.5061/dryad.8515')
125
+ expect(bibtex[:title]).to eq('Data from: A new malaria agent in African hominids.')
126
+ expect(bibtex[:author]).to eq('Ollomo, Benjamin and Durand, Patrick and Prugnolle, Franck and Douzery, Emmanuel J. P. and Arnathau, Céline and Nkoghe, Dieudonné and Leroy, Eric and Renaud, François')
127
+ expect(bibtex[:publisher]).to eq('Dryad')
128
+ expect(bibtex[:year]).to eq('2011')
129
+ expect(bibtex[:copyright]).to eq('Creative Commons Zero v1.0 Universal')
130
130
  end
131
131
 
132
- it "from schema_org" do
133
- input = "https://blog.front-matter.io/posts/eating-your-own-dog-food/"
134
- subject = Briard::Metadata.new(input: input, from: "schema_org")
132
+ it 'from schema_org' do
133
+ input = 'https://blog.front-matter.io/posts/eating-your-own-dog-food/'
134
+ subject = described_class.new(input: input, from: 'schema_org')
135
135
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
136
- expect(bibtex[:bibtex_type].to_s).to eq("article")
137
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.53731/r79vxn1-97aq74v-ag58n")
138
- expect(bibtex[:doi]).to eq("10.53731/r79vxn1-97aq74v-ag58n")
139
- expect(bibtex[:title]).to eq("Eating your own Dog Food")
140
- expect(bibtex[:author]).to eq("Fenner, Martin")
141
- expect(bibtex[:publisher]).to eq("Front Matter")
142
- expect(bibtex[:keywords]).to eq("feature")
143
- expect(bibtex[:year]).to eq("2016")
136
+ expect(bibtex[:bibtex_type].to_s).to eq('article')
137
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.53731/r79vxn1-97aq74v-ag58n')
138
+ expect(bibtex[:doi]).to eq('10.53731/r79vxn1-97aq74v-ag58n')
139
+ expect(bibtex[:title]).to eq('Eating your own Dog Food')
140
+ expect(bibtex[:author]).to eq('Fenner, Martin')
141
+ expect(bibtex[:publisher]).to eq('Front Matter')
142
+ expect(bibtex[:keywords]).to eq('feature')
143
+ expect(bibtex[:year]).to eq('2016')
144
144
  end
145
145
 
146
- it "authors with affiliations" do
147
- input = "10.16910/jemr.9.1.2"
148
- subject = Briard::Metadata.new(input: input, from: "crossref")
146
+ it 'authors with affiliations' do
147
+ input = '10.16910/jemr.9.1.2'
148
+ subject = described_class.new(input: input, from: 'crossref')
149
149
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
150
- expect(bibtex[:bibtex_type].to_s).to eq("article")
151
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.16910/jemr.9.1.2")
152
- expect(bibtex[:doi]).to eq("10.16910/jemr.9.1.2")
153
- expect(bibtex[:title]).to eq("Eye tracking scanpath analysis techniques on web pages: A survey, evaluation and comparison")
154
- expect(bibtex[:author]).to eq("Eraslan, Sukru and Yesilada, Yeliz and Harper, Simon")
155
- expect(bibtex[:publisher]).to eq("University of Bern")
156
- expect(bibtex[:year]).to eq("2015")
150
+ expect(bibtex[:bibtex_type].to_s).to eq('article')
151
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.16910/jemr.9.1.2')
152
+ expect(bibtex[:doi]).to eq('10.16910/jemr.9.1.2')
153
+ expect(bibtex[:title]).to eq('Eye tracking scanpath analysis techniques on web pages: A survey, evaluation and comparison')
154
+ expect(bibtex[:author]).to eq('Eraslan, Sukru and Yesilada, Yeliz and Harper, Simon')
155
+ expect(bibtex[:publisher]).to eq('University of Bern')
156
+ expect(bibtex[:year]).to eq('2015')
157
157
  end
158
158
 
159
- it "keywords subject scheme" do
160
- input = "https://doi.org/10.1594/pangaea.721193"
161
- subject = Briard::Metadata.new(input: input, from: "datacite")
159
+ it 'keywords subject scheme' do
160
+ input = 'https://doi.org/10.1594/pangaea.721193'
161
+ subject = described_class.new(input: input, from: 'datacite')
162
162
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
163
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
164
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.1594/pangaea.721193")
165
- expect(bibtex[:doi]).to eq("10.1594/pangaea.721193")
166
- expect(bibtex[:keywords]).to start_with("animalia, bottles or small containers/aquaria (<20 l), calcification/dissolution")
167
- expect(bibtex[:year]).to eq("2007")
168
- expect(bibtex[:copyright]).to eq("Creative Commons Attribution 3.0 Unported")
163
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
164
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.1594/pangaea.721193')
165
+ expect(bibtex[:doi]).to eq('10.1594/pangaea.721193')
166
+ expect(bibtex[:keywords]).to start_with('animalia, bottles or small containers/aquaria (<20 l), calcification/dissolution')
167
+ expect(bibtex[:year]).to eq('2007')
168
+ expect(bibtex[:copyright]).to eq('Creative Commons Attribution 3.0 Unported')
169
169
  end
170
170
 
171
- it "author is organization" do
172
- input = fixture_path + 'gtex.xml'
173
- subject = Briard::Metadata.new(input: input, from: "datacite")
171
+ it 'author is organization' do
172
+ input = "#{fixture_path}gtex.xml"
173
+ subject = described_class.new(input: input, from: 'datacite')
174
174
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
175
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
176
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.25491/9hx8-ke93")
177
- expect(bibtex[:author]).to eq("{The GTEx Consortium}")
175
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
176
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.25491/9hx8-ke93')
177
+ expect(bibtex[:author]).to eq('{The GTEx Consortium}')
178
178
  end
179
179
 
180
- it "dataset neurophysiology" do
181
- input = fixture_path + 'datacite-schema-2.2.xml'
182
- subject = Briard::Metadata.new(input: input)
180
+ it 'dataset neurophysiology' do
181
+ input = "#{fixture_path}datacite-schema-2.2.xml"
182
+ subject = described_class.new(input: input)
183
183
  expect(subject.valid?).to be true
184
184
  bibtex = BibTeX.parse(subject.bibtex).to_a(quotes: '').first
185
- expect(bibtex[:bibtex_type].to_s).to eq("misc")
186
- expect(bibtex[:bibtex_key]).to eq("https://doi.org/10.6080/k0f769gp")
187
- expect(bibtex[:doi]).to eq("10.6080/k0f769gp")
188
- expect(bibtex[:title]).to eq("Single-unit recordings from two auditory areas in male zebra finches")
189
- expect(bibtex[:author]).to eq("Theunissen, Frederic E. and Hauber, ME and Woolley, Sarah M. N. and Gill, Patrick and Shaevitz, SS and Amin, Noopur and Hsu, A and Singh, NC and Grace, GA and Fremouw, Thane and Zhang, Junli and Cassey, P and Doupe, AJ and David, SV and Vinje, WE")
190
- expect(bibtex[:publisher]).to eq("CRCNS.org")
191
- expect(bibtex[:keywords]).to eq("neuroscience, electrophysiology, auditory area, avian (zebra finch)")
192
- expect(bibtex[:year]).to eq("2009")
185
+ expect(bibtex[:bibtex_type].to_s).to eq('misc')
186
+ expect(bibtex[:bibtex_key]).to eq('https://doi.org/10.6080/k0f769gp')
187
+ expect(bibtex[:doi]).to eq('10.6080/k0f769gp')
188
+ expect(bibtex[:title]).to eq('Single-unit recordings from two auditory areas in male zebra finches')
189
+ expect(bibtex[:author]).to eq('Theunissen, Frederic E. and Hauber, ME and Woolley, Sarah M. N. and Gill, Patrick and Shaevitz, SS and Amin, Noopur and Hsu, A and Singh, NC and Grace, GA and Fremouw, Thane and Zhang, Junli and Cassey, P and Doupe, AJ and David, SV and Vinje, WE')
190
+ expect(bibtex[:publisher]).to eq('CRCNS.org')
191
+ expect(bibtex[:keywords]).to eq('neuroscience, electrophysiology, auditory area, avian (zebra finch)')
192
+ expect(bibtex[:year]).to eq('2009')
193
193
  end
194
194
  end
195
195
  end
@@ -3,110 +3,116 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Briard::Metadata, vcr: true do
6
- context "write metadata as cff" do
7
- it "SoftwareSourceCode Zenodo" do
8
- input = "https://doi.org/10.5281/zenodo.10164"
9
- subject = Briard::Metadata.new(input: input, from: "datacite")
6
+ context 'write metadata as cff' do
7
+ it 'SoftwareSourceCode Zenodo' do
8
+ input = 'https://doi.org/10.5281/zenodo.10164'
9
+ subject = described_class.new(input: input, from: 'datacite')
10
10
  expect(subject.valid?).to be true
11
11
  json = Psych.safe_load(subject.cff, permitted_classes: [Date])
12
- expect(json["doi"]).to eq("https://doi.org/10.5281/zenodo.10164")
13
- expect(json["authors"]).to eq([{"affiliation"=>"Juelich Supercomputing Centre, Jülich, Germany",
14
- "family-names"=>"Klatt",
15
- "given-names"=>"Torbjörn"},
16
- {"affiliation"=>"Juelich Supercomputing Centre, Jülich, Germany",
17
- "family-names"=>"Moser",
18
- "given-names"=>"Dieter"},
19
- {"affiliation"=>"Juelich Supercomputing Centre, Jülich, Germany",
20
- "family-names"=>"Speck",
21
- "given-names"=>"Robert"}])
22
- expect(json["title"]).to eq("Pypint -- Python Framework For Parallel-In-Time Methods")
23
- expect(json["abstract"]).to eq("<em>PyPinT</em> is a framework for Parallel-in-Time integration routines. The main purpose of <em>PyPinT</em> is to provide a framework for educational use and prototyping new parallel-in-time algorithms. As well it will aid in developing a high-performance C++ implementation for massively parallel computers providing the benefits of parallel-in-time routines to a zoo of time integrators in various applications.")
24
- expect(json["date-released"]).to eq("2014-05-27")
25
- expect(json["repository-code"]).to eq("https://zenodo.org/record/10164")
26
- expect(json["keywords"]).to eq(["parallel-in-time integration", "spectral deferred corrections", "multigrid", "multi-level spectral deferred corrections", "python framework"])
27
- expect(json["license"]).to be_nil
28
- expect(json["references"]).to eq("identifiers"=>[{"type"=>"url", "value"=>"https://github.com/Parallel-in-Time/PyPinT/tree/release-v0.0.4"}])
12
+ expect(json['doi']).to eq('https://doi.org/10.5281/zenodo.10164')
13
+ expect(json['authors']).to eq([{ 'affiliation' => 'Juelich Supercomputing Centre, Jülich, Germany',
14
+ 'family-names' => 'Klatt',
15
+ 'given-names' => 'Torbjörn' },
16
+ { 'affiliation' => 'Juelich Supercomputing Centre, Jülich, Germany',
17
+ 'family-names' => 'Moser',
18
+ 'given-names' => 'Dieter' },
19
+ { 'affiliation' => 'Juelich Supercomputing Centre, Jülich, Germany',
20
+ 'family-names' => 'Speck',
21
+ 'given-names' => 'Robert' }])
22
+ expect(json['title']).to eq('Pypint -- Python Framework For Parallel-In-Time Methods')
23
+ expect(json['abstract']).to eq('<em>PyPinT</em> is a framework for Parallel-in-Time integration routines. The main purpose of <em>PyPinT</em> is to provide a framework for educational use and prototyping new parallel-in-time algorithms. As well it will aid in developing a high-performance C++ implementation for massively parallel computers providing the benefits of parallel-in-time routines to a zoo of time integrators in various applications.')
24
+ expect(json['date-released']).to eq('2014-05-27')
25
+ expect(json['repository-code']).to eq('https://zenodo.org/record/10164')
26
+ expect(json['keywords']).to eq(['parallel-in-time integration',
27
+ 'spectral deferred corrections', 'multigrid', 'multi-level spectral deferred corrections', 'python framework'])
28
+ expect(json['license'].nil?).to be(true)
29
+ expect(json['references']).to eq('identifiers' => [{ 'type' => 'url',
30
+ 'value' => 'https://github.com/Parallel-in-Time/PyPinT/tree/release-v0.0.4' }])
29
31
  end
30
32
 
31
- it "SoftwareSourceCode also Zenodo" do
32
- input = "https://doi.org/10.5281/zenodo.15497"
33
- subject = Briard::Metadata.new(input: input, from: "datacite")
33
+ it 'SoftwareSourceCode also Zenodo' do
34
+ input = 'https://doi.org/10.5281/zenodo.15497'
35
+ subject = described_class.new(input: input, from: 'datacite')
34
36
  expect(subject.valid?).to be true
35
37
  json = Psych.safe_load(subject.cff, permitted_classes: [Date])
36
- expect(json["doi"]).to eq("https://doi.org/10.5281/zenodo.15497")
37
- expect(json["authors"]).to eq([{"affiliation"=>
38
- "Instituut voor Kern- en Stralingsfysica, KU Leuven, 3001 Leuven, België",
39
- "family-names"=>"Gins",
40
- "given-names"=>"Wouter"},
41
- {"affiliation"=>
42
- "Instituut voor Kern- en Stralingsfysica, KU Leuven, 3001 Leuven, België",
43
- "family-names"=>"de Groote",
44
- "given-names"=>"Ruben"},
45
- {"affiliation"=>
46
- "Instituut voor Kern- en Stralingsfysica, KU Leuven, 3001 Leuven, België",
47
- "family-names"=>"Heylen",
48
- "given-names"=>"Hanne"}])
49
- expect(json["title"]).to eq("Satlas: Simulation And Analysis Toolbox For Laser Spectroscopy And Nmr Experiments")
50
- expect(json["abstract"]).to eq("Initial release of the satlas Python package for the analysis and simulation for laser spectroscopy experiments. For the documentation, see http://woutergins.github.io/satlas/")
51
- expect(json["date-released"]).to eq("2015-02-18")
52
- expect(json["repository-code"]).to eq("https://zenodo.org/record/15497")
53
- expect(json["keywords"]).to be_nil
54
- expect(json["license"]).to be_nil
55
- expect(json["references"]).to eq("identifiers"=>[{"type"=>"url", "value"=>"https://github.com/woutergins/satlas/tree/v1.0.0"}])
38
+ expect(json['doi']).to eq('https://doi.org/10.5281/zenodo.15497')
39
+ expect(json['authors']).to eq([{ 'affiliation' =>
40
+ 'Instituut voor Kern- en Stralingsfysica, KU Leuven, 3001 Leuven, België',
41
+ 'family-names' => 'Gins',
42
+ 'given-names' => 'Wouter' },
43
+ { 'affiliation' =>
44
+ 'Instituut voor Kern- en Stralingsfysica, KU Leuven, 3001 Leuven, België',
45
+ 'family-names' => 'de Groote',
46
+ 'given-names' => 'Ruben' },
47
+ { 'affiliation' =>
48
+ 'Instituut voor Kern- en Stralingsfysica, KU Leuven, 3001 Leuven, België',
49
+ 'family-names' => 'Heylen',
50
+ 'given-names' => 'Hanne' }])
51
+ expect(json['title']).to eq('Satlas: Simulation And Analysis Toolbox For Laser Spectroscopy And Nmr Experiments')
52
+ expect(json['abstract']).to eq('Initial release of the satlas Python package for the analysis and simulation for laser spectroscopy experiments. For the documentation, see http://woutergins.github.io/satlas/')
53
+ expect(json['date-released']).to eq('2015-02-18')
54
+ expect(json['repository-code']).to eq('https://zenodo.org/record/15497')
55
+ expect(json['keywords'].nil?).to be(true)
56
+ expect(json['license'].nil?).to be(true)
57
+ expect(json['references']).to eq('identifiers' => [{ 'type' => 'url',
58
+ 'value' => 'https://github.com/woutergins/satlas/tree/v1.0.0' }])
56
59
  end
57
60
 
58
- it "ruby-cff" do
59
- input = "https://github.com/citation-file-format/ruby-cff"
60
- subject = Briard::Metadata.new(input: input)
61
+ it 'ruby-cff' do
62
+ input = 'https://github.com/citation-file-format/ruby-cff'
63
+ subject = described_class.new(input: input)
61
64
  expect(subject.valid?).to be true
62
65
  json = Psych.safe_load(subject.cff, permitted_classes: [Date])
63
- expect(json["doi"]).to eq("https://doi.org/10.5281/zenodo.1184077")
64
- expect(json["authors"]).to eq([{"affiliation"=>"The University of Manchester, UK",
65
- "family-names"=>"Haines",
66
- "given-names"=>"Robert",
67
- "orcid"=>"https://orcid.org/0000-0002-9538-7919"},
68
- {"name"=>"The Ruby Citation File Format Developers"}])
69
- expect(json["title"]).to eq("Ruby CFF Library")
70
- expect(json["abstract"]).to eq("This library provides a Ruby interface to manipulate Citation File Format files")
71
- expect(json["date-released"]).to eq("2021-08-18")
72
- expect(json["repository-code"]).to eq("https://github.com/citation-file-format/ruby-cff")
73
- expect(json["keywords"]).to eq(["ruby", "credit", "software citation", "research software", "software sustainability", "metadata", "citation file format", "cff"])
74
- expect(json["license"]).to eq("apache-2.0")
75
- expect(json["references"]).to eq("identifiers"=>[{"type"=>"doi", "value"=>"10.5281/zenodo.1003149"}])
66
+ expect(json['doi']).to eq('https://doi.org/10.5281/zenodo.1184077')
67
+ expect(json['authors']).to eq([{ 'affiliation' => 'The University of Manchester, UK',
68
+ 'family-names' => 'Haines',
69
+ 'given-names' => 'Robert',
70
+ 'orcid' => 'https://orcid.org/0000-0002-9538-7919' },
71
+ { 'name' => 'The Ruby Citation File Format Developers' }])
72
+ expect(json['title']).to eq('Ruby CFF Library')
73
+ expect(json['abstract']).to eq('This library provides a Ruby interface to manipulate Citation File Format files')
74
+ expect(json['date-released']).to eq('2021-08-18')
75
+ expect(json['repository-code']).to eq('https://github.com/citation-file-format/ruby-cff')
76
+ expect(json['keywords']).to eq(['ruby', 'credit', 'software citation', 'research software',
77
+ 'software sustainability', 'metadata', 'citation file format', 'cff'])
78
+ expect(json['license']).to eq('apache-2.0')
79
+ expect(json['references']).to eq('identifiers' => [{ 'type' => 'doi',
80
+ 'value' => '10.5281/zenodo.1003149' }])
76
81
  end
77
82
 
78
- it "Collection of Jupyter notebooks" do
79
- input = "https://doi.org/10.14454/fqq6-w751"
80
- subject = Briard::Metadata.new(input: input, from: "datacite")
83
+ it 'Collection of Jupyter notebooks' do
84
+ input = 'https://doi.org/10.14454/fqq6-w751'
85
+ subject = described_class.new(input: input, from: 'datacite')
81
86
  expect(subject.valid?).to be true
82
87
  json = Psych.safe_load(subject.cff, permitted_classes: [Date])
83
- expect(json["doi"]).to eq("https://doi.org/10.14454/fqq6-w751")
84
- expect(json["authors"]).to eq([{"family-names"=>"Petryszak",
85
- "given-names"=>"Robert",
86
- "orcid"=>"https://orcid.org/0000-0001-6333-2182"},
87
- {"affiliation"=>"DataCite",
88
- "family-names"=>"Fenner",
89
- "given-names"=>"Martin",
90
- "orcid"=>"https://orcid.org/0000-0003-1419-2405"},
91
- {"affiliation"=>"Science and Technology Facilities Council",
92
- "family-names"=>"Lambert",
93
- "given-names"=>"Simon",
94
- "orcid"=>"https://orcid.org/0000-0001-9570-8121"},
95
- {"affiliation"=>"European Bioinformatics Institute",
96
- "family-names"=>"Llinares",
97
- "given-names"=>"Manuel Bernal",
98
- "orcid"=>"https://orcid.org/0000-0002-7368-180X"},
99
- {"affiliation"=>"British Library",
100
- "family-names"=>"Madden",
101
- "given-names"=>"Frances",
102
- "orcid"=>"https://orcid.org/0000-0002-5432-6116"}])
103
- expect(json["title"]).to eq("FREYA PID Graph Jupyter Notebooks")
104
- expect(json["abstract"]).to eq("Jupyter notebooks that use GraphQL to implement EC-funded FREYA Project PID Graph user stories.")
105
- expect(json["date-released"]).to eq("2020-05-08")
106
- expect(json["repository-code"]).to eq("https://github.com/datacite/pidgraph-notebooks-python")
107
- expect(json["keywords"]).to eq(["pid graph", "pid", "graphql", "freya", "jupyter", "FOS: Computer and information sciences"])
108
- expect(json["license"]).to be_nil
109
- expect(json["references"]).to be_nil
88
+ expect(json['doi']).to eq('https://doi.org/10.14454/fqq6-w751')
89
+ expect(json['authors']).to eq([{ 'family-names' => 'Petryszak',
90
+ 'given-names' => 'Robert',
91
+ 'orcid' => 'https://orcid.org/0000-0001-6333-2182' },
92
+ { 'affiliation' => 'DataCite',
93
+ 'family-names' => 'Fenner',
94
+ 'given-names' => 'Martin',
95
+ 'orcid' => 'https://orcid.org/0000-0003-1419-2405' },
96
+ { 'affiliation' => 'Science and Technology Facilities Council',
97
+ 'family-names' => 'Lambert',
98
+ 'given-names' => 'Simon',
99
+ 'orcid' => 'https://orcid.org/0000-0001-9570-8121' },
100
+ { 'affiliation' => 'European Bioinformatics Institute',
101
+ 'family-names' => 'Llinares',
102
+ 'given-names' => 'Manuel Bernal',
103
+ 'orcid' => 'https://orcid.org/0000-0002-7368-180X' },
104
+ { 'affiliation' => 'British Library',
105
+ 'family-names' => 'Madden',
106
+ 'given-names' => 'Frances',
107
+ 'orcid' => 'https://orcid.org/0000-0002-5432-6116' }])
108
+ expect(json['title']).to eq('FREYA PID Graph Jupyter Notebooks')
109
+ expect(json['abstract']).to eq('Jupyter notebooks that use GraphQL to implement EC-funded FREYA Project PID Graph user stories.')
110
+ expect(json['date-released']).to eq('2020-05-08')
111
+ expect(json['repository-code']).to eq('https://github.com/datacite/pidgraph-notebooks-python')
112
+ expect(json['keywords']).to eq(['pid graph', 'pid', 'graphql', 'freya', 'jupyter',
113
+ 'FOS: Computer and information sciences'])
114
+ expect(json['license'].nil?).to be(true)
115
+ expect(json['references'].nil?).to be(true)
110
116
  end
111
117
  end
112
118
  end