bagit 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
3
4
 
4
5
  describe BagIt::Bag do
5
6
  describe "a valid bag" do
@@ -7,11 +8,11 @@ describe BagIt::Bag do
7
8
  @sandbox = Sandbox.new
8
9
 
9
10
  # make the bag
10
- @bag_path = File.join @sandbox.to_s, 'the_bag'
11
+ @bag_path = File.join @sandbox.to_s, "the_bag"
11
12
  @bag = described_class.new @bag_path
12
13
 
13
14
  # add some files
14
- File.open('/dev/urandom') do |rio|
15
+ File.open("/dev/urandom") do |rio|
15
16
  10.times do |n|
16
17
  @bag.add_file("file-#{n}-💩
17
18
  ") { |io| io.write rio.read(16) }
@@ -32,38 +33,38 @@ describe BagIt::Bag do
32
33
 
33
34
  it "is invalid if there is a file that's in the bag, but not in the manifest" do
34
35
  # add a file into the bag through the back door
35
- File.open(File.join(@bag.data_dir, 'not-manifested'), 'w') do |io|
36
- io.puts 'nothing to see here, move along'
36
+ File.open(File.join(@bag.data_dir, "not-manifested"), "w") do |io|
37
+ io.puts "nothing to see here, move along"
37
38
  end
38
39
 
39
- @bag.validate_only('true_for/completeness')
40
+ @bag.validate_only("true_for/completeness")
40
41
  expect(@bag.errors.on(:completeness)).not_to be_empty
41
42
  expect(@bag).not_to be_valid
42
43
  end
43
44
 
44
45
  it "is invalid if there are files that are in the manifest but not in the bag" do
45
46
  # add a file and then remove it through the back door
46
- @bag.add_file("file-k") { |io| io.puts 'time to go' }
47
+ @bag.add_file("file-k") { |io| io.puts "time to go" }
47
48
  @bag.manifest!
48
49
 
49
- FileUtils.rm File.join(@bag.bag_dir, 'data', 'file-k')
50
+ FileUtils.rm File.join(@bag.bag_dir, "data", "file-k")
50
51
 
51
- @bag.validate_only('true_for/completeness')
52
+ @bag.validate_only("true_for/completeness")
52
53
  expect(@bag.errors.on(:completeness)).not_to be_empty
53
54
  expect(@bag).not_to be_valid
54
55
  end
55
56
 
56
57
  it "is invalid if there is a fixity problem" do
57
58
  # tweak a file through the back door
58
- File.open(@bag.bag_files[0], 'a') { |io| io.puts 'oops!' }
59
+ File.open(@bag.bag_files[0], "a") { |io| io.puts "oops!" }
59
60
 
60
- @bag.validate_only('true_for/consistency')
61
+ @bag.validate_only("true_for/consistency")
61
62
  expect(@bag.errors.on(:consistency)).not_to be_empty
62
63
  expect(@bag).not_to be_valid
63
64
  end
64
65
 
65
66
  it "calculates sha1 correctly for a big file" do
66
- @bag.add_file 'big-data-file' do |fh|
67
+ @bag.add_file "big-data-file" do |fh|
67
68
  count = 0
68
69
  while count < 1024 * 512
69
70
  fh.write "1" * 1024
@@ -71,14 +72,14 @@ describe BagIt::Bag do
71
72
  end
72
73
  end
73
74
  @bag.manifest!
74
- sha1_manifest = File.join @bag_path, 'manifest-sha1.txt'
75
+ sha1_manifest = File.join @bag_path, "manifest-sha1.txt"
75
76
  checksums = {}
76
77
  File.open(sha1_manifest).each_line do |line|
77
- fixity, path = line.split(' ')
78
+ fixity, path = line.split(" ")
78
79
  checksums[path] = fixity
79
80
  end
80
- expected = checksums['data/big-data-file']
81
- expect(expected).to eq('12be64c30968bb90136ee695dc58f4b2276968c6')
81
+ expected = checksums["data/big-data-file"]
82
+ expect(expected).to eq("12be64c30968bb90136ee695dc58f4b2276968c6")
82
83
  end
83
84
 
84
85
  it "validates by oxum when needed" do
@@ -87,7 +88,7 @@ describe BagIt::Bag do
87
88
 
88
89
  it "raises a sensible error when the manifest algorithm is unknown" do
89
90
  # add a manifest with an unsupported algorithm
90
- File.open(File.join(@bag.bag_dir, 'manifest-sha999.txt'), 'w') do |io|
91
+ File.open(File.join(@bag.bag_dir, "manifest-sha999.txt"), "w") do |io|
91
92
  io.puts "digest-does-not-matter data/file-0\n"
92
93
  end
93
94
  expect { @bag.valid? }.to raise_error ArgumentError
@@ -95,13 +96,13 @@ describe BagIt::Bag do
95
96
 
96
97
  it "validates false by oxum when file count is incorrect" do
97
98
  # tweak oxum through backdoor
98
- File.open(@bag.bag_info_txt_file, 'a') { |f| f.write "Payload-Oxum: " + @bag.bag_info["Payload-Oxum"].split('.')[0] + '.0' }
99
+ File.open(@bag.bag_info_txt_file, "a") { |f| f.write "Payload-Oxum: " + @bag.bag_info["Payload-Oxum"].split(".")[0] + ".0" }
99
100
  expect(@bag.valid_oxum?).to eq(false)
100
101
  end
101
102
 
102
103
  it "validates false by oxum when octetstream size is incorrect" do
103
104
  # tweak oxum through backdoor
104
- File.open(@bag.bag_info_txt_file, 'a') { |f| f.write "Payload-Oxum: 1." + @bag.bag_info["Payload-Oxum"].split('.')[1] }
105
+ File.open(@bag.bag_info_txt_file, "a") { |f| f.write "Payload-Oxum: 1." + @bag.bag_info["Payload-Oxum"].split(".")[1] }
105
106
  expect(@bag.valid_oxum?).to eq(false)
106
107
  end
107
108
 
@@ -127,10 +128,10 @@ describe BagIt::Bag do
127
128
  describe "tag manifest validation" do
128
129
  it "is invalid if listed tag file does not exist" do
129
130
  # add a file and then remove it through the back door
130
- @bag.add_tag_file("tag-k") { |io| io.puts 'time to go' }
131
+ @bag.add_tag_file("tag-k") { |io| io.puts "time to go" }
131
132
  @bag.tagmanifest!
132
133
 
133
- FileUtils.rm File.join(@bag.bag_dir, 'tag-k')
134
+ FileUtils.rm File.join(@bag.bag_dir, "tag-k")
134
135
 
135
136
  # @bag.should_not be_valid
136
137
  expect(@bag).not_to be_valid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bagit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Johnson, Francesco Lazzarino, Jamie Little
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-09 00:00:00.000000000 Z
11
+ date: 2022-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: validatable
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: bixby
42
+ name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: bundler
56
+ name: coveralls
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: coveralls
70
+ name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry
84
+ name: pry-byebug
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,47 +95,47 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: pry-byebug
98
+ name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 12.3.3
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 12.3.3
111
111
  - !ruby/object:Gem::Dependency
112
- name: rake
112
+ name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '10.4'
117
+ version: '3'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '10.4'
124
+ version: '3'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rspec
126
+ name: standard
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
- version: '3'
131
+ version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
- version: '3'
138
+ version: '0'
139
139
  description: Ruby Library and Command Line tools for bagit
140
140
  email: jamie@jamielittle.org
141
141
  executables:
@@ -144,7 +144,6 @@ extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
146
  - ".gitignore"
147
- - ".rubocop.yml"
148
147
  - ".travis.yml"
149
148
  - Gemfile
150
149
  - LICENSE.txt
@@ -174,24 +173,26 @@ homepage: http://github.com/tipr/bagit
174
173
  licenses:
175
174
  - MIT
176
175
  metadata: {}
177
- post_install_message:
176
+ post_install_message:
178
177
  rdoc_options: []
179
178
  require_paths:
180
179
  - lib
181
180
  required_ruby_version: !ruby/object:Gem::Requirement
182
181
  requirements:
183
- - - "~>"
182
+ - - ">="
184
183
  - !ruby/object:Gem::Version
185
184
  version: '2.0'
185
+ - - "<"
186
+ - !ruby/object:Gem::Version
187
+ version: '3.2'
186
188
  required_rubygems_version: !ruby/object:Gem::Requirement
187
189
  requirements:
188
190
  - - ">="
189
191
  - !ruby/object:Gem::Version
190
192
  version: '0'
191
193
  requirements: []
192
- rubyforge_project:
193
- rubygems_version: 2.6.14
194
- signing_key:
194
+ rubygems_version: 3.2.3
195
+ signing_key:
195
196
  specification_version: 4
196
197
  summary: BagIt package generation and validation
197
198
  test_files:
data/.rubocop.yml DELETED
@@ -1,22 +0,0 @@
1
- inherit_gem:
2
- bixby: bixby_default.yml
3
- Rails/Delegate:
4
- Enabled: false
5
- Rails/Date:
6
- Enabled: false
7
- RSpec/InstanceVariable:
8
- Enabled: false
9
- Metrics/BlockLength:
10
- Enabled: false
11
- Metrics/ModuleLength:
12
- Enabled: false
13
- Metrics/MethodLength:
14
- Enabled: false
15
- RSpec/ExampleLength:
16
- Enabled: false
17
- Style/Semicolon:
18
- Enabled: false
19
- Style/ClassVars:
20
- Enabled: false
21
- Metrics/AbcSize:
22
- Enabled: false