fcrepo_wrapper 0.3.2 → 0.3.3

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: 948928eb6c192c09f5dfc0ae21bf93e38d1cbba1
4
- data.tar.gz: d542075cf22ff47808eb686466c459698315e0a4
3
+ metadata.gz: c102b7a74944cf02652f2dc830d76e74ef1b8414
4
+ data.tar.gz: 8319d065eb50146b9e8b0cf3cb0466034eaa4083
5
5
  SHA512:
6
- metadata.gz: e1ab2ad5c507c6fffabaa4d7438473db92b1329dc780304a7e459325b4ed879d2f5aeb5553bcbd23271230702b0449e88b5d8edc08ce255f2097e102a2b4824a
7
- data.tar.gz: 97ab45e5bd4bc0b17e4273d7f8be15838b5b5fff7f8d48e598321005a855408c870e1686ff4357a740915f8f38849eb4136f2428369551fab5ee346ac04a514c
6
+ metadata.gz: 0d5e3a3f034cc7822b88a4a74242c1bf2dde1e844c05c5f54db4a9815b3ed9abb08abe8c87f34db83112db6736c411a865865e8e29c5c8f047e3f057fb7522d7
7
+ data.tar.gz: def50e95cda89ee4e934e688042eca1e4c388a40c427e56cabfaea9816e89d272a5376841bcf2cd6cc86c80503a846d10244c94238244d9ab01664fdc82775cc
@@ -22,6 +22,10 @@ module FcrepoWrapper
22
22
  @download_path ||= options.fetch(:download_path, default_download_path)
23
23
  end
24
24
 
25
+ def ignore_md5sum
26
+ options.fetch(:ignore_md5sum, false)
27
+ end
28
+
25
29
  def md5sum_path
26
30
  File.join(download_dir, File.basename(md5url))
27
31
  end
@@ -94,6 +98,10 @@ module FcrepoWrapper
94
98
  options.fetch(:validate, true)
95
99
  end
96
100
 
101
+ def md5sum
102
+ options.fetch(:md5sum, nil)
103
+ end
104
+
97
105
  private
98
106
 
99
107
  def read_config(config_file, verbose)
@@ -22,7 +22,7 @@ module FcrepoWrapper
22
22
  # @option options [String] :version_file Local path to store the currently installed version
23
23
  # @option options [String] :download_dir Local directory to store the downloaded fcrepo jar and its md5 file in (overridden by :download_path)
24
24
  # @option options [String] :download_path Local path for storing the downloaded fcrepo jar file
25
- # @option options [Boolean] :validate Should fcrepo_wrapper download a new md5 and (re-)validate the zip file? (default: trueF)
25
+ # @option options [Boolean] :validate Should fcrepo_wrapper download a new md5 and (re-)false the zip file? (default: trueF)
26
26
  # @option options [String] :md5sum Path/URL to MD5 checksum
27
27
  # @option options [Boolean] :verbose return verbose info when running fcrepo commands
28
28
  # @option options [Boolean] :ignore_md5sum
@@ -1,3 +1,3 @@
1
1
  module FcrepoWrapper
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.3.3'.freeze
3
3
  end
@@ -37,5 +37,16 @@ describe FcrepoWrapper::Configuration do
37
37
  subject { config.validate }
38
38
  it { is_expected.to eq true }
39
39
  end
40
- end
41
40
 
41
+ describe "#md5sum" do
42
+ let(:options) { {} }
43
+ subject { config.md5sum }
44
+ it { is_expected.to be nil }
45
+ end
46
+
47
+ describe "#ignore_md5sum" do
48
+ let(:options) { {} }
49
+ subject { config.ignore_md5sum }
50
+ it { is_expected.to be false }
51
+ end
52
+ end
@@ -4,10 +4,21 @@ describe FcrepoWrapper::MD5 do
4
4
  let(:options) { {} }
5
5
  let(:config) { FcrepoWrapper::Configuration.new options }
6
6
  let(:md5) { described_class.new(config) }
7
- let(:file) { 'Gemfile' }
7
+ let(:file) { 'spec/fixtures/sample_config.yml' }
8
8
 
9
9
  describe "#validate!" do
10
10
  subject { md5.validate!(file) }
11
- it { is_expected.to eq true }
11
+ context "with a checksum mismatch" do
12
+ it "raises an error" do
13
+ expect { subject }.to raise_error "MD5 mismatch"
14
+ end
15
+ end
16
+
17
+ context "with a correct checksum" do
18
+ let(:options) { { md5sum: 'de0b8ccf94db635e149b4c01027b34c1' } }
19
+ it "doesn't raise an error" do
20
+ expect { subject }.not_to raise_error
21
+ end
22
+ end
12
23
  end
13
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fcrepo_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer