dev 2.1.6 → 2.1.7
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 +4 -4
- data/lib/base/dir.rb +38 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2016bcb713de8bb6f3cf4d031fe3333dc8ce3652
|
4
|
+
data.tar.gz: 0a3917f627add8fea551ac76253c2105b11e1aeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f44e1ddf9eb61b1643102eae8691be495dc547d4160c3001646217d84827c5bf04e5fc9608daa69bdc2cbde72697dd3b5ca6a230577ca85c32f2de1038fdfa01
|
7
|
+
data.tar.gz: c4289c044352675ed64a423db53cbb631c6b393fdc39eb1e42be9826498364af18b0d625ac2f80fe2990f3fedda87a8b3a2f9f55aa31e5a44240e7856a6f987d
|
data/lib/base/dir.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
|
+
if Gem::Specification::find_all_by_name('zip').any?
|
4
|
+
require 'zip'
|
5
|
+
end
|
6
|
+
|
3
7
|
class Dir
|
4
8
|
def self.make directory
|
5
9
|
FileUtils.mkdir_p directory if !File.exists? directory
|
@@ -36,4 +40,38 @@ class Dir
|
|
36
40
|
end
|
37
41
|
mtime
|
38
42
|
end
|
43
|
+
|
44
|
+
def self.zip_source(directory,glob_pattern,zipfilename)
|
45
|
+
if Gem::Specification::find_all_by_name('zip').any?
|
46
|
+
File.delete(zipfilename) if(File.exists?(zipfilename))
|
47
|
+
Zip::File.open(zipfilename,Zip::File::CREATE) do |zipfile|
|
48
|
+
Dir.chdir(directory) do
|
49
|
+
count = 0
|
50
|
+
Dir.glob(glob_pattern).each{|source_file|
|
51
|
+
zipfile.add(source_file,"#{File.dirname(__FILE__)}/#{directory}/#{source_file}")
|
52
|
+
count = count + 1
|
53
|
+
}
|
54
|
+
puts "added #{count} files to #{zipfilename}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
else
|
58
|
+
puts "rubyzip gem is not installed 'gem install rubyzip'"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.unzip(zipfilename,directory)
|
63
|
+
if Gem::Specification::find_all_by_name('rubyzip').any?
|
64
|
+
Zip::File.open(zipfilename) do |zip_file|
|
65
|
+
zip_file.each do |entry|
|
66
|
+
puts entry
|
67
|
+
dest = "#{directory}/#{entry.to_s}"
|
68
|
+
parent_dir=File.dirname(dest)
|
69
|
+
FileUtils.mkdir_p parent_dir if(!Dir.exists?(parent_dir))
|
70
|
+
entry.extract("#{directory}/#{entry.to_s}")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
else
|
74
|
+
puts "rubyzip gem is not installed 'gem install rubyzip'"
|
75
|
+
end
|
76
|
+
end
|
39
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dev
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lou Parslow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|