zip_dir 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22142ae2361dcab30f0d4ad978ff3260e696a4e2
4
- data.tar.gz: 01e541d83f1ced7255b4fbfe17c9901fd3aba747
3
+ metadata.gz: c2f252849777261ba6721e2beef2572104bd61ff
4
+ data.tar.gz: 67f86f8b9d49fef13b44025bd2f75e34f2e0b6a2
5
5
  SHA512:
6
- metadata.gz: d6851216876a02cb2bde2053e8ba72707a8d98abf9a18c2ae6732171bde48be53807a70ad372100a0ea37e130d8ae0d81f2dcc34ccb555c35adb5aee00f3a02b
7
- data.tar.gz: fba12bc80581b2fae9166510c9f9b62aa1b9a7576aceea1d9dd74a86f7348053f9240e375c0a5adf87d3a31c105190b81f72e334ed44eba191ea35de776f8bfc
6
+ metadata.gz: 8f80df62e8a3b8eff1964a544798f5f8646263b4ba17f7fdd8523e754704f64bfe668111b451ac45408966356334527f94f61c361d27f7afe4726b4e788efb47
7
+ data.tar.gz: e0d0a7da5a394928effee6a162bc71432d98b01e0cde14837eb230753ac7391ef0891777b9c3cc1cc6fda956557d1000beb8f01435a057f7dc25072e6ddfa8c2
data/README.md CHANGED
@@ -24,29 +24,29 @@ Or install it yourself as:
24
24
  #
25
25
  # Zip
26
26
  #
27
- zipper = ZipDir::Zipper.new(__optional_filename__)
27
+ zipper = ZipDir::Zipper.new("optional_filename")
28
28
 
29
- zip_file = zipper.generate(__some_path_to_directory__)
29
+ zip_file = zipper.generate("some/path/to/directory")
30
30
  zip_file # => #<Tempfile:/var/folders/6c/s4snqy051jqdpbjw7f7tsn940000gn/T/zipper-20151127-19694-1baaqoi.zip>
31
31
  zip_file == zipper.file # => true
32
32
 
33
33
  # to zip multiple directories
34
34
  zip_file = zipper.generate do |z|
35
- z.add_path __some_path_to_directory__
36
- z.add_path __another_path_to_directory__ # does a shell "cp -r" operation
35
+ z.add_path "some/path/to/directory"
36
+ z.add_path "another/path/to/directory" # does a shell "cp -r" operation
37
37
  end
38
38
 
39
39
  # to zip __just the paths inside the directory___
40
- zip_file = zipper.generate(__some_path_to_directory__, root_directory: true)
40
+ zip_file = zipper.generate("some/path/to/directory", root_directory: true)
41
41
 
42
42
  zip_file = zipper.generate do |z|
43
- z.add_path __some_path_to_directory__, root_directory: true
43
+ z.add_path "some/path/to/directory", root_directory: true
44
44
  end
45
45
 
46
46
  #
47
47
  # Unzip
48
48
  #
49
- unzip_path = ZipDir::Unzipper.new(zip_file.path).unzip_path
49
+ unzip_path = ZipDir::Unzipper.new(zip_file.path).unzip_path # => "/var/folders/6c/s4snqy051jqdpbjw7f7tsn940000gn/T/d20151127-22683-a9vrnv"
50
50
  ```
51
51
 
52
52
  ## dir_model
@@ -1,3 +1,3 @@
1
1
  module ZipDir
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/zip_dir/zip.rb CHANGED
@@ -25,7 +25,8 @@ module ZipDir
25
25
  protected
26
26
  def zip_path(zip_io, relative_path="")
27
27
  entries = Dir.entries(relative_path.empty? ? source_path : File.join(source_path, relative_path))
28
- entries.shift(2)
28
+ entries.delete(".")
29
+ entries.delete("..")
29
30
  entries.each do |entry|
30
31
  relative_entry_path = relative_path.empty? ? entry : File.join(relative_path, entry)
31
32
  source_entry_path = File.join(source_path, relative_entry_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_dir
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Chung
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-27 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip