briard 2.0.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/changelog.yml +0 -1
  3. data/.tool-versions +1 -0
  4. data/CHANGELOG.md +24 -0
  5. data/CITATION.cff +19 -0
  6. data/Gemfile.lock +1 -1
  7. data/README.md +7 -0
  8. data/lib/briard/metadata.rb +2 -2
  9. data/lib/briard/metadata_utils.rb +4 -0
  10. data/lib/briard/readers/cff_reader.rb +123 -0
  11. data/lib/briard/readers/crossref_reader.rb +3 -3
  12. data/lib/briard/utils.rb +23 -1
  13. data/lib/briard/version.rb +1 -1
  14. data/lib/briard/writers/cff_writer.rb +54 -0
  15. data/spec/find_from_format_spec.rb +21 -1
  16. data/spec/fixtures/CITATION.cff +83 -0
  17. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/cff-converter-python.yml +75 -0
  18. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/pidgraph-notebooks-python.yml +75 -0
  19. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff.yml +75 -0
  20. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_cff_metadata/ruby-cff_repository_url.yml +75 -0
  21. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/maremma.yml +10 -10
  22. data/spec/fixtures/vcr_cassettes/Briard_Metadata/get_codemeta_metadata/metadata_reports.yml +6 -6
  23. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_as_cff_url.yml +65 -0
  24. data/spec/fixtures/vcr_cassettes/Briard_Metadata/github/github_from_url_cff_file.yml +65 -0
  25. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_DataCite.yml +61 -0
  26. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_Zenodo.yml +61 -0
  27. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/SoftwareSourceCode_also_Zenodo.yml +61 -0
  28. data/spec/fixtures/vcr_cassettes/Briard_Metadata/write_metadata_as_cff/ruby-cff.yml +75 -0
  29. data/spec/metadata_spec.rb +1 -1
  30. data/spec/readers/cff_reader_spec.rb +172 -0
  31. data/spec/readers/codemeta_reader_spec.rb +1 -1
  32. data/spec/utils_spec.rb +12 -0
  33. data/spec/writers/cff_writer_spec.rb +78 -0
  34. metadata +19 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65a505fc688ba72560bdf8d29ab426970e8a6311903e967c1d2563c343e84685
4
- data.tar.gz: 2347e11f16850adbc2d334781dcab18cdbee15e9d9927e1f32b3022e79230802
3
+ metadata.gz: 349614e729e9bd290b3ca0c48eb91d49043e182a207bbbbfbfd7e1657348d362
4
+ data.tar.gz: f70c334067e2da787d68fccc1cdeb0100fc0de03c927f2eac88f63c37a598f78
5
5
  SHA512:
6
- metadata.gz: fc7b865665796f8b6c59abe93bcf5166dbe71fb2091cf74a378ba76c300e832e81a0b42af6393aaf0bb0306c71fd85461419536c2fe382bb32332378761f5967
7
- data.tar.gz: b76690c8c58f1274c98288986af0fa91eef0442a7d0c622279a541397e6aadf1cc12c1bef54561c542ecc3ac57819ee1e695bc90a94868e43db7bf80160eb305
6
+ metadata.gz: eb860b30e945398009874041f24e5ae5406db7d3e673cff493f5546ea4e867a582f5446f107026e9b1a3487b239b5c388090a4249c7311c77c709243cf9bfdb7
7
+ data.tar.gz: 445a74956b47895317231d9b231c9a1e43a0c12f5981cae4e0ffe804d74342e7adf56d1ead143732ff73acbdb6f2aac74bb0e249122f5cdda15b349b0e512066
@@ -21,7 +21,6 @@ jobs:
21
21
  uses: charmixer/auto-changelog-action@v1.4
22
22
  with:
23
23
  token: ${{ secrets.GITHUB_TOKEN }}
24
- since_tag: "1.16.2"
25
24
 
26
25
  - name: Commit files
27
26
  run: |
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.5
data/CHANGELOG.md CHANGED
@@ -1 +1,25 @@
1
1
  # Changelog
2
+
3
+ ## [2.2](https://github.com/front-matter/briard/tree/2.2) (2021-12-07)
4
+
5
+ [Full Changelog](https://github.com/front-matter/briard/compare/2.1...2.2)
6
+
7
+ ## [2.1](https://github.com/front-matter/briard/tree/2.1) (2021-12-07)
8
+
9
+ [Full Changelog](https://github.com/front-matter/briard/compare/2.0.2...2.1)
10
+
11
+ ## [2.0.2](https://github.com/front-matter/briard/tree/2.0.2) (2021-12-06)
12
+
13
+ [Full Changelog](https://github.com/front-matter/briard/compare/2.0.1...2.0.2)
14
+
15
+ ## [2.0.1](https://github.com/front-matter/briard/tree/2.0.1) (2021-12-06)
16
+
17
+ [Full Changelog](https://github.com/front-matter/briard/compare/2.0...2.0.1)
18
+
19
+ ## [2.0](https://github.com/front-matter/briard/tree/2.0) (2021-12-06)
20
+
21
+ [Full Changelog](https://github.com/front-matter/briard/compare/d1adb0353c9b3abd0b8f64fed5e0970cf03b537c...2.0)
22
+
23
+
24
+
25
+ \* *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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- briard (2.0.1)
4
+ briard (2.2.1)
5
5
  activesupport (>= 4.2.5)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (>= 5.1.0)
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>
@@ -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,123 @@
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
+ related_identifiers = Array.wrap(cff_references(meta.fetch("references", nil)))
54
+ rights_list = meta.fetch("license", nil).present? ? [hsh_to_spdx("rightsIdentifier" => meta.fetch("license"))] : nil
55
+
56
+ { "id" => id,
57
+ "types" => types,
58
+ "identifiers" => identifiers,
59
+ "doi" => doi_from_url(id),
60
+ "url" => url,
61
+ "titles" => titles,
62
+ "creators" => creators,
63
+ "publisher" => publisher,
64
+ "related_identifiers" => related_identifiers,
65
+ "dates" => dates,
66
+ "publication_year" => publication_year,
67
+ "descriptions" => meta.fetch("abstract", nil).present? ? [{ "description" => sanitize(meta.fetch("abstract")), "descriptionType" => "Abstract" }] : nil,
68
+ "rights_list" => rights_list,
69
+ "version_info" => meta.fetch("version", nil),
70
+ "subjects" => subjects,
71
+ "state" => state
72
+ }.merge(read_options)
73
+ end
74
+
75
+ def cff_creators(creators)
76
+ Array.wrap(creators).map do |a|
77
+ name_identifiers = normalize_orcid(parse_attributes(a["orcid"])).present? ? [{ "nameIdentifier" => normalize_orcid(parse_attributes(a["orcid"])), "nameIdentifierScheme" => "ORCID", "schemeUri"=>"https://orcid.org" }] : nil
78
+ if a["given-names"].present? || a["family-names"].present? || name_identifiers.present?
79
+ given_name = parse_attributes(a["given-names"])
80
+ family_name = parse_attributes(a["family-names"])
81
+ affiliation = Array.wrap(a["affiliation"]).map do |a|
82
+ if a.is_a?(Hash)
83
+ a
84
+ elsif a.is_a?(Hash) && a.key?("__content__") && a["__content__"].strip.blank?
85
+ nil
86
+ elsif a.is_a?(Hash) && a.key?("__content__")
87
+ { "name" => a["__content__"] }
88
+ elsif a.strip.blank?
89
+ nil
90
+ elsif a.is_a?(String)
91
+ { "name" => a }
92
+ end
93
+ end.compact
94
+
95
+ { "nameType" => "Personal",
96
+ "nameIdentifiers" => name_identifiers,
97
+ "name" => [family_name, given_name].compact.join(", "),
98
+ "givenName" => given_name,
99
+ "familyName" => family_name,
100
+ "affiliation" => affiliation.presence }.compact
101
+ else
102
+ { "nameType" => "Organizational",
103
+ "name" => a["name"] || a["__content__"] }
104
+ end
105
+ end
106
+ end
107
+
108
+ def cff_references(references)
109
+ Array.wrap(references).map do |r|
110
+ identifier = Array.wrap(r["identifiers"]).find { |i| i["type"] == "doi" }
111
+
112
+ if identifier.present?
113
+ { "relatedIdentifier" => normalize_id(parse_attributes(identifier["value"])),
114
+ "relationType" => "References",
115
+ "relatedIdentifierType" => "DOI" }.compact
116
+ else
117
+ nil
118
+ end
119
+ end.compact.unwrap
120
+ end
121
+ end
122
+ end
123
+ 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) && a.key?("__content__") && a["__content__"].strip.blank?
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
 
@@ -1,3 +1,3 @@
1
1
  module Briard
2
- VERSION = "2.0.1"
2
+ VERSION = "2.2.1"
3
3
  end
@@ -0,0 +1,54 @@
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
+ title = parse_attributes(titles, content: "title", first: true)
13
+
14
+ hsh = {
15
+ "cff-version" => "1.2.0",
16
+ "message" => "If you use #{title} in your work, please cite it using the following metadata",
17
+ "doi" => normalize_doi(doi),
18
+ "repository-code" => url,
19
+ "title" => parse_attributes(titles, content: "title", first: true),
20
+ "authors" => write_cff_creators(creators),
21
+ "abstract" => parse_attributes(descriptions, content: "description", first: true),
22
+ "version" => version_info,
23
+ "keywords" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
24
+ "date-released" => get_date(dates, "Issued") || publication_year,
25
+ "license" => Array.wrap(rights_list).map { |l| l["rightsIdentifier"] }.compact.unwrap,
26
+ "references" => write_references(related_identifiers)
27
+ }.compact
28
+ hsh.to_yaml
29
+ end
30
+
31
+ def write_cff_creators(creators)
32
+ Array.wrap(creators).map do |a|
33
+ if a["givenName"].present? || a["nameIdentifiers"].present?
34
+ { "given-names" => a["givenName"],
35
+ "family-names" => a["familyName"],
36
+ "orcid" => parse_attributes(a["nameIdentifiers"], content: "nameIdentifier", first: true),
37
+ "affiliation" => parse_attributes(a["affiliation"], content: "name", first: true) }.compact
38
+ else
39
+ { "name" => a["name"] }
40
+ end
41
+ end
42
+ end
43
+
44
+ def write_references(related_identifiers)
45
+ { "identifiers" =>
46
+ Array.wrap(related_identifiers).map do |r|
47
+ {
48
+ "type" => r["relatedIdentifierType"].downcase,
49
+ "value" => r["relatedIdentifierType"] == "DOI" ? doi_from_url(r["relatedIdentifier"]) : r["relatedIdentifier"] }
50
+ end }
51
+ end
52
+ end
53
+ end
54
+ 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