cloudformation-tool 1.0.2 → 1.0.4

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
  SHA256:
3
- metadata.gz: 83b8efc5704070ab9a788b2a90abd76c5cddf51e001a809b8eb4232404d6a4a1
4
- data.tar.gz: 09e63883d8159f6331d06f8b5b4af28888f755134f55972272b53df0bd7fe3e6
3
+ metadata.gz: f3c901ead020a647c6b7fca5e7c54a87ac460fa40ffea601e57fc679f4e16d48
4
+ data.tar.gz: e4a3b0af6b07b111926088777071e180bbf83fe4efc6782a97f1ed5b60683cd3
5
5
  SHA512:
6
- metadata.gz: bbf45c2d3e1e03db1ae3e686e5432175547e00dc92db30ed12bf4bf03c66c2d8be8832cb1e1244a67025379a3918162962a071c67431468ea83795669c7eac58
7
- data.tar.gz: 4e6480feac36232936ef892541aa0cd6e528547dab38721b0acb290db1360ee1ebd8f9cadd45f6c02cac43f3701d0298fc45c744175a1dde8ab2ae42bf1ab349
6
+ metadata.gz: 9b5f8f00b6a8d0c724dc1b7231b063d4b1b4c5807fd7915dcd70b272112266d7d8be75eb88f4576d9d0966b24629ea2d025c336a4f40958b9b3e7adc6fd1dbee
7
+ data.tar.gz: dc198485e2c6af34cef73e380fb69e478cf3b09b1512f76263bfb943061b90f16a2b3297bfd157baec7a50960cea8011a32381773081057b2085dbd55494f580
data/bin/cftool CHANGED
@@ -4,6 +4,12 @@ require 'cloud_formation_tool'
4
4
 
5
5
  begin
6
6
  CloudFormationTool::CLI::Main.run
7
+ rescue SocketError => e
8
+ warn "Networking error: #{e.message}"
9
+ exit 1
10
+ rescue Seahorse::Client::NetworkingError => e
11
+ warn "Networking error: #{e.message}"
12
+ exit 1
7
13
  rescue CloudFormationTool::Errors::BaseError => e
8
14
  warn e.message
9
15
  exit 1
@@ -38,19 +38,14 @@ module CloudFormationTool
38
38
  end
39
39
 
40
40
  def zip_path(path)
41
- temp_file = Tempfile.new
42
- temp_path = temp_file.path + '.zip'
43
- begin
44
- Zip::ZipFile.open(temp_path, true) do |zipfile|
45
- Dir[File.join(path, '**','*')].each do |file|
46
- zipfile.add(file.sub("#{path}/", ''), file)
47
- end
41
+ Zip::OutputStream.write_buffer do |zf|
42
+ rdir path do |ent|
43
+ #log "Deflating #{ent}"
44
+ filepath = File.join(path,ent)
45
+ zf.put_next_entry ::Zip::Entry.new(nil, ent, nil, nil, nil, nil, nil, nil, ::Zip::DOSTime.at(File.mtime(filepath).to_i))
46
+ zf.write File.read(filepath)
48
47
  end
49
- File.read(temp_path)
50
- ensure
51
- temp_file.close!
52
- File.unlink temp_path
53
- end
48
+ end.string
54
49
  end
55
50
 
56
51
  def already_in_cache(uri_str)
@@ -129,6 +124,27 @@ module CloudFormationTool
129
124
  }
130
125
  end
131
126
  end
127
+
128
+ def rdir path, prefix = '', &block
129
+ ents = []
130
+ (Dir.entries(path) - %w(. ..)).collect do |ent|
131
+ diskpath = File.join(path,ent)
132
+ localpath = prefix.length>0 ? File.join(prefix,ent) : ent
133
+ if block_given?
134
+ if File.directory? diskpath
135
+ rdir diskpath, localpath, &block
136
+ else
137
+ yield localpath
138
+ end
139
+ end
140
+ if File.directory? diskpath
141
+ rdir diskpath, localpath
142
+ else
143
+ ent
144
+ end
145
+ end.flatten
146
+ end
147
+
132
148
  end
133
149
 
134
150
  end
@@ -1,3 +1,3 @@
1
1
  module CloudFormationTool
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformation-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oded Arbel
@@ -109,19 +109,19 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '2'
111
111
  - !ruby/object:Gem::Dependency
112
- name: zip
112
+ name: rubyzip
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '2'
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '2'
124
+ version: '0'
125
125
  description:
126
126
  email: oded.arbel@greenfieldtech.net
127
127
  executables: