commonmeta-ruby 3.3.17 → 3.3.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -29
- data/bin/commonmeta +1 -1
- data/lib/commonmeta/cli.rb +7 -0
- data/lib/commonmeta/utils.rb +6 -4
- data/lib/commonmeta/version.rb +1 -1
- data/spec/cli_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c4fb0fccfd81d27f198f9cb4f4d56dace1a0ea509f9dfa48603e6b09d5058cf
|
4
|
+
data.tar.gz: d50b7df6d786722b3d86a61da19c1c3083cf2df55c46d9b70393d67532802e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4b8a03b506d1b14895fdf0f41a66cb45d674f15f0d022826f335048213533d73f32e8394c7f40df5935d7d56670f104b76a1042ed313c88e08ee0a38e1cd89c
|
7
|
+
data.tar.gz: 9af2e1d27abdc064550b95ce544394c72cf319dde10f1e2e33001ee6d61ba57d4554573772059c78a36e7235efd894549225f5090f8e11dcb8e31299701966f0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
commonmeta-ruby (3.3.
|
4
|
+
commonmeta-ruby (3.3.18)
|
5
5
|
activesupport (>= 4.2.5, < 8.0)
|
6
6
|
addressable (~> 2.8.1, < 2.8.2)
|
7
7
|
base32-url (>= 0.7.0, < 1)
|
@@ -60,7 +60,7 @@ GEM
|
|
60
60
|
docile (1.4.0)
|
61
61
|
domain_name (0.5.20190701)
|
62
62
|
unf (>= 0.0.5, < 1.0.0)
|
63
|
-
ebnf (2.3.
|
63
|
+
ebnf (2.3.5)
|
64
64
|
htmlentities (~> 4.3)
|
65
65
|
rdf (~> 3.2)
|
66
66
|
scanf (~> 1.0)
|
@@ -76,9 +76,6 @@ GEM
|
|
76
76
|
ffi (>= 1.0.0)
|
77
77
|
rake
|
78
78
|
gender_detector (2.0.0)
|
79
|
-
haml (5.2.2)
|
80
|
-
temple (>= 0.8.0)
|
81
|
-
tilt
|
82
79
|
hana (1.3.7)
|
83
80
|
hashdiff (1.0.1)
|
84
81
|
htmlentities (4.3.4)
|
@@ -124,13 +121,13 @@ GEM
|
|
124
121
|
crass (~> 1.0.2)
|
125
122
|
nokogiri (>= 1.12.0)
|
126
123
|
matrix (0.4.2)
|
127
|
-
minitest (5.
|
124
|
+
minitest (5.19.0)
|
128
125
|
multi_json (1.15.0)
|
129
126
|
namae (1.1.1)
|
130
127
|
nokogiri (1.15.3-arm64-darwin)
|
131
128
|
racc (~> 1.4)
|
132
|
-
oj (3.15.
|
133
|
-
optimist (3.0
|
129
|
+
oj (3.15.1)
|
130
|
+
optimist (3.1.0)
|
134
131
|
parallel (1.23.0)
|
135
132
|
parser (3.2.2.3)
|
136
133
|
ast (~> 2.4.1)
|
@@ -150,31 +147,19 @@ GEM
|
|
150
147
|
rake (13.0.6)
|
151
148
|
rdf (3.2.11)
|
152
149
|
link_header (~> 0.0, >= 0.0.8)
|
153
|
-
rdf-
|
154
|
-
|
155
|
-
rdf-rdfa (3.2.2)
|
156
|
-
haml (>= 5.2, < 7)
|
157
|
-
htmlentities (~> 4.3)
|
158
|
-
rdf (~> 3.2)
|
159
|
-
rdf-aggregate-repo (~> 3.2)
|
160
|
-
rdf-vocab (~> 3.2)
|
161
|
-
rdf-xsd (~> 3.2)
|
162
|
-
rdf-rdfxml (3.2.1)
|
163
|
-
haml (~> 5.2)
|
150
|
+
rdf-rdfxml (3.2.2)
|
151
|
+
builder (~> 3.2)
|
164
152
|
htmlentities (~> 4.3)
|
165
153
|
rdf (~> 3.2)
|
166
|
-
rdf-rdfa (~> 3.2)
|
167
154
|
rdf-xsd (~> 3.2)
|
168
155
|
rdf-turtle (3.2.1)
|
169
156
|
ebnf (~> 2.3)
|
170
157
|
rdf (~> 3.2)
|
171
|
-
rdf-vocab (3.2.6)
|
172
|
-
rdf (~> 3.2, >= 3.2.4)
|
173
158
|
rdf-xsd (3.2.1)
|
174
159
|
rdf (~> 3.2)
|
175
160
|
rexml (~> 3.2)
|
176
161
|
regexp_parser (2.8.1)
|
177
|
-
rexml (3.2.
|
162
|
+
rexml (3.2.6)
|
178
163
|
rspec (3.12.0)
|
179
164
|
rspec-core (~> 3.12.0)
|
180
165
|
rspec-expectations (~> 3.12.0)
|
@@ -184,14 +169,14 @@ GEM
|
|
184
169
|
rspec-expectations (3.12.3)
|
185
170
|
diff-lcs (>= 1.2.0, < 2.0)
|
186
171
|
rspec-support (~> 3.12.0)
|
187
|
-
rspec-mocks (3.12.
|
172
|
+
rspec-mocks (3.12.6)
|
188
173
|
diff-lcs (>= 1.2.0, < 2.0)
|
189
174
|
rspec-support (~> 3.12.0)
|
190
175
|
rspec-support (3.12.1)
|
191
176
|
rspec-xsd (0.1.0)
|
192
177
|
nokogiri (~> 1.6)
|
193
178
|
rspec (~> 3)
|
194
|
-
rubocop (1.
|
179
|
+
rubocop (1.55.1)
|
195
180
|
json (~> 2.3)
|
196
181
|
language_server-protocol (>= 3.17.0)
|
197
182
|
parallel (~> 1.10)
|
@@ -199,7 +184,7 @@ GEM
|
|
199
184
|
rainbow (>= 2.2.2, < 4.0)
|
200
185
|
regexp_parser (>= 1.8, < 3.0)
|
201
186
|
rexml (>= 3.2.5, < 4.0)
|
202
|
-
rubocop-ast (>= 1.28.
|
187
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
203
188
|
ruby-progressbar (~> 1.7)
|
204
189
|
unicode-display_width (>= 2.4.0, < 3.0)
|
205
190
|
rubocop-ast (1.29.0)
|
@@ -213,7 +198,7 @@ GEM
|
|
213
198
|
rubocop-ast (>= 0.4.0)
|
214
199
|
rubocop-rake (0.6.0)
|
215
200
|
rubocop (~> 1.0)
|
216
|
-
rubocop-rspec (2.
|
201
|
+
rubocop-rspec (2.23.0)
|
217
202
|
rubocop (~> 1.33)
|
218
203
|
rubocop-capybara (~> 2.17)
|
219
204
|
rubocop-factory_bot (~> 2.22)
|
@@ -231,14 +216,12 @@ GEM
|
|
231
216
|
sxp (1.2.4)
|
232
217
|
matrix (~> 0.4)
|
233
218
|
rdf (~> 3.2)
|
234
|
-
temple (0.10.2)
|
235
219
|
textutils (1.4.0)
|
236
220
|
activesupport
|
237
221
|
logutils (>= 0.6.1)
|
238
222
|
props (>= 1.1.2)
|
239
223
|
rubyzip (>= 1.0.0)
|
240
224
|
thor (1.2.2)
|
241
|
-
tilt (2.2.0)
|
242
225
|
tzinfo (2.0.6)
|
243
226
|
concurrent-ruby (~> 1.0)
|
244
227
|
unf (0.1.4)
|
data/bin/commonmeta
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require File.expand_path("../../lib/commonmeta", __FILE__)
|
4
4
|
|
5
|
-
if (ARGV & %w(--version -v help --help encode decode encode_id decode_id encode_by_blog encode_by_id json_feed_not_indexed json_feed_unregistered json_feed_by_blog update_ghost_post)).empty?
|
5
|
+
if (ARGV & %w(--version -v help --help encode decode encode_id decode_id encode_by_blog encode_by_id json_feed_not_indexed json_feed_unregistered json_feed_by_blog update_ghost_post generate_ghost_api_token)).empty?
|
6
6
|
Commonmeta::CLI.start(ARGV.dup.unshift("convert"))
|
7
7
|
else
|
8
8
|
Commonmeta::CLI.start
|
data/lib/commonmeta/cli.rb
CHANGED
@@ -121,6 +121,13 @@ module Commonmeta
|
|
121
121
|
puts update_ghost_post_via_api(id)
|
122
122
|
end
|
123
123
|
|
124
|
+
desc "", "generate_ghost_api_token"
|
125
|
+
|
126
|
+
def generate_ghost_api_token
|
127
|
+
# generate short lived jwt for ghost admin api
|
128
|
+
puts generate_ghost_token
|
129
|
+
end
|
130
|
+
|
124
131
|
default_task :convert
|
125
132
|
end
|
126
133
|
end
|
data/lib/commonmeta/utils.rb
CHANGED
@@ -1096,14 +1096,14 @@ module Commonmeta
|
|
1096
1096
|
|
1097
1097
|
# parsing of unix timestamps such as 1427846400
|
1098
1098
|
def get_datetime_from_unix_timestamp(unix_timestamp)
|
1099
|
-
strip_milliseconds(DateTime.strptime(unix_timestamp.to_s,
|
1099
|
+
strip_milliseconds(DateTime.strptime(unix_timestamp.to_s, "%s").iso8601)
|
1100
1100
|
rescue StandardError
|
1101
1101
|
nil
|
1102
1102
|
end
|
1103
1103
|
|
1104
1104
|
# parsing of unix timestamps such as 1427846400
|
1105
1105
|
def get_date_from_unix_timestamp(unix_timestamp)
|
1106
|
-
DateTime.strptime(unix_timestamp.to_s,
|
1106
|
+
DateTime.strptime(unix_timestamp.to_s, "%s").strftime("%Y-%m-%d")
|
1107
1107
|
rescue StandardError
|
1108
1108
|
nil
|
1109
1109
|
end
|
@@ -1467,9 +1467,11 @@ module Commonmeta
|
|
1467
1467
|
"https://rogue-scholar.org/api/posts/#{id}"
|
1468
1468
|
end
|
1469
1469
|
|
1470
|
-
def generate_ghost_token(admin_api_key)
|
1470
|
+
def generate_ghost_token(admin_api_key = ENV["API_KEY"])
|
1471
1471
|
# from https://ghost.org/docs/admin-api/
|
1472
1472
|
|
1473
|
+
return nil unless admin_api_key.present?
|
1474
|
+
|
1473
1475
|
# Split the key into ID and SECRET
|
1474
1476
|
id, secret = admin_api_key.split(":")
|
1475
1477
|
|
@@ -1522,7 +1524,7 @@ module Commonmeta
|
|
1522
1524
|
|
1523
1525
|
# update post canonical_url with new doi
|
1524
1526
|
ghost_url = "#{api_url}/ghost/api/admin/posts/#{ghost_id}/"
|
1525
|
-
response = HTTP.auth("Ghost #{ghost_jwt}").headers(
|
1527
|
+
response = HTTP.auth("Ghost #{ghost_jwt}").headers("Content-Type" => "application/json", "Accept-Version" => "v5").put(ghost_url, :json => { "posts" => [{ "canonical_url" => doi, "updated_at" => updated_at }] })
|
1526
1528
|
"#{response.status} DOI #{doi} added to post #{ghost_id}"
|
1527
1529
|
end
|
1528
1530
|
end
|
data/lib/commonmeta/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -371,7 +371,7 @@ describe Commonmeta::CLI do
|
|
371
371
|
end
|
372
372
|
|
373
373
|
it "json_feed_not_indexed" do
|
374
|
-
expect { subject.json_feed_not_indexed }.to output(/
|
374
|
+
expect { subject.json_feed_not_indexed }.to output(/r294649-6f79289-8cw1w/).to_stdout
|
375
375
|
end
|
376
376
|
|
377
377
|
it "json_feed_by_blog" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonmeta-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|