cloudspin-stack-rake 0.1.18 → 0.1.19
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/lib/cloudspin/stack/rake/stack_task.rb +0 -67
- data/lib/cloudspin/stack/rake/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aaf8bba7c93e42c6757fb7c856dab24706ad075e38874e20029e12bb6fafc95
|
4
|
+
data.tar.gz: 16b57b8e3febbf07a208b3ca20d816eb49e47a70deafc5cdc75e343a15c963a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba3dcdfedb69409afe5660d6506ff41ffb33cd99e1dcb2c616ec0269a694d9cf208cfed93fd7b6178bc34558319e7f74e3ab9482c978a2b40768b9b99182d111
|
7
|
+
data.tar.gz: 0d20b4bfb64f96963ae8ca1418e7f4f43627da0ad2aa1276e353ba15da22ca40dff22068d366a8775036d7e8f372c9a390bb834f9f6af9e7538acde21e34abd4
|
@@ -7,13 +7,11 @@ module Cloudspin
|
|
7
7
|
|
8
8
|
attr_reader :environment
|
9
9
|
attr_reader :stack_name
|
10
|
-
attr_reader :definition_folder
|
11
10
|
attr_reader :configuration_files
|
12
11
|
|
13
12
|
def initialize(
|
14
13
|
environment = nil,
|
15
14
|
stack_name: 'instance',
|
16
|
-
definition_folder: nil, # Should be deprecated
|
17
15
|
definition_location: nil,
|
18
16
|
base_folder: '.',
|
19
17
|
configuration_files: nil
|
@@ -26,9 +24,6 @@ module Cloudspin
|
|
26
24
|
# TODO: Pick this up from the configuration files?
|
27
25
|
@definition_location = if definition_location
|
28
26
|
definition_location
|
29
|
-
elsif definition_folder
|
30
|
-
puts "'definition_folder': is deprecated for Cloudspin::Stack::Rake::StackTask - use 'definition_location' instead"
|
31
|
-
definition_folder
|
32
27
|
else
|
33
28
|
'./src'
|
34
29
|
end
|
@@ -135,70 +130,8 @@ module Cloudspin
|
|
135
130
|
}
|
136
131
|
end
|
137
132
|
|
138
|
-
# TODO: This stuff belongs in a core class, so the CLI and other stuff can use it, too.
|
139
|
-
|
140
|
-
def fetch_definition
|
141
|
-
if /^http.*\.zip$/.match @definition_location
|
142
|
-
puts "Downloading stack definition source from a remote zipfile"
|
143
|
-
fetch_definition_zipfile
|
144
|
-
elsif /^[\.\/]/.match @definition_location
|
145
|
-
puts "Using local stack definition source"
|
146
|
-
@definition_location
|
147
|
-
else
|
148
|
-
raise UnsupportedStackDefinitionLocationError, @definition_location
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def fetch_definition_zipfile
|
153
|
-
unpack(download_artefact(@definition_location), '.cloudspin/definitions')
|
154
|
-
end
|
155
|
-
|
156
|
-
def download_artefact(artefact_url)
|
157
|
-
download_dir = Dir.mktmpdir(['cloudspin-', '-download'])
|
158
|
-
zipfile = "#{download_dir}/undetermined-spin-stack-artefact.zip"
|
159
|
-
puts "Downloading artefact from #{artefact_url} to #{zipfile}"
|
160
|
-
File.open(zipfile, 'wb') do |saved_file|
|
161
|
-
open(artefact_url, 'rb') do |read_file|
|
162
|
-
saved_file.write(read_file.read)
|
163
|
-
end
|
164
|
-
end
|
165
|
-
zipfile
|
166
|
-
end
|
167
|
-
|
168
|
-
def unpack(zipfile, where_to_put_it)
|
169
|
-
folder_name = path_of_source_in(zipfile)
|
170
|
-
puts "Unzipping #{zipfile} to #{where_to_put_it}"
|
171
|
-
Zip::File.open(zipfile) { |zip_file|
|
172
|
-
zip_file.each { |f|
|
173
|
-
puts "-> #{f.name}"
|
174
|
-
f_path = File.join(where_to_put_it, f.name)
|
175
|
-
FileUtils.mkdir_p(File.dirname(f_path))
|
176
|
-
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
177
|
-
}
|
178
|
-
}
|
179
|
-
puts "Definition unpacked to #{where_to_put_it}/#{folder_name}"
|
180
|
-
"#{where_to_put_it}/#{folder_name}"
|
181
|
-
end
|
182
|
-
|
183
|
-
def path_of_source_in(zipfile_path)
|
184
|
-
File.dirname(path_of_configuration_file_in(zipfile_path))
|
185
|
-
end
|
186
|
-
|
187
|
-
def path_of_configuration_file_in(zipfile_path)
|
188
|
-
zipfile = Zip::File.open(zipfile_path)
|
189
|
-
begin
|
190
|
-
zipfile.entries.select { |entry|
|
191
|
-
/\/stack-definition.yaml$/.match entry.name
|
192
|
-
}.first.name
|
193
|
-
ensure
|
194
|
-
zipfile.close
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
133
|
end
|
199
134
|
|
200
|
-
class UnsupportedStackDefinitionLocationError < StandardError; end
|
201
|
-
|
202
135
|
end
|
203
136
|
end
|
204
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudspin-stack-rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'kief '
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cloudspin-stack
|