real_zip 1.0.1 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module RealZip
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.6"
3
3
  end
data/lib/real_zip.rb CHANGED
@@ -3,6 +3,8 @@ require "real_zip/version"
3
3
  require 'yaml'
4
4
  require 'forwardable'
5
5
  require 'zip/zipfilesystem'
6
+ require 'fileutils'
7
+ require 'pry'
6
8
 
7
9
  def RealZip file, structure
8
10
  RealZip.new file, structure
@@ -42,6 +44,10 @@ module RealZip
42
44
  end
43
45
  def dirs(given)
44
46
  collect_only(given, :dir).map { |x| x.join ?/ }
47
+ end
48
+
49
+ def is_file(file)
50
+ File.file?(file)
45
51
  end
46
52
  end
47
53
 
@@ -60,6 +66,7 @@ module RealZip
60
66
  hash = struct
61
67
  # puts "hash => #{hash}"
62
68
  hash.each do |dir,file_arr|
69
+
63
70
  # puts "directory ======> #{dir}"
64
71
  # puts "file_array ======> #{file_arr.to_s}"
65
72
 
@@ -69,14 +76,39 @@ module RealZip
69
76
  # puts "file ======> #{file} index => #{index}"
70
77
  orignal_file_path = file_arr[index]
71
78
  # puts "orignal_file_path ==========> #{orignal_file_path}"
72
- string = File.open(orignal_file_path, 'r'){ |f| f.read }
73
- file_name = file.split('/').last
74
- new_file_name = ( files( {dir => [ "#{file_name}" ] } ) ).first
75
- puts "file_name ========> #{file_name}"
76
- z.file.open(new_file_name, "w") { |f| f.write string }
77
- end
79
+
80
+ # unless File.file?(orignal_file_path)
81
+ # if dir.to_s == 'home'
82
+ # source = "#{orignal_file_path}"
83
+ # puts " Not a file #{source}"
84
+ # puts "directory =====> #{dir}"
85
+ # directory = source
86
+
87
+ # Dir.foreach(source).each do | file_or_dir|
88
+
89
+ # if File.file?(file_or_dir)
90
+
91
+ # z.add(new_file_name, )
92
+ # end
93
+ # end
94
+
95
+
96
+
97
+
98
+ # # binding.pry
99
+ # #
100
+ # else
101
+ string = File.open(orignal_file_path, 'r'){ |f| f.read }
102
+ file_name = file.split('/').last
103
+ new_file_name = ( files( {dir => [ "#{file_name}" ] } ) ).first
104
+ # puts "file_name ========> #{file_name}"
105
+ z.file.open(new_file_name, "w") { |f| f.write string }
106
+ # end
107
+
108
+ end
109
+ # binding.pry
78
110
  end
79
-
111
+ # binding.pry
80
112
  end
81
113
  end
82
114
 
data/real_zip.gemspec CHANGED
@@ -5,8 +5,8 @@ require 'real_zip/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "real_zip"
7
7
  spec.version = RealZip::VERSION
8
- spec.authors = ["Prasad R."]
9
- spec.email = ["thelaptopsage@gmail.com"]
8
+ spec.authors = ["Prasad R.", "Ravi Baghele"]
9
+ spec.email = ["rbaghele@gmail.com"]
10
10
  spec.description = %q{ build zip files with given file structure and transfer files to it }.strip
11
11
  spec.summary = %q{ build zip files with given file structure and transfer files to it }.strip
12
12
  spec.homepage = "https://github.com/OskarSchindler/real_zip"
data/temp.zip CHANGED
Binary file
metadata CHANGED
@@ -1,89 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real_zip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.6
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Prasad R.
9
+ - Ravi Baghele
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
- date: 2014-07-17 00:00:00.000000000 Z
13
+ date: 2014-07-18 00:00:00.000000000 +05:30
14
+ default_executable:
12
15
  dependencies:
13
16
  - !ruby/object:Gem::Dependency
14
17
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
18
+ requirement: &23163120 !ruby/object:Gem::Requirement
19
+ none: false
16
20
  requirements:
17
- - - "~>"
21
+ - - ~>
18
22
  - !ruby/object:Gem::Version
19
23
  version: '1.3'
20
24
  type: :development
21
25
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version_requirements: *23163120
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
- requirement: !ruby/object:Gem::Requirement
29
+ requirement: &23162700 !ruby/object:Gem::Requirement
30
+ none: false
30
31
  requirements:
31
- - - ">="
32
+ - - ! '>='
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0'
34
35
  type: :development
35
36
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
37
+ version_requirements: *23162700
41
38
  - !ruby/object:Gem::Dependency
42
39
  name: rspec
43
- requirement: !ruby/object:Gem::Requirement
40
+ requirement: &23162240 !ruby/object:Gem::Requirement
41
+ none: false
44
42
  requirements:
45
- - - ">="
43
+ - - ! '>='
46
44
  - !ruby/object:Gem::Version
47
45
  version: '0'
48
46
  type: :development
49
47
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
48
+ version_requirements: *23162240
55
49
  - !ruby/object:Gem::Dependency
56
50
  name: rubyzip
57
- requirement: !ruby/object:Gem::Requirement
51
+ requirement: &23217220 !ruby/object:Gem::Requirement
52
+ none: false
58
53
  requirements:
59
- - - "<"
54
+ - - <
60
55
  - !ruby/object:Gem::Version
61
56
  version: 1.0.0
62
57
  type: :runtime
63
58
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "<"
67
- - !ruby/object:Gem::Version
68
- version: 1.0.0
59
+ version_requirements: *23217220
69
60
  description: build zip files with given file structure and transfer files to it
70
61
  email:
71
- - thelaptopsage@gmail.com
62
+ - rbaghele@gmail.com
72
63
  executables: []
73
64
  extensions: []
74
65
  extra_rdoc_files: []
75
66
  files:
76
- - ".gitignore"
77
- - ".idea/.name"
78
- - ".idea/.rakeTasks"
79
- - ".idea/encodings.xml"
80
- - ".idea/misc.xml"
81
- - ".idea/modules.xml"
82
- - ".idea/real_zip.iml"
83
- - ".idea/scopes/scope_settings.xml"
84
- - ".idea/vcs.xml"
85
- - ".idea/workspace.xml"
86
- - ".rspec"
67
+ - .gitignore
68
+ - .idea/.name
69
+ - .idea/.rakeTasks
70
+ - .idea/encodings.xml
71
+ - .idea/misc.xml
72
+ - .idea/modules.xml
73
+ - .idea/real_zip.iml
74
+ - .idea/scopes/scope_settings.xml
75
+ - .idea/vcs.xml
76
+ - .idea/workspace.xml
77
+ - .rspec
87
78
  - Gemfile
88
79
  - LICENSE.txt
89
80
  - README.md
@@ -100,29 +91,31 @@ files:
100
91
  - spec/support/require.rb
101
92
  - spec/support/zip_entries.rb.rb
102
93
  - temp.zip
94
+ has_rdoc: true
103
95
  homepage: https://github.com/OskarSchindler/real_zip
104
96
  licenses:
105
97
  - MIT
106
- metadata: {}
107
98
  post_install_message:
108
99
  rdoc_options: []
109
100
  require_paths:
110
101
  - lib
111
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
112
104
  requirements:
113
- - - ">="
105
+ - - ! '>='
114
106
  - !ruby/object:Gem::Version
115
107
  version: '0'
116
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
117
110
  requirements:
118
- - - ">="
111
+ - - ! '>='
119
112
  - !ruby/object:Gem::Version
120
113
  version: '0'
121
114
  requirements: []
122
115
  rubyforge_project:
123
- rubygems_version: 2.3.0
116
+ rubygems_version: 1.5.2
124
117
  signing_key:
125
- specification_version: 4
118
+ specification_version: 3
126
119
  summary: build zip files with given file structure and transfer files to it
127
120
  test_files:
128
121
  - spec/examples_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 6569b2ac88ccb33e74db0ccdad70b5f141ef862f
4
- data.tar.gz: 1f337700dd47c6755bb7c1b3ac42c1b1b2c35f2e
5
- SHA512:
6
- metadata.gz: 7c996ccafef21b403e5e9e475792b3ab2018ef6c18db0cbbd4a9ad02d8d0ab3ef6a92b6df34975ee4eba19856263f515d539d4997b8baada36c87bab26fd9797
7
- data.tar.gz: 83c55940ce2b1b0239d95e3bb4895b9f51aa654cca2ec324815284414649978f17c476e6e644b4934938cbf9a439810b12c9905da032b53ae3be054b7881716f