stackr 1.1.0 → 2.0.0
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/README.md +8 -0
- data/lib/stackr/cloudformation.rb +4 -1
- data/lib/stackr/errors.rb +2 -1
- data/lib/stackr/template_helpers.rb +21 -1
- data/lib/stackr/version.rb +1 -1
- data/templates/generator.rb.tt +0 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 102190aec51260a54c6e0d3c0963c33ea153a641
|
4
|
+
data.tar.gz: 4a6eb9fb914b0ee9517f93f0bd05c456729c8c71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 395e5ca269cffc68e3a67d980a8601a534694e848783bc27801c7add3a09c14d13494bf3409b95cc8688e9cebb96e25424167036072db1fbab1dc2b2407de940
|
7
|
+
data.tar.gz: 31446b8e086d8d26eb3fe93c9b460de39a038df893706138e88f6146d34e218d29059145bf097a971594635c4501a23580ef781b018cb2c2f32915f7da02599c
|
data/README.md
CHANGED
@@ -76,6 +76,14 @@ You can use a ```.env``` file for your environment variables. It's included in t
|
|
76
76
|
|
77
77
|
You may want to use the same template to launch stacks in different environments (e.g. 'dev', 'prd', 'test'). You can edit ```includes/environment_map.rb``` to configure your different environments. This is useful when you are creating resources in different VPCs or Regions for different environments.
|
78
78
|
|
79
|
+
### Breaking Change in Behavior for 2.0.0
|
80
|
+
|
81
|
+
In order to support mappings with greater than 64 attributes, we no longer add a mapping for ```includes/environment_map.rb``` directly in the template. Instead, we load the environment map into a lookup table and ```find_in_env``` simply returns the value it finds in that table. This greatly reduces the size if templates with very large environment maps.
|
82
|
+
|
83
|
+
If you want to use the old 1.x deprecated behavior be sure to include this line in the body of your template script and use ```find_in_env_map()``` instead of ```find_in_env()```
|
84
|
+
|
85
|
+
```mapping 'EnvironmentMap', File.join(t.includes_path, 'environment_map.rb')```
|
86
|
+
|
79
87
|
## Contributing
|
80
88
|
|
81
89
|
Bug reports and pull requests are welcome on GitHub at https://github.com/LeafSoftware/stackr.
|
@@ -24,8 +24,11 @@ module Stackr
|
|
24
24
|
if ENV['TEMPLATE_BUCKET'].nil?
|
25
25
|
raise Stackr::TemplateBucketMissingError, 'Please set TEMPLATE_BUCKET environment variable before uploading templates to S3.'
|
26
26
|
end
|
27
|
+
if ENV['ENVIRONMENT'].nil?
|
28
|
+
raise Stackr::EnvironmentMissingError, 'Please set ENVIRONMENT environment variable before uploading templates to S3.'
|
29
|
+
end
|
27
30
|
bucket = s3.bucket(ENV['TEMPLATE_BUCKET'])
|
28
|
-
key = "#{name}.json"
|
31
|
+
key = "#{ENV['ENVIRONMENT']}/#{name}.json"
|
29
32
|
if ENV['TEMPLATE_PREFIX']
|
30
33
|
key = "#{ENV['TEMPLATE_PREFIX']}/#{key}"
|
31
34
|
end
|
data/lib/stackr/errors.rb
CHANGED
@@ -6,7 +6,8 @@ module Stackr
|
|
6
6
|
class TemplateValidationError < StandardError; end
|
7
7
|
class ParameterMissingError < StandardError; end
|
8
8
|
class TemplateTooBigError < StandardError; end
|
9
|
-
class
|
9
|
+
class TemplateBucketMissingError < StandardError; end
|
10
10
|
class StackNameMissingError < StandardError; end
|
11
11
|
class ChangeSetMissingError < StandardError; end
|
12
|
+
class EnvironmentMissingError < StandardError; end
|
12
13
|
end
|
@@ -5,10 +5,30 @@ module Stackr
|
|
5
5
|
# Put all helper methods that you want to add to the DSL here.
|
6
6
|
# TODO: Make something that loads project helpers too.
|
7
7
|
|
8
|
-
|
8
|
+
# DEPRECATED: This is the old version of find_in_env()
|
9
|
+
# It fails when there are more than 64 attributes in the map.
|
10
|
+
# Use new find_in_env() instead
|
11
|
+
def find_in_env_map(name)
|
9
12
|
find_in_map('EnvironmentMap', ref('Environment'), name)
|
10
13
|
end
|
11
14
|
|
15
|
+
def load_environment_map
|
16
|
+
if @environment_map.nil?
|
17
|
+
map_path = File.join(includes_path, 'environment_map.rb')
|
18
|
+
mappings = eval(File.read(map_path))
|
19
|
+
@environment_map = mappings['Mappings']['EnvironmentMap']
|
20
|
+
end
|
21
|
+
@environment_map
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_in_env(name)
|
25
|
+
if ENV['ENVIRONMENT'].nil?
|
26
|
+
raise Stackr::EnvironmentMissingError, 'Please set ENVIRONMENT environment variable.'
|
27
|
+
end
|
28
|
+
map = load_environment_map()
|
29
|
+
return map[ ENV['ENVIRONMENT'].to_sym ][name.to_sym]
|
30
|
+
end
|
31
|
+
|
12
32
|
def include_file(filepath, locals={})
|
13
33
|
interpolate(file(filepath), locals)
|
14
34
|
end
|
data/lib/stackr/version.rb
CHANGED
data/templates/generator.rb.tt
CHANGED
@@ -30,11 +30,6 @@ Stackr::Template.new.tap do |t|
|
|
30
30
|
|
31
31
|
# Add other parameters here.
|
32
32
|
|
33
|
-
# Add in the environment map in includes/environment_map.rb
|
34
|
-
# You can edit the map to include environment specific things
|
35
|
-
# like Vpc, Subnets, Security Groups, etc.
|
36
|
-
mapping 'EnvironmentMap', File.join(t.includes_path, 'environment_map.rb')
|
37
|
-
|
38
33
|
# Add resources here.
|
39
34
|
|
40
35
|
# Add outputs here.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Chalfant
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|