druid-tools 1.0.0 → 2.2.0

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.
@@ -0,0 +1,419 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe DruidTools::Druid do
4
+ let(:fixture_dir) { File.expand_path('fixtures', __dir__) }
5
+ let(:druid_str) { 'druid:cd456ef7890' }
6
+ let(:tree1) { File.join(fixture_dir, 'cd/456/ef/7890/cd456ef7890') }
7
+ let(:strictly_valid_druid_str) { 'druid:cd456gh1234' }
8
+ let(:tree2) { File.join(fixture_dir, 'cd/456/gh/1234/cd456gh1234') }
9
+ let(:access_druid_str) { 'druid:cd456ef9999' }
10
+ let(:tree3) { File.join(fixture_dir, 'cd/456/ef/9999') }
11
+
12
+ after do
13
+ FileUtils.rm_rf(File.join(fixture_dir, 'cd'))
14
+ end
15
+
16
+ describe '.valid?' do
17
+ # also tests .pattern
18
+ it 'correctly validates druid strings' do
19
+ tests = [
20
+ # Expected Input druid
21
+ [true, 'druid:aa000bb0001'],
22
+ [true, 'aa000bb0001'],
23
+ [false, 'Aa000bb0001'],
24
+ [false, "xxx\naa000bb0001"],
25
+ [false, 'aaa000bb0001'],
26
+ [false, 'druidX:aa000bb0001'],
27
+ [false, ':aa000bb0001'],
28
+ [true, 'aa123bb1234'],
29
+ [false, 'aa12bb1234'],
30
+ [false, 'aa1234bb1234'],
31
+ [false, 'aa123bb123'],
32
+ [false, 'aa123bb12345'],
33
+ [false, 'a123bb1234'],
34
+ [false, 'aaa123bb1234'],
35
+ [false, 'aa123b1234'],
36
+ [false, 'aa123bbb1234'],
37
+ [false, 'druid:az918AZ9381'.upcase],
38
+ [true, 'druid:az918AZ9381'.downcase],
39
+ [true, 'druid:zz943vx1492']
40
+ ]
41
+ tests.each do |exp, dru|
42
+ expect(described_class.valid?(dru)).to eq(exp)
43
+ expect(described_class.valid?(dru, false)).to eq(exp)
44
+ end
45
+ end
46
+
47
+ context 'with strict validation' do
48
+ it 'correctly validates druid strings' do
49
+ tests = [
50
+ # Expected Input druid
51
+ [false, 'aa000aa0000'],
52
+ [false, 'ee000ee0000'],
53
+ [false, 'ii000ii0000'],
54
+ [false, 'oo000oo0000'],
55
+ [false, 'uu000uu0000'],
56
+ [false, 'll000ll0000'],
57
+ [false, 'aa000bb0001'],
58
+ [true, 'druid:dd000bb0001'],
59
+ [false, 'druid:aa000bb0001'],
60
+ [true, 'dd000bb0001'],
61
+ [false, 'Dd000bb0001'],
62
+ [false, "xxx\ndd000bb0001"],
63
+ [false, 'ddd000bb0001'],
64
+ [false, 'druidX:dd000bb0001'],
65
+ [false, ':dd000bb0001'],
66
+ [true, 'cc123bb1234'],
67
+ [false, 'aa123bb1234'],
68
+ [false, 'dd12bb1234'],
69
+ [false, 'dd1234bb1234'],
70
+ [false, 'dd123bb123'],
71
+ [false, 'dd123bb12345'],
72
+ [false, 'd123bb1234'],
73
+ [false, 'ddd123bb1234'],
74
+ [false, 'dd123b1234'],
75
+ [false, 'dd123bbb1234'],
76
+ [false, 'druid:bz918BZ9381'.upcase],
77
+ [true, 'druid:bz918BZ9381'.downcase],
78
+ [false, 'druid:az918AZ9381'.downcase],
79
+ [true, 'druid:zz943vx1492']
80
+ ]
81
+ tests.each do |exp, dru|
82
+ expect(described_class.valid?(dru, true)).to eq(exp)
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ describe '#pruning_base' do
89
+ subject(:path) { described_class.new(druid_str).pruning_base }
90
+
91
+ it { is_expected.to eq(Pathname.new('./cd/456/ef/7890')) }
92
+ end
93
+
94
+ it '#druid provides the full druid including the prefix' do
95
+ expect(described_class.new('druid:cd456ef7890', fixture_dir).druid).to eq('druid:cd456ef7890')
96
+ expect(described_class.new('cd456ef7890', fixture_dir).druid).to eq('druid:cd456ef7890')
97
+ end
98
+
99
+ it '#id extracts the ID from the stem' do
100
+ expect(described_class.new('druid:cd456ef7890', fixture_dir).id).to eq('cd456ef7890')
101
+ expect(described_class.new('cd456ef7890', fixture_dir).id).to eq('cd456ef7890')
102
+ end
103
+
104
+ describe '#new' do
105
+ it 'raises exception if the druid is invalid' do
106
+ expect { described_class.new('nondruid:cd456ef7890', fixture_dir) }.to raise_error(ArgumentError)
107
+ expect { described_class.new('druid:cd4567ef890', fixture_dir) }.to raise_error(ArgumentError)
108
+ end
109
+
110
+ it 'takes strict argument' do
111
+ described_class.new(strictly_valid_druid_str, fixture_dir, true)
112
+ expect { described_class.new(druid_str, fixture_dir, true) }.to raise_error(ArgumentError)
113
+ end
114
+ end
115
+
116
+ it '#tree builds a druid tree from a druid' do
117
+ druid = described_class.new(druid_str, fixture_dir)
118
+ expect(druid.tree).to eq(%w[cd 456 ef 7890 cd456ef7890])
119
+ expect(druid.path).to eq(tree1)
120
+ end
121
+
122
+ it '#mkdir creates, and #rmdir destroys, *only* the expected druid directory' do
123
+ allow(Deprecation).to receive(:warn)
124
+ expect(File.exist?(tree1)).to be false
125
+ expect(File.exist?(tree2)).to be false
126
+ expect(File.exist?(tree3)).to be false
127
+
128
+ druid1 = described_class.new(druid_str, fixture_dir)
129
+ druid2 = described_class.new(strictly_valid_druid_str, fixture_dir)
130
+ druid3 = DruidTools::AccessDruid.new(access_druid_str, fixture_dir)
131
+
132
+ druid1.mkdir
133
+ expect(File.exist?(tree1)).to be true
134
+ expect(File.exist?(tree2)).to be false
135
+ expect(File.exist?(tree3)).to be false
136
+
137
+ druid2.mkdir
138
+ expect(File.exist?(tree1)).to be true
139
+ expect(File.exist?(tree2)).to be true
140
+ expect(File.exist?(tree3)).to be false
141
+
142
+ druid3.mkdir
143
+ expect(File.exist?(tree1)).to be true
144
+ expect(File.exist?(tree2)).to be true
145
+ expect(File.exist?(tree3)).to be true
146
+
147
+ druid3.rmdir
148
+ expect(File.exist?(tree1)).to be true
149
+ expect(File.exist?(tree2)).to be true
150
+ expect(File.exist?(tree3)).to be false
151
+
152
+ druid2.rmdir
153
+ expect(File.exist?(tree1)).to be true
154
+ expect(File.exist?(tree2)).to be false
155
+ expect(File.exist?(tree3)).to be false
156
+
157
+ druid1.rmdir
158
+ expect(File.exist?(tree1)).to be false
159
+ expect(File.exist?(tree2)).to be false
160
+ expect(File.exist?(tree3)).to be false
161
+ expect(File.exist?(File.join(fixture_dir, 'cd'))).to be false
162
+ end
163
+
164
+ describe 'alternate prefixes' do
165
+ before :all do
166
+ described_class.prefix = 'sulair'
167
+ end
168
+
169
+ after :all do
170
+ described_class.prefix = 'druid'
171
+ end
172
+
173
+ it 'handles alternate prefixes' do
174
+ expect { described_class.new('druid:cd456ef7890', fixture_dir) }.to raise_error(ArgumentError)
175
+ expect(described_class.new('sulair:cd456ef7890', fixture_dir).id).to eq('cd456ef7890')
176
+ expect(described_class.new('cd456ef7890', fixture_dir).druid).to eq('sulair:cd456ef7890')
177
+ end
178
+ end
179
+
180
+ describe 'content directories' do
181
+ it 'knows where its content goes' do
182
+ druid = described_class.new(druid_str, fixture_dir)
183
+ expect(druid.content_dir(false)).to eq(File.join(tree1, 'content'))
184
+ expect(druid.metadata_dir(false)).to eq(File.join(tree1, 'metadata'))
185
+ expect(druid.temp_dir(false)).to eq(File.join(tree1, 'temp'))
186
+
187
+ expect(File.exist?(File.join(tree1, 'content'))).to be false
188
+ expect(File.exist?(File.join(tree1, 'metadata'))).to be false
189
+ expect(File.exist?(File.join(tree1, 'temp'))).to be false
190
+ end
191
+
192
+ it 'creates its content directories on the fly' do
193
+ druid = described_class.new(druid_str, fixture_dir)
194
+ expect(druid.content_dir).to eq(File.join(tree1, 'content'))
195
+ expect(druid.metadata_dir).to eq(File.join(tree1, 'metadata'))
196
+ expect(druid.temp_dir).to eq(File.join(tree1, 'temp'))
197
+
198
+ expect(File.exist?(File.join(tree1, 'content'))).to be true
199
+ expect(File.exist?(File.join(tree1, 'metadata'))).to be true
200
+ expect(File.exist?(File.join(tree1, 'temp'))).to be true
201
+ end
202
+
203
+ it 'matches glob' do
204
+ druid = described_class.new(druid_str, fixture_dir)
205
+ druid.mkdir
206
+ expect(Dir.glob(File.join(File.dirname(druid.path), described_class.glob)).size).to eq(1)
207
+ end
208
+
209
+ it 'matches strict_glob' do
210
+ druid = described_class.new(druid_str, fixture_dir)
211
+ druid.mkdir
212
+ expect(Dir.glob(File.join(File.dirname(druid.path), described_class.strict_glob)).size).to eq(0)
213
+ druid = described_class.new(strictly_valid_druid_str, fixture_dir)
214
+ druid.mkdir
215
+ expect(Dir.glob(File.join(File.dirname(druid.path), described_class.strict_glob)).size).to eq(1)
216
+ end
217
+ end
218
+
219
+ describe 'content discovery' do
220
+ let(:druid) { described_class.new(druid_str, fixture_dir) }
221
+ let(:filelist) { %w[1 2 3 4].collect { |num| "someFile#{num}" } }
222
+
223
+ it 'finds content in content directories' do
224
+ location = druid.content_dir
225
+ File.write(File.join(location, 'someContent'), 'This is the content')
226
+ expect(druid.find_content('someContent')).to eq(File.join(location, 'someContent'))
227
+ end
228
+
229
+ it 'finds content in the root directory' do
230
+ location = druid.path(nil, true)
231
+ File.write(File.join(location, 'someContent'), 'This is the content')
232
+ expect(druid.find_content('someContent')).to eq(File.join(location, 'someContent'))
233
+ end
234
+
235
+ it 'finds content in the leaf directory' do
236
+ location = File.expand_path('..', druid.path(nil, true))
237
+ File.write(File.join(location, 'someContent'), 'This is the content')
238
+ expect(druid.find_content('someContent')).to eq(File.join(location, 'someContent'))
239
+ end
240
+
241
+ it 'does not find content in the wrong content directory' do
242
+ location = druid.metadata_dir
243
+ File.write(File.join(location, 'someContent'), 'This is the content')
244
+ expect(druid.find_content('someContent')).to be_nil
245
+ end
246
+
247
+ it 'does not find content in a higher-up directory' do
248
+ location = File.expand_path('../..', druid.path(nil, true))
249
+ File.write(File.join(location, 'someContent'), 'This is the content')
250
+ expect(druid.find_content('someContent')).to be_nil
251
+ end
252
+
253
+ it 'finds a filelist in the content directory' do
254
+ location = Pathname(druid.content_dir)
255
+ filelist.each do |filename|
256
+ location.join(filename).open('w') { |f| f.write "This is #{filename}" }
257
+ end
258
+ expect(druid.find_filelist_parent('content', filelist)).to eq(location)
259
+ end
260
+
261
+ it 'finds a filelist in the root directory' do
262
+ location = Pathname(druid.path(nil, true))
263
+ filelist.each do |filename|
264
+ location.join(filename).open('w') { |f| f.write "This is #{filename}" }
265
+ end
266
+ expect(druid.find_filelist_parent('content', filelist)).to eq(location)
267
+ end
268
+
269
+ it 'finds a filelist in the leaf directory' do
270
+ location = Pathname(File.expand_path('..', druid.path(nil, true)))
271
+ filelist.each do |filename|
272
+ location.join(filename).open('w') { |f| f.write "This is #{filename}" }
273
+ end
274
+ expect(druid.find_filelist_parent('content', filelist)).to eq(location)
275
+ end
276
+
277
+ it 'raises an exception if the first file in the filelist is not found' do
278
+ Pathname(druid.content_dir)
279
+ expect { druid.find_filelist_parent('content', filelist) }.to raise_exception(/content dir not found for 'someFile1' when searching/)
280
+ end
281
+
282
+ it 'raises an exception if any other file in the filelist is not found' do
283
+ location = Pathname(druid.content_dir)
284
+ location.join(filelist.first).open('w') { |f| f.write "This is #{filelist.first}" }
285
+ expect { druid.find_filelist_parent('content', filelist) }.to raise_exception(/File 'someFile2' not found/)
286
+ end
287
+ end
288
+
289
+ describe '#mkdir error handling' do
290
+ it 'raises SameContentExistsError if the directory already exists' do
291
+ druid_obj = described_class.new(strictly_valid_druid_str, fixture_dir)
292
+ druid_obj.mkdir
293
+ expect { druid_obj.mkdir }.to raise_error(DruidTools::SameContentExistsError)
294
+ end
295
+
296
+ it 'raises DifferentContentExistsError if a link already exists in the workspace for this druid' do
297
+ source_dir = '/tmp/content_dir'
298
+ FileUtils.mkdir_p(source_dir)
299
+ dr = described_class.new(strictly_valid_druid_str, fixture_dir)
300
+ new_path = dr.path
301
+ FileUtils.mkdir_p(File.expand_path('..', new_path))
302
+ FileUtils.ln_s(source_dir, new_path, force: true)
303
+
304
+ expect { dr.mkdir }.to raise_error(DruidTools::DifferentContentExistsError)
305
+ end
306
+ end
307
+
308
+ describe '#mkdir_with_final_link' do
309
+ let(:source_dir) { '/tmp/content_dir' }
310
+ let(:druid_obj) { described_class.new(strictly_valid_druid_str, fixture_dir) }
311
+
312
+ before do
313
+ allow(Deprecation).to receive(:warn)
314
+ FileUtils.mkdir_p(source_dir)
315
+ end
316
+
317
+ it 'creates a druid tree in the workspace with the final directory being a link to the passed in source' do
318
+ druid_obj.mkdir_with_final_link(source_dir)
319
+ expect(File).to be_symlink(druid_obj.path)
320
+ expect(File.readlink(tree2)).to eq(source_dir)
321
+ end
322
+
323
+ it 'does not error out if the link to source already exists' do
324
+ druid_obj.mkdir_with_final_link(source_dir)
325
+ expect(File).to be_symlink(druid_obj.path)
326
+ expect(File.readlink(tree2)).to eq(source_dir)
327
+ end
328
+
329
+ it 'raises DifferentContentExistsError if a directory already exists in the workspace for this druid' do
330
+ druid_obj.mkdir(fixture_dir)
331
+ expect { druid_obj.mkdir_with_final_link(source_dir) }.to raise_error(DruidTools::DifferentContentExistsError)
332
+ end
333
+ end
334
+
335
+ describe '#prune!' do
336
+ let(:workspace) { Dir.mktmpdir }
337
+ let(:dr1) { described_class.new(druid_str, workspace) }
338
+ let(:dr2) { described_class.new(strictly_valid_druid_str, workspace) }
339
+ let(:dr3) { DruidTools::AccessDruid.new(access_druid_str, workspace) }
340
+ let(:pathname1) { dr1.pathname }
341
+
342
+ before do
343
+ allow(Deprecation).to receive(:warn)
344
+ end
345
+
346
+ after do
347
+ FileUtils.remove_entry workspace
348
+ end
349
+
350
+ context 'with an access druid sharing the first three path segments' do
351
+ before do
352
+ # Nil the create records for this context because we're in a known read only one
353
+ dr1.mkdir
354
+ dr2.mkdir
355
+ dr3.mkdir
356
+ dr3.prune!
357
+ end
358
+
359
+ it 'deletes the outermost directory' do
360
+ expect(File).not_to exist(dr3.pruning_base)
361
+ end
362
+
363
+ it 'does not delete unrelated ancestor directories' do
364
+ expect(File).to exist(dr1.pruning_base)
365
+ expect(File).to exist(dr1.pruning_base.parent)
366
+ end
367
+
368
+ it 'stops at ancestor directories that have children' do
369
+ # 'cd/456/ef' should still exist because of dr1
370
+ shared_ancestor = dr1.pruning_base.parent
371
+ expect(shared_ancestor.to_s).to match(%r{cd/456/ef$})
372
+ expect(File).to exist(shared_ancestor)
373
+ end
374
+ end
375
+
376
+ context 'when there is a shared ancestor' do
377
+ before do
378
+ # Nil the create records for this context because we're in a known read only one
379
+ dr1.mkdir
380
+ dr2.mkdir
381
+ dr1.prune!
382
+ end
383
+
384
+ it 'deletes the outermost directory' do
385
+ expect(File).not_to exist(dr1.path)
386
+ end
387
+
388
+ it 'deletes empty ancestor directories' do
389
+ expect(File).not_to exist(pathname1.parent)
390
+ expect(File).not_to exist(pathname1.parent.parent)
391
+ end
392
+
393
+ it 'stops at ancestor directories that have children' do
394
+ # 'cd/456' should still exist because of druid2
395
+ shared_ancestor = pathname1.parent.parent.parent
396
+ expect(shared_ancestor.to_s).to match(%r{cd/456$})
397
+ expect(File).to exist(shared_ancestor)
398
+ end
399
+ end
400
+
401
+ it 'removes all directories up to the base path when there are no common ancestors' do
402
+ # Nil the create records for this test
403
+ dr1.mkdir
404
+ dr1.prune!
405
+ expect(File).not_to exist(File.join(workspace, 'cd'))
406
+ expect(File).to exist(workspace)
407
+ end
408
+
409
+ it 'removes directories with symlinks' do
410
+ # Nil the create records for this test
411
+ source_dir = File.join workspace, 'src_dir'
412
+ FileUtils.mkdir_p(source_dir)
413
+ dr2.mkdir_with_final_link(source_dir)
414
+ dr2.prune!
415
+ expect(File).not_to exist(dr2.path)
416
+ expect(File).not_to exist(File.join(workspace, 'cd'))
417
+ end
418
+ end
419
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
- #$LOAD_PATH.unshift(File.expand_path('../../lib',__FILE__))
1
+ # frozen_string_literal: true
2
+
3
+ # $LOAD_PATH.unshift(File.expand_path('../../lib',__FILE__))
2
4
 
