dev 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/base/dir.rb +7 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e66c424797de17baaa1f869aae264dfdaa26444f
|
4
|
+
data.tar.gz: 2c321b23310a1ede2de4810c6979679b134d573f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4810610db14511cddfaebfcfce660965cdaec445c47a0da381d8ca176e877ab6fdf7724284df7e74804a467b1fbc995c14021a9ecc37b9133cddd4219783a83a
|
7
|
+
data.tar.gz: f4024242cc892a47838db5c165c37fa2fac6441bf2eeed40263d9d974d66e52632193b146eda60e7a2ba49e0886dd59931b4d0e0549aa7ff396c9cedd5baa4f0
|
data/lib/base/dir.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
-
if Gem::Specification::find_all_by_name('zip').any?
|
4
|
-
require 'zip'
|
5
|
-
end
|
6
|
-
|
7
3
|
class Dir
|
8
4
|
def self.make directory
|
9
5
|
FileUtils.mkdir_p directory if !File.exists? directory
|
@@ -41,8 +37,9 @@ class Dir
|
|
41
37
|
mtime
|
42
38
|
end
|
43
39
|
|
44
|
-
def self.
|
45
|
-
if Gem::Specification::find_all_by_name('
|
40
|
+
def self.zip(directory,glob_pattern,zipfilename)
|
41
|
+
if Gem::Specification::find_all_by_name('rubyzip').any?
|
42
|
+
require 'zip'
|
46
43
|
File.delete(zipfilename) if(File.exists?(zipfilename))
|
47
44
|
Zip::File.open(zipfilename,Zip::File::CREATE) do |zipfile|
|
48
45
|
Dir.chdir(directory) do
|
@@ -61,15 +58,19 @@ end
|
|
61
58
|
|
62
59
|
def self.unzip(zipfilename,directory)
|
63
60
|
if Gem::Specification::find_all_by_name('rubyzip').any?
|
61
|
+
require 'zip'
|
64
62
|
Zip::File.open(zipfilename) do |zip_file|
|
63
|
+
count = 0
|
65
64
|
zip_file.each do |entry|
|
66
65
|
puts entry
|
67
66
|
dest = "#{directory}/#{entry.to_s}"
|
68
67
|
parent_dir=File.dirname(dest)
|
69
68
|
FileUtils.mkdir_p parent_dir if(!Dir.exists?(parent_dir))
|
70
69
|
entry.extract("#{directory}/#{entry.to_s}")
|
70
|
+
count = count + 1
|
71
71
|
end
|
72
72
|
end
|
73
|
+
puts "extracted #{count} files to #{directory}"
|
73
74
|
else
|
74
75
|
puts "rubyzip gem is not installed 'gem install rubyzip'"
|
75
76
|
end
|