cirneco 0.8.8 → 0.8.9
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/cirneco/doi.rb +6 -3
- data/lib/cirneco/utils.rb +4 -8
- data/lib/cirneco/version.rb +1 -1
- data/spec/doi_spec.rb +1 -1
- data/spec/utils_spec.rb +7 -7
- 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: 8c54d706925809957c6b2e13498ef108a1dd6f97
|
|
4
|
+
data.tar.gz: b749d9f09ce922be14766ec1e088ddd3a44af503
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c101766fe5bf96673fc4b2fbfd602f6d71c5ca93541aa5557c95fbd2b3f7725eb98f752806212f31d2c2b89511e1a9b1175a8ac07dbe080b09eceb093432808
|
|
7
|
+
data.tar.gz: 2a03c0d808979285bcf72e704bdc2ee23624cc3e2ad675eff0ea201f1256654dc4b78dd2b1251a4f934fb29cd88a5731733708ba334ff9e7e27218e000464225
|
data/Gemfile.lock
CHANGED
data/lib/cirneco/doi.rb
CHANGED
|
@@ -106,7 +106,8 @@ module Cirneco
|
|
|
106
106
|
method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
|
|
107
107
|
method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
|
|
108
108
|
method_option :source_dir, :default => ENV['SOURCE_DIR']
|
|
109
|
-
method_option :
|
|
109
|
+
method_option :build_dir, :default => ENV['BUILD_DIR']
|
|
110
|
+
method_option :posts_dir, :default => ENV['POSTS_DIR']
|
|
110
111
|
method_option :csl, :default => ENV['SITE_CSLPATH']
|
|
111
112
|
method_option :number, :aliases => '-n'
|
|
112
113
|
method_option :username, :default => ENV['MDS_USERNAME']
|
|
@@ -123,7 +124,8 @@ module Cirneco
|
|
|
123
124
|
method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
|
|
124
125
|
method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
|
|
125
126
|
method_option :source_dir, :default => ENV['SOURCE_DIR']
|
|
126
|
-
method_option :
|
|
127
|
+
method_option :build_dir, :default => ENV['BUILD_DIR']
|
|
128
|
+
method_option :posts_dir, :default => ENV['POSTS_DIR']
|
|
127
129
|
method_option :csl, :default => ENV['SITE_CSLPATH']
|
|
128
130
|
method_option :number, :aliases => '-n'
|
|
129
131
|
method_option :username, :default => ENV['MDS_USERNAME']
|
|
@@ -140,7 +142,8 @@ module Cirneco
|
|
|
140
142
|
method_option :authorpath, :default => ENV['SITE_AUTHORPATH']
|
|
141
143
|
method_option :referencespath, :default => ENV['SITE_REFERENCESPATH']
|
|
142
144
|
method_option :source_dir, :default => ENV['SOURCE_DIR']
|
|
143
|
-
method_option :
|
|
145
|
+
method_option :build_dir, :default => ENV['BUILD_DIR']
|
|
146
|
+
method_option :posts_dir, :default => ENV['POSTS_DIR']
|
|
144
147
|
method_option :csl, :default => ENV['SITE_CSLPATH']
|
|
145
148
|
method_option :bibliography, :default => ENV['SITE_REFERENCESPATH']
|
|
146
149
|
method_option :username, :default => ENV['MDS_USERNAME']
|
data/lib/cirneco/utils.rb
CHANGED
|
@@ -197,8 +197,6 @@ module Cirneco
|
|
|
197
197
|
metadata["publisher"] = metadata.fetch("publisher", {}).fetch("name", nil)
|
|
198
198
|
metadata["publication_year"] = metadata.fetch("datePublished", "")[0..3].to_i
|
|
199
199
|
|
|
200
|
-
resource_type_general =
|
|
201
|
-
|
|
202
200
|
resource_type_general = case metadata["@type"]
|
|
203
201
|
when "Dataset" then "Dataset"
|
|
204
202
|
when "Blog" then "Collection"
|
|
@@ -339,13 +337,11 @@ module Cirneco
|
|
|
339
337
|
filename = (File.basename(uri.path, ".html").presence || "index") + ".html"
|
|
340
338
|
|
|
341
339
|
if filename == "index.html"
|
|
342
|
-
|
|
343
|
-
build_path = Dir.pwd +
|
|
344
|
-
source_path = build_path + ".erb"
|
|
340
|
+
source_path = Dir.pwd + options[:source_dir].to_s + filename + ".erb"
|
|
341
|
+
build_path = Dir.pwd + options[:build_dir].to_s + filename
|
|
345
342
|
else
|
|
346
|
-
|
|
347
|
-
build_path = Dir.pwd +
|
|
348
|
-
source_path = build_path + ".md"
|
|
343
|
+
source_path = Dir.pwd + options[:source_dir].to_s + options[:posts_dir].to_s + filename + ".md"
|
|
344
|
+
build_path = Dir.pwd + options[:build_dir].to_s + options[:posts_dir].to_s + filename
|
|
349
345
|
end
|
|
350
346
|
[filename, build_path, source_path]
|
|
351
347
|
end
|
data/lib/cirneco/version.rb
CHANGED
data/spec/doi_spec.rb
CHANGED
|
@@ -17,7 +17,7 @@ describe Cirneco::Doi do
|
|
|
17
17
|
let(:csl) { "spec/fixtures/apa.csl" }
|
|
18
18
|
let(:bibliography) { "spec/fixtures/bibliography.yaml" }
|
|
19
19
|
let(:api_options) { { username: username, password: password, sandbox: true } }
|
|
20
|
-
let(:mint_options) { { username: username, password: password, sandbox: true, source_dir: "/spec/fixtures/",
|
|
20
|
+
let(:mint_options) { { username: username, password: password, sandbox: true, source_dir: "/spec/fixtures/", build_dir: "/spec/fixtures/", csl: csl, bibliography: bibliography } }
|
|
21
21
|
|
|
22
22
|
describe "MDS DOI API", vcr: true, :order => :defined do
|
|
23
23
|
context "put" do
|
data/spec/utils_spec.rb
CHANGED
|
@@ -8,7 +8,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
|
8
8
|
let(:options) { { username: username,
|
|
9
9
|
password: password,
|
|
10
10
|
sandbox: true,
|
|
11
|
-
|
|
11
|
+
build_dir: source_dir,
|
|
12
12
|
source_dir: source_dir } }
|
|
13
13
|
|
|
14
14
|
subject { Cirneco::DataCenter.new(prefix: prefix,
|
|
@@ -204,7 +204,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
|
204
204
|
context "filepath from url" do
|
|
205
205
|
it 'https://blog.datacite.org/' do
|
|
206
206
|
url = 'https://blog.datacite.org/'
|
|
207
|
-
filename, build_path, source_path = subject.filepath_from_url(url,
|
|
207
|
+
filename, build_path, source_path = subject.filepath_from_url(url, build_dir: source_dir, source_dir: source_dir)
|
|
208
208
|
expect(filename).to eq("index.html")
|
|
209
209
|
expect(source_path).to eq(fixture_path + "index.html.erb")
|
|
210
210
|
expect(build_path).to eq(fixture_path + "index.html")
|
|
@@ -212,7 +212,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
|
212
212
|
|
|
213
213
|
it 'https://blog.datacite.org' do
|
|
214
214
|
url = 'https://blog.datacite.org'
|
|
215
|
-
filename, build_path, source_path = subject.filepath_from_url(url,
|
|
215
|
+
filename, build_path, source_path = subject.filepath_from_url(url, build_dir: source_dir, source_dir: source_dir)
|
|
216
216
|
expect(filename).to eq("index.html")
|
|
217
217
|
expect(source_path).to eq(fixture_path + "index.html.erb")
|
|
218
218
|
expect(build_path).to eq(fixture_path + "index.html")
|
|
@@ -220,7 +220,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
|
220
220
|
|
|
221
221
|
it 'index.html' do
|
|
222
222
|
url = fixture_path + 'index.html'
|
|
223
|
-
filename, build_path, source_path = subject.filepath_from_url(url,
|
|
223
|
+
filename, build_path, source_path = subject.filepath_from_url(url, build_dir: source_dir, source_dir: source_dir)
|
|
224
224
|
expect(filename).to eq("index.html")
|
|
225
225
|
expect(source_path).to eq(fixture_path + "index.html.erb")
|
|
226
226
|
expect(build_path).to eq(fixture_path + "index.html")
|
|
@@ -228,7 +228,7 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
|
228
228
|
|
|
229
229
|
it 'index.html basename' do
|
|
230
230
|
url = 'index.html'
|
|
231
|
-
filename, build_path, source_path = subject.filepath_from_url(url,
|
|
231
|
+
filename, build_path, source_path = subject.filepath_from_url(url, build_dir: source_dir, source_dir: source_dir)
|
|
232
232
|
expect(filename).to eq("index.html")
|
|
233
233
|
expect(source_path).to eq(fixture_path + "index.html.erb")
|
|
234
234
|
expect(build_path).to eq(fixture_path + "index.html")
|
|
@@ -236,14 +236,14 @@ describe Cirneco::DataCenter, vcr: true, :order => :defined do
|
|
|
236
236
|
|
|
237
237
|
it 'cool-dois.html' do
|
|
238
238
|
url = fixture_path + 'cool-dois.html'
|
|
239
|
-
filename, build_path, source_path = subject.filepath_from_url(url, source_dir: source_dir)
|
|
239
|
+
filename, build_path, source_path = subject.filepath_from_url(url, build_dir: source_dir, source_dir: source_dir)
|
|
240
240
|
expect(source_path).to eq(fixture_path + "cool-dois.html.md")
|
|
241
241
|
expect(build_path).to eq(fixture_path + "cool-dois.html")
|
|
242
242
|
end
|
|
243
243
|
|
|
244
244
|
it 'cool-dois.html basename' do
|
|
245
245
|
url = 'cool-dois.html'
|
|
246
|
-
filename, build_path, source_path = subject.filepath_from_url(url, source_dir: source_dir)
|
|
246
|
+
filename, build_path, source_path = subject.filepath_from_url(url, build_dir: source_dir, source_dir: source_dir)
|
|
247
247
|
expect(source_path).to eq(fixture_path + "cool-dois.html.md")
|
|
248
248
|
expect(build_path).to eq(fixture_path + "cool-dois.html")
|
|
249
249
|
end
|