cirneco 0.7 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.env.example +0 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +0 -19
- data/lib/cirneco/doi.rb +4 -4
- data/lib/cirneco/media.rb +2 -2
- data/lib/cirneco/metadata.rb +3 -3
- data/lib/cirneco/utils.rb +4 -6
- data/lib/cirneco/version.rb +1 -1
- data/spec/doi_spec.rb +0 -1
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/get/should_get_all_dois_by_prefix.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_metadata_for_work.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_post_metadata_for_work.yml +4 -4
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_all_dois.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/get/should_get_doi.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Doi/MDS_DOI_API/put/should_put_doi.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_all_dois.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/put/should_put_doi.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/get/should_get_media.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/post/should_post_media.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/get/should_get_metadata.yml +2 -2
- data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/post/should_post_metadata.yml +2 -2
- 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: c8a8e700d7b0dd87587e3807300302bcc19fbccb
|
4
|
+
data.tar.gz: 943cab2ad20fbe4b4be178665f3dfd37544e117c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8de5fba5d1bd0c5fdf83fe9710c7a02ac53b6c2c9d746afa40a8035eec01da0346871fd704015fce1fb3dfe762f1814ffb23fd81148538f7d7092cf9bc861c2f
|
7
|
+
data.tar.gz: 8b9c3d3b14a82160c18a59a465a394152e6447f27431f3b3aa2e50b935c7f80abaeac6b10e3e42e43c9a9ac6eb3f4455f85adf35f7f075d6e0e56a04984fa3bf
|
data/.env.example
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -8,24 +8,5 @@ require 'rspec/core/rake_task'
|
|
8
8
|
Bundler::GemHelper.install_tasks
|
9
9
|
RSpec::Core::RakeTask.new('spec')
|
10
10
|
|
11
|
-
namespace :repo do
|
12
|
-
desc "push files generated with cirneco to remote"
|
13
|
-
task :push do
|
14
|
-
|
15
|
-
# Configure git if this is run in Travis CI
|
16
|
-
if ENV["TRAVIS"]
|
17
|
-
sh "git config --global user.name '#{ENV['GIT_NAME']}'"
|
18
|
-
sh "git config --global user.email '#{ENV['GIT_EMAIL']}'"
|
19
|
-
sh "git config --global push.default simple"
|
20
|
-
end
|
21
|
-
|
22
|
-
# Commit and push to github
|
23
|
-
sh "git add --all ."
|
24
|
-
sh "git commit -m 'Committing changed files.'"
|
25
|
-
sh "git push https://${GH_TOKEN}@github.com/datacite/cirneco.rb master --quiet"
|
26
|
-
puts "Pushed changed files to repo"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
11
|
# default task is running rspec tests
|
31
12
|
task :default => :spec
|
data/lib/cirneco/doi.rb
CHANGED
@@ -13,7 +13,7 @@ module Cirneco
|
|
13
13
|
desc "get DOI", "get handle url for DOI"
|
14
14
|
method_option :username, :default => ENV['MDS_USERNAME']
|
15
15
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
16
|
-
method_option :sandbox, :
|
16
|
+
method_option :sandbox, :type => :boolean, :force => false
|
17
17
|
def get(doi)
|
18
18
|
if doi == "all"
|
19
19
|
response = get_dois(options)
|
@@ -31,7 +31,7 @@ module Cirneco
|
|
31
31
|
desc "put DOI", "put handle url for DOI"
|
32
32
|
method_option :username, :default => ENV['MDS_USERNAME']
|
33
33
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
34
|
-
method_option :sandbox, :
|
34
|
+
method_option :sandbox, :type => :boolean, :force => false
|
35
35
|
method_option :url
|
36
36
|
def put(doi)
|
37
37
|
response = put_doi(doi, options)
|
@@ -72,7 +72,7 @@ module Cirneco
|
|
72
72
|
method_option :username, :default => ENV['MDS_USERNAME']
|
73
73
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
74
74
|
method_option :prefix, :default => ENV['PREFIX']
|
75
|
-
method_option :sandbox, :
|
75
|
+
method_option :sandbox, :type => :boolean, :force => false
|
76
76
|
def mint(filepath)
|
77
77
|
|
78
78
|
if File.directory?(filepath)
|
@@ -92,7 +92,7 @@ module Cirneco
|
|
92
92
|
method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
|
93
93
|
method_option :username, :default => ENV['MDS_USERNAME']
|
94
94
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
95
|
-
method_option :sandbox, :
|
95
|
+
method_option :sandbox, :type => :boolean, :force => false
|
96
96
|
def hide(filepath)
|
97
97
|
|
98
98
|
if File.directory?(filepath)
|
data/lib/cirneco/media.rb
CHANGED
@@ -14,7 +14,7 @@ module Cirneco
|
|
14
14
|
desc "get DOI", "get media for DOI"
|
15
15
|
method_option :username, :default => ENV['MDS_USERNAME']
|
16
16
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
17
|
-
method_option :sandbox, :
|
17
|
+
method_option :sandbox, :type => :boolean, :force => false
|
18
18
|
def get(doi)
|
19
19
|
response = get_media(doi, options.merge(raw: true))
|
20
20
|
|
@@ -31,7 +31,7 @@ module Cirneco
|
|
31
31
|
desc "post DOI", "post media for DOI"
|
32
32
|
method_option :username, :default => ENV['MDS_USERNAME']
|
33
33
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
34
|
-
method_option :sandbox, :
|
34
|
+
method_option :sandbox, :type => :boolean, :force => false
|
35
35
|
method_option :file, :aliases => '-f'
|
36
36
|
def post(doi)
|
37
37
|
filename = options[:file] || doi.split("/", 2).last + ".txt"
|
data/lib/cirneco/metadata.rb
CHANGED
@@ -14,7 +14,7 @@ module Cirneco
|
|
14
14
|
desc "get DOI", "get metadata for DOI"
|
15
15
|
method_option :username, :default => ENV['MDS_USERNAME']
|
16
16
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
17
|
-
method_option :sandbox, :
|
17
|
+
method_option :sandbox, :type => :boolean, :force => false
|
18
18
|
def get(doi)
|
19
19
|
response = get_metadata(doi, options)
|
20
20
|
|
@@ -31,7 +31,7 @@ module Cirneco
|
|
31
31
|
desc "post DOI", "post metadata for DOI"
|
32
32
|
method_option :username, :default => ENV['MDS_USERNAME']
|
33
33
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
34
|
-
method_option :sandbox, :
|
34
|
+
method_option :sandbox, :type => :boolean, :force => false
|
35
35
|
def post(file)
|
36
36
|
data = IO.read(file)
|
37
37
|
response = post_metadata(data, options)
|
@@ -46,7 +46,7 @@ module Cirneco
|
|
46
46
|
desc "delete DOI", "hide metadata for DOI"
|
47
47
|
method_option :username, :default => ENV['MDS_USERNAME']
|
48
48
|
method_option :password, :default => ENV['MDS_PASSWORD']
|
49
|
-
method_option :sandbox, :
|
49
|
+
method_option :sandbox, :type => :boolean, :force => false
|
50
50
|
def delete(doi)
|
51
51
|
response = delete_metadata(doi, options)
|
52
52
|
|
data/lib/cirneco/utils.rb
CHANGED
@@ -63,17 +63,15 @@ module Cirneco
|
|
63
63
|
end
|
64
64
|
|
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.
|
69
|
-
response.present? ? response.join("\n") : "No new DOI minted"
|
68
|
+
end.uniq.join("\n")
|
70
69
|
end
|
71
70
|
|
72
71
|
def hide_dois_for_all_files(folderpath, options={})
|
73
|
-
|
72
|
+
Dir.glob("#{folderpath}/*.md").map do |filepath|
|
74
73
|
hide_doi_for_file(filepath, options)
|
75
|
-
end.
|
76
|
-
response.present? ? response.join("\n") : "No new DOI hidden"
|
74
|
+
end.uniq.join("\n")
|
77
75
|
end
|
78
76
|
|
79
77
|
def generate_metadata_for_work(filepath, options={})
|
data/lib/cirneco/version.rb
CHANGED
data/spec/doi_spec.rb
CHANGED
@@ -14,7 +14,6 @@ describe Cirneco::Doi do
|
|
14
14
|
let(:filepath) { fixture_path + filename }
|
15
15
|
let(:username) { ENV['MDS_USERNAME'] }
|
16
16
|
let(:password) { ENV['MDS_PASSWORD'] }
|
17
|
-
let(:sandbox) { ENV['SANDBOX'] }
|
18
17
|
let(:csl) { "spec/fixtures/apa.csl" }
|
19
18
|
let(:bibliography) { "spec/fixtures/bibliography.yaml" }
|
20
19
|
let(:api_options) { { username: username, password: password, sandbox: true } }
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:37 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -49,5 +49,5 @@ http_interactions:
|
|
49
49
|
10.5438/EXAMPLE-FULL
|
50
50
|
10.5438/MDS-CLIENT-RUBY-TEST
|
51
51
|
http_version:
|
52
|
-
recorded_at: Mon, 19 Dec 2016
|
52
|
+
recorded_at: Mon, 19 Dec 2016 08:14:37 GMT
|
53
53
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:47 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: OK
|
38
38
|
http_version:
|
39
|
-
recorded_at: Mon, 19 Dec 2016
|
39
|
+
recorded_at: Mon, 19 Dec 2016 08:14:47 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -63,7 +63,7 @@ http_interactions:
|
|
63
63
|
Server:
|
64
64
|
- nginx/1.4.6 (Ubuntu)
|
65
65
|
Date:
|
66
|
-
- Mon, 19 Dec 2016
|
66
|
+
- Mon, 19 Dec 2016 08:14:45 GMT
|
67
67
|
Content-Type:
|
68
68
|
- text/html;charset=UTF-8
|
69
69
|
Location:
|
@@ -80,7 +80,7 @@ http_interactions:
|
|
80
80
|
encoding: UTF-8
|
81
81
|
string: OK (10.5072/0000-03VC)
|
82
82
|
http_version:
|
83
|
-
recorded_at: Mon, 19 Dec 2016
|
83
|
+
recorded_at: Mon, 19 Dec 2016 08:14:45 GMT
|
84
84
|
- request:
|
85
85
|
method: put
|
86
86
|
uri: https://mds.test.datacite.org/doi/10.5072/0000-03VC
|
@@ -106,7 +106,7 @@ http_interactions:
|
|
106
106
|
Server:
|
107
107
|
- nginx/1.4.6 (Ubuntu)
|
108
108
|
Date:
|
109
|
-
- Mon, 19 Dec 2016
|
109
|
+
- Mon, 19 Dec 2016 08:14:46 GMT
|
110
110
|
Content-Type:
|
111
111
|
- text/html;charset=UTF-8
|
112
112
|
Connection:
|
@@ -121,5 +121,5 @@ http_interactions:
|
|
121
121
|
encoding: UTF-8
|
122
122
|
string: OK
|
123
123
|
http_version:
|
124
|
-
recorded_at: Mon, 19 Dec 2016
|
124
|
+
recorded_at: Mon, 19 Dec 2016 08:14:46 GMT
|
125
125
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:37 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -49,5 +49,5 @@ http_interactions:
|
|
49
49
|
10.5438/EXAMPLE-FULL
|
50
50
|
10.5438/MDS-CLIENT-RUBY-TEST
|
51
51
|
http_version:
|
52
|
-
recorded_at: Mon, 19 Dec 2016
|
52
|
+
recorded_at: Mon, 19 Dec 2016 08:14:37 GMT
|
53
53
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:37 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: http://www.datacite.org
|
38
38
|
http_version:
|
39
|
-
recorded_at: Mon, 19 Dec 2016
|
39
|
+
recorded_at: Mon, 19 Dec 2016 08:14:37 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -25,7 +25,7 @@ http_interactions:
|
|
25
25
|
Server:
|
26
26
|
- nginx/1.4.6 (Ubuntu)
|
27
27
|
Date:
|
28
|
-
- Mon, 19 Dec 2016
|
28
|
+
- Mon, 19 Dec 2016 08:14:37 GMT
|
29
29
|
Content-Type:
|
30
30
|
- text/html;charset=UTF-8
|
31
31
|
Connection:
|
@@ -40,5 +40,5 @@ http_interactions:
|
|
40
40
|
encoding: UTF-8
|
41
41
|
string: OK
|
42
42
|
http_version:
|
43
|
-
recorded_at: Mon, 19 Dec 2016
|
43
|
+
recorded_at: Mon, 19 Dec 2016 08:14:37 GMT
|
44
44
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:48 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -49,5 +49,5 @@ http_interactions:
|
|
49
49
|
10.5438/EXAMPLE-FULL
|
50
50
|
10.5438/MDS-CLIENT-RUBY-TEST
|
51
51
|
http_version:
|
52
|
-
recorded_at: Mon, 19 Dec 2016
|
52
|
+
recorded_at: Mon, 19 Dec 2016 08:14:48 GMT
|
53
53
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:48 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: http://www.datacite.org
|
38
38
|
http_version:
|
39
|
-
recorded_at: Mon, 19 Dec 2016
|
39
|
+
recorded_at: Mon, 19 Dec 2016 08:14:48 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -25,7 +25,7 @@ http_interactions:
|
|
25
25
|
Server:
|
26
26
|
- nginx/1.4.6 (Ubuntu)
|
27
27
|
Date:
|
28
|
-
- Mon, 19 Dec 2016
|
28
|
+
- Mon, 19 Dec 2016 08:14:48 GMT
|
29
29
|
Content-Type:
|
30
30
|
- text/html;charset=UTF-8
|
31
31
|
Connection:
|
@@ -40,5 +40,5 @@ http_interactions:
|
|
40
40
|
encoding: UTF-8
|
41
41
|
string: OK
|
42
42
|
http_version:
|
43
|
-
recorded_at: Mon, 19 Dec 2016
|
43
|
+
recorded_at: Mon, 19 Dec 2016 08:14:48 GMT
|
44
44
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:49 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/xml;charset=UTF-8
|
27
27
|
Content-Length:
|
@@ -40,5 +40,5 @@ http_interactions:
|
|
40
40
|
|
41
41
|
'
|
42
42
|
http_version:
|
43
|
-
recorded_at: Mon, 19 Dec 2016
|
43
|
+
recorded_at: Mon, 19 Dec 2016 08:14:49 GMT
|
44
44
|
recorded_with: VCR 3.0.3
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
Server:
|
24
24
|
- nginx/1.4.6 (Ubuntu)
|
25
25
|
Date:
|
26
|
-
- Mon, 19 Dec 2016
|
26
|
+
- Mon, 19 Dec 2016 08:14:49 GMT
|
27
27
|
Content-Type:
|
28
28
|
- text/html;charset=UTF-8
|
29
29
|
Connection:
|
@@ -38,5 +38,5 @@ http_interactions:
|
|
38
38
|
encoding: UTF-8
|
39
39
|
string: OK
|
40
40
|
http_version:
|
41
|
-
recorded_at: Mon, 19 Dec 2016
|
41
|
+
recorded_at: Mon, 19 Dec 2016 08:14:49 GMT
|
42
42
|
recorded_with: VCR 3.0.3
|
data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml
CHANGED
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:14:47 GMT
|
25
25
|
Content-Type:
|
26
26
|
- text/html;charset=UTF-8
|
27
27
|
Connection:
|
@@ -36,5 +36,5 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: OK
|
38
38
|
http_version:
|
39
|
-
recorded_at: Mon, 19 Dec 2016
|
39
|
+
recorded_at: Mon, 19 Dec 2016 08:14:47 GMT
|
40
40
|
recorded_with: VCR 3.0.3
|
@@ -21,7 +21,7 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx/1.4.6 (Ubuntu)
|
23
23
|
Date:
|
24
|
-
- Mon, 19 Dec 2016
|
24
|
+
- Mon, 19 Dec 2016 08:15:40 GMT
|
25
25
|
Content-Type:
|
26
26
|
- application/xml;charset=UTF-8
|
27
27
|
Content-Length:
|
@@ -56,5 +56,5 @@ http_interactions:
|
|
56
56
|
<resourceType resourceTypeGeneral="Software">XML</resourceType>
|
57
57
|
</resource>
|
58
58
|
http_version:
|
59
|
-
recorded_at: Mon, 19 Dec 2016
|
59
|
+
recorded_at: Mon, 19 Dec 2016 08:15:40 GMT
|
60
60
|
recorded_with: VCR 3.0.3
|
@@ -41,7 +41,7 @@ http_interactions:
|
|
41
41
|
Server:
|
42
42
|
- nginx/1.4.6 (Ubuntu)
|
43
43
|
Date:
|
44
|
-
- Mon, 19 Dec 2016
|
44
|
+
- Mon, 19 Dec 2016 08:14:48 GMT
|
45
45
|
Content-Type:
|
46
46
|
- text/html;charset=UTF-8
|
47
47
|
Location:
|
@@ -58,5 +58,5 @@ http_interactions:
|
|
58
58
|
encoding: UTF-8
|
59
59
|
string: OK (10.5072/0000-03VC)
|
60
60
|
http_version:
|
61
|
-
recorded_at: Mon, 19 Dec 2016
|
61
|
+
recorded_at: Mon, 19 Dec 2016 08:14:48 GMT
|
62
62
|
recorded_with: VCR 3.0.3
|