cirneco 0.9.23 → 0.9.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/cirneco/doi.rb +25 -0
- data/lib/cirneco/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ac39292e6b7fbd6b2fa3a5cc3af60a5e1c870faefc4005a9662c87121f1a51e
|
4
|
+
data.tar.gz: af84fca5e3ed856627b5cb944b72cf8fc29fdae9fd8bdd3f3b7c5cf0d874c471
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cb5420737aeb474f8c64786eef5c04afb09cbc892287180eab3f1b98bba8ab7554bfff8c6aecb8a34f5a7747d7690dcbfef9bd299f9a6f912c38cd986b5b534
|
7
|
+
data.tar.gz: 9c4d74e349ac0227a25affb527f7dbf8c1333db5238ef6d9b938643e39e9b392b1611924cd91fd36844efced66418f1cf9ef1a0661acc77218ef4cbdbd8e2759
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cirneco (0.9.
|
4
|
+
cirneco (0.9.24)
|
5
5
|
activesupport (>= 4.2.5, < 6)
|
6
6
|
base32-url (~> 0.5)
|
7
7
|
bergamasco (~> 0.3)
|
@@ -36,7 +36,7 @@ GEM
|
|
36
36
|
safe_yaml (~> 1.0, >= 1.0.4)
|
37
37
|
bibtex-ruby (4.4.7)
|
38
38
|
latex-decode (~> 0.0)
|
39
|
-
bolognese (0.13.
|
39
|
+
bolognese (0.13.4)
|
40
40
|
activesupport (>= 4.2.5, < 6)
|
41
41
|
benchmark_methods (~> 0.7)
|
42
42
|
bibtex-ruby (~> 4.1)
|
data/lib/cirneco/doi.rb
CHANGED
@@ -49,6 +49,31 @@ module Cirneco
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
desc "put DOIs", "put handle url for multiple DOIs"
|
53
|
+
method_option :username, :default => ENV['MDS_USERNAME']
|
54
|
+
method_option :password, :default => ENV['MDS_PASSWORD']
|
55
|
+
method_option :sandbox, :type => :boolean, :force => false
|
56
|
+
def post(file)
|
57
|
+
data = JSON.parse(IO.read(file))
|
58
|
+
count = 0
|
59
|
+
data.each do |json|
|
60
|
+
doi = doi_from_url(json["@id"])
|
61
|
+
url = json["@url"]
|
62
|
+
next unless doi.present? && url.present?
|
63
|
+
|
64
|
+
response = put_doi(doi, options.merge(url: url))
|
65
|
+
|
66
|
+
if response.body["errors"]
|
67
|
+
puts "Error: " + response.body["errors"].first.fetch("title", "An error occured")
|
68
|
+
else
|
69
|
+
puts response.headers["Location"]
|
70
|
+
count += 1
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
puts "#{count} DOIs registered/updated."
|
75
|
+
end
|
76
|
+
|
52
77
|
desc "generate DOI", "generate a DOI name"
|
53
78
|
method_option :prefix, :default => ENV['PREFIX']
|
54
79
|
method_option :number, :aliases => '-n'
|
data/lib/cirneco/version.rb
CHANGED