dev 2.1.7 → 2.1.8

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/base/dir.rb +7 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2016bcb713de8bb6f3cf4d031fe3333dc8ce3652
4
- data.tar.gz: 0a3917f627add8fea551ac76253c2105b11e1aeb
3
+ metadata.gz: e66c424797de17baaa1f869aae264dfdaa26444f
4
+ data.tar.gz: 2c321b23310a1ede2de4810c6979679b134d573f
5
5
  SHA512:
6
- metadata.gz: f44e1ddf9eb61b1643102eae8691be495dc547d4160c3001646217d84827c5bf04e5fc9608daa69bdc2cbde72697dd3b5ca6a230577ca85c32f2de1038fdfa01
7
- data.tar.gz: c4289c044352675ed64a423db53cbb631c6b393fdc39eb1e42be9826498364af18b0d625ac2f80fe2990f3fedda87a8b3a2f9f55aa31e5a44240e7856a6f987d
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.zip_source(directory,glob_pattern,zipfilename)
45
- if Gem::Specification::find_all_by_name('zip').any?
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.7
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow