pr-zlib 1.0.5 → 1.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e267929bdd826d6886a7c925291f1a8e2f344e9d2d6a4458c11f7fff0a68f896
4
- data.tar.gz: 04d530d76deb665ba5b825545ac41b032ae0b2a792d24b72ab09e5bc3281c642
3
+ metadata.gz: 884faa312813258452c180d7b246e02d3d373b79d5990c7aed19d66c4280db5d
4
+ data.tar.gz: dfffc0fd870fc104809938535c89c6a65be8612c607c930c261386b972f741bf
5
5
  SHA512:
6
- metadata.gz: 5bfa36efad4f579428aa55297044cf0a1174fbded31d7b0e4c2d79815306bb9406f9b48ed4afb7c71c2e12d8114650efca13a444c391dcc5f11a72bc56da3073
7
- data.tar.gz: ae47b4147c1607ec1ab0962a5c49200874c3b62010186a1648b2c27f8b85f341a5ef83074774acdaa9b809c73d21938098850279cc037b3742fce98321675381
6
+ metadata.gz: 0c947923f7ca9f1f73a677774d4820ecbce39e6c059ecd1987c15ee47a5c7fad58e797ec0628e984a27157cc771c5cc6780af0f1ce4c25a988a8666c216f2c4d
7
+ data.tar.gz: 66bde3b05ad77c5ad8dc45ea4c38b414ce315735c3453cf08dcdd35409e2d8f3965cc576db31a2233668182ade1118e5bffcb22e11b0a71e7db3e34b5c4a269b
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ = 1.0.6 - 19-Mar-2018
2
+ * Added the minirbgzip executable, a Ruby implementation of minigzip.
3
+ Formerly minigzip.rb, this had been part of the repo but had never been
4
+ released with the gem.
5
+ * Some minor updates and fixes to the minirbgzip executable.
6
+ * Metadata fix for changelog_uri.
7
+
1
8
  = 1.0.5 - 18-Mar-2018
2
9
  * Set the frozen_string_literal pragma, which gives us a small performance
3
10
  boost for reads.
data/MANIFEST CHANGED
@@ -2,7 +2,7 @@ CHANGES
2
2
  MANIFEST
3
3
  README
4
4
  pr-zlib.gemspec
5
- bin/minizip.rb
5
+ bin/minirbgzip
6
6
  certs/djberg96_pub.pem
7
7
  examples/example_rbzlib.rb
8
8
  lib/pr-zlib.rb
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  namespace :gem do
18
18
  desc 'Create the pr-zlib gem'
19
- task :create do
19
+ task :create => :clean do
20
20
  require 'rubygems/package'
21
21
  spec = eval(IO.read('pr-zlib.gemspec'))
22
22
  spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
@@ -1,9 +1,7 @@
1
- # minigzip.rb -- simulate gzip using the zlib compression library
1
+ # minigzip -- simulate gzip using the zlib compression library
2
2
  # Copyright (C) 1995-2005 Jean-loup Gailly.
3
3
  # For conditions of distribution and use, see copyright notice in rbzlib.rb
4
4
  #
5
- #
6
- #
7
5
  # minigzip is a minimal implementation of the gzip utility. This is
8
6
  # only an example of using zlib and isn't meant to replace the
9
7
  # full-featured gzip. No attempt is made to deal with file systems
@@ -11,10 +9,10 @@
11
9
  # very limited. So use minigzip only for testing; use gzip for the
12
10
  # real thing. On MSDOS, use only on file names without extension
13
11
  # or in pipe mode.
14
- #
15
- # Ruby tralnslation By Park Heesob.
12
+ #
13
+ # minigzip to minirbgzip Ruby translation By Park Heesob.
16
14
 
17
- require 'rbzlib'
15
+ require 'pr-zlib'
18
16
  include Rbzlib
19
17
 
20
18
  GZ_SUFFIX = ".gz"
@@ -23,69 +21,70 @@ SUFFIX_LEN = GZ_SUFFIX.length
23
21
  BUFLEN = 16384
24
22
  MAX_NAME_LEN = 1024
25
23
 
26
-
27
24
  def error(msg)
28
- puts("#{__FILE__}: #{msg}")
29
- exit(1)
25
+ puts("#{__FILE__}: #{msg}")
26
+ exit(1)
30
27
  end
31
28
 
32
29
  def gz_compress(_in, out)
33
- while(true)
34
- begin
35
- buf = _in.read(BUFLEN)
36
- rescue
37
- raise RuntimeError,"read"
38
- end
39
- break if buf.nil?
40
- err = 0
41
- len = buf.length
42
- if (gzwrite(out, buf, len) != len)
43
- error(gzerror(out, err))
44
- end
30
+ while true
31
+ begin
32
+ buf = _in.read(BUFLEN)
33
+ rescue
34
+ raise RuntimeError,"read"
45
35
  end
46
- _in.close
47
- error("failed gzclose") if (gzclose(out) != Z_OK)
48
- end
49
36
 
37
+ break if buf.nil?
38
+
39
+ err = 0
40
+ len = buf.length
41
+
42
+ if (gzwrite(out, buf, len) != len)
43
+ error(gzerror(out, err))
44
+ end
45
+ end
46
+ _in.close
47
+ error("failed gzclose") if (gzclose(out) != Z_OK)
48
+ end
50
49
 
51
50
  def gz_uncompress(_in, out)
52
- buf = 0.chr * BUFLEN
53
- while true
54
- len = gzread(_in, buf, buf.length)
55
- err = 0
56
- error(gzerror(_in, err)) if (len < 0)
57
- break if len.zero?
51
+ buf = 0.chr * BUFLEN
52
+ while true
53
+ len = gzread(_in, buf, buf.length)
54
+ err = 0
55
+ error(gzerror(_in, err)) if (len < 0)
56
+ break if len.zero?
58
57
  if(out.write(buf[0,len]) != len)
59
- error("failed write")
60
- end
58
+ error("failed write")
61
59
  end
62
- begin
63
- out.close
64
- rescue
65
- error("failed fclose")
66
- end
67
-
68
- error("failed gzclose") if (gzclose(_in) != Z_OK)
60
+ end
61
+ begin
62
+ out.close
63
+ rescue
64
+ error("failed fclose")
65
+ end
66
+
67
+ error("failed gzclose") if (gzclose(_in) != Z_OK)
69
68
  end
70
69
 
71
-
72
70
  def file_compress(file, mode)
73
- outfile = file + GZ_SUFFIX
71
+ outfile = file + GZ_SUFFIX
74
72
 
75
- _in = File.open(file, "rb")
76
- if _in.nil?
77
- raise RuntimeError,file
78
- end
79
- out = gzopen(outfile, mode)
80
- if out.nil?
81
- puts("#{__FILE__}: can't gzopen #{outfile}")
82
- exit(1)
83
- end
84
- gz_compress(_in, out)
73
+ _in = File.open(file, "rb")
74
+ if _in.nil?
75
+ raise RuntimeError,file
76
+ end
77
+ out = gzopen(outfile, mode)
85
78
 
86
- File.unlink(file)
87
- end
79
+ if out.nil?
80
+ puts("#{__FILE__}: can't gzopen #{outfile}")
81
+ exit(1)
82
+ end
88
83
 
84
+ gz_compress(_in, out)
85
+
86
+ File.unlink(file)
87
+ end
89
88
 
90
89
  def file_uncompress(file)
91
90
  len = file.length
@@ -94,17 +93,17 @@ def file_uncompress(file)
94
93
  if (file[-SUFFIX_LEN..-1] == GZ_SUFFIX)
95
94
  infile = file.dup
96
95
  outfile = buf[0..(-SUFFIX_LEN-1)]
97
- else
96
+ else
98
97
  outfile = file.dup
99
98
  infile = buf + GZ_SUFFIX
100
99
  end
101
100
  _in = gzopen(infile, "rb")
102
- if _in.nil?
101
+ if _in.nil?
103
102
  puts("#{__FILE__}: can't gzopen #{infile}")
104
103
  exit(1)
105
104
  end
106
105
  out = File.open(outfile, "wb")
107
- if out.nil?
106
+ if out.nil?
108
107
  raise RuntimeError,file
109
108
  exit(1)
110
109
  end
@@ -141,6 +140,17 @@ end
141
140
  outmode[3] = 'R'
142
141
  when "-1".."-9"
143
142
  outmode[2] = argv[1]
143
+ when "--help"
144
+ help = <<-HERE
145
+ Usage: minigzip [-d] [-f] [-h] [-r] [-1 to -9] [files...]
146
+ -d : decompress
147
+ -f : compress with Z_FILTERED
148
+ -h : compress with Z_HUFFMAN_ONLY
149
+ -r : compress with Z_RLE
150
+ -1 to -9 : compression level
151
+ HERE
152
+ puts help
153
+ exit!
144
154
  else
145
155
  ARGV.unshift(argv)
146
156
  break
@@ -149,23 +159,23 @@ end
149
159
  if (outmode[3].chr == ' ')
150
160
  outmode = outmode[0,3]
151
161
  end
152
- if (ARGV.empty?)
162
+ if (ARGV.empty?)
153
163
  $stdin.binmode
154
164
  $stdout.binmode
155
- if (uncompr)
165
+ if (uncompr)
156
166
  file = gzdopen($stdin.fileno, "rb")
157
- error("can't gzdopen stdin") if file.nil?
167
+ error("can't gzdopen stdin") if file.nil?
158
168
  gz_uncompress(file, $stdout)
159
- else
169
+ else
160
170
  file = gzdopen($stdout.fileno, outmode)
161
- error("can't gzdopen stdout") if file.nil?
171
+ error("can't gzdopen stdout") if file.nil?
162
172
  gz_compress($stdin, file)
163
173
  end
164
- else
165
- while !ARGV.empty?
166
- if (uncompr)
174
+ else
175
+ while !ARGV.empty?
176
+ if (uncompr)
167
177
  file_uncompress(ARGV.shift)
168
- else
178
+ else
169
179
  file_compress(ARGV.shift, outmode)
170
180
  end
171
181
  end
@@ -11,7 +11,7 @@ include Rbzlib
11
11
  module Zlib
12
12
 
13
13
  RUBY_ZLIB_VERSION = '0.6.0'.freeze
14
- PR_ZLIB_VERSION = '1.0.5'.freeze
14
+ PR_ZLIB_VERSION = '1.0.6'.freeze
15
15
 
16
16
  class Error < StandardError
17
17
  end
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'pr-zlib'
5
- spec.version = '1.0.5'
5
+ spec.version = '1.0.6'
6
6
  spec.authors = ['Park Heesob', 'Daniel Berger']
7
7
  spec.email = ['phasis@gmail.com', 'djberg96@gmail.com'],
8
8
  spec.homepage = 'https://github.com/djberg96/pr-zlib'
@@ -12,6 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.files = Dir["**/*"].reject{ |f| f.include?('git') }
13
13
  spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
14
14
  spec.cert_chain = Dir['certs/*']
15
+ spec.executables = 'minirbgzip'
15
16
 
16
17
  spec.add_development_dependency('test-unit', '>= 2.4.0')
17
18
  spec.add_development_dependency('ruby-prof')
@@ -21,7 +22,7 @@ Gem::Specification.new do |spec|
21
22
  spec.metadata = {
22
23
  'homepage_uri' => 'https://github.com/djberg96/pr-zlib',
23
24
  'bug_tracker_uri' => 'https://github.com/djberg96/pr-zlib/issues',
24
- 'changelog_uri' => 'https://github.com/djberg96/pr-zlib/CHANGES',
25
+ 'changelog_uri' => 'https://github.com/djberg96/pr-zlib/blob/master/CHANGES',
25
26
  'documentation_uri' => 'https://github.com/djberg96/pr-zlib/wiki',
26
27
  'source_code_uri' => 'https://github.com/djberg96/pr-zlib',
27
28
  'wiki_uri' => 'https://github.com/djberg96/pr-zlib/wiki'
@@ -18,7 +18,7 @@ class TC_Zlib < Test::Unit::TestCase
18
18
 
19
19
  def test_zlib_version
20
20
  assert_equal('1.2.3', Zlib::ZLIB_VERSION)
21
- assert_equal('1.0.5', Zlib::PR_ZLIB_VERSION)
21
+ assert_equal('1.0.6', Zlib::PR_ZLIB_VERSION)
22
22
  end
23
23
 
24
24
  def test_zlib_included_constants
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pr-zlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Park Heesob
@@ -36,7 +36,7 @@ cert_chain:
36
36
  ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
37
37
  WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
38
38
  -----END CERTIFICATE-----
39
- date: 2018-03-18 00:00:00.000000000 Z
39
+ date: 2018-03-19 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: test-unit
@@ -74,7 +74,8 @@ email:
74
74
  - - phasis@gmail.com
75
75
  - djberg96@gmail.com
76
76
  - https://github.com/djberg96/pr-zlib
77
- executables: []
77
+ executables:
78
+ - minirbgzip
78
79
  extensions: []
79
80
  extra_rdoc_files:
80
81
  - README
@@ -82,7 +83,7 @@ extra_rdoc_files:
82
83
  - MANIFEST
83
84
  files:
84
85
  - bin
85
- - bin/minizip.rb
86
+ - bin/minirbgzip
86
87
  - certs
87
88
  - certs/djberg96_pub.pem
88
89
  - CHANGES
@@ -119,7 +120,7 @@ licenses:
119
120
  metadata:
120
121
  homepage_uri: https://github.com/djberg96/pr-zlib
121
122
  bug_tracker_uri: https://github.com/djberg96/pr-zlib/issues
122
- changelog_uri: https://github.com/djberg96/pr-zlib/CHANGES
123
+ changelog_uri: https://github.com/djberg96/pr-zlib/blob/master/CHANGES
123
124
  documentation_uri: https://github.com/djberg96/pr-zlib/wiki
124
125
  source_code_uri: https://github.com/djberg96/pr-zlib
125
126
  wiki_uri: https://github.com/djberg96/pr-zlib/wiki
metadata.gz.sig CHANGED
Binary file