zip_tricks 4.4.2 → 4.5.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.
@@ -1,16 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler'
3
5
  Bundler.setup
4
6
  require_relative '../lib/zip_tricks'
5
7
  require 'terminal-table'
6
8
 
7
- $war_and_peace = File.open(__dir__ + '/in/war-and-peace.txt', 'rb'){|f| f.read }.freeze
9
+ $war_and_peace = File.open(__dir__ + '/in/war-and-peace.txt', 'rb', &:read).freeze
8
10
  $war_and_peace_crc = Zlib.crc32($war_and_peace)
9
11
 
10
- $image_file = File.open(__dir__ + '/in/VTYL8830.jpg', 'rb'){|f| f.read }.freeze
12
+ $image_file = File.open(__dir__ + '/in/VTYL8830.jpg', 'rb', &:read).freeze
11
13
  $image_file_crc = Zlib.crc32($image_file)
12
14
 
13
- class BigEntry < Struct.new(:crc32, :size, :iterations)
15
+ # Rubocop: convention: Missing top-level class documentation comment.
16
+ BigEntry = Struct.new(:crc32, :size, :iterations) do
14
17
  def write_to(io)
15
18
  iterations.times { io << $war_and_peace }
16
19
  end
@@ -21,7 +24,7 @@ def generate_big_entry(desired_minimum_size)
21
24
  crc_stream = ZipTricks::StreamCRC32.new
22
25
  repeats.times { crc_stream << $war_and_peace }
23
26
  entry_size = $war_and_peace.bytesize * repeats
24
- raise "Ooops" if entry_size < desired_minimum_size
27
+ raise 'Ooops' if entry_size < desired_minimum_size
25
28
  BigEntry.new(crc_stream.to_i, entry_size, repeats)
26
29
  end
27
30
 
@@ -32,15 +35,16 @@ $test_descs = []
32
35
  $builder_threads = []
33
36
  at_exit { $builder_threads.map(&:join) }
34
37
 
38
+ # Rubocop: convention: Assignment Branch Condition size for build_test is too high. [23.35/15]
35
39
  def build_test(test_description)
36
40
  $tests_performed += 1
37
41
 
38
- test_file_base = test_description.downcase.gsub(/\-/, '').gsub(/[\s\:]+/, '_')
39
- filename = '%02d-%s.zip' % [$tests_performed, test_file_base]
42
+ test_file_base = test_description.downcase.delete('-').gsub(/[\s\:]+/, '_')
43
+ filename = format('%02d-%s.zip', $tests_performed, test_file_base)
40
44
 
41
- puts 'Test %02d: %s' % [$tests_performed, test_description]
45
+ puts format('Test %02d: %s', $tests_performed, test_description)
42
46
  puts filename
43
- puts ""
47
+ puts ''
44
48
 
45
49
  $test_descs << TestDesc.new(test_description, filename)
46
50
  $builder_threads << Thread.new do
@@ -54,23 +58,24 @@ def build_test(test_description)
54
58
  end
55
59
 
56
60
  # For quickly disabling them by prepending "x" (like RSpec)
57
- def xbuild_test(*)
58
- end
61
+ def xbuild_test(*); end
59
62
 
60
63
  # Prints a text file that you can then fill in
64
+ # Rubocop: convention: Assignment Branch Condition size for prepare_test_protocol
65
+ # is too high. [18.47/15]
61
66
  def prepare_test_protocol
62
67
  File.open(__dir__ + '/test-report.txt', 'wb') do |f|
63
68
  platforms = [
64
- "OSX 10.11 - Archive Utility (builtin)",
65
- "OSX - The Unarchiver 3.10",
66
- "Windows7 x64 - Builtin Explorer ZIP opener",
67
- "Windows7 x64 - 7Zip 9.20",
69
+ 'OSX 10.11 - Archive Utility (builtin)',
70
+ 'OSX - The Unarchiver 3.10',
71
+ 'Windows7 x64 - Builtin Explorer ZIP opener',
72
+ 'Windows7 x64 - 7Zip 9.20'
68
73
  ]
69
74
  platforms.each do |platform_name|
70
75
  f.puts ''
71
- table = Terminal::Table.new title: platform_name, headings: ['Test', 'Outcome']
76
+ table = Terminal::Table.new title: platform_name, headings: %w[Test Outcome]
72
77
  $test_descs.each_with_index do |desc, i|
73
- test_name = [desc.filename, '%s' % desc.title].join("\n")
78
+ test_name = [desc.filename, format('%s', desc.title)].join("\n")
74
79
  outcome = ' ' * 64
75
80
  table << [test_name, outcome]
76
81
  table << :separator if i < ($test_descs.length - 1)
@@ -0,0 +1,28 @@
1
+
2
+ +-------------------+-------------------+
3
+ | OSX 10.11 - Archive Utility (builtin) |
4
+ +-------------------+-------------------+
5
+ | Test | Outcome |
6
+ +-------------------+-------------------+
7
+ +-------------------+-------------------+
8
+
9
+ +-------------+-------------+
10
+ | OSX - The Unarchiver 3.10 |
11
+ +-------------+-------------+
12
+ | Test | Outcome |
13
+ +-------------+-------------+
14
+ +-------------+-------------+
15
+
16
+ +----------------------+---------------------+
17
+ | Windows7 x64 - Builtin Explorer ZIP opener |
18
+ +----------------------+---------------------+
19
+ | Test | Outcome |
20
+ +----------------------+---------------------+
21
+ +----------------------+---------------------+
22
+
23
+ +-------------+------------+
24
+ | Windows7 x64 - 7Zip 9.20 |
25
+ +-------------+------------+
26
+ | Test | Outcome |
27
+ +-------------+------------+
28
+ +-------------+------------+
@@ -1,44 +1,46 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'zip_tricks/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "zip_tricks"
8
- spec.version = ZipTricks::VERSION
9
- spec.authors = ["Julik Tarkhanov"]
10
- spec.email = ["me@julik.nl"]
8
+ spec.name = 'zip_tricks'
9
+ spec.version = ZipTricks::VERSION
10
+ spec.authors = ['Julik Tarkhanov']
11
+ spec.email = ['me@julik.nl']
11
12
 
12
- spec.summary = 'Stream out ZIP files from Ruby'
13
- spec.description = 'Stream out ZIP files from Ruby'
14
- spec.homepage = "http://github.com/wetransfer/zip_tricks"
13
+ spec.summary = 'Stream out ZIP files from Ruby'
14
+ spec.description = 'Stream out ZIP files from Ruby'
15
+ spec.homepage = 'http://github.com/wetransfer/zip_tricks'
15
16
 
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
17
+ # Prevent pushing this gem to RubyGems.org.
18
+ # To allow pushes either set the 'allowed_push_host'
19
+ # To allow pushing to a single host or delete this section to allow pushing to any host.
18
20
  if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
22
  else
21
- raise "RubyGems 2.0 or newer is required to protect against " \
22
- "public gem pushes."
23
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
24
+ 'public gem pushes.'
23
25
  end
24
26
 
25
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
28
  f.match(%r{^(test|spec|features)/})
27
29
  end
28
- spec.bindir = "exe"
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
- spec.require_paths = ["lib"]
30
+ spec.bindir = 'exe'
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ['lib']
31
33
 
32
- spec.add_development_dependency "bundler", "~> 1"
34
+ spec.add_development_dependency 'bundler', '~> 1'
33
35
  spec.add_development_dependency 'rubyzip', '~> 1.1'
34
36
  spec.add_development_dependency 'terminal-table'
35
37
  spec.add_development_dependency 'range_utils'
36
-
38
+
37
39
  spec.add_development_dependency 'rack', '~> 1.6' # For Jeweler
38
- spec.add_development_dependency 'rake', '~> 10.4'
39
- spec.add_development_dependency "rspec", "~> 3"
40
+ spec.add_development_dependency 'rake', '~> 12.2'
41
+ spec.add_development_dependency 'rspec', '~> 3'
40
42
  spec.add_development_dependency 'complexity_assert'
41
43
  spec.add_development_dependency 'coderay'
42
- spec.add_development_dependency "yard", "~> 0.9"
43
-
44
+ spec.add_development_dependency 'yard', '~> 0.9'
45
+ spec.add_development_dependency 'rubocop', '0.51.0' # No conforming to arbitrary rules that _change_ underneath you
44
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_tricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.2
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-29 00:00:00.000000000 Z
11
+ date: 2017-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '10.4'
89
+ version: '12.2'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '10.4'
96
+ version: '12.2'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.9'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '='
158
+ - !ruby/object:Gem::Version
159
+ version: 0.51.0
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '='
165
+ - !ruby/object:Gem::Version
166
+ version: 0.51.0
153
167
  description: Stream out ZIP files from Ruby
154
168
  email:
155
169
  - me@julik.nl
@@ -157,9 +171,12 @@ executables: []
157
171
  extensions: []
158
172
  extra_rdoc_files: []
159
173
  files:
174
+ - ".codeclimate.yml"
160
175
  - ".document"
161
176
  - ".gitignore"
162
177
  - ".rspec"
178
+ - ".rubocop.yml"
179
+ - ".rubocop_todo.yml"
163
180
  - ".travis.yml"
164
181
  - ".yardopts"
165
182
  - CHANGELOG.md
@@ -201,6 +218,7 @@ files:
201
218
  - testing/test-report-2016-07-28.txt
202
219
  - testing/test-report-2016-12-12.txt
203
220
  - testing/test-report-2017-04-2.txt
221
+ - testing/test-report.txt
204
222
  - zip_tricks.gemspec
205
223
  homepage: http://github.com/wetransfer/zip_tricks
206
224
  licenses: []
@@ -222,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
240
  version: '0'
223
241
  requirements: []
224
242
  rubyforge_project:
225
- rubygems_version: 2.6.11
243
+ rubygems_version: 2.4.5.1
226
244
  signing_key:
227
245
  specification_version: 4
228
246
  summary: Stream out ZIP files from Ruby