cirneco 0.7.2 → 0.7.3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -8
- data/cirneco.gemspec +1 -1
- data/lib/cirneco/utils.rb +17 -11
- data/lib/cirneco/version.rb +1 -1
- data/spec/fixtures/cool-dois.yml +1 -0
- data/spec/utils_spec.rb +9 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbfad88c2c54f5051b560e08c5e4b8bf712a0ddf
|
4
|
+
data.tar.gz: 6eb1e706e6fdb0315b2c1605d38da5239bcedfaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76547c8dfa55b15f623d9bd083a3f1dabb40f41262d41943e3766ff04e7d6e1d48409cc68bc2556e60b105a61437e061890da2b61bb59dad6bd2606a073824e5
|
7
|
+
data.tar.gz: 552148f8314551d7bae6bce5f35031b3708df2e3ad19c400d8ce4b8777d4e76a6c4e9ce5d94923efa212d78303922f37e6a7f1dd1a6a4c8fff4ecc9bffe008e5
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cirneco (0.7.
|
4
|
+
cirneco (0.7.3)
|
5
5
|
activesupport (~> 4.2, >= 4.2.5)
|
6
6
|
base32-crockford-checksum (~> 0.2.2)
|
7
|
-
bergamasco (~> 0.
|
7
|
+
bergamasco (~> 0.3)
|
8
8
|
builder (~> 3.2, >= 3.2.2)
|
9
9
|
dotenv (~> 2.1, >= 2.1.1)
|
10
10
|
maremma (~> 3.1)
|
@@ -22,11 +22,10 @@ GEM
|
|
22
22
|
tzinfo (~> 1.1)
|
23
23
|
addressable (2.3.8)
|
24
24
|
base32-crockford-checksum (0.2.3)
|
25
|
-
bergamasco (0.
|
25
|
+
bergamasco (0.3.4)
|
26
26
|
activesupport (~> 4.2, >= 4.2.5)
|
27
27
|
addressable (~> 2.3.8)
|
28
28
|
builder (~> 3.2, >= 3.2.2)
|
29
|
-
commonmarker (~> 0.14.0)
|
30
29
|
loofah (~> 2.0, >= 2.0.3)
|
31
30
|
multi_json (~> 1.11.2)
|
32
31
|
nokogiri (~> 1.6.7)
|
@@ -36,8 +35,6 @@ GEM
|
|
36
35
|
builder (3.2.2)
|
37
36
|
codeclimate-test-reporter (1.0.3)
|
38
37
|
simplecov
|
39
|
-
commonmarker (0.14.0)
|
40
|
-
ruby-enum (~> 0.4)
|
41
38
|
crack (0.4.3)
|
42
39
|
safe_yaml (~> 1.0.0)
|
43
40
|
diff-lcs (1.2.5)
|
@@ -93,8 +90,6 @@ GEM
|
|
93
90
|
rspec-xsd (0.1.0)
|
94
91
|
nokogiri (~> 1.6)
|
95
92
|
rspec (~> 3)
|
96
|
-
ruby-enum (0.6.0)
|
97
|
-
i18n
|
98
93
|
safe_yaml (1.0.4)
|
99
94
|
simplecov (0.12.0)
|
100
95
|
docile (~> 1.1.0)
|
data/cirneco.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
# Declary dependencies here, rather than in the Gemfile
|
18
18
|
s.add_dependency 'maremma', '~> 3.1'
|
19
|
-
s.add_dependency 'bergamasco', '~> 0.
|
19
|
+
s.add_dependency 'bergamasco', '~> 0.3'
|
20
20
|
s.add_dependency 'base32-crockford-checksum', '~> 0.2.2'
|
21
21
|
s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
|
22
22
|
s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
|
data/lib/cirneco/utils.rb
CHANGED
@@ -33,12 +33,12 @@ module Cirneco
|
|
33
33
|
return "File #{filename} ignored: not a markdown file" unless File.extname(filepath) == ".md"
|
34
34
|
|
35
35
|
old_metadata = Bergamasco::Markdown.read_yaml_for_doi_metadata(filepath)
|
36
|
-
return "
|
36
|
+
return "DOI #{old_metadata["doi"]} not changed for #{filename}" if old_metadata["doi"] && old_metadata["published"]
|
37
37
|
|
38
38
|
metadata = generate_metadata_for_work(filepath, options)
|
39
39
|
work = post_metadata_for_work(metadata, options)
|
40
40
|
|
41
|
-
return "Errors for DOI #{metadata["doi"]}:\n#{work.validation_errors}" if work.validation_errors.present?
|
41
|
+
# return "Errors for DOI #{metadata["doi"]}:\n#{work.validation_errors}" if work.validation_errors.present?
|
42
42
|
|
43
43
|
new_metadata = Bergamasco::Markdown.update_file(filepath, "doi" => metadata["doi"], "published" => true)
|
44
44
|
"DOI #{new_metadata["doi"]} minted for #{filename}"
|
@@ -51,12 +51,12 @@ module Cirneco
|
|
51
51
|
return "File #{filename} ignored: not a markdown file" unless File.extname(filepath) == ".md"
|
52
52
|
|
53
53
|
old_metadata = Bergamasco::Markdown.read_yaml_for_doi_metadata(filepath)
|
54
|
-
return "
|
54
|
+
return "DOI #{old_metadata["doi"]} not changed for #{filename}" unless old_metadata["doi"] && old_metadata["published"]
|
55
55
|
|
56
56
|
metadata = generate_metadata_for_work(filepath, options)
|
57
57
|
work = hide_metadata_for_work(metadata, options)
|
58
58
|
|
59
|
-
return "Errors for DOI #{old_metadata["doi"]}:\n#{work.validation_errors}" if work.validation_errors.present?
|
59
|
+
# return "Errors for DOI #{old_metadata["doi"]}:\n#{work.validation_errors}" if work.validation_errors.present?
|
60
60
|
|
61
61
|
new_metadata = Bergamasco::Markdown.update_file(filepath, "published" => false)
|
62
62
|
"DOI #{old_metadata["doi"]} hidden for #{filename}"
|
@@ -65,20 +65,20 @@ module Cirneco
|
|
65
65
|
def mint_dois_for_all_files(folderpath, options={})
|
66
66
|
Dir.glob("#{folderpath}/*.md").map do |filepath|
|
67
67
|
mint_doi_for_file(filepath, options)
|
68
|
-
end.
|
68
|
+
end.join("\n")
|
69
69
|
end
|
70
70
|
|
71
71
|
def hide_dois_for_all_files(folderpath, options={})
|
72
72
|
Dir.glob("#{folderpath}/*.md").map do |filepath|
|
73
73
|
hide_doi_for_file(filepath, options)
|
74
|
-
end.
|
74
|
+
end.join("\n")
|
75
75
|
end
|
76
76
|
|
77
77
|
def generate_metadata_for_work(filepath, options={})
|
78
78
|
sitepath = options[:sitepath] || ENV['SITE_SITEPATH'] || "data/site.yml"
|
79
79
|
authorpath = options[:authorpath] || ENV['SITE_AUTHORPATH'] || "data/authors.yml"
|
80
80
|
referencespath = options[:referencespath] || ENV['SITE_REFERENCESPATH'] || "data/references.yaml"
|
81
|
-
csl = options[:csl] || ENV['
|
81
|
+
csl = options[:csl] || ENV['SITE_CSLPATH'] || "styles/apa.csl"
|
82
82
|
options = options.merge(csl: csl, bibliography: referencespath)
|
83
83
|
|
84
84
|
metadata = Bergamasco::Markdown.read_yaml_for_doi_metadata(filepath, options.except(:number))
|
@@ -162,9 +162,9 @@ module Cirneco
|
|
162
162
|
}
|
163
163
|
end.select { |t| t[:related_identifier_type].present? }
|
164
164
|
|
165
|
-
license_name = site_options.fetch("license", {}).fetch("name", nil) || ENV['SITE_LICENCE_NAME'] || "Creative Commons Attribution"
|
166
|
-
license_url = site_options.fetch("license", {}).fetch("url", nil) || ENV['SITE_LICENCE_URL'] || "https://creativecommons.org/licenses/by/4.0/"
|
167
|
-
metadata["rights_list"] = [{ value: license_name, rights_uri: license_url }]
|
165
|
+
metadata["license_name"] = site_options.fetch("license", {}).fetch("name", nil) || ENV['SITE_LICENCE_NAME'] || "Creative Commons Attribution"
|
166
|
+
metadata["license_url"] = site_options.fetch("license", {}).fetch("url", nil) || ENV['SITE_LICENCE_URL'] || "https://creativecommons.org/licenses/by/4.0/"
|
167
|
+
metadata["rights_list"] = [{ value: metadata["license_name"], rights_uri: metadata["license_url"] }]
|
168
168
|
|
169
169
|
metadata["subjects"] = Array(metadata["tags"]).select { |t| t != "featured" }
|
170
170
|
|
@@ -172,9 +172,11 @@ module Cirneco
|
|
172
172
|
metadata["contributors"] = [{ literal: contributor, contributor_type: "HostingInstitution" }]
|
173
173
|
|
174
174
|
metadata["date_issued"] = metadata["date"]
|
175
|
+
metadata["publication_month"] = metadata["date"][5..6]
|
176
|
+
metadata["publication_day"] = metadata["date"][8..9]
|
175
177
|
|
176
178
|
metadata = metadata.extract!(*%w(doi url creators title publisher
|
177
|
-
publication_year resource_type descriptions version rights_list subjects contributors
|
179
|
+
publication_year publication_month publication_day resource_type descriptions version license_name license_url rights_list subjects contributors
|
178
180
|
date_issued related_identifiers))
|
179
181
|
end
|
180
182
|
|
@@ -198,5 +200,9 @@ module Cirneco
|
|
198
200
|
|
199
201
|
work.delete_metadata(metadata["doi"], options)
|
200
202
|
end
|
203
|
+
|
204
|
+
def generate_jats(filepath, options={})
|
205
|
+
Bergamasco::Pandoc.write_jats(filepath, options)
|
206
|
+
end
|
201
207
|
end
|
202
208
|
end
|
data/lib/cirneco/version.rb
CHANGED
data/spec/fixtures/cool-dois.yml
CHANGED
data/spec/utils_spec.rb
CHANGED
@@ -112,5 +112,14 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
112
112
|
expect(response.body["data"]).to eq("OK")
|
113
113
|
expect(response.status).to eq(200)
|
114
114
|
end
|
115
|
+
|
116
|
+
# it 'should generate jats xml' do
|
117
|
+
# filepath = fixture_path + 'cool-dois.html.md'
|
118
|
+
# number = 123
|
119
|
+
# options = { csl: 'spec/fixtures/apa.csl', bibliography: 'spec/fixtures/references.yaml' }
|
120
|
+
# metadata = subject.generate_metadata_for_work(filepath, options)
|
121
|
+
# xml_path = subject.generate_jats(filepath, options.merge(metadata: metadata))
|
122
|
+
# expect(xml_path).to eq(fixture_path + 'cool-dois.xml')
|
123
|
+
# end
|
115
124
|
end
|
116
125
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cirneco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: base32-crockford-checksum
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|