formatron 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/formatron/aws.rb +7 -0
- data/lib/formatron/cloud_formation.rb +16 -5
- data/lib/formatron/external/outputs.rb +2 -1
- data/lib/formatron/external.rb +1 -0
- data/lib/formatron/s3/cloud_formation_template.rb +12 -0
- data/lib/formatron/version.rb +1 -1
- data/lib/formatron.rb +7 -2
- data/support/s3_list_objects_response.rb +21 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53582a32e61c5a984b2ce3a963398f7b6ac4ffd8
|
4
|
+
data.tar.gz: 42a7c9b8047d9b58ad96ed6754e3c4441140b9ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdec0b8c3ac59c8e2c717fd0da9f8a4d661c4a2fdeec56150d9f75c35d3d856daa211e4730af30ab83554803888f56454656386f17e2623930e584e8f86847ce
|
7
|
+
data.tar.gz: c077d7d087c9a13d2c01ca5fb77fe90a9efb4505e97424a5d6b167c77b4fc8f6577c0f71cf31210da16c8b6b7c4b5bfbf18dac8131232af484f23543942d4f38
|
data/lib/formatron/aws.rb
CHANGED
@@ -31,13 +31,24 @@ class Formatron
|
|
31
31
|
aws.delete_stack stack_name: stack_name
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
# rubocop:disable Metrics/MethodLength
|
35
|
+
def self.outputs(aws:, bucket:, name:, target:)
|
36
|
+
if S3::CloudFormationTemplate.exists?(
|
37
|
+
aws: aws,
|
38
|
+
bucket: bucket,
|
39
|
+
name: name,
|
40
|
+
target: target
|
41
|
+
)
|
42
|
+
stack_name = _stack_name name, target
|
43
|
+
Formatron::LOG.info do
|
44
|
+
"Query CloudFormation stack outputs: #{stack_name}"
|
45
|
+
end
|
46
|
+
aws.stack_outputs stack_name: stack_name
|
47
|
+
else
|
48
|
+
{}
|
38
49
|
end
|
39
|
-
aws.stack_outputs stack_name: stack_name
|
40
50
|
end
|
51
|
+
# rubocop:enable Metrics/MethodLength
|
41
52
|
|
42
53
|
def self.stack_ready!(aws:, name:, target:)
|
43
54
|
aws.stack_ready! stack_name: _stack_name(name, target)
|
@@ -12,10 +12,11 @@ class Formatron
|
|
12
12
|
@hash = {}
|
13
13
|
end
|
14
14
|
|
15
|
-
def merge(dependency:, configuration:)
|
15
|
+
def merge(bucket:, dependency:, configuration:)
|
16
16
|
@hash.merge! configuration
|
17
17
|
@hash.merge! CloudFormation.outputs(
|
18
18
|
aws: @aws,
|
19
|
+
bucket: bucket,
|
19
20
|
name: dependency,
|
20
21
|
target: @target
|
21
22
|
)
|
data/lib/formatron/external.rb
CHANGED
@@ -30,6 +30,18 @@ class Formatron
|
|
30
30
|
# rubocop:enable Metrics/MethodLength
|
31
31
|
# rubocop:enable Metrics/ParameterLists
|
32
32
|
|
33
|
+
def self.exists?(aws:, bucket:, name:, target:)
|
34
|
+
key = Path.key(
|
35
|
+
name: name,
|
36
|
+
target: target,
|
37
|
+
sub_key: FILE_NAME
|
38
|
+
)
|
39
|
+
aws.file_exists?(
|
40
|
+
bucket: bucket,
|
41
|
+
key: key
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
33
45
|
# rubocop:disable Metrics/MethodLength
|
34
46
|
def self.destroy(aws:, bucket:, name:, target:)
|
35
47
|
key = Path.key(
|
data/lib/formatron/version.rb
CHANGED
data/lib/formatron.rb
CHANGED
@@ -136,8 +136,13 @@ class Formatron
|
|
136
136
|
def deploy
|
137
137
|
_deploy_configuration
|
138
138
|
_deploy_chef_server_certs
|
139
|
-
|
140
|
-
|
139
|
+
if @cloud_formation_template[:Resources].empty?
|
140
|
+
_destroy_template
|
141
|
+
_destroy_stack
|
142
|
+
else
|
143
|
+
_deploy_template
|
144
|
+
_deploy_stack
|
145
|
+
end
|
141
146
|
end
|
142
147
|
|
143
148
|
def provision
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Formatron
|
2
|
+
module Support
|
3
|
+
# Stub S3 list_objects response class
|
4
|
+
class S3ListObjectsResponse
|
5
|
+
attr_reader :contents
|
6
|
+
|
7
|
+
# Stub S3 get_object response.body class
|
8
|
+
class Contents
|
9
|
+
attr_reader :key
|
10
|
+
|
11
|
+
def initialize(key)
|
12
|
+
@key = key
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def initialize(keys)
|
17
|
+
@contents = keys.map { |key| Contents.new(key) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formatron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Halliday
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -391,6 +391,7 @@ files:
|
|
391
391
|
- support/dsl_test.rb
|
392
392
|
- support/route53_get_hosted_zone_response.rb
|
393
393
|
- support/s3_get_object_response.rb
|
394
|
+
- support/s3_list_objects_response.rb
|
394
395
|
- support/template_test.rb
|
395
396
|
homepage: https://github.com/pghalliday/formatron
|
396
397
|
licenses:
|