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 +4 -4
- data/README.md +7 -7
- data/lib/zip_dir/version.rb +1 -1
- data/lib/zip_dir/zip.rb +2 -1
- 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: c2f252849777261ba6721e2beef2572104bd61ff
|
4
|
+
data.tar.gz: 67f86f8b9d49fef13b44025bd2f75e34f2e0b6a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
27
|
+
zipper = ZipDir::Zipper.new("optional_filename")
|
28
28
|
|
29
|
-
zip_file = zipper.generate(
|
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
|
36
|
-
z.add_path
|
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(
|
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
|
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
|
data/lib/zip_dir/version.rb
CHANGED
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.
|
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.
|
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
|
+
date: 2015-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|