humidifier 1.11.0 → 1.11.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 666dd5554cc35b20ad539b0c2fe0c2f72edd6060
4
- data.tar.gz: 9c60c92099f44e870e65c6c717b4ec782fdd2bd0
3
+ metadata.gz: f63e3c8426ef72d434bc4cedf68899d4ae9e2573
4
+ data.tar.gz: 99cdd9a0863a786e1c72df2d8008805e70ebca0d
5
5
  SHA512:
6
- metadata.gz: 7326c58c9452e78574b9901fbb893e609253fe4ea2bfefae4e72b0fcebcacb54d9b5d47151e1f207cde4f2d9e369caf141c6666157c9cfb71e6f8cf2e76242e2
7
- data.tar.gz: b819cf0ac8da2fa435ba3f70ccd271c2123c010e84c6c5967140aaab4e1e40f8929b9c08656f8ed0899c961a94832587f3c1e6d83e28c7bc1ffe96e41c5dfe9d
6
+ metadata.gz: c19ea21dbaa03e6a0515f7f8e5c9af5d785f14549f02b021505948e25f046659dac1cd055e591299face04d19a896e7f91eb69460134df114a7a7bfc509f50d2
7
+ data.tar.gz: 4a64f7e5ed14d2e6441eaa565c3816f8008b2c6abfd1c6988a65c8593f5bc5eef65797ca4fa3d906f5a56f9e4d64c6d2220dbaa9e4af84c119f1614a80058f78
data/README.md CHANGED
@@ -77,6 +77,23 @@ Humidifier.configure do |config|
77
77
  end
78
78
  ```
79
79
 
80
+ ### Forcing uploading
81
+
82
+ You can force a stack to upload its template to S3 regardless of the size of the template. This is a useful option if you're going to be deploying multiple
83
+ copies of a template or you just generally want a backup. You can set this option on a per-stack basis:
84
+
85
+ ```ruby
86
+ stack.deploy(force_upload: true)
87
+ ```
88
+
89
+ or globally, but setting the configuration option:
90
+
91
+ ```ruby
92
+ Humidifier.configure do |config|
93
+ config.force_upload = true
94
+ end
95
+ ```
96
+
80
97
  ## Development
81
98
 
82
99
  To get started, ensure you have ruby installed, version 2.1 or later. From there, install the `bundler` gem: `gem install bundler` and then `bundle install` in the root of the repository.
@@ -15,12 +15,31 @@ Humidifier object like so:
15
15
  end
16
16
  MSG
17
17
 
18
- attr_accessor :s3_bucket, :s3_prefix, :sdk_version
18
+ # If true, always upload the CloudFormation template to the configured S3
19
+ # destination. A useful option if you're going to be deploying multiple
20
+ # copies of a template or you just generally want a backup.
21
+ attr_accessor :force_upload
22
+
23
+ # The S3 bucket to which to deploy CloudFormation templates when
24
+ # `always_upload` is set to true or the template is too big for a string
25
+ # literal.
26
+ attr_accessor :s3_bucket
27
+
28
+ # An optional prefix for the stack names.
29
+ attr_accessor :s3_prefix
30
+
31
+ # By default, `humidifier` will attempt to determine which SDK you have
32
+ # loaded. (There's not really a story for peer dependencies with bundler).
33
+ # If you want to enforce a specific version (for instance if you have both
34
+ # `aws-sdk-v1` and `aws-sdk` but want to use the former) you can set this
35
+ # variable to `1`.
36
+ attr_accessor :sdk_version
19
37
 
20
38
  def initialize(opts = {})
21
- self.s3_bucket = opts[:s3_bucket]
22
- self.s3_prefix = opts[:s3_prefix]
23
- self.sdk_version = opts[:sdk_version]
39
+ @force_upload = opts[:force_upload]
40
+ @s3_bucket = opts[:s3_bucket]
41
+ @s3_prefix = opts[:s3_prefix]
42
+ @sdk_version = opts[:sdk_version]
24
43
  end
25
44
 
26
45
  # raise an error unless the s3_bucket field is set
@@ -24,7 +24,21 @@ module Humidifier
24
24
  end
25
25
  end
26
26
 
27
- attr_reader :stack, :options, :max_wait
27
+ # The stack on which operations are going to be performed.
28
+ attr_reader :stack
29
+
30
+ # Options that should be passed through to CloudFormation when the desired
31
+ # operation is being performed. Particularly useful for the `capabilities`
32
+ # option for acknowledging IAM resource changes.
33
+ attr_reader :options
34
+
35
+ # The maximum amount of time that `humidifier` should wait for the stack to
36
+ # resolve to the desired state. If your stacks are particularly large, you
37
+ # may need to set this to wait longer than the default `MAX_WAIT`.
38
+ attr_accessor :max_wait
39
+
40
+ # Force the stack to upload to S3 regardless of the size of the stack.
41
+ attr_accessor :force_upload
28
42
 
29
43
  extend Forwardable
30
44
  def_delegators :stack, :id=, :identifier, :name
@@ -33,6 +47,7 @@ module Humidifier
33
47
  @stack = stack
34
48
  @options = options
35
49
  @max_wait = options.delete(:max_wait) || MAX_WAIT
50
+ @force_upload = options.delete(:force_upload)
36
51
  end
37
52
 
38
53
  # True if the stack and options are the same as the other (used for testing)
@@ -87,9 +102,14 @@ module Humidifier
87
102
  end
88
103
  end
89
104
 
105
+ def should_upload?
106
+ return force_upload unless force_upload.nil?
107
+ Humidifier.config.force_upload || bytesize > MAX_TEMPLATE_BODY_SIZE
108
+ end
109
+
90
110
  def template_param
91
111
  @template_param ||=
92
- if bytesize > MAX_TEMPLATE_BODY_SIZE
112
+ if should_upload?
93
113
  { template_url: AwsShim.upload(self) }
94
114
  else
95
115
  { template_body: template_body }
@@ -1,4 +1,4 @@
1
1
  module Humidifier
2
2
  # Gem version
3
- VERSION = '1.11.0'.freeze
3
+ VERSION = '1.11.0.1'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humidifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.11.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Localytics
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-01 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler