cirneco 0.9.16 → 0.9.17

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.
Files changed (94) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +70 -67
  3. data/cirneco.gemspec +3 -3
  4. data/lib/cirneco/data_center.rb +0 -2
  5. data/lib/cirneco/doi.rb +2 -90
  6. data/lib/cirneco/media.rb +1 -3
  7. data/lib/cirneco/metadata.rb +0 -2
  8. data/lib/cirneco/utils.rb +3 -3
  9. data/lib/cirneco/version.rb +1 -1
  10. data/lib/cirneco/work.rb +0 -2
  11. data/spec/api_spec.rb +8 -7
  12. data/spec/doi_spec.rb +4 -63
  13. data/spec/fixtures/vcr_cassettes/Cirneco_Work/media/includes_media.yml +42 -56
  14. data/spec/fixtures/vcr_cassettes/Cirneco_Work/schema/BlogPosting.yml +42 -56
  15. data/spec/utils_spec.rb +9 -10
  16. data/spec/work_spec.rb +2 -2
  17. metadata +10 -93
  18. data/data/authors.yml +0 -0
  19. data/data/references.yaml +0 -0
  20. data/data/site.yml +0 -0
  21. data/lib/cirneco/file_utils.rb +0 -371
  22. data/resources/jats-1.1/JATS-journalpublishing1-elements.xsd +0 -8608
  23. data/resources/jats-1.1/JATS-journalpublishing1-mathml3-elements.xsd +0 -8608
  24. data/resources/jats-1.1/JATS-journalpublishing1-mathml3.xsd +0 -48
  25. data/resources/jats-1.1/JATS-journalpublishing1.xsd +0 -59
  26. data/resources/jats-1.1/module-ali.xsd +0 -46
  27. data/resources/jats-1.1/standard-modules/mathml2/common/common-attribs.xsd +0 -44
  28. data/resources/jats-1.1/standard-modules/mathml2/common/math.xsd +0 -126
  29. data/resources/jats-1.1/standard-modules/mathml2/common/xlink-href.xsd +0 -20
  30. data/resources/jats-1.1/standard-modules/mathml2/content/arith.xsd +0 -90
  31. data/resources/jats-1.1/standard-modules/mathml2/content/calculus.xsd +0 -146
  32. data/resources/jats-1.1/standard-modules/mathml2/content/common-attrib.xsd +0 -30
  33. data/resources/jats-1.1/standard-modules/mathml2/content/constants.xsd +0 -83
  34. data/resources/jats-1.1/standard-modules/mathml2/content/constructs.xsd +0 -260
  35. data/resources/jats-1.1/standard-modules/mathml2/content/elementary-functions.xsd +0 -117
  36. data/resources/jats-1.1/standard-modules/mathml2/content/functions.xsd +0 -73
  37. data/resources/jats-1.1/standard-modules/mathml2/content/linear-algebra.xsd +0 -173
  38. data/resources/jats-1.1/standard-modules/mathml2/content/logic.xsd +0 -53
  39. data/resources/jats-1.1/standard-modules/mathml2/content/relations.xsd +0 -55
  40. data/resources/jats-1.1/standard-modules/mathml2/content/semantics.xsd +0 -85
  41. data/resources/jats-1.1/standard-modules/mathml2/content/sets.xsd +0 -236
  42. data/resources/jats-1.1/standard-modules/mathml2/content/statistics.xsd +0 -136
  43. data/resources/jats-1.1/standard-modules/mathml2/content/tokens.xsd +0 -120
  44. data/resources/jats-1.1/standard-modules/mathml2/content/vector-calculus.xsd +0 -88
  45. data/resources/jats-1.1/standard-modules/mathml2/content/zzz.tokens.xsd.from.zip +0 -120
  46. data/resources/jats-1.1/standard-modules/mathml2/mathml2.xsd +0 -59
  47. data/resources/jats-1.1/standard-modules/mathml2/presentation/action.xsd +0 -44
  48. data/resources/jats-1.1/standard-modules/mathml2/presentation/characters.xsd +0 -37
  49. data/resources/jats-1.1/standard-modules/mathml2/presentation/common-attribs.xsd +0 -113
  50. data/resources/jats-1.1/standard-modules/mathml2/presentation/common-types.xsd +0 -103
  51. data/resources/jats-1.1/standard-modules/mathml2/presentation/error.xsd +0 -40
  52. data/resources/jats-1.1/standard-modules/mathml2/presentation/layout.xsd +0 -195
  53. data/resources/jats-1.1/standard-modules/mathml2/presentation/scripts.xsd +0 -186
  54. data/resources/jats-1.1/standard-modules/mathml2/presentation/space.xsd +0 -52
  55. data/resources/jats-1.1/standard-modules/mathml2/presentation/style.xsd +0 -69
  56. data/resources/jats-1.1/standard-modules/mathml2/presentation/table.xsd +0 -216
  57. data/resources/jats-1.1/standard-modules/mathml2/presentation/tokens.xsd +0 -124
  58. data/resources/jats-1.1/standard-modules/xlink.xsd +0 -100
  59. data/resources/jats-1.1/standard-modules/xml.xsd +0 -287
  60. data/spec/file_utils_spec.rb +0 -203
  61. data/spec/fixtures/apa.csl +0 -621
  62. data/spec/fixtures/authors.yml +0 -19
  63. data/spec/fixtures/cool-dois/index.html +0 -404
  64. data/spec/fixtures/cool-dois-minted/index.html +0 -359
  65. data/spec/fixtures/cool-dois-minted.html.md +0 -99
  66. data/spec/fixtures/cool-dois-missing-metadata/index.html +0 -356
  67. data/spec/fixtures/cool-dois-no-accession-number.html.md +0 -97
  68. data/spec/fixtures/cool-dois-no-json-ld/index.html +0 -352
  69. data/spec/fixtures/cool-dois.html.md +0 -100
  70. data/spec/fixtures/cool-dois.yml +0 -10
  71. data/spec/fixtures/index-minted.html +0 -271
  72. data/spec/fixtures/index.html +0 -320
  73. data/spec/fixtures/index.html.erb +0 -42
  74. data/spec/fixtures/references.bib +0 -506
  75. data/spec/fixtures/references.yaml +0 -1060
  76. data/spec/fixtures/site.yml +0 -8
  77. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/jats/should_generate_jats_for_all_urls.yml +0 -38
  78. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_hide_for_all_urls.yml +0 -38
  79. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_and_hide_for_all_urls.yml +0 -38
  80. data/spec/fixtures/vcr_cassettes/Cirneco_DataCenter/mint_and_hide_DOIs/should_mint_for_all_urls.yml +0 -38
  81. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/jats/writes_jats_for_list_of_urls.yml +0 -38
  82. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/hides_dois_for_list_of_urls.yml +0 -38
  83. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_and_hides_dois_for_list_of_urls.yml +0 -38
  84. data/spec/fixtures/vcr_cassettes/Cirneco_Doi/mint_and_hide_DOIs/mints_dois_for_list_of_urls.yml +0 -38
  85. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_all_dois.yml +0 -121
  86. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi.yml +0 -121
  87. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/should_get_doi_not_found.yml +0 -121
  88. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/get/username_missing.yml +0 -121
  89. data/spec/fixtures/vcr_cassettes/Cirneco_Work/DOI_API/put/should_put_doi.yml +0 -121
  90. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/get/should_get_media.yml +0 -121
  91. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Media_API/post/should_post_media.yml +0 -121
  92. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/delete/should_delete_metadata.yml +0 -121
  93. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/get/should_get_metadata.yml +0 -121
  94. data/spec/fixtures/vcr_cassettes/Cirneco_Work/Metadata_API/post/should_post_metadata.yml +0 -121
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7ee0608001f28042bd320695cb4e967041abbad3
4
- data.tar.gz: bede1ebf522dcc4f1e375f350974096a6053a20a
2
+ SHA256:
3
+ metadata.gz: 1a62f02ec6dd9d41499762d7895ea4d05e296e9c1de28f4eb3793ba94831a210
4
+ data.tar.gz: bd7e7994cc3871edb6ea2556ab46fb90beac546e850e0380412ed7a1ba8cace0
5
5
  SHA512:
6
- metadata.gz: adb555b21099da678e39e24c0601b72a5a818a5c3cdf35a8fa561229fbaa2449243cc75db1fb0c4693ea0a732731e383cf716d27269079c4cbbbdfb92da150a4
7
- data.tar.gz: 1a6b59838c76ebb8ddac3b0bf0a47f47ab1d8d85abe58ae1f880dbb51a8afd246f66b53a011a7806b1222a53cd3d71294323049f6f31714e2af3c08c5440aec7
6
+ metadata.gz: 9f41065948d2e4989f413c576c7212bdb656a00a9f649a9a50132e86dd7f525df35a7444b814d92de23e29ff2c6d616050cecd6b6885ba18fd9cb9cf27bf2737
7
+ data.tar.gz: 7296b8960ecea524b72b431e0f256e9e62f9383f14af68410d1787e523f9cbab8c61a0381de87bc7fb2b3ef360ddebbbe3a0335d9f08510baaf4629202b8af48
data/Gemfile.lock CHANGED
@@ -1,28 +1,28 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirneco (0.9.16)
4
+ cirneco (0.9.17)
5
5
  activesupport (>= 4.2.5, < 6)
6
- base32-crockford-checksum (~> 0.2.2)
6
+ base32-url (~> 0.3)
7
7
  bergamasco (~> 0.3)
8
- bolognese (~> 0.9.32)
8
+ bolognese (~> 0.9)
9
9
  builder (~> 3.2, >= 3.2.2)
10
10
  dotenv (~> 2.1, >= 2.1.1)
11
11
  maremma (~> 3.5, >= 3.5.7)
12
- nokogiri (~> 1.6, >= 1.6.8)
12
+ nokogiri (~> 1.8.1)
13
13
  thor (~> 0.19)
14
14
 
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- activesupport (5.1.3)
18
+ activesupport (5.1.4)
19
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
20
  i18n (~> 0.7)
21
21
  minitest (~> 5.1)
22
22
  tzinfo (~> 1.1)
23
- addressable (2.5.1)
24
- public_suffix (~> 2.0, >= 2.0.2)
25
- base32-crockford-checksum (0.2.3)
23
+ addressable (2.5.2)
24
+ public_suffix (>= 2.0.2, < 4.0)
25
+ base32-url (0.3)
26
26
  benchmark_methods (0.7)
27
27
  bergamasco (0.3.17)
28
28
  activesupport (>= 4.2.5, < 6)
@@ -34,21 +34,22 @@ GEM
34
34
  oj (>= 2.8.3)
35
35
  pandoc-ruby (~> 2.0, >= 2.0.0)
36
36
  safe_yaml (~> 1.0, >= 1.0.4)
37
- bibtex-ruby (4.4.4)
37
+ bibtex-ruby (4.4.5)
38
38
  latex-decode (~> 0.0)
39
- bolognese (0.9.43)
39
+ bolognese (0.9.73)
40
40
  activesupport (>= 4.2.5, < 6)
41
41
  benchmark_methods (~> 0.7)
42
42
  bibtex-ruby (~> 4.1)
43
43
  builder (~> 3.2, >= 3.2.2)
44
44
  colorize (~> 0.8.1)
45
45
  gender_detector (~> 0.1.2)
46
+ iso8601 (~> 0.9.1)
46
47
  json-ld (~> 2.1, >= 2.1.2)
47
48
  jsonlint (~> 0.2.0)
48
49
  loofah (~> 2.0, >= 2.0.3)
49
50
  maremma (~> 3.5, >= 3.5.7)
50
51
  namae (~> 0.11.3)
51
- nokogiri (~> 1.6, >= 1.6.8)
52
+ nokogiri (~> 1.8.1)
52
53
  oj (>= 2.8.3)
53
54
  postrank-uri (~> 1.0, >= 1.0.18)
54
55
  rdf-rdfxml (~> 2.0)
@@ -61,11 +62,12 @@ GEM
61
62
  concurrent-ruby (1.0.5)
62
63
  crack (0.4.3)
63
64
  safe_yaml (~> 1.0.0)
65
+ crass (1.0.3)
64
66
  diff-lcs (1.3)
65
67
  docile (1.1.5)
66
68
  dotenv (2.2.1)
67
- ebnf (1.1.1)
68
- rdf (~> 2.2)
69
+ ebnf (1.1.2)
70
+ rdf (>= 2.2, < 4.0)
69
71
  sxp (~> 1.0)
70
72
  excon (0.45.4)
71
73
  faraday (0.9.2)
@@ -76,27 +78,29 @@ GEM
76
78
  faraday (>= 0.7.4, < 1.0)
77
79
  gender_detector (0.1.2)
78
80
  unicode_utils (>= 1.3.0)
79
- haml (5.0.2)
81
+ haml (5.0.4)
80
82
  temple (>= 0.8.0)
81
83
  tilt
82
84
  hamster (3.0.0)
83
85
  concurrent-ruby (~> 1.0)
84
- hashdiff (0.3.5)
86
+ hashdiff (0.3.7)
85
87
  htmlentities (4.3.4)
86
- i18n (0.8.6)
88
+ i18n (0.9.1)
89
+ concurrent-ruby (~> 1.0)
90
+ iso8601 (0.9.1)
87
91
  json (2.1.0)
88
- json-ld (2.1.5)
92
+ json-ld (2.2.1)
89
93
  multi_json (~> 1.12)
90
- rdf (~> 2.2)
94
+ rdf (>= 2.2.8, < 4.0)
91
95
  jsonlint (0.2.0)
92
96
  oj (~> 2)
93
97
  trollop (~> 2)
94
- latex-decode (0.2.2)
95
- unicode (~> 0.4)
98
+ latex-decode (0.3.1)
96
99
  link_header (0.0.8)
97
- loofah (2.0.3)
100
+ loofah (2.1.1)
101
+ crass (~> 1.0.2)
98
102
  nokogiri (>= 1.5.9)
99
- maremma (3.5.11)
103
+ maremma (3.6.2)
100
104
  activesupport (>= 4.2.5, < 6)
101
105
  addressable (>= 2.3.6)
102
106
  builder (~> 3.2, >= 3.2.2)
@@ -105,60 +109,60 @@ GEM
105
109
  faraday-encoding (~> 0.0.1)
106
110
  faraday_middleware (~> 0.10.0)
107
111
  multi_json (~> 1.12)
108
- nokogiri (~> 1.6, >= 1.6.8)
112
+ nokogiri (~> 1.8.1)
109
113
  oj (>= 2.8.3)
110
- mini_portile2 (2.1.0)
111
- minitest (5.10.3)
112
- multi_json (1.12.1)
114
+ mini_portile2 (2.3.0)
115
+ minitest (5.11.1)
116
+ multi_json (1.13.1)
113
117
  multipart-post (2.0.0)
114
118
  namae (0.11.3)
115
- nokogiri (1.7.2)
116
- mini_portile2 (~> 2.1.0)
119
+ nokogiri (1.8.1)
120
+ mini_portile2 (~> 2.3.0)
117
121
  oj (2.18.5)
118
- pandoc-ruby (2.0.1)
119
- postrank-uri (1.0.22)
122
+ pandoc-ruby (2.0.2)
123
+ postrank-uri (1.0.23)
120
124
  addressable (>= 2.3.0, < 2.6)
121
- nokogiri (>= 1.6.1, < 1.8)
125
+ nokogiri (>= 1.6.1, < 1.9)
122
126
  public_suffix (>= 2.0.0, < 2.1)
123
127
  public_suffix (2.0.5)
124
128
  rack (2.0.3)
125
- rack-test (0.7.0)
129
+ rack-test (0.8.2)
126
130
  rack (>= 1.0, < 3)
127
- rake (12.0.0)
128
- rdf (2.2.7)
131
+ rake (12.3.0)
132
+ rdf (3.0.1)
129
133
  hamster (~> 3.0)
130
134
  link_header (~> 0.0, >= 0.0.8)
131
- rdf-aggregate-repo (2.2.0)
132
- rdf (~> 2.0)
133
- rdf-rdfa (2.2.3)
135
+ rdf-aggregate-repo (2.2.1)
136
+ rdf (>= 2.2, < 4.0)
137
+ rdf-rdfa (2.2.4)
134
138
  haml (~> 5.0)
135
139
  htmlentities (~> 4.3)
136
- rdf (~> 2.2)
137
- rdf-aggregate-repo (~> 2.2)
138
- rdf-xsd (~> 2.1)
139
- rdf-rdfxml (2.2.0)
140
+ rdf (>= 2.2, < 4.0)
141
+ rdf-aggregate-repo (>= 2.2, < 4.0)
142
+ rdf-xsd (>= 2.2, < 4.0)
143
+ rdf-rdfxml (2.2.1)
140
144
  htmlentities (~> 4.3)
141
- rdf (~> 2.0)
142
- rdf-rdfa (~> 2.0)
143
- rdf-xsd (~> 2.0)
144
- rdf-turtle (2.2.0)
145
+ rdf (>= 2.2, < 4.0)
146
+ rdf-rdfa (>= 2.2, < 4.0)
147
+ rdf-xsd (>= 2.2, < 4.0)
148
+ rdf-turtle (2.2.2)
145
149
  ebnf (~> 1.1)
146
- rdf (~> 2.2)
147
- rdf-xsd (2.2.0)
148
- rdf (~> 2.1)
149
- rspec (3.6.0)
150
- rspec-core (~> 3.6.0)
151
- rspec-expectations (~> 3.6.0)
152
- rspec-mocks (~> 3.6.0)
153
- rspec-core (3.6.0)
154
- rspec-support (~> 3.6.0)
155
- rspec-expectations (3.6.0)
150
+ rdf (>= 2.2, < 4.0)
151
+ rdf-xsd (3.0.0)
152
+ rdf (~> 3.0)
153
+ rspec (3.7.0)
154
+ rspec-core (~> 3.7.0)
155
+ rspec-expectations (~> 3.7.0)
156
+ rspec-mocks (~> 3.7.0)
157
+ rspec-core (3.7.1)
158
+ rspec-support (~> 3.7.0)
159
+ rspec-expectations (3.7.0)
156
160
  diff-lcs (>= 1.2.0, < 2.0)
157
- rspec-support (~> 3.6.0)
158
- rspec-mocks (3.6.0)
161
+ rspec-support (~> 3.7.0)
162
+ rspec-mocks (3.7.0)
159
163
  diff-lcs (>= 1.2.0, < 2.0)
160
- rspec-support (~> 3.6.0)
161
- rspec-support (3.6.0)
164
+ rspec-support (~> 3.7.0)
165
+ rspec-support (3.7.0)
162
166
  rspec-xsd (0.1.0)
163
167
  nokogiri (~> 1.6)
164
168
  rspec (~> 3)
@@ -167,20 +171,19 @@ GEM
167
171
  docile (~> 1.1.0)
168
172
  json (>= 1.8, < 3)
169
173
  simplecov-html (~> 0.10.0)
170
- simplecov-html (0.10.1)
171
- sxp (1.0.0)
172
- rdf (~> 2.0)
174
+ simplecov-html (0.10.2)
175
+ sxp (1.0.1)
176
+ rdf (>= 2.2, < 4.0)
173
177
  temple (0.8.0)
174
- thor (0.19.4)
178
+ thor (0.20.0)
175
179
  thread_safe (0.3.6)
176
180
  tilt (2.0.8)
177
181
  trollop (2.1.2)
178
- tzinfo (1.2.3)
182
+ tzinfo (1.2.4)
179
183
  thread_safe (~> 0.1)
180
- unicode (0.4.4.4)
181
184
  unicode_utils (1.4.0)
182
185
  vcr (3.0.3)
183
- webmock (3.0.1)
186
+ webmock (3.3.0)
184
187
  addressable (>= 2.3.6)
185
188
  crack (>= 0.3.2)
186
189
  hashdiff
@@ -201,4 +204,4 @@ DEPENDENCIES
201
204
  webmock (~> 3.0, >= 3.0.1)
202
205
 
203
206
  BUNDLED WITH
204
- 1.15.3
207
+ 1.16.0
data/cirneco.gemspec CHANGED
@@ -17,9 +17,9 @@ Gem::Specification.new do |s|
17
17
  # Declary dependencies here, rather than in the Gemfile
18
18
  s.add_dependency 'maremma', '~> 3.5', '>= 3.5.7'
19
19
  s.add_dependency 'bergamasco', '~> 0.3'
20
- s.add_dependency 'bolognese', '~> 0.9.32'
21
- s.add_dependency 'base32-crockford-checksum', '~> 0.2.2'
22
- s.add_dependency 'nokogiri', '~> 1.6', '>= 1.6.8'
20
+ s.add_dependency 'bolognese', '~> 0.9'
21
+ s.add_dependency 'base32-url', '~> 0.3'
22
+ s.add_dependency 'nokogiri', '~> 1.8.1'
23
23
  s.add_dependency 'builder', '~> 3.2', '>= 3.2.2'
24
24
  s.add_dependency 'activesupport', '>= 4.2.5', '< 6'
25
25
  s.add_dependency 'dotenv', '~> 2.1', '>= 2.1.1'
@@ -4,7 +4,6 @@ require 'bolognese'
4
4
 
5
5
  require_relative 'api'
6
6
  require_relative 'utils'
7
- require_relative 'file_utils'
8
7
  require_relative 'base'
9
8
 
10
9
  module Cirneco
@@ -12,7 +11,6 @@ module Cirneco
12
11
  include Cirneco::Base
13
12
  include Cirneco::Api
14
13
  include Cirneco::Utils
15
- include Cirneco::FileUtils
16
14
  include Bolognese::Utils
17
15
  include Bolognese::DoiUtils
18
16
 
data/lib/cirneco/doi.rb CHANGED
@@ -3,7 +3,6 @@ require 'bolognese'
3
3
 
4
4
  require_relative 'api'
5
5
  require_relative 'utils'
6
- require_relative 'file_utils'
7
6
  require_relative 'base'
8
7
 
9
8
  module Cirneco
@@ -11,7 +10,6 @@ module Cirneco
11
10
  include Cirneco::Base
12
11
  include Cirneco::Api
13
12
  include Cirneco::Utils
14
- include Cirneco::FileUtils
15
13
  include Bolognese::Utils
16
14
  include Bolognese::DoiUtils
17
15
 
@@ -70,7 +68,7 @@ module Cirneco
70
68
  puts generate_accession_number(options)
71
69
  end
72
70
 
73
- desc "decode DOI", "decode DOI encoded using Crockford base32 algorithm"
71
+ desc "decode DOI", "decode DOI encoded using base32-url algorithm"
74
72
  def decode(doi)
75
73
  number = decode_doi(doi)
76
74
 
@@ -81,7 +79,7 @@ module Cirneco
81
79
  end
82
80
  end
83
81
 
84
- desc "check DOI", "check DOI using Crockford base32 checksum"
82
+ desc "check DOI", "check DOI using base32-url checksum"
85
83
  def check(doi)
86
84
  if decode_doi(doi) > 0
87
85
  puts "Checksum for #{doi} is valid"
@@ -89,91 +87,5 @@ module Cirneco
89
87
  puts "Checksum for #{doi} is not valid"
90
88
  end
91
89
  end
92
-
93
- desc "name DOCUMENT", "name document"
94
- method_option :length, :type => :numeric
95
- method_option :lower_limit, :type => :numeric
96
- method_option :split, :type => :numeric, :default => 4
97
- method_option :namespace, :default => 'MS-'
98
- method_option :opt_in, :type => :boolean
99
- def name(filepath)
100
- if File.directory?(filepath)
101
- response = update_all_accession_numbers(filepath, options)
102
- else
103
- response = update_accession_number(filepath, options)
104
- end
105
-
106
- puts response
107
- end
108
-
109
- desc "mint DOCUMENT", "mint document"
110
- method_option :sitepath, :default => ENV['SITE_SITEPATH']
111
- method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
112
- method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
113
- method_option :source_dir, :default => ENV['SOURCE_DIR']
114
- method_option :build_dir, :default => ENV['BUILD_DIR']
115
- method_option :posts_dir, :default => ENV['POSTS_DIR']
116
- method_option :csl, :default => ENV['SITE_CSLPATH']
117
- method_option :number, :aliases => '-n'
118
- method_option :username, :default => ENV['MDS_USERNAME']
119
- method_option :password, :default => ENV['MDS_PASSWORD']
120
- method_option :prefix, :default => ENV['PREFIX']
121
- method_option :sandbox, :type => :boolean, :force => false
122
- method_option :force, :type => :boolean, :force => false
123
- def mint(url)
124
- response = mint_dois_for_all_urls(url, options)
125
- puts response
126
- end
127
-
128
- desc "mint and hide DOCUMENT", "mint and hide document"
129
- method_option :sitepath, :default => ENV['SITE_SITEPATH']
130
- method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
131
- method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
132
- method_option :source_dir, :default => ENV['SOURCE_DIR']
133
- method_option :build_dir, :default => ENV['BUILD_DIR']
134
- method_option :posts_dir, :default => ENV['POSTS_DIR']
135
- method_option :csl, :default => ENV['SITE_CSLPATH']
136
- method_option :number, :aliases => '-n'
137
- method_option :username, :default => ENV['MDS_USERNAME']
138
- method_option :password, :default => ENV['MDS_PASSWORD']
139
- method_option :prefix, :default => ENV['PREFIX']
140
- method_option :sandbox, :type => :boolean, :force => false
141
- method_option :force, :type => :boolean, :force => false
142
- def mint_and_hide(url)
143
- response = mint_and_hide_dois_for_all_urls(url, options)
144
- puts response
145
- end
146
-
147
- desc "hide DOCUMENT", "hide document"
148
- method_option :sitepath, :default => ENV['SITE_SITEPATH']
149
- method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
150
- method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
151
- method_option :source_dir, :default => ENV['SOURCE_DIR']
152
- method_option :build_dir, :default => ENV['BUILD_DIR']
153
- method_option :posts_dir, :default => ENV['POSTS_DIR']
154
- method_option :csl, :default => ENV['SITE_CSLPATH']
155
- method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
156
- method_option :username, :default => ENV['MDS_USERNAME']
157
- method_option :password, :default => ENV['MDS_PASSWORD']
158
- method_option :sandbox, :type => :boolean, :force => false
159
- method_option :force, :type => :boolean, :force => false
160
- def hide(url)
161
- response = hide_dois_for_all_urls(url, options)
162
- puts response
163
- end
164
-
165
- desc "write_jats DOCUMENT", "write_jats document"
166
- method_option :sitepath, :default => ENV['SITE_SITEPATH']
167
- method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
168
- method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
169
- method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
170
- method_option :source_dir, :default => ENV['SOURCE_DIR']
171
- method_option :build_dir, :default => ENV['BUILD_DIR']
172
- method_option :posts_dir, :default => ENV['POSTS_DIR']
173
- method_option :csl, :default => ENV['SITE_CSLPATH']
174
- def write_jats(url)
175
- response = generate_jats_for_all_urls(url, options)
176
- puts response
177
- end
178
90
  end
179
91
  end
data/lib/cirneco/media.rb CHANGED
@@ -3,7 +3,6 @@ require 'active_support/all'
3
3
 
4
4
  require_relative 'api'
5
5
  require_relative 'utils'
6
- require_relative 'file_utils'
7
6
  require_relative 'base'
8
7
 
9
8
  module Cirneco
@@ -11,8 +10,7 @@ module Cirneco
11
10
  include Cirneco::Base
12
11
  include Cirneco::Api
13
12
  include Cirneco::Utils
14
- include Cirneco::FileUtils
15
-
13
+
16
14
  desc "get DOI", "get media for DOI"
17
15
  method_option :username, :default => ENV['MDS_USERNAME']
18
16
  method_option :password, :default => ENV['MDS_PASSWORD']
@@ -3,7 +3,6 @@ require 'active_support/all'
3
3
 
4
4
  require_relative 'api'
5
5
  require_relative 'utils'
6
- require_relative 'file_utils'
7
6
  require_relative 'base'
8
7
 
9
8
  module Cirneco
@@ -11,7 +10,6 @@ module Cirneco
11
10
  include Cirneco::Base
12
11
  include Cirneco::Api
13
12
  include Cirneco::Utils
14
- include Cirneco::FileUtils
15
13
 
16
14
  desc "get DOI", "get metadata for DOI"
17
15
  method_option :username, :default => ENV['MDS_USERNAME']
data/lib/cirneco/utils.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'base32/crockford'
1
+ require 'base32/url'
2
2
  require 'securerandom'
3
3
  require 'bergamasco'
4
4
  require 'open-uri'
@@ -20,7 +20,7 @@ module Cirneco
20
20
 
21
21
  def decode_doi(doi)
22
22
  prefix, string = doi.split('/', 2)
23
- Base32::Crockford.decode(string.upcase, checksum: true).to_i
23
+ Base32::URL.decode(string, checksum: true).to_i
24
24
  end
25
25
 
26
26
  def encode_doi(prefix, options={})
@@ -33,7 +33,7 @@ module Cirneco
33
33
 
34
34
  length = shoulder.length > 0 ? 6 : 8
35
35
  split = shoulder.length > 0 ? nil : 4
36
- prefix.to_s + "/" + shoulder + Base32::Crockford.encode(number, split: split, length: length, checksum: true).downcase
36
+ prefix.to_s + "/" + shoulder + Base32::URL.encode(number, split: split, length: length, checksum: true)
37
37
  end
38
38
 
39
39
  def generate_accession_number(options={})
@@ -1,3 +1,3 @@
1
1
  module Cirneco
2
- VERSION = "0.9.16"
2
+ VERSION = "0.9.17"
3
3
  end
data/lib/cirneco/work.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  require 'bolognese'
2
2
  require_relative 'api'
3
3
  require_relative 'utils'
4
- require_relative 'file_utils'
5
4
  require_relative 'base'
6
5
 
7
6
  module Cirneco
@@ -9,7 +8,6 @@ module Cirneco
9
8
  include Cirneco::Base
10
9
  include Cirneco::Api
11
10
  include Cirneco::Utils
12
- include Cirneco::FileUtils
13
11
 
14
12
  attr_reader :media, :username, :password
15
13
 
data/spec/api_spec.rb CHANGED
@@ -1,13 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cirneco::Work, vcr: true, :order => :defined do
4
- let(:input) { "https://blog.datacite.org/eating-your-own-dog-food/" }
4
+ let(:samples_path) { "resources/kernel-4.0/samples/" }
5
+ let(:input) { samples_path + "datacite-example-complicated-v4.0.xml" }
5
6
  let(:media) { [{ mime_type: "application/pdf", url:"http://www.datacite.org/cirneco-test.pdf" }]}
6
7
  let(:username) { ENV['MDS_USERNAME'] }
7
8
  let(:password) { ENV['MDS_PASSWORD'] }
8
9
  let(:options) { { username: username, password: password, sandbox: true } }
9
10
  let(:fixture_path) { "spec/fixtures/" }
10
- let(:samples_path) { "resources/kernel-4.0/samples/" }
11
+
11
12
 
