commonmeta-ruby 3.0.5 → 3.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile.lock +16 -12
- data/commonmeta.gemspec +2 -0
- data/lib/commonmeta/cli.rb +12 -0
- data/lib/commonmeta/crossref_utils.rb +6 -5
- data/lib/commonmeta/utils.rb +684 -673
- data/lib/commonmeta/version.rb +1 -1
- data/lib/commonmeta.rb +1 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_doi/decode_another_doi.yml +221 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_id/decode_another_id.yml +221 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_id/decode_id.yml +221 -0
- data/spec/fixtures/vcr_cassettes/Commonmeta_Metadata/random_id/encode_id.yml +221 -0
- data/spec/utils_spec.rb +21 -1
- metadata +47 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8554b09a4a7efef4be8b21703eec6013c56b679b3cd84b1c82f1e3c7c8747ae
|
4
|
+
data.tar.gz: cb597fd50b0ba17d9e379344aa2c84647e0eb32829676def9e63356bdb415a4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e4907bf337d9296440b40fbeaa6d97f2da4125f83b649db9787d1e220ee70d53d1dcf57739e2dcf0653b01261f512291e34ba4d4905fbf7f59864878daa90ad
|
7
|
+
data.tar.gz: 9328e0618e95c59dc8e2e0d61238fc2a2de9cc0cd2210619e5a797f0742d26d4360e2cecdb47ac318f749f073b5a8919606773f16398df61fc983c016c247922
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
commonmeta-ruby (3.0.
|
4
|
+
commonmeta-ruby (3.0.7)
|
5
5
|
activesupport (>= 4.2.5, < 8.0)
|
6
|
+
addressable (~> 2.8.1, < 2.8.2)
|
6
7
|
base32-url (>= 0.5.0, < 1)
|
7
8
|
bibtex-ruby (~> 6.0)
|
8
9
|
builder (~> 3.2, >= 3.2.4)
|
9
10
|
citeproc-ruby (~> 2.0)
|
10
11
|
csl-styles (~> 2.0)
|
12
|
+
dotenv (~> 2.1, >= 2.1.1)
|
11
13
|
edtf (~> 3.0, >= 3.0.4)
|
12
14
|
gender_detector (~> 2.0)
|
13
15
|
http (~> 5.1, >= 5.1.1)
|
@@ -56,6 +58,7 @@ GEM
|
|
56
58
|
docile (1.4.0)
|
57
59
|
domain_name (0.5.20190701)
|
58
60
|
unf (>= 0.0.5, < 1.0.0)
|
61
|
+
dotenv (2.8.1)
|
59
62
|
ebnf (2.3.2)
|
60
63
|
htmlentities (~> 4.3)
|
61
64
|
rdf (~> 3.2)
|
@@ -71,8 +74,9 @@ GEM
|
|
71
74
|
ffi (>= 1.0.0)
|
72
75
|
rake
|
73
76
|
gender_detector (2.0.0)
|
74
|
-
haml (
|
75
|
-
temple (>= 0.8.
|
77
|
+
haml (6.1.1)
|
78
|
+
temple (>= 0.8.2)
|
79
|
+
thor
|
76
80
|
tilt
|
77
81
|
hana (1.3.7)
|
78
82
|
hashdiff (1.0.1)
|
@@ -112,7 +116,7 @@ GEM
|
|
112
116
|
llhttp-ffi (0.4.0)
|
113
117
|
ffi-compiler (~> 1.0)
|
114
118
|
rake (~> 13.0)
|
115
|
-
loofah (2.
|
119
|
+
loofah (2.20.0)
|
116
120
|
crass (~> 1.0.2)
|
117
121
|
nokogiri (>= 1.5.9)
|
118
122
|
matrix (0.4.2)
|
@@ -124,7 +128,7 @@ GEM
|
|
124
128
|
oj (3.14.2)
|
125
129
|
optimist (3.0.1)
|
126
130
|
parallel (1.22.1)
|
127
|
-
parser (3.2.
|
131
|
+
parser (3.2.2.0)
|
128
132
|
ast (~> 2.4.1)
|
129
133
|
postrank-uri (1.1)
|
130
134
|
addressable (>= 2.4.0)
|
@@ -141,8 +145,8 @@ GEM
|
|
141
145
|
link_header (~> 0.0, >= 0.0.8)
|
142
146
|
rdf-aggregate-repo (3.2.1)
|
143
147
|
rdf (~> 3.2)
|
144
|
-
rdf-rdfa (3.2.
|
145
|
-
haml (
|
148
|
+
rdf-rdfa (3.2.1)
|
149
|
+
haml (>= 5.2, < 7)
|
146
150
|
htmlentities (~> 4.3)
|
147
151
|
rdf (~> 3.2)
|
148
152
|
rdf-aggregate-repo (~> 3.2)
|
@@ -156,7 +160,7 @@ GEM
|
|
156
160
|
rdf-turtle (3.2.1)
|
157
161
|
ebnf (~> 2.3)
|
158
162
|
rdf (~> 3.2)
|
159
|
-
rdf-vocab (3.2.
|
163
|
+
rdf-vocab (3.2.4)
|
160
164
|
rdf (~> 3.2, >= 3.2.4)
|
161
165
|
rdf-xsd (3.2.1)
|
162
166
|
rdf (~> 3.2)
|
@@ -172,24 +176,24 @@ GEM
|
|
172
176
|
rspec-expectations (3.12.2)
|
173
177
|
diff-lcs (>= 1.2.0, < 2.0)
|
174
178
|
rspec-support (~> 3.12.0)
|
175
|
-
rspec-mocks (3.12.
|
179
|
+
rspec-mocks (3.12.5)
|
176
180
|
diff-lcs (>= 1.2.0, < 2.0)
|
177
181
|
rspec-support (~> 3.12.0)
|
178
182
|
rspec-support (3.12.0)
|
179
183
|
rspec-xsd (0.1.0)
|
180
184
|
nokogiri (~> 1.6)
|
181
185
|
rspec (~> 3)
|
182
|
-
rubocop (1.
|
186
|
+
rubocop (1.49.0)
|
183
187
|
json (~> 2.3)
|
184
188
|
parallel (~> 1.10)
|
185
189
|
parser (>= 3.2.0.0)
|
186
190
|
rainbow (>= 2.2.2, < 4.0)
|
187
191
|
regexp_parser (>= 1.8, < 3.0)
|
188
192
|
rexml (>= 3.2.5, < 4.0)
|
189
|
-
rubocop-ast (>= 1.
|
193
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
190
194
|
ruby-progressbar (~> 1.7)
|
191
195
|
unicode-display_width (>= 2.4.0, < 3.0)
|
192
|
-
rubocop-ast (1.
|
196
|
+
rubocop-ast (1.28.0)
|
193
197
|
parser (>= 3.2.1.0)
|
194
198
|
rubocop-capybara (2.17.1)
|
195
199
|
rubocop (~> 1.41)
|
data/commonmeta.gemspec
CHANGED
@@ -19,11 +19,13 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
# Declare dependencies here, rather than in the Gemfile
|
21
21
|
s.add_dependency 'activesupport', '>= 4.2.5', '< 8.0'
|
22
|
+
s.add_dependency 'addressable', '~> 2.8.1', '< 2.8.2'
|
22
23
|
s.add_dependency 'base32-url', '>= 0.5.0', '< 1'
|
23
24
|
s.add_dependency 'bibtex-ruby', '~> 6.0'
|
24
25
|
s.add_dependency 'builder', '~> 3.2', '>= 3.2.4'
|
25
26
|
s.add_dependency 'citeproc-ruby', '~> 2.0'
|
26
27
|
s.add_dependency 'csl-styles', '~> 2.0'
|
28
|
+
s.add_dependency 'dotenv', '~> 2.1', '>= 2.1.1'
|
27
29
|
s.add_dependency 'edtf', '~> 3.0', '>= 3.0.4'
|
28
30
|
s.add_dependency 'gender_detector', '~> 2.0'
|
29
31
|
s.add_dependency 'http', '~> 5.1', '>= 5.1.1'
|
data/lib/commonmeta/cli.rb
CHANGED
@@ -61,12 +61,24 @@ module Commonmeta
|
|
61
61
|
puts encode_doi(prefix)
|
62
62
|
end
|
63
63
|
|
64
|
+
desc '', 'encode_id'
|
65
|
+
|
66
|
+
def encode_id
|
67
|
+
puts encode_id
|
68
|
+
end
|
69
|
+
|
64
70
|
desc '', 'decode'
|
65
71
|
|
66
72
|
def decode(doi)
|
67
73
|
puts decode_doi(doi)
|
68
74
|
end
|
69
75
|
|
76
|
+
desc '', 'decode_id'
|
77
|
+
|
78
|
+
def decode_id(id)
|
79
|
+
puts decode_id(id)
|
80
|
+
end
|
81
|
+
|
70
82
|
default_task :convert
|
71
83
|
end
|
72
84
|
end
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
module Commonmeta
|
4
4
|
module CrossrefUtils
|
5
|
-
# To configure the writing of Crossref metadata,
|
6
|
-
#
|
5
|
+
# To configure the writing of Crossref metadata, use environmental
|
6
|
+
# variables CROSSREF_DEPOSITOR_NAME, CROSSREF_DEPOSITOR_EMAIL and CROSSREF_REGISTRANT,
|
7
|
+
# e.g. in a .env file
|
7
8
|
def write_crossref_xml
|
8
9
|
@crossref_xml ||= Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
|
9
10
|
xml.doi_batch(crossref_root_attributes) do
|
@@ -12,10 +13,10 @@ module Commonmeta
|
|
12
13
|
xml.doi_batch_id(SecureRandom.uuid)
|
13
14
|
xml.timestamp(Time.now.utc.strftime('%Y%m%d%H%M%S'))
|
14
15
|
xml.depositor do
|
15
|
-
xml.depositor_name(
|
16
|
-
xml.email_address(
|
16
|
+
xml.depositor_name(ENV.fetch('CROSSREF_DEPOSITOR_NAME', nil))
|
17
|
+
xml.email_address(ENV.fetch('CROSSREF_DEPOSITOR_EMAIL', nil))
|
17
18
|
end
|
18
|
-
xml.registrant(
|
19
|
+
xml.registrant(ENV.fetch('CROSSREF_REGISTRANT', nil))
|
19
20
|
end
|
20
21
|
xml.body do
|
21
22
|
insert_crossref_work(xml)
|