druid-tools 2.0.0 → 2.1.0

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
  SHA256:
3
- metadata.gz: f669f7b8429c7d0d95c9b7e8715afc362924911005504f75e8c9c6e9addee306
4
- data.tar.gz: dedef2151df6f1e7ca40ea664834218634e61a44190a17069a6d62973bc9f03d
3
+ metadata.gz: 01fc970eff4953a9530606f133d2d91c2bebeda6b1d182d472f47dae1f54d67b
4
+ data.tar.gz: 7bb69909e6b552d2a5bb1f9cf1a4089e38b3696bcf250843d6754ed9dc238360
5
5
  SHA512:
6
- metadata.gz: a288b3e8ba6a1db699ce7737c196d65859c28f7e52513d0d32a421e39ca30702184e2c2b38eefc5a2d34665dffcc0ea75d85a88d7115989bb9689e865c1c6335
7
- data.tar.gz: 64ac1bdaa0b1c7bfc3a85f0480dca6b1387c76d47635f4a3823be95595303373d0d1d8e4bfd00f95c04ab4186ba7bc24f20fa7464b41f0c91f4f9e0f47facb3a
6
+ metadata.gz: 8b4d19d3d554ebe71afa477780265dccc1ee2bef4ccec0a683cae16df64bc2dd66a6c52b540b05390cd0d62b8aa569bb8f6162d0fa233180a0a938f6b33cb363
7
+ data.tar.gz: c6b7f6ba698164350a8704703d16dc1c5b8a8e6da36173b7c1944d7275a508d785fbaaf1938baa862c987a11c475987ff1d82bd55586e43fdf43ac908c7dfcc1
data/Gemfile CHANGED
@@ -3,11 +3,7 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  group :development do
6
- gem 'debugger', platform: :ruby_19
7
- gem 'pry-debugger', platform: :ruby_19
8
- gem 'rcov', platform: :ruby_18
9
- gem 'ruby-debug', platform: :ruby_18
10
- gem 'simplecov', platform: %i[ruby_19 ruby_20]
6
+ gem 'byebug'
11
7
  end
12
8
 
13
9
  gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ 2.1.0
@@ -16,6 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ['lib']
17
17
  gem.version = File.read('VERSION').strip
18
18
 
19
+ gem.add_dependency 'deprecation'
19
20
  gem.add_development_dependency 'coveralls'
20
21
  gem.add_development_dependency 'rake', '>= 10.1.0'
21
22
  gem.add_development_dependency 'rspec', '~> 3.0'
@@ -2,9 +2,13 @@
2
2
 
3
3
  require 'pathname'
4
4
  require 'fileutils'
5
+ require 'deprecation'
5
6
 
6
7
  module DruidTools
7
8
  class Druid
9
+ extend Deprecation
10
+ self.deprecation_horizon = 'druid-tools 3.0.0'
11
+
8
12
  attr_accessor :druid, :base
9
13
 
10
14
  # See https://consul.stanford.edu/pages/viewpage.action?title=SURI+2.0+Specification&spaceKey=chimera
@@ -41,16 +45,28 @@ module DruidTools
41
45
  end
42
46
  self.prefix = 'druid'
43
47
 
44
- %i[content metadata temp].each do |dir_type|
45
- class_eval <<-EOC
46
- def #{dir_type}_dir(create=true)
47
- path("#{dir_type}",create)
48
- end
48
+ def content_dir(create = true)
49
+ path('content', create)
50
+ end
49
51
 
50
- def find_#{dir_type}(path)
51
- find(:#{dir_type},path)
52
- end
53
- EOC
52
+ def metadata_dir(create = true)
53
+ path('metadata', create)
54
+ end
55
+
56
+ def temp_dir(create = true)
57
+ path('temp', create)
58
+ end
59
+
60
+ def find_content(path)
61
+ find(:content, path)
62
+ end
63
+
64
+ def find_metadata(path)
65
+ find(:metadata, path)
66
+ end
67
+
68
+ def find_temp(path)
69
+ find(:temp, path)
54
70
  end
55
71
 
56
72
  # @param druid [String] A valid druid
@@ -122,6 +138,7 @@ module DruidTools
122
138
  FileUtils.mkdir_p(real_path)
123
139
  FileUtils.ln_s(source, new_path, force: true)
124
140
  end
141
+ deprecation_deprecate :mkdir_with_final_link
125
142
 
126
143
  def rmdir(extra = nil)
127
144
  parts = tree
@@ -137,6 +154,7 @@ module DruidTools
137
154
  parts.pop
138
155
  end
139
156
  end
157
+ deprecation_deprecate :rmdir
140
158
 
141
159
  def pathname
142
160
  Pathname path
@@ -152,6 +170,7 @@ module DruidTools
152
170
  parent.rmtree if parent.exist? && parent != base_pathname
153
171
  prune_ancestors parent.parent
154
172
  end
173
+ deprecation_deprecate :prune!
155
174
 
156
175
  # @param [Pathname] outermost_branch The branch at which pruning begins
157
176
  # @return [void] Ascend the druid tree and prune empty branches
@@ -162,5 +181,6 @@ module DruidTools
162
181
  break if outermost_branch == base_pathname
163
182
  end
164
183
  end
184
+ deprecation_deprecate :prune_ancestors
165
185
  end
166
186
  end
@@ -110,6 +110,7 @@ RSpec.describe DruidTools::Druid do
110
110
  end
111
111
 
112
112
  it '#mkdir, #rmdir create and destroy druid directories' do
113
+ allow(Deprecation).to receive(:warn)
113
114
  expect(File.exist?(tree1)).to eq false
114
115
  expect(File.exist?(tree2)).to eq false
115
116
 
@@ -269,7 +270,10 @@ RSpec.describe DruidTools::Druid do
269
270
  source_dir = '/tmp/content_dir'
270
271
  FileUtils.mkdir_p(source_dir)
271
272
  dr = described_class.new(strictly_valid_druid_str, fixture_dir)
272
- dr.mkdir_with_final_link(source_dir)
273
+ new_path = dr.path
274
+ FileUtils.mkdir_p(File.expand_path('..', new_path))
275
+ FileUtils.ln_s(source_dir, new_path, force: true)
276
+
273
277
  expect { dr.mkdir }.to raise_error(DruidTools::DifferentContentExistsError)
274
278
  end
275
279
  end
@@ -279,6 +283,7 @@ RSpec.describe DruidTools::Druid do
279
283
  let(:druid_obj) { described_class.new(strictly_valid_druid_str, fixture_dir) }
280
284
 
281
285
  before do
286
+ allow(Deprecation).to receive(:warn)
282
287
  FileUtils.mkdir_p(source_dir)
283
288
  end
284
289
 
@@ -306,6 +311,10 @@ RSpec.describe DruidTools::Druid do
306
311
  let(:dr2) { described_class.new(strictly_valid_druid_str, workspace) }
307
312
  let(:pathname1) { dr1.pathname }
308
313
 
314
+ before do
315
+ allow(Deprecation).to receive(:warn)
316
+ end
317
+
309
318
  after do
310
319
  FileUtils.remove_entry workspace
311
320
  end
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: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -9,8 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-28 00:00:00.000000000 Z
12
+ date: 2019-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: deprecation
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
14
28
  - !ruby/object:Gem::Dependency
15
29
  name: coveralls
16
30
  requirement: !ruby/object:Gem::Requirement