3
5
  require 'coveralls'
4
6
  Coveralls.wear_merged! # because we run travis on multiple rubies
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: druid-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -9,78 +9,92 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-19 00:00:00.000000000 Z
12
+ date: 2022-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rake
15
+ name: deprecation
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 10.1.0
21
- type: :development
20
+ version: '0'
21
+ type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 10.1.0
27
+ version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rspec
29
+ name: coveralls
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '3.0'
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '3.0'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: coveralls
43
+ name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '0'
48
+ version: 10.1.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '0'
55
+ version: 10.1.0
56
56
  - !ruby/object:Gem::Dependency
57
- name: rubocop
57
+ name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 0.50.0
62
+ version: '3.0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 0.50.0
69
+ version: '3.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rubocop
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rubocop-rspec
72
86
  requirement: !ruby/object:Gem::Requirement
73
87
  requirements:
74
- - - "~>"
88
+ - - ">="
75
89
  - !ruby/object:Gem::Version
76
- version: 1.18.0
90
+ version: '0'
77
91
  type: :development
78
92
  prerelease: false
79
93
  version_requirements: !ruby/object:Gem::Requirement
80
94
  requirements:
81
- - - "~>"
95
+ - - ">="
82
96
  - !ruby/object:Gem::Version
83
- version: 1.18.0
97
+ version: '0'
84
98
  description: Tools to manipulate DRUID trees and content directories