12
13
  subject { Cirneco::Work.new(input: input,
13
14
  media: media,
@@ -18,9 +19,9 @@ describe Cirneco::Work, vcr: true, :order => :defined do
18
19
  context "post" do
19
20
  it 'should post metadata' do
20
21
  response = subject.post_metadata(subject.datacite, options)
21
- expect(response.body["data"]).to eq("OK (10.5438/0000-01hc)")
22
+ expect(response.body["data"]).to eq("OK (10.5072/testpub)")
22
23
  expect(response.status).to eq(201)
23
- expect(response.headers["Location"]).to eq("http://mds.test.datacite.org/metadata/10.5438/0000-01hc")
24
+ expect(response.headers["Location"]).to eq("http://mds.test.datacite.org/metadata/10.5072/testpub")
24
25
  end
25
26
  end
26
27
 
@@ -54,8 +55,8 @@ describe Cirneco::Work, vcr: true, :order => :defined do
54
55
  it 'should get all dois' do
55
56
  response = subject.get_dois(options)
56
57
  dois = response.body["data"]
57
- expect(dois.length).to eq(521)
58
- expect(dois.first).to eq("10.23725/0000-03VC")
58
+ expect(dois.length).to eq(6)
59
+ expect(dois.first).to eq("10.5072/0007-NW90")
59
60
  end
60
61
 
61
62
  it 'should get doi' do
@@ -64,7 +65,7 @@ describe Cirneco::Work, vcr: true, :order => :defined do
64
65
  end
65
66
 
66
67
  it 'should get doi not found' do
67
- response = subject.get_doi("10.5438/0000-03V", options)
68
+ response = subject.get_doi("10.5072/0000-03V", options)
68
69
  expect(response.status).to eq(404)
69
70
  end
70
71
 
data/spec/doi_spec.rb CHANGED
@@ -8,16 +8,11 @@ describe Cirneco::Doi do
8
8
 
9
9
  let(:number) { 123 }
10
10
  let(:prefix) { ENV['PREFIX'] }
11
- let(:doi) { "10.5438/0000-03VC" }
11
+ let(:doi) { "10.5072/55e5-t5c0" }
12
12
  let(:url) { "http://www.datacite.org" }
13
- let(:filename) { 'cool-dois/index.html' }
14
- let(:filepath) { fixture_path + filename }
15
13
  let(:username) { ENV['MDS_USERNAME'] }
16
14
  let(:password) { ENV['MDS_PASSWORD'] }
17
- let(:csl) { "spec/fixtures/apa.csl" }
18
- let(:bibliography) { "spec/fixtures/references.yaml" }
19
15
  let(:api_options) { { username: username, password: password, sandbox: true } }
20
- let(:mint_options) { { username: username, password: password, sandbox: true, source_dir: "/spec/fixtures/", build_dir: "/spec/fixtures/", csl: csl, bibliography: bibliography } }
21
16
 
22
17
  describe "MDS DOI API", vcr: true, :order => :defined do
23
18
  context "put" do
@@ -30,7 +25,7 @@ describe Cirneco::Doi do
30
25
  context "get" do
31
26
  it 'should get all dois' do
32
27
  subject.options = api_options.merge(limit: 3)
33
- expect { subject.get "all" }.to output("10.23725/0000-03VC\n10.23725/0000-0A53\n10.23725/GQZDGNZW\n").to_stdout
28
+ expect { subject.get "all" }.to output("10.5072/0007-NW90\n10.5072/55E5-T5C0\n10.5072/BC11-CQW6\n").to_stdout
34
29
  end
35
30
 
36
31
  it 'should get doi' do
@@ -50,21 +45,12 @@ describe Cirneco::Doi do
50
45
  subject.options = { number: number }
51
46
  expect { subject.accession_number }.to output("MS-123\n").to_stdout
52
47
  end
53
-
54
- it 'updates accession_number for file' do
55
- expect { subject.name fixture_path + 'cool-dois.html.md' }.to output("Accession number MS-123 not changed for cool-dois.html.md\n").to_stdout
56
- end
57
-
58
- it 'updates accession_number for all files with opt-in' do
59
- subject.options = { opt_in: true }
60
- expect { subject.name fixture_path }.to output("Accession number MS-124 not changed for cool-dois-minted.html.md\nFile cool-dois-no-accession-number.html.md ignored: no empty accession_number\nAccession number MS-123 not changed for cool-dois.html.md\n").to_stdout
61
- end
62
48
  end
63
49
 
64
50
  context "base32" do
65
51
  it 'generates a doi' do
66
52
  subject.options = { number: number, prefix: prefix }
67
- expect { subject.generate }.to output("10.5438/0000-03vc\n").to_stdout
53
+ expect { subject.generate }.to output("10.5072/0000-03vc\n").to_stdout
68
54
  end
69
55
 
70
56
  it 'requires a prefix' do
@@ -73,7 +59,7 @@ describe Cirneco::Doi do
73
59
  end
74
60
 
75
61
  it 'decodes a doi' do
76
- expect { subject.decode doi }.to output("DOI #{doi} was encoded with 123\n").to_stdout
62
+ expect { subject.decode doi }.to output("DOI #{doi} was encoded with 5551351980\n").to_stdout
77
63
  end
78
64
 
79
65
  it 'checks a doi' do
@@ -85,49 +71,4 @@ describe Cirneco::Doi do
85
71
  expect { subject.check doi }.to output("Checksum for #{doi} is not valid\n").to_stdout
86
72
  end
87
73
  end
88
-
89
- context "mint and hide DOIs", vcr: true, :order => :defined do
90
- it 'mints a doi' do
91
- subject.options = mint_options
92
- expect { subject.mint filepath }.to output("DOI 10.5438/55e5-t5c0 minted for cool-dois.html.md\n").to_stdout
93
- end
94
-
95
- it 'hides a doi' do
96
- filename = 'cool-dois-minted/index.html'
97
- filepath = fixture_path + filename
98
- subject.options = mint_options.merge(filepath: filepath)
99
- expect { subject.hide filepath }.to output("DOI 10.5438/55e5-t5c0 hidden for cool-dois-minted.html.md\n").to_stdout
100
- end
101
-
102
- it 'mints and hides a doi' do
103
- subject.options = mint_options
104
- expect { subject.mint_and_hide filepath }.to output("DOI 10.5438/55e5-t5c0 minted and hidden for cool-dois.html.md\n").to_stdout
105
- end
106
-
107
- it 'mints dois for list of urls' do
108
- filepath = fixture_path + 'index.html'
109
- subject.options = mint_options
110
- expect { subject.mint filepath }.to output("DOI 10.5438/55e5-t5c0 minted for cool-dois.html.md\nDOI 10.5438/0007-nw90 minted for index.html.erb\n").to_stdout
111
- end
112
-
113
- it 'hides dois for list of urls' do
114
- filepath = fixture_path + 'index.html'
115
- subject.options = mint_options
116
- expect { subject.hide filepath }.to output("No DOI for cool-dois.html.md\nDOI 10.5438/0000-00ss hidden for index.html.erb\n").to_stdout
117
- end
118
-
119
- it 'mints and hides dois for list of urls' do
120
- filepath = fixture_path + 'index.html'
121
- subject.options = mint_options
122
- expect { subject.mint_and_hide filepath }.to output("DOI 10.5438/55e5-t5c0 minted and hidden for cool-dois.html.md\nDOI 10.5438/0000-00ss minted and hidden for index.html.erb\n").to_stdout
123
- end
124
- end
125
-
126
- context "jats", vcr: true do
127
- it 'writes jats for list of urls' do
128
- filepath = fixture_path + 'index.html'
129
- subject.options = mint_options
130
- expect { subject.write_jats filepath }.to output("JATS XML written for cool-dois.html.md\nJATS XML written for index.html.erb\n").to_stdout
131
- end
132
- end
133
74
  end