minizip 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/minizip/version.rb +1 -1
  2. data/lib/minizip/zip.rb +10 -18
  3. metadata +8 -8
@@ -1,3 +1,3 @@
1
1
  module Minizip
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
data/lib/minizip/zip.rb CHANGED
@@ -2,28 +2,22 @@ require 'rbconfig'
2
2
 
3
3
  module Minizip
4
4
  USING_WINDOWS = (::RbConfig::CONFIG['host_os'] =~/mswin|mingw/)
5
- USING_OSX = (::RbConfig::CONFIG['host_os'] =~ /darwin/)
6
5
 
7
6
  class Zip
8
7
  def self.zip_files(zip_name, *files)
9
- if USING_OSX
10
- system "zip #{zip_name} #{files.join(' ')}"
11
- elsif USING_WINDOWS
8
+ if USING_WINDOWS
12
9
  system "7za a #{zip_name} #{files.join(' ')}"
13
10
  else
14
- raise "Unsupported platform"
11
+ system "zip #{zip_name} #{files.join(' ')}"
15
12
  end
16
13
  end
17
14
 
18
15
  def self.zip_dir(zip_name, directory)
19
16
  if File.exists?(directory)
20
- if USING_OSX
21
- puts "ZIPPING #{directory} to #{zip_name}.zip"
22
- system "zip -r #{zip_name} #{directory}"
23
- elsif USING_WINDOWS
17
+ if USING_WINDOWS
24
18
  system "7za a #{zip_name} #{directory}"
25
19
  else
26
- raise "Unsupported platform"
20
+ system "zip -r #{zip_name} #{directory}"
27
21
  end
28
22
  else
29
23
  puts "#{directory} doesn't exist in #{Dir.pwd}"
@@ -34,20 +28,18 @@ module Minizip
34
28
  if File.exists?(zip_name)
35
29
  Dir.mkdir(directory) if directory && !File.exists?(directory)
36
30
 
37
- if USING_OSX
38
- if directory
39
- system "unzip #{zip_name} -d #{directory}"
40
- else
41
- system "unzip #{zip_name}"
42
- end
43
- elsif USING_WINDOWS
31
+ if USING_WINDOWS
44
32
  if directory
45
33
  system "7za x #{zip_name} -o#{directory}"
46
34
  else
47
35
  system "7za x #{zip_name}"
48
36
  end
49
37
  else
50
- raise "Unsupported platform"
38
+ if directory
39
+ system "unzip #{zip_name} -d #{directory}"
40
+ else
41
+ system "unzip #{zip_name}"
42
+ end
51
43
  end
52
44
  else
53
45
  puts "#{zip_name} doesn't exist in #{Dir.pwd}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minizip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 8
10
- version: 0.0.8
9
+ - 9
10
+ version: 0.0.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Radamanthus Batnag and Eumir Gaspar
@@ -15,10 +15,10 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-16 00:00:00 Z
18
+ date: 2011-12-22 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- type: :development
21
+ name: aruba
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
@@ -29,10 +29,10 @@ dependencies:
29
29
  segments:
30
30
  - 0
31
31
  version: "0"
32
+ type: :development
32
33
  version_requirements: *id001
33
- name: aruba
34
34
  - !ruby/object:Gem::Dependency
35
- type: :runtime
35
+ name: thor
36
36
  prerelease: false
37
37
  requirement: &id002 !ruby/object:Gem::Requirement
38
38
  none: false
@@ -43,8 +43,8 @@ dependencies:
43
43
  segments:
44
44
  - 0
45
45
  version: "0"
46
+ type: :runtime
46
47
  version_requirements: *id002
47
- name: thor
48
48
  description: A Ruby wrapper for the zip/unzip command line tools(for UNIX) and 7zip(for Windows)
49
49
  email:
50
50
  - rad+eumir@aelogica.com