cirneco 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3883d7039860e18b72e4221f9cc6d2991453971
4
- data.tar.gz: 7daac6b6eaaadf0646931d70e8b6bb849280493c
3
+ metadata.gz: 8c54d706925809957c6b2e13498ef108a1dd6f97
4
+ data.tar.gz: b749d9f09ce922be14766ec1e088ddd3a44af503
5
5
  SHA512:
6
- metadata.gz: 5c136aea1e1e0b6b1c6c9fb41e1d154bb679948ae1e659ab73b3463373b7b97bf4ffef0783c6f05f6a797e0c8f2ed56b5d3c6df4309beababbb2b0ddfdce353d
7
- data.tar.gz: ca8a76e900f9777db7d04506e56165da8348a658c49c918ea2b4b43126e9cc78aede0ead8950405656de77490578feff31e6ea7c2299381f22ad11c5cff23f3c
6
+ metadata.gz: 1c101766fe5bf96673fc4b2fbfd602f6d71c5ca93541aa5557c95fbd2b3f7725eb98f752806212f31d2c2b89511e1a9b1175a8ac07dbe080b09eceb093432808
7
+ data.tar.gz: 2a03c0d808979285bcf72e704bdc2ee23624cc3e2ad675eff0ea201f1256654dc4b78dd2b1251a4f934fb29cd88a5731733708ba334ff9e7e27218e000464225
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirneco (0.8.8)
4
+ cirneco (0.8.9)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  base32-crockford-checksum (~> 0.2.2)
7
7
  bergamasco (~> 0.3)
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 :index_dir, :default => ENV['INDEX_DIR']
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 :index_dir, :default => ENV['INDEX_DIR']
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 :index_dir, :default => ENV['INDEX_DIR']
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
- index_dir = options[:index_dir].presence || "/"
343
- build_path = Dir.pwd + index_dir + filename
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
- source_dir = options[:source_dir].presence || "/"
347
- build_path = Dir.pwd + source_dir + filename
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
@@ -1,3 +1,3 @@
1
1
  module Cirneco
2
- VERSION = "0.8.8"
2
+ VERSION = "0.8.9"
3
3
  end
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/", index_dir: "/spec/fixtures/", csl: csl, bibliography: bibliography } }
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
- index_dir: source_dir,
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, index_dir: source_dir)
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, index_dir: source_dir)
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, index_dir: source_dir)
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, index_dir: source_dir)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cirneco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner