real_zip 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/real_zip/version.rb +1 -1
- data/lib/real_zip.rb +14 -35
- metadata +9 -9
data/lib/real_zip/version.rb
CHANGED
data/lib/real_zip.rb
CHANGED
@@ -64,51 +64,30 @@ module RealZip
|
|
64
64
|
end
|
65
65
|
|
66
66
|
hash = struct
|
67
|
-
# puts "hash => #{hash}"
|
68
67
|
hash.each do |dir,file_arr|
|
69
|
-
|
70
|
-
# puts "directory ======> #{dir}"
|
71
|
-
# puts "file_array ======> #{file_arr.to_s}"
|
72
|
-
|
73
68
|
new_files = files({dir => file_arr})
|
74
|
-
# puts "new files ======> #{new_files.to_s}"
|
75
69
|
new_files.each_with_index do |file, index|
|
76
|
-
# puts "file ======> #{file} index => #{index}"
|
77
70
|
orignal_file_path = file_arr[index]
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
# z.add(new_file_name, )
|
92
|
-
# end
|
93
|
-
# end
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
# # binding.pry
|
99
|
-
# #
|
100
|
-
# else
|
71
|
+
if File.directory?(orignal_file_path)
|
72
|
+
puts "..... directory found ......"
|
73
|
+
source = "#{orignal_file_path}"
|
74
|
+
# directory_name = source.split('/').last
|
75
|
+
Dir.glob("#{source}**/*").reject {|fn| File.directory?(fn) }.each do |file|
|
76
|
+
string = File.open(file, 'r'){ |f| f.read }
|
77
|
+
destination_path = file.sub(source, '' )
|
78
|
+
destination_path = "#{dir.to_s}/#{destination_path}"
|
79
|
+
puts "adding file #{destination_path} ..."
|
80
|
+
z.file.open(destination_path, "w") { |f| f.write string }
|
81
|
+
end
|
82
|
+
else
|
83
|
+
puts "..... File found ......"
|
101
84
|
string = File.open(orignal_file_path, 'r'){ |f| f.read }
|
102
85
|
file_name = file.split('/').last
|
103
86
|
new_file_name = ( files( {dir => [ "#{file_name}" ] } ) ).first
|
104
|
-
# puts "file_name ========> #{file_name}"
|
105
87
|
z.file.open(new_file_name, "w") { |f| f.write string }
|
106
|
-
|
107
|
-
|
88
|
+
end
|
108
89
|
end
|
109
|
-
# binding.pry
|
110
90
|
end
|
111
|
-
# binding.pry
|
112
91
|
end
|
113
92
|
end
|
114
93
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: real_zip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -15,7 +15,7 @@ default_executable:
|
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
18
|
-
requirement: &
|
18
|
+
requirement: &10718880 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: '1.3'
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *10718880
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
|
-
requirement: &
|
29
|
+
requirement: &10718460 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *10718460
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: rspec
|
40
|
-
requirement: &
|
40
|
+
requirement: &10718000 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,10 +45,10 @@ dependencies:
|
|
45
45
|
version: '0'
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *10718000
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: rubyzip
|
51
|
-
requirement: &
|
51
|
+
requirement: &10773360 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - <
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: 1.0.0
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
|
-
version_requirements: *
|
59
|
+
version_requirements: *10773360
|
60
60
|
description: build zip files with given file structure and transfer files to it
|
61
61
|
email:
|
62
62
|
- rbaghele@gmail.com
|