briard 2.0 → 2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/changelog.yml +0 -1
- data/.tool-versions +1 -0
- data/CHANGELOG.md +20 -0
- data/CITATION.cff +19 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/bolognese.gemspec +1 -1
- data/lib/briard/metadata.rb +2 -2
- data/lib/briard/metadata_utils.rb +4 -0
- data/lib/briard/readers/cff_reader.rb +107 -0
- data/lib/briard/readers/crossref_reader.rb +3 -3
- data/lib/briard/utils.rb +23 -1
- data/lib/briard/version.rb +1 -1
- data/lib/briard/writers/cff_writer.rb +27 -0
- data/spec/find_from_format_spec.rb +21 -1
- data/spec/fixtures/CITATION.cff +83 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/cff-converter-python.yml +75 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/pidgraph-notebooks-python.yml +75 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff.yml +75 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff_repository_url.yml +75 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/maremma.yml +10 -10
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/metadata_reports.yml +6 -6
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_as_cff_url.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url_cff_file.yml +65 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_DataCite.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_Zenodo.yml +61 -0
- data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_also_Zenodo.yml +61 -0
- data/spec/metadata_spec.rb +1 -1
- data/spec/readers/cff_reader_spec.rb +168 -0
- data/spec/readers/codemeta_reader_spec.rb +1 -1
- data/spec/utils_spec.rb +12 -0
- data/spec/writers/cff_writer_spec.rb +65 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 277672725deb5879eab67ba97ad3790a8af6444e3ff1d16f95c174f3f6229c8d
|
4
|
+
data.tar.gz: ea82a2e0a0cb6e1ecbdc85fae4502111dfc0b2c6a6e7a87ad8af0dea89def161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6172b62c3f60e047b0c11204d452919f7ce4a6348f50ecc8dafd2117c920600b06c2508d0af018d0aa88b8c96d0138978f0efdd8d8ce9ad621a91e4db296118
|
7
|
+
data.tar.gz: 881202c95ffad90050b687a581ffc87861397c7d861e47b898e609589243b7d3c773a8597004f54794899a8a917ea10827bf2350d64e78513a21fb39a496c916
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.7.5
|
data/CHANGELOG.md
CHANGED
@@ -1 +1,21 @@
|
|
1
1
|
# Changelog
|
2
|
+
|
3
|
+
## [2.1](https://github.com/front-matter/briard/tree/2.1) (2021-12-07)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/front-matter/briard/compare/2.0.2...2.1)
|
6
|
+
|
7
|
+
## [2.0.2](https://github.com/front-matter/briard/tree/2.0.2) (2021-12-06)
|
8
|
+
|
9
|
+
[Full Changelog](https://github.com/front-matter/briard/compare/2.0.1...2.0.2)
|
10
|
+
|
11
|
+
## [2.0.1](https://github.com/front-matter/briard/tree/2.0.1) (2021-12-06)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/front-matter/briard/compare/2.0...2.0.1)
|
14
|
+
|
15
|
+
## [2.0](https://github.com/front-matter/briard/tree/2.0) (2021-12-06)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/front-matter/briard/compare/d1adb0353c9b3abd0b8f64fed5e0970cf03b537c...2.0)
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/CITATION.cff
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
cff-version: 1.2.0
|
2
|
+
message: If you use ruby-cff in your work, please cite it using the following metadata
|
3
|
+
title: Briard
|
4
|
+
abstract: Ruby gem and command-line utility for conversion of DOI metadata from and to different metadata formats, including schema.org. Fork of version 1.19.12 of the bolognese gem.
|
5
|
+
authors:
|
6
|
+
- family-names: Fenner
|
7
|
+
given-names: Martin
|
8
|
+
orcid: https://orcid.org/0000-0003-1419-2405
|
9
|
+
affiliation: Front Matter
|
10
|
+
keywords:
|
11
|
+
- ruby
|
12
|
+
- metadata
|
13
|
+
- software citation
|
14
|
+
- research software
|
15
|
+
version: 2.0.1
|
16
|
+
date-released: 2021-08-18
|
17
|
+
license: MIT
|
18
|
+
repository-artifact: https://rubygems.org/gems/briard
|
19
|
+
repository-code: https://github.com/front-matter/briard
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -83,6 +83,13 @@ Briard reads and/or writes these metadata formats:
|
|
83
83
|
<td>Yes</td>
|
84
84
|
<td>Yes</td>
|
85
85
|
</tr>
|
86
|
+
<tr>
|
87
|
+
<td><a href='https://citation-file-format.github.io/'>CFF</a></td>
|
88
|
+
<td>citation file format (cff)</td>
|
89
|
+
<td>application/vnd.cff+yaml</td>
|
90
|
+
<td>Yes</td>
|
91
|
+
<td>Yes</td>
|
92
|
+
</tr>
|
86
93
|
<tr>
|
87
94
|
<td><a href='https://jats.nlm.nih.gov/'>JATS</a></td>
|
88
95
|
<td>jats</td>
|
data/bolognese.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.homepage = "https://github.com/front-matter/briard"
|
9
9
|
s.summary = "Ruby client library for conversion of DOI Metadata"
|
10
10
|
s.date = Date.today
|
11
|
-
s.description = "Ruby gem and command-line utility for conversion of DOI metadata from and to different metadata formats, including schema.org. Fork of bolognese gem."
|
11
|
+
s.description = "Ruby gem and command-line utility for conversion of DOI metadata from and to different metadata formats, including schema.org. Fork of version 1.19.12 of the bolognese gem."
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.version = Briard::VERSION
|
14
14
|
s.extra_rdoc_files = ["README.md"]
|
data/lib/briard/metadata.rb
CHANGED
@@ -43,7 +43,7 @@ module Briard
|
|
43
43
|
elsif options[:input].present? && File.exist?(options[:input])
|
44
44
|
filename = File.basename(options[:input])
|
45
45
|
ext = File.extname(options[:input])
|
46
|
-
if %w(.bib .ris .xml .json).include?(ext)
|
46
|
+
if %w(.bib .ris .xml .json .cff).include?(ext)
|
47
47
|
hsh = {
|
48
48
|
"url" => options[:url],
|
49
49
|
"state" => options[:state],
|
@@ -83,7 +83,7 @@ module Briard
|
|
83
83
|
end
|
84
84
|
|
85
85
|
# make sure input is encoded as utf8
|
86
|
-
string = string.force_encoding("UTF-8") if string.present?
|
86
|
+
string = string.force_encoding("UTF-8") if string.present? && string.is_a?(String)
|
87
87
|
@string = string
|
88
88
|
|
89
89
|
# input options for citation formatting
|
@@ -8,6 +8,7 @@ require_relative 'utils'
|
|
8
8
|
|
9
9
|
require_relative 'readers/bibtex_reader'
|
10
10
|
require_relative 'readers/citeproc_reader'
|
11
|
+
require_relative 'readers/cff_reader'
|
11
12
|
require_relative 'readers/codemeta_reader'
|
12
13
|
require_relative 'readers/crosscite_reader'
|
13
14
|
require_relative 'readers/crossref_reader'
|
@@ -20,6 +21,7 @@ require_relative 'readers/schema_org_reader'
|
|
20
21
|
require_relative 'writers/bibtex_writer'
|
21
22
|
require_relative 'writers/citation_writer'
|
22
23
|
require_relative 'writers/citeproc_writer'
|
24
|
+
require_relative 'writers/cff_writer'
|
23
25
|
require_relative 'writers/codemeta_writer'
|
24
26
|
require_relative 'writers/crosscite_writer'
|
25
27
|
require_relative 'writers/crossref_writer'
|
@@ -43,6 +45,7 @@ module Briard
|
|
43
45
|
|
44
46
|
include Briard::Readers::BibtexReader
|
45
47
|
include Briard::Readers::CiteprocReader
|
48
|
+
include Briard::Readers::CffReader
|
46
49
|
include Briard::Readers::CodemetaReader
|
47
50
|
include Briard::Readers::CrossciteReader
|
48
51
|
include Briard::Readers::CrossrefReader
|
@@ -55,6 +58,7 @@ module Briard
|
|
55
58
|
include Briard::Writers::BibtexWriter
|
56
59
|
include Briard::Writers::CitationWriter
|
57
60
|
include Briard::Writers::CiteprocWriter
|
61
|
+
include Briard::Writers::CffWriter
|
58
62
|
include Briard::Writers::CodemetaWriter
|
59
63
|
include Briard::Writers::CrossciteWriter
|
60
64
|
include Briard::Writers::CrossrefWriter
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Briard
|
4
|
+
module Readers
|
5
|
+
module CffReader
|
6
|
+
def get_cff(id: nil, **options)
|
7
|
+
return { "string" => nil, "state" => "not_found" } unless id.present?
|
8
|
+
id = normalize_id(id)
|
9
|
+
response = Maremma.get(github_as_cff_url(id), accept: "json", raw: true)
|
10
|
+
data = response.body.fetch("data", nil)
|
11
|
+
# Dates are parsed to date object, need to convert to iso8601 later
|
12
|
+
string = Psych.safe_load(data, permitted_classes: [Date])
|
13
|
+
{ "string" => string }
|
14
|
+
end
|
15
|
+
|
16
|
+
def read_cff(string: nil, **options)
|
17
|
+
read_options = ActiveSupport::HashWithIndifferentAccess.new(options.except(:doi, :id, :url, :sandbox, :validate, :ra))
|
18
|
+
meta = string.is_a?(String) ? Psych.safe_load(string, permitted_classes: [Date]) : string
|
19
|
+
|
20
|
+
identifiers = Array.wrap(meta.fetch("identifiers", nil)).map do |r|
|
21
|
+
r = normalize_id(r) if r.is_a?(String)
|
22
|
+
if r.is_a?(String) && !r.start_with?("https://doi.org")
|
23
|
+
{ "identifierType" => "URL", "identifier" => r }
|
24
|
+
elsif r.is_a?(Hash)
|
25
|
+
{ "identifierType" => get_identifier_type(r["propertyID"]), "identifier" => r["value"] }
|
26
|
+
end
|
27
|
+
end.compact.uniq
|
28
|
+
|
29
|
+
id = normalize_id(options[:doi] || meta.fetch("doi", nil) || Array.wrap(meta.fetch("identifiers", nil)).find { |i| i["type"] == "doi"}.fetch("value", nil))
|
30
|
+
url = normalize_id(meta.fetch("repository-code", nil))
|
31
|
+
creators = cff_creators(Array.wrap(meta.fetch("authors", nil)))
|
32
|
+
|
33
|
+
dates = []
|
34
|
+
dates << { "date" => meta.fetch("date-released", nil).iso8601, "dateType" => "Issued" } if meta.fetch("date-released", nil).present?
|
35
|
+
publication_year = meta.fetch("date-released").iso8601[0..3] if meta.fetch("date-released", nil).present?
|
36
|
+
publisher = url.to_s.starts_with?("https://github.com") ? "GitHub" : nil
|
37
|
+
state = meta.present? || read_options.present? ? "findable" : "not_found"
|
38
|
+
types = {
|
39
|
+
"resourceTypeGeneral" => "Software",
|
40
|
+
"resourceType" => nil,
|
41
|
+
"schemaOrg" => "SoftwareSourceCode",
|
42
|
+
"citeproc" => "article-journal",
|
43
|
+
"bibtex" => "misc",
|
44
|
+
"ris" => "COMP"
|
45
|
+
}.compact
|
46
|
+
subjects = Array.wrap(meta.fetch("keywords", nil)).reduce([]) do |sum, subject|
|
47
|
+
sum += name_to_fos(subject)
|
48
|
+
|
49
|
+
sum
|
50
|
+
end
|
51
|
+
|
52
|
+
titles = meta.fetch("title", nil).present? ? [{ "title" => meta.fetch("title", nil) }] : []
|
53
|
+
rights_list = meta.fetch("license", nil).present? ? [hsh_to_spdx("rightsIdentifier" => meta.fetch("license"))] : nil
|
54
|
+
|
55
|
+
{ "id" => id,
|
56
|
+
"types" => types,
|
57
|
+
"identifiers" => identifiers,
|
58
|
+
"doi" => doi_from_url(id),
|
59
|
+
"url" => url,
|
60
|
+
"titles" => titles,
|
61
|
+
"creators" => creators,
|
62
|
+
"publisher" => publisher,
|
63
|
+
"dates" => dates,
|
64
|
+
"publication_year" => publication_year,
|
65
|
+
"descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract")), "descriptionType" => "Abstract" }] : nil,
|
66
|
+
"rights_list" => rights_list,
|
67
|
+
"version_info" => meta.fetch("version", nil),
|
68
|
+
"subjects" => subjects,
|
69
|
+
"state" => state
|
70
|
+
}.merge(read_options)
|
71
|
+
end
|
72
|
+
|
73
|
+
def cff_creators(creators)
|
74
|
+
Array.wrap(creators).map do |a|
|
75
|
+
name_identifiers = normalize_orcid(parse_attributes(a["orcid"])).present? ? [{ "nameIdentifier" => normalize_orcid(parse_attributes(a["orcid"])), "nameIdentifierScheme" => "ORCID", "schemeUri"=>"https://orcid.org" }] : nil
|
76
|
+
if a["given-names"].present? || name_identifiers.present?
|
77
|
+
given_name = parse_attributes(a["given-names"])
|
78
|
+
family_name = parse_attributes(a["family-names"])
|
79
|
+
affiliation = Array.wrap(a["affiliation"]).map do |a|
|
80
|
+
if a.is_a?(Hash)
|
81
|
+
a
|
82
|
+
elsif a.is_a?(Hash) && a.key?("__content__") && a["__content__"].strip.blank?
|
83
|
+
nil
|
84
|
+
elsif a.is_a?(Hash) && a.key?("__content__")
|
85
|
+
{ "name" => a["__content__"] }
|
86
|
+
elsif a.strip.blank?
|
87
|
+
nil
|
88
|
+
elsif a.is_a?(String)
|
89
|
+
{ "name" => a }
|
90
|
+
end
|
91
|
+
end.compact
|
92
|
+
|
93
|
+
{ "nameType" => "Personal",
|
94
|
+
"nameIdentifiers" => name_identifiers,
|
95
|
+
"name" => [family_name, given_name].compact.join(", "),
|
96
|
+
"givenName" => given_name,
|
97
|
+
"familyName" => family_name,
|
98
|
+
"affiliation" => affiliation.presence }.compact
|
99
|
+
else
|
100
|
+
{ "nameType" => "Organizational",
|
101
|
+
"name" => a["name"] || a["__content__"] }
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -264,12 +264,12 @@ module Briard
|
|
264
264
|
given_name = parse_attributes(a["given_name"])
|
265
265
|
family_name = parse_attributes(a["surname"])
|
266
266
|
affiliation = Array.wrap(a["affiliation"]).map do |a|
|
267
|
-
if a.is_a?(Hash)
|
267
|
+
if a.is_a?(Hash)
|
268
|
+
a
|
269
|
+
elsif a.is_a?(Hash) && a.key?("__content__") && a["__content__"].strip.blank?
|
268
270
|
nil
|
269
271
|
elsif a.is_a?(Hash) && a.key?("__content__")
|
270
272
|
{ "name" => a["__content__"] }
|
271
|
-
elsif a.is_a?(Hash)
|
272
|
-
a
|
273
273
|
elsif a.strip.blank?
|
274
274
|
nil
|
275
275
|
elsif a.is_a?(String)
|
data/lib/briard/utils.rb
CHANGED
@@ -506,8 +506,12 @@ module Briard
|
|
506
506
|
"orcid"
|
507
507
|
elsif /\A(http|https):\/(\/)?github\.com\/(.+)\/package.json\z/.match(id)
|
508
508
|
"npm"
|
509
|
-
elsif /\A(http|https):\/(\/)?github\.com\/(.+)\z/.match(id)
|
509
|
+
elsif /\A(http|https):\/(\/)?github\.com\/(.+)\/codemeta.json\z/.match(id)
|
510
510
|
"codemeta"
|
511
|
+
elsif /\A(http|https):\/(\/)?github\.com\/(.+)\/CITATION.cff\z/.match(id)
|
512
|
+
"cff"
|
513
|
+
elsif /\A(http|https):\/(\/)?github\.com\/(.+)\z/.match(id)
|
514
|
+
"cff"
|
511
515
|
else
|
512
516
|
"schema_org"
|
513
517
|
end
|
@@ -516,6 +520,8 @@ module Briard
|
|
516
520
|
def find_from_format_by_filename(filename)
|
517
521
|
if filename == "package.json"
|
518
522
|
"npm"
|
523
|
+
elsif filename == "CITATION.cff"
|
524
|
+
"cff"
|
519
525
|
end
|
520
526
|
end
|
521
527
|
|
@@ -528,6 +534,8 @@ module Briard
|
|
528
534
|
"crossref"
|
529
535
|
elsif options[:ext] == ".xml" && Nokogiri::XML(string, nil, 'UTF-8', &:noblanks).collect_namespaces.find { |k, v| v.start_with?("http://datacite.org/schema/kernel") }
|
530
536
|
"datacite"
|
537
|
+
elsif options[:ext] == ".cff"
|
538
|
+
"cff"
|
531
539
|
elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("@context").to_s.start_with?("http://schema.org", "https://schema.org")
|
532
540
|
"schema_org"
|
533
541
|
elsif options[:ext] == ".json" && Maremma.from_json(string).to_h.dig("@context") == ("https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld")
|
@@ -558,9 +566,13 @@ module Briard
|
|
558
566
|
"citeproc"
|
559
567
|
elsif string.start_with?("TY - ")
|
560
568
|
"ris"
|
569
|
+
elsif YAML.load(string).to_h.fetch("cff-version", nil).present?
|
570
|
+
"cff"
|
561
571
|
elsif BibTeX.parse(string).first
|
562
572
|
"bibtex"
|
563
573
|
end
|
574
|
+
rescue Psych::SyntaxError => error
|
575
|
+
"bibtex"
|
564
576
|
rescue BibTeX::ParseError => error
|
565
577
|
nil
|
566
578
|
end
|
@@ -1079,6 +1091,16 @@ module Briard
|
|
1079
1091
|
end
|
1080
1092
|
end
|
1081
1093
|
|
1094
|
+
def github_as_cff_url(url)
|
1095
|
+
github_hash = github_from_url(url)
|
1096
|
+
|
1097
|
+
if github_hash[:path].to_s.end_with?("CITATION.cff")
|
1098
|
+
"https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/#{github_hash[:release]}/#{github_hash[:path]}"
|
1099
|
+
elsif github_hash[:owner].present?
|
1100
|
+
"https://raw.githubusercontent.com/#{github_hash[:owner]}/#{github_hash[:repo]}/main/CITATION.cff"
|
1101
|
+
end
|
1102
|
+
end
|
1103
|
+
|
1082
1104
|
def get_date_parts(iso8601_time)
|
1083
1105
|
return { 'date-parts' => [[]] } if iso8601_time.nil?
|
1084
1106
|
|
data/lib/briard/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Briard
|
4
|
+
module Writers
|
5
|
+
module CffWriter
|
6
|
+
def cff
|
7
|
+
return nil unless valid? || show_errors
|
8
|
+
|
9
|
+
# only use CFF for software
|
10
|
+
return nil unless types["resourceTypeGeneral"] == "Software"
|
11
|
+
|
12
|
+
hsh = {
|
13
|
+
"doi" => normalize_doi(doi),
|
14
|
+
"repository-code" => url,
|
15
|
+
"title" => parse_attributes(titles, content: "title", first: true),
|
16
|
+
"authors" => creators,
|
17
|
+
"abstract" => parse_attributes(descriptions, content: "description", first: true),
|
18
|
+
"version" => version_info,
|
19
|
+
"keywords" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
|
20
|
+
"date-released" => get_date(dates, "Issued") || publication_year,
|
21
|
+
"license" => Array.wrap(rights_list).map { |l| l["rightsUri"] }.compact.unwrap,
|
22
|
+
}.compact
|
23
|
+
hsh.to_yaml
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -39,8 +39,18 @@ describe Briard::CLI do
|
|
39
39
|
expect(subject.find_from_format_by_id(id)).to eq("op")
|
40
40
|
end
|
41
41
|
|
42
|
+
it "cff" do
|
43
|
+
id = "https://github.com/citation-file-format/ruby-cff/blob/main/CITATION.cff"
|
44
|
+
expect(subject.find_from_format_by_id(id)).to eq("cff")
|
45
|
+
end
|
46
|
+
|
47
|
+
it "cff repository url" do
|
48
|
+
id = "https://github.com/citation-file-format/ruby-cff"
|
49
|
+
expect(subject.find_from_format_by_id(id)).to eq("cff")
|
50
|
+
end
|
51
|
+
|
42
52
|
it "codemeta" do
|
43
|
-
id = "https://github.com/datacite/maremma"
|
53
|
+
id = "https://github.com/datacite/maremma/blob/master/codemeta.json"
|
44
54
|
expect(subject.find_from_format_by_id(id)).to eq("codemeta")
|
45
55
|
end
|
46
56
|
|
@@ -64,6 +74,11 @@ describe Briard::CLI do
|
|
64
74
|
filename = "package.json"
|
65
75
|
expect(subject.find_from_format_by_filename(filename)).to eq("npm")
|
66
76
|
end
|
77
|
+
|
78
|
+
it "cff" do
|
79
|
+
filename = "CITATION.cff"
|
80
|
+
expect(subject.find_from_format_by_filename(filename)).to eq("cff")
|
81
|
+
end
|
67
82
|
end
|
68
83
|
|
69
84
|
context "find_from_format_by_string" do
|
@@ -91,6 +106,11 @@ describe Briard::CLI do
|
|
91
106
|
expect(subject.find_from_format_by_string(string)).to eq("codemeta")
|
92
107
|
end
|
93
108
|
|
109
|
+
it "cff" do
|
110
|
+
string = IO.read(fixture_path + 'CITATION.cff').strip
|
111
|
+
expect(subject.find_from_format_by_string(string)).to eq("cff")
|
112
|
+
end
|
113
|
+
|
94
114
|
it "schema_org" do
|
95
115
|
string = IO.read(fixture_path + 'schema_org_topmed.json').strip
|
96
116
|
expect(subject.find_from_format_by_string(string)).to eq("schema_org")
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# This CITATION.cff file was created by ruby-cff (v 0.9.0).
|
2
|
+
# Gem: https://rubygems.org/gems/cff
|
3
|
+
# CFF: https://citation-file-format.github.io/
|
4
|
+
|
5
|
+
cff-version: 1.2.0
|
6
|
+
message: If you use ruby-cff in your work, please cite it using the following metadata
|
7
|
+
title: Ruby CFF Library
|
8
|
+
abstract: This library provides a Ruby interface to manipulate Citation File Format files
|
9
|
+
authors:
|
10
|
+
- family-names: Haines
|
11
|
+
given-names: Robert
|
12
|
+
orcid: https://orcid.org/0000-0002-9538-7919
|
13
|
+
affiliation: The University of Manchester, UK
|
14
|
+
- name: The Ruby Citation File Format Developers
|
15
|
+
keywords:
|
16
|
+
- ruby
|
17
|
+
- credit
|
18
|
+
- software citation
|
19
|
+
- research software
|
20
|
+
- software sustainability
|
21
|
+
- metadata
|
22
|
+
- citation file format
|
23
|
+
- CFF
|
24
|
+
version: 0.9.0
|
25
|
+
doi: 10.5281/zenodo.1184077
|
26
|
+
date-released: 2021-08-18
|
27
|
+
license: Apache-2.0
|
28
|
+
repository-artifact: https://rubygems.org/gems/cff
|
29
|
+
repository-code: https://github.com/citation-file-format/ruby-cff
|
30
|
+
references:
|
31
|
+
- type: software
|
32
|
+
title: Citation File Format
|
33
|
+
authors:
|
34
|
+
- family-names: Druskat
|
35
|
+
given-names: Stephan
|
36
|
+
orcid: https://orcid.org/0000-0003-4925-7248
|
37
|
+
- family-names: Spaaks
|
38
|
+
given-names: Jurriaan H.
|
39
|
+
orcid: https://orcid.org/0000-0002-7064-4069
|
40
|
+
- family-names: Chue Hong
|
41
|
+
given-names: Neil
|
42
|
+
orcid: https://orcid.org/0000-0002-8876-7606
|
43
|
+
- family-names: Haines
|
44
|
+
given-names: Robert
|
45
|
+
orcid: https://orcid.org/0000-0002-9538-7919
|
46
|
+
- family-names: Baker
|
47
|
+
given-names: James
|
48
|
+
orcid: https://orcid.org/0000-0002-2682-6922
|
49
|
+
- family-names: Bliven
|
50
|
+
given-names: Spencer
|
51
|
+
orcid: https://orcid.org/0000-0002-1200-1698
|
52
|
+
email: spencer.bliven@gmail.com
|
53
|
+
- family-names: Willighagen
|
54
|
+
given-names: Egon
|
55
|
+
orcid: https://orcid.org/0000-0001-7542-0286
|
56
|
+
- family-names: Pérez-Suárez
|
57
|
+
given-names: David
|
58
|
+
orcid: https://orcid.org/0000-0003-0784-6909
|
59
|
+
website: https://dpshelio.github.io
|
60
|
+
- family-names: Konovalov
|
61
|
+
given-names: Alexander
|
62
|
+
orcid: https://orcid.org/0000-0001-5299-3292
|
63
|
+
identifiers:
|
64
|
+
- type: doi
|
65
|
+
value: 10.5281/zenodo.1003149
|
66
|
+
description: The concept DOI for the collection containing all versions of the Citation File Format.
|
67
|
+
- type: doi
|
68
|
+
value: 10.5281/zenodo.5171937
|
69
|
+
description: The versioned DOI for the version 1.2.0 of the Citation File Format.
|
70
|
+
keywords:
|
71
|
+
- citation file format
|
72
|
+
- CFF
|
73
|
+
- citation files
|
74
|
+
- software citation
|
75
|
+
- file format
|
76
|
+
- YAML
|
77
|
+
- software sustainability
|
78
|
+
- research software
|
79
|
+
- credit
|
80
|
+
abstract: CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.
|
81
|
+
date-released: 2021-08-09
|
82
|
+
license: CC-BY-4.0
|
83
|
+
version: 1.2.0
|
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://raw.githubusercontent.com/citation-file-format/cff-converter-python/main/CITATION.cff
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Mozilla/5.0 (compatible; Maremma/4.9.6; mailto:info@front-matter.io)
|
12
|
+
Accept:
|
13
|
+
- application/json;charset=UTF-8
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip,deflate
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Content-Length:
|
24
|
+
- '1212'
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=300
|
27
|
+
Content-Security-Policy:
|
28
|
+
- default-src 'none'; style-src 'unsafe-inline'; sandbox
|
29
|
+
Content-Type:
|
30
|
+
- text/plain; charset=utf-8
|
31
|
+
Etag:
|
32
|
+
- W/"481e62c88d87f88f330c3713aad93abd1a281b2967c7ad0cd91ccca939567e52"
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31536000
|
35
|
+
X-Content-Type-Options:
|
36
|
+
- nosniff
|
37
|
+
X-Frame-Options:
|
38
|
+
- deny
|
39
|
+
X-Xss-Protection:
|
40
|
+
- 1; mode=block
|
41
|
+
X-Github-Request-Id:
|
42
|
+
- B098:F9B8:176B365:188E5A5:61AF23E8
|
43
|
+
Content-Encoding:
|
44
|
+
- gzip
|
45
|
+
Accept-Ranges:
|
46
|
+
- bytes
|
47
|
+
Date:
|
48
|
+
- Tue, 07 Dec 2021 09:05:45 GMT
|
49
|
+
Via:
|
50
|
+
- 1.1 varnish
|
51
|
+
X-Served-By:
|
52
|
+
- cache-hhn4043-HHN
|
53
|
+
X-Cache:
|
54
|
+
- MISS
|
55
|
+
X-Cache-Hits:
|
56
|
+
- '0'
|
57
|
+
X-Timer:
|
58
|
+
- S1638867945.967912,VS0,VE186
|
59
|
+
Vary:
|
60
|
+
- Authorization,Accept-Encoding,Origin
|
61
|
+
Access-Control-Allow-Origin:
|
62
|
+
- "*"
|
63
|
+
X-Fastly-Request-Id:
|
64
|
+
- 8209173bb874db42d9e8e382110b46303cc17b0a
|
65
|
+
Expires:
|
66
|
+
- Tue, 07 Dec 2021 09:10:45 GMT
|
67
|
+
Source-Age:
|
68
|
+
- '0'
|
69
|
+
body:
|
70
|
+
encoding: ASCII-8BIT
|
71
|
+
string: !binary |-
|
72
|
+
H4sIAAAAAAAAA62XXXLiOBDH3zmFDrAytsGAedgqQiabTDJJKjAftW/CbmMNtuSS5bDMefYme7FtyRBMgCmo4KpUsGR3/7rVav3NZqVWLNJDMpZ5zkRMMi6AFErOFcuJluSVZTxmGoiZjKR4BaXJ+G46mt49PTpRkpCEZ1A6LVbpVKpy2CKEEpbgKGeaSzEkj6BTUBkaKAlMIg4iAjIGoUHhw4QkLOfZigqWQzkkk4KxRWkn5vwVxGb8c6UUZ0yQW8dOShXxeEhSrYty2G7bW0eqedvFi+KfT/tur0u7bi/8KNN9xl7XEztMU5l/1PQ3UKkEtLlvfaIhYeLUYIOB71Hf7bn7RLdVPpNZrOlXgfZVyfV//2ryqyJXyMnFAaprVZULpg8yFempUB3aDf2A9v3uYB/qjWVFZEKeykwe4HgAKSIu9zm+syzmdT7NCC0rtP2PTb6WLSxLao0bR57jO27L1DBVkAErAaF9F7PlhtT3WzzGteEJh03x6lUBQxJLbs3jBqjw1nOdwB947V8gZCwdz+v5btC3T8RQRooXdVjPxm2p0STZGiaJVIRlGVlDlSZkhFzvp5O9BoHv9XtnedUpLzduj3qtVNb0ulnROddpNXMimbcjru26UbPbKRrOmW6bNK+NgaLFChuA2Gf7+vJgGgluCvIX17fVjCgoJC68VCuLeA5SsSq4rTFsUT8hsgzbl9953s4RDP559XzXWsBqKVW8XukZn2XctLoiXdmBKz6bwg/7E1+u/68jtzfNxlcPyBi+gGb25pOIH6UG+/vlblI/sH6d3GDiyI1NXCvjEYgSwxoVLEqBmgLFsi7ZHMfuErKSFalKqBevlIleMgV/kMJWryECwjU+wcXc5BXHcmTAEmdOa5tcyhQWgu3up6Sv8WKEUX2wDDTXGTSXoPW2ITFajFdBAsr0xs2RsT0/zHVmU91vHX8v2bpP7R8lTAhYwNuk7SCFyVZkmF/xkIkbdk9ovoOOH+Jx47qXov8OapHKzbGwF8FVY2Kf/hzyfuAOaMfv+5ciH4kYMnYEW1ZLOJ3Oo6HrBnQQdi+W1ytZHkZ7ZlrxaHFO6npup0PDnvvjYqnTGvIjqfvMy7Pg3LA7oB6eFhfLHFssGpMHdNBF3DTk334O3knAU0u8IQMvwnhfFQVKtkwfxrxmifhdczmH3e/1fOqFYfdS7N/gWE95kBX24/KsHdDxPCyy3uBSdC8yOwz36e2EPwnNw44c9Gm3G3Qul7imUN8DbIj1E5PXFOwXIbxGNXMM74ap6sz+MQhp6IcXa27TnxLVyj3PyYSJ+ZFVVvwsyEG3gyp+4NWQexLfG1C3T71aL7+T+XVMO3JxjN8aUGhy/XRndelvYkQxaVQOmUJeZExvd/uuijfXke+Hjuf2A88+1dSkNVYk5YJDVOltOlEX7/qiawZ7e0hQmvFTNN3jA0zG7Vq20R0naw13bh7qHGxka63iN9rPdbqOe1jv7ZbLl2gUS3nkuOG51FaxvzHeyqX5yBgbaTxZeyZckNHzCLfmKmuSzTJZ1x9+YwzJn3TtZJMaM+2wgpXmNVtwm5s2llTQdr12KpdUS2qEON3ESbmg+CCtX0t1nrX+B23vkxxeEQAA
|
73
|
+
http_version:
|
74
|
+
recorded_at: Tue, 07 Dec 2021 09:05:45 GMT
|
75
|
+
recorded_with: VCR 3.0.3
|
data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/pidgraph-notebooks-python.yml
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://raw.githubusercontent.com/datacite/pidgraph-notebooks-python/master/CITATION.cff
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Mozilla/5.0 (compatible; Maremma/4.9.6; mailto:info@front-matter.io)
|
12
|
+
Accept:
|
13
|
+
- application/json;charset=UTF-8
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip,deflate
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Connection:
|
22
|
+
- keep-alive
|
23
|
+
Content-Length:
|
24
|
+
- '179'
|
25
|
+
Cache-Control:
|
26
|
+
- max-age=300
|
27
|
+
Content-Security-Policy:
|
28
|
+
- default-src 'none'; style-src 'unsafe-inline'; sandbox
|
29
|
+
Content-Type:
|
30
|
+
- text/plain; charset=utf-8
|
31
|
+
Etag:
|
32
|
+
- W/"904897bb01e8a81799120f8fbea0b9eda07bef8124d684df22007d3de35a640c"
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=31536000
|
35
|
+
X-Content-Type-Options:
|
36
|
+
- nosniff
|
37
|
+
X-Frame-Options:
|
38
|
+
- deny
|
39
|
+
X-Xss-Protection:
|
40
|
+
- 1; mode=block
|
41
|
+
X-Github-Request-Id:
|
42
|
+
- A448:F9B8:1763958:18867D3:61AF22E7
|
43
|
+
Content-Encoding:
|
44
|
+
- gzip
|
45
|
+
Accept-Ranges:
|
46
|
+
- bytes
|
47
|
+
Date:
|
48
|
+
- Tue, 07 Dec 2021 09:01:27 GMT
|
49
|
+
Via:
|
50
|
+
- 1.1 varnish
|
51
|
+
X-Served-By:
|
52
|
+
- cache-hhn4076-HHN
|
53
|
+
X-Cache:
|
54
|
+
- MISS
|
55
|
+
X-Cache-Hits:
|
56
|
+
- '0'
|
57
|
+
X-Timer:
|
58
|
+
- S1638867687.247696,VS0,VE211
|
59
|
+
Vary:
|
60
|
+
- Authorization,Accept-Encoding,Origin
|
61
|
+
Access-Control-Allow-Origin:
|
62
|
+
- "*"
|
63
|
+
X-Fastly-Request-Id:
|
64
|
+
- a9a785c986684079c845062877d41c83fb8d2de6
|
65
|
+
Expires:
|
66
|
+
- Tue, 07 Dec 2021 09:06:27 GMT
|
67
|
+
Source-Age:
|
68
|
+
- '0'
|
69
|
+
body:
|
70
|
+
encoding: ASCII-8BIT
|
71
|
+
string: !binary |-
|
72
|
+
H4sIAAAAAAAAA1XNPQ+CMBCA4b2/4uJssSWghs3Ej+BgjJtjlas0oge9Q8K/l7i5vsP7qLv3+oORA70LsIlNjHohs3tgAbPSw0g99IwgdWBg8jK4iHNoG3RTvQdBCAKO4YYNDclMuV5qilyoisJ0NInNsjxb+K5b6mGVW/WnWSVBmsnaX3bXDZzLLRyia2s49u0oGOFEgjeiJ6vKCeqIP7gqIDWp0SbXZq2+JhyHJMUAAAA=
|
73
|
+
http_version:
|
74
|
+
recorded_at: Tue, 07 Dec 2021 09:01:27 GMT
|
75
|
+
recorded_with: VCR 3.0.3
|