uc3-sam-sceptre 0.0.25 → 0.0.27

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
  SHA256:
3
- metadata.gz: 32b327c9a7d6940d11f3de18f55e1ae6c61507b09f66eb4f27113f2fd6667a8f
4
- data.tar.gz: b90be4b3fa2d7734a7fd22dd8e28953c54c32f157b018044c98e0b0d14b0c6d3
3
+ metadata.gz: 6f7b9764a42ded1f8d7855c2cf22a0ada89a10d814ed9999924851237cfcd77c
4
+ data.tar.gz: defd899b8c31d43532870d589848fc3127548b2053b6c80491f5bb077648d32e
5
5
  SHA512:
6
- metadata.gz: b6075ea1fdf2c3d7926de9e1724260b7eb28399ad8f0f66f960f78a7ce9125db974853ce30c75d9c45777f74bf8c2d6f608250d1b9601b356f9e8f346ca0b575
7
- data.tar.gz: 3c4226af364977c5de5bb4c8b079547bddf9914dbad03dc0ac991a4adb7b6db277e1d7ebc23f73add5caeafc73f2b39456ab8a94ae5eb908f1574c4968c53085
6
+ metadata.gz: ae948e49092c85c543e8c2526c075ea6ec6a4759de1469b4b0e902e6c23c55c7aec441d325f00c7a74ed0c38a837aa2306a4007a7b02842d02a01cd469ef395a
7
+ data.tar.gz: 68ed2adc319ad83f1362471419aab38db32917d909d99d52ec6ca32766851cbddfe226e6d7c392ceebde8ba46bc0dcea0922d07825500d0c839de52a6c70d15e
data/README.md CHANGED
@@ -210,12 +210,17 @@ if ARGV.length == 2
210
210
  { template_param_name: 'Version', value: 'v0' }
211
211
  ]
212
212
  }
213
-
214
213
  proxy = Uc3SamSceptre::Proxy.new(params)
215
- proxy.build if ARGV[0].to_s.downcase.strip == 'true'
216
- proxy.deploy if ARGV[1].to_s.downcase.strip == 'true'
214
+
215
+ if ARGV[0].to_s.downcase.strip == 'false' && ARGV[1].to_s.downcase.strip == 'false'
216
+ proxy.delete
217
+ else
218
+ proxy.build if ARGV[0].to_s.downcase.strip == 'true'
219
+ proxy.deploy if ARGV[1].to_s.downcase.strip == 'true'
220
+ end
217
221
  else
218
- p 'Expected 2 arguments: run build? and run deploy? (For example: `ruby sam_build_deploy.rb true true`)'
222
+ p 'Expected 2 arguments: run build? and run deploy? (For example: `ruby sam_build_deploy.rb true true`).'
223
+ p 'Setting both arguments to false will trigger a `sam delete`.'
219
224
  end
220
225
  ```
221
226
 
@@ -249,9 +254,15 @@ if ARGV.length == 2
249
254
  }
250
255
 
251
256
  proxy = Uc3SamSceptre::Proxy.new(params)
252
- proxy.build if ARGV[0].to_s.downcase.strip == 'true'
253
- proxy.deploy if ARGV[1].to_s.downcase.strip == 'true'
257
+
258
+ if ARGV[0].to_s.downcase.strip == 'false' && ARGV[1].to_s.downcase.strip == 'false'
259
+ proxy.delete
260
+ else
261
+ proxy.build if ARGV[0].to_s.downcase.strip == 'true'
262
+ proxy.deploy if ARGV[1].to_s.downcase.strip == 'true'
263
+ end
254
264
  else
255
265
  p 'Expected 2 arguments: run build? and run deploy? (For example: `ruby sam_build_deploy.rb true true`)'
266
+ p 'Setting both arguments to false will trigger a `sam delete`.'
256
267
  end
257
268
  ```
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3SamSceptre
4
- VERSION = '0.0.25'
4
+ VERSION = '0.0.27'
5
5
  end
@@ -64,9 +64,26 @@ module Uc3SamSceptre
64
64
  system 'sam build'
65
65
  end
66
66
 
67
+ # Run a SAM package (build and upload to the S3 bucket or ECR)
68
+ def package
69
+ args = [
70
+ "--force-upload"
71
+ "--metadata #{_sam_tags(admin_email: true).join(',')}"
72
+ ]
73
+ args << "--s3-bucket #{_locate_value(key: @s3_arn_key)&.gsub('arn:aws:s3:::', '')}" unless @s3_arn_key.nil?
74
+ args << "--s3-prefix #{@stack_name}" unless @s3_arn_key.nil?
75
+ args << "--image-repository #{_locate_value(key: @ecr_uri_key)}" unless @ecr_uri_key.nil?
76
+ system "sam package #{args.join(' ')}"
77
+ end
78
+
67
79
  # Run a SAM deploy
68
80
  def deploy(guided: false)
69
- args = _base_args
81
+ args = [
82
+ "--stack-name #{@stack_name}",
83
+ "--confirm-changeset #{!@auto}",
84
+ '--capabilities CAPABILITY_NAMED_IAM',
85
+ '--disable-rollback false'
86
+ ]
70
87
 
71
88
  # Add the S3 or ECR details depending on what we're working with
72
89
  args << "--s3-bucket #{_locate_value(key: @s3_arn_key)&.gsub('arn:aws:s3:::', '')}" unless @s3_arn_key.nil?
@@ -81,21 +98,11 @@ module Uc3SamSceptre
81
98
 
82
99
  # Run a SAM delete
83
100
  def delete
84
- args = _base_args
85
- system "sam delete #{args.join(' ')}"
101
+ system "sam delete --stack-name #{@stack_name}"
86
102
  end
87
103
 
88
104
  private
89
105
 
90
- def _base_args
91
- [
92
- "--stack-name #{@stack_name}",
93
- "--confirm-changeset #{!@auto}",
94
- '--capabilities CAPABILITY_NAMED_IAM',
95
- '--disable-rollback false'
96
- ]
97
- end
98
-
99
106
  # Construct the AWS tags that SAM will use when building resources
100
107
  def _sam_tags(admin_email: nil)
101
108
  tags = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-sam-sceptre
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-05 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-cloudformation