cirneco 0.9.7 → 0.9.8
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 +1 -1
- data/lib/cirneco/utils.rb +8 -0
- data/lib/cirneco/version.rb +1 -1
- data/lib/cirneco/work.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be929143a58fd9c937df95525b11e3a3b76a722e
|
|
4
|
+
data.tar.gz: cccd893bcfeed2521ecd0b3937a0d945eca9f03b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2089c3c0c112b6830443d52da5257d109a259e4483a4df75e6e6dc12daf63f6b561cbf8374bf6e4c5a11daef9c22a974e48704c279b3112e2586403e0f082ddf
|
|
7
|
+
data.tar.gz: 6f2c1ffcb66d1937503e56e1e094df5514e05ccb0bfd95ed9aaa21a18aac303dfe8c283bc33e5fec028ee50e55e90aafb6874644a75bcad303c55b7122889bb3
|
data/Gemfile.lock
CHANGED
data/lib/cirneco/utils.rb
CHANGED
|
@@ -245,6 +245,8 @@ module Cirneco
|
|
|
245
245
|
end
|
|
246
246
|
|
|
247
247
|
def post_metadata_for_work(metadata, options={})
|
|
248
|
+
return Openstruct.new(body: { "errors" => [{"title" => "Error: required metadata missing" }] }) unless ["title", "creators", "publisher", "publication_year", "resource_type"].all? { |k| metadata.key? k }
|
|
249
|
+
|
|
248
250
|
prefix = options[:prefix] || ENV['PREFIX']
|
|
249
251
|
metadata["doi"] = encode_doi(prefix, number: metadata["alternate_identifier"]) if metadata["doi"].blank?
|
|
250
252
|
|
|
@@ -265,6 +267,8 @@ module Cirneco
|
|
|
265
267
|
end
|
|
266
268
|
|
|
267
269
|
def post_and_hide_metadata_for_work(metadata, options={})
|
|
270
|
+
return Openstruct.new(body: { "errors" => [{"title" => "Error: required metadata missing" }] }) unless ["title", "creators", "publisher", "publication_year", "resource_type"].all? { |k| metadata.key? k }
|
|
271
|
+
|
|
268
272
|
prefix = options[:prefix] || ENV['PREFIX']
|
|
269
273
|
metadata["doi"] = encode_doi(prefix, number: metadata["alternate_identifier"]) if metadata["doi"].blank?
|
|
270
274
|
|
|
@@ -288,6 +292,8 @@ module Cirneco
|
|
|
288
292
|
end
|
|
289
293
|
|
|
290
294
|
def hide_metadata_for_work(metadata, options={})
|
|
295
|
+
return Openstruct.new(body: { "errors" => [{"title" => "Error: required metadata missing" }] }) unless ["title", "creators", "publisher", "publication_year", "resource_type"].all? { |k| metadata.key? k }
|
|
296
|
+
|
|
291
297
|
prefix = options[:prefix] || ENV['PREFIX']
|
|
292
298
|
metadata["doi"] = encode_doi(prefix, number: metadata["alternate_identifier"]) if metadata["doi"].blank?
|
|
293
299
|
|
|
@@ -353,6 +359,8 @@ module Cirneco
|
|
|
353
359
|
def generate_jats_for_url(url, options={})
|
|
354
360
|
filename, build_path, source_path = filepath_from_url(url, options)
|
|
355
361
|
metadata = generate_metadata_for_jats(build_path, options)
|
|
362
|
+
return "No JATS XML written for #{filename}" if metadata["published"].to_s == "false"
|
|
363
|
+
|
|
356
364
|
file = IO.read(source_path)
|
|
357
365
|
content = Bergamasco::Markdown.split_yaml_frontmatter(file).last
|
|
358
366
|
text = Bergamasco::Markdown.join_yaml_frontmatter(metadata, content)
|
data/lib/cirneco/version.rb
CHANGED
data/lib/cirneco/work.rb
CHANGED