85
99
  email:
86
100
  - mbklein@stanford.edu
@@ -88,11 +102,12 @@ executables: []
88
102
  extensions: []
89
103
  extra_rdoc_files: []
90
104
  files:
105
+ - ".circleci/config.yml"
106
+ - ".github/pull_request_template.md"
91
107
  - ".gitignore"
92
108
  - ".rspec"
93
109
  - ".rubocop.yml"
94
110
  - ".rubocop_todo.yml"
95
- - ".travis.yml"
96
111
  - Gemfile
97
112
  - LICENSE
98
113
  - README.md
@@ -105,14 +120,15 @@ files:
105
120
  - lib/druid_tools/druid.rb
106
121
  - lib/druid_tools/exceptions.rb
107
122
  - lib/druid_tools/version.rb
108
- - spec/access_druid_spec.rb
109
- - spec/druid_spec.rb
123
+ - spec/druid_tools/purl_druid_spec.rb
124
+ - spec/druid_tools_spec.rb
110
125
  - spec/spec_helper.rb
111
126
  homepage: http://github.com/sul-dlss/druid-tools
112
127
  licenses:
113
128
  - ALv2
114
129
  - Stanford University Libraries
115
- metadata: {}
130
+ metadata:
131
+ rubygems_mfa_required: 'true'
116
132
  post_install_message:
117
133
  rdoc_options: []
118
134
  require_paths:
@@ -121,19 +137,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
137
  requirements:
122
138
  - - ">="
123
139
  - !ruby/object:Gem::Version
124
- version: '0'
140
+ version: '3.0'
125
141
  required_rubygems_version: !ruby/object:Gem::Requirement
126
142
  requirements:
127
143
  - - ">="
128
144
  - !ruby/object:Gem::Version
129
145
  version: '0'
130
146
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.6.13
147
+ rubygems_version: 3.2.32
133
148
  signing_key:
134
149
  specification_version: 4
135
150
  summary: Tools to manipulate DRUID trees and content directories
136
151
  test_files:
137
- - spec/access_druid_spec.rb
138
- - spec/druid_spec.rb
152
+ - spec/druid_tools/purl_druid_spec.rb
153
+ - spec/druid_tools_spec.rb
139
154
  - spec/spec_helper.rb
data/.travis.yml DELETED
@@ -1,18 +0,0 @@
1
- notifications:
2
- email: false
3
-
4
- rvm:
5
- - 2.1.2
6
- - 2.2.4
7
- - 2.3.1
8
- - 2.4.1
9
- - 2.4.2
10
-
11
- # script, expressed as an array, is necessary for 'bundle exec coveralls push' to work locally
12
- script:
13
- - bundle exec rake
14
-
15
- cache: bundler
16
-
17
- before_install:
18
- - gem install bundler # the default version of bundler for ruby 2.1 is out of date.
@@ -1,28 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe DruidTools::PurlDruid do
4
-
5
- let(:purl_root) { Dir.mktmpdir }
6
-
7
- let(:druid) { DruidTools::PurlDruid.new 'druid:cd456ef7890', purl_root }
8
-
9
- after(:each) do
10
- FileUtils.remove_entry purl_root
11
- end
12
-
13
- it "overrides Druid#tree so that the leaf is not Druid#id" do
14
- expect(druid.tree).to eq(['cd','456','ef','7890'])
15
- end
16
-
17
- describe "#content_dir" do
18
-
19
- it "creates content directories at leaf of the druid tree" do
20
- expect(druid.content_dir).to match(/ef\/7890$/)
21
- end
22
-
23
- it "does not create a 'content' subdirectory" do
24
- expect(druid.content_dir).to_not match(/content$/)
25
- end
26
- end
27
-
28
- end