seven_zip_ruby 1.2.1 → 1.2.2

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: fc520a330afc1504a227c21446eaa410dc2b130c
4
- data.tar.gz: faa164047f17bec951a944433a6c9d7276a9fa92
3
+ metadata.gz: bc5b39f5f4ce40497a97a9477dba9e3fe4257e1b
4
+ data.tar.gz: 377e14418cbed8063581cfe00282ce3ab57ff84c
5
5
  SHA512:
6
- metadata.gz: 5bb85502e25cc0146b8e0238bdf853549a3b62ce1b8a2e9d7ac4485ad2fbd1a900fe66fd2a116cc1b6192194f067b73dc1cfb3be36af5971c92ed75fc2c7167c
7
- data.tar.gz: b32b40db99b37c8fcf39beca6f47ffb363f2fcab3a5bdd8f8aa6ccedd13b6f1c7abbf22d3bf55aec30ae68877579095cf9790618d46ec99df33ec21afbac781d
6
+ metadata.gz: 6832f88d201f527dd22b832ea7ff7aabd3489239d76804c004c7c74daa2c609a3f298ed5eef2acb3de2aa7ba0d4279cccff24097b4e1b59e956a2c386b35a093
7
+ data.tar.gz: 3c5cdc5cf8416455c2c809bcbee52174e806aa61c77e47e0b1d3c32f3ab3b0b0dfac60177660849938b202e8f0b5f45bc5a8d5a72e08d67c861713c93af06587
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "2.0.0"
4
- - "2.1.0"
4
+ - "2.1.1"
5
5
  - "rbx"
6
6
  - "ruby-head"
7
7
  matrix:
data/README.md CHANGED
@@ -187,6 +187,8 @@ LGPL and unRAR license. Please refer to LICENSE.txt.
187
187
 
188
188
  ## Releases
189
189
 
190
+ * 1.2.*
191
+ Bug fix.
190
192
  * 1.1.0
191
193
  Raise error when wrong password is specified.
192
194
  * 1.0.0
@@ -102,8 +102,12 @@ module SevenZipRuby
102
102
  szr = self.new
103
103
  szr.open(stream, param)
104
104
  if (block)
105
- block.call(szr)
106
- szr.close
105
+ begin
106
+ block.call(szr)
107
+ szr.close
108
+ ensure
109
+ szr.close_file
110
+ end
107
111
  else
108
112
  szr
109
113
  end
@@ -135,8 +139,12 @@ module SevenZipRuby
135
139
  szr = self.new
136
140
  szr.open_file(filename, param)
137
141
  if (block)
138
- block.call(szr)
139
- szr.close
142
+ begin
143
+ block.call(szr)
144
+ szr.close
145
+ ensure
146
+ szr.close_file
147
+ end
140
148
  else
141
149
  szr
142
150
  end
@@ -200,9 +208,14 @@ module SevenZipRuby
200
208
  # # => true/false
201
209
  # end
202
210
  def verify(stream, opt = {})
203
- szr = self.open(stream, opt)
204
- ret = szr.verify
205
- szr.close
211
+ ret = false
212
+ begin
213
+ self.open(stream, opt) do |szr|
214
+ ret = szr.verify
215
+ end
216
+ rescue
217
+ ret = false
218
+ end
206
219
  return ret
207
220
  end
208
221
  end
@@ -248,8 +261,12 @@ module SevenZipRuby
248
261
 
249
262
  def close
250
263
  close_impl
264
+ close_file
265
+ end
266
+
267
+ def close_file # :nodoc:
251
268
  if (@stream)
252
- @stream.close
269
+ @stream.close rescue nil
253
270
  @stream = nil
254
271
  end
255
272
  end
@@ -1,3 +1,3 @@
1
1
  module SevenZipRuby
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = SevenZipRuby::VERSION
9
9
  spec.authors = ["Masamitsu MURASE"]
10
10
  spec.email = ["masamitsu.murase@gmail.com"]
11
- spec.description = %q{SevenZipRuby is a gem library to read and write 7zip archives. This gem library calls official 7z.dll internally.}
12
- spec.summary = %q{This is a gem library to read and write 7-Zip files.}
11
+ spec.description = %q{SevenZipRuby (seven_zip_ruby) is a ruby gem library to read and write 7zip archives. This gem library calls official 7z.dll internally.}
12
+ spec.summary = %q{This is a ruby gem library to read and write 7zip files.}
13
13
  spec.homepage = "https://github.com/masamitsu-murase/seven_zip_ruby"
14
14
  spec.license = "LGPL + unRAR"
15
15
 
@@ -139,6 +139,11 @@ describe SevenZipRuby do
139
139
 
140
140
  expect(SevenZipRuby::SevenZipReader.verify(StringIO.new(data))).to eq true
141
141
 
142
+ data_org = data[-1]
143
+ data[-1] = 0x01.chr # This highly dependes on the current test binary.
144
+ expect(SevenZipRuby::SevenZipReader.verify(StringIO.new(data))).to eq false
145
+ data[-1] = data_org
146
+
142
147
  data[0x27] = 0xEB.chr # This highly dependes on the current test binary.
143
148
  expected = [ :DataError, :DataError, :DataError, :DataError, :DataError, :DataError, :DataError, true, true, true, true, true ]
144
149
  SevenZipRuby::SevenZipReader.open(StringIO.new(data)) do |szr|
@@ -179,9 +184,7 @@ describe SevenZipRuby do
179
184
  end
180
185
  th_list.push(th)
181
186
  end
182
- th_list.each do |t|
183
- t.join
184
- end
187
+ th_list.each(&:join)
185
188
  end
186
189
 
187
190
 
@@ -512,7 +515,6 @@ describe SevenZipRuby do
512
515
 
513
516
  example "run in multi threads" do
514
517
  th_list = []
515
- mutex = Mutex.new
516
518
  100.times do
517
519
  th = Thread.new do
518
520
  stream = StringIO.new
@@ -523,9 +525,7 @@ describe SevenZipRuby do
523
525
  end
524
526
  th_list.push(th)
525
527
  end
526
- th_list.each do |t|
527
- t.join
528
- end
528
+ th_list.each(&:join)
529
529
  end
530
530
 
531
531
  if (SevenZipRubySpecHelper.processor_count && SevenZipRubySpecHelper.processor_count > 1)
@@ -616,11 +616,11 @@ describe SevenZipRuby do
616
616
  th.join
617
617
  diff = Time.now - start
618
618
 
619
- 10.times do
619
+ 20.times do
620
+ kill_time = rand * diff
620
621
  th = Thread.start{ prc.call }
621
- sleep(rand * diff)
622
+ sleep(kill_time)
622
623
  expect{ th.kill }.not_to raise_error # Thread can be killed.
623
- sleep diff*2 # Workaround. When some threads of SZR are running and killed, SEGV sometimes occurs...
624
624
  end
625
625
  end
626
626
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seven_zip_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masamitsu MURASE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-25 00:00:00.000000000 Z
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,8 +52,8 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- description: SevenZipRuby is a gem library to read and write 7zip archives. This gem
56
- library calls official 7z.dll internally.
55
+ description: SevenZipRuby (seven_zip_ruby) is a ruby gem library to read and write
56
+ 7zip archives. This gem library calls official 7z.dll internally.
57
57
  email:
58
58
  - masamitsu.murase@gmail.com
59
59
  executables: []
@@ -814,7 +814,7 @@ rubyforge_project:
814
814
  rubygems_version: 2.0.2
815
815
  signing_key:
816
816
  specification_version: 4
817
- summary: This is a gem library to read and write 7-Zip files.
817
+ summary: This is a ruby gem library to read and write 7zip files.
818
818
  test_files:
819
819
  - spec/seven_zip_ruby_spec.rb
820
820
  - spec/seven_zip_ruby_spec_helper.rb