rubycfn 0.5.0 → 0.5.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
  SHA256:
3
- metadata.gz: 98d65cbb897496a9645eab2271bc04e8a7080e2cbf247537e5e5eb65e78f6fbe
4
- data.tar.gz: 3da58edcf1ac8f9a58846e8e3ca459090f1590af531640b94fafc137ac949712
3
+ metadata.gz: b3edf333cbadc6a8996cffd0d68726b7a85dfd8c3cc10726be8bbc5f773d954f
4
+ data.tar.gz: 76d18eb2f1ab6f4363649fbb7982dcba65256fb255875e726dd74a6b41c3c13c
5
5
  SHA512:
6
- metadata.gz: 3eed6c4a96dfafb68fa8a4e67058ec1951caea92bd5d6337f55a9d7638735874da321b5ac1c40dc3384a6207d942b0aa9aef463841213adf492d045941ec57a1
7
- data.tar.gz: fda4c8d3d8436b2f4554fe15add7172d0f903792cd06086a7d8caf59e43e2fa38be4287714c303e30bb22ab78f5fcfc968232e75f8c3372a30aabbaaa2da5970
6
+ metadata.gz: 476691b642e3c9bbed9682a268ed25c8b6e7ae4d665895f6f3b339b2142322adfe0b08b86d3ef37886d0a1666a2c81995a5ce5a362d8df728a8cde509da4c502
7
+ data.tar.gz: d40b8ddc22e3a67e5959a16719029c076cc1d039f097c6943425058a420fc40aa986194241c2537a54797af32578a8daf6598f98efe73bc76030754d4ab97e20
data/CHANGELOG.md CHANGED
@@ -2,7 +2,15 @@
2
2
  All notable changes to Rubycfn will be documented in this file.
3
3
  This project uses [Semantic Versioning](http://semver.org/).
4
4
 
5
- ## 0.5.1 (Next Release)
5
+ ## 0.5.2 (Next Release)
6
+
7
+ ## 0.5.1
8
+
9
+ * Added descriptive error messages for common errors -- [@dennisvink][@dennisvink]
10
+ * Allow `rake compile` to succeed with mock .env.dependency.rspec values
11
+ * Added `rake update` command
12
+ * Removed a stray unused variable in template code
13
+ * Update README.md
6
14
 
7
15
  ## 0.5.0
8
16
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubycfn (0.5.0)
4
+ rubycfn (0.5.1)
5
5
  activesupport (~> 5.1.5)
6
6
  dotenv (~> 2.4.0)
7
7
  json (~> 2.1.0)
data/README.md CHANGED
@@ -61,7 +61,7 @@ __________ ____ __________________.___._________ _____________________
61
61
  | _/ | /| | _// | |/ \ \/ | __) | | _/
62
62
  | | \ | / | | \\____ |\ \____| \ | | \
63
63
  |____|_ /______/ |______ // ______| \______ /\___ / |______ /
64
- \/ \/ \/ \/ \/ \/ [v0.5.0]
64
+ \/ \/ \/ \/ \/ \/ [v0.5.1]
65
65
  Project name? example
66
66
  Account ID? 1234567890
67
67
  Select region EU (Frankfurt)
@@ -1,4 +1,4 @@
1
1
  # Rubycfn version
2
2
  module Rubycfn
3
- VERSION = "0.5.0".freeze
3
+ VERSION = "0.5.1".freeze
4
4
  end
data/templates/README.md CHANGED
@@ -16,11 +16,12 @@ __________ ____ __________________.___._________ _____________________
16
16
 
17
17
  ## Rake commands
18
18
 
19
- `rake` - Compile the code into CloudFormation templates and run unit tests
19
+ `rake` - Retrieve required outputs from DependencyStack, Compile the code into CloudFormation templates and run unit tests
20
20
  `rake init` - Deploy the DependencyStack in the AWS account
21
21
  `rake compile` - Compile the code into CloudFormation templates
22
22
  `rake spec` - Run unit tests
23
23
  `rake upload` - Upload the CloudFormation templates to s3
24
+ `rake update` - Save required outputs from DependencyStack to .env.dependencies
24
25
  `rake apply` - Deploy the CloudFormation templates
25
26
 
26
27
  ## Stack configuration
data/templates/Rakefile CHANGED
@@ -51,7 +51,8 @@ RuboCop::RakeTask.new(:rubocop) do |t|
51
51
  t.options = ["--display-cop-names"]
52
52
  end
53
53
 
54
+ task apply: %i(dependencies apply_stack)
55
+ task compile: %i(compile_stack)
54
56
  task default: %i(dependencies compile_stack spec)
55
- task compile: %i(dependencies compile_stack)
57
+ task update: %i(dependencies)
56
58
  task upload: %i(dependencies upload_stack)
57
- task apply: %i(dependencies apply_stack)
@@ -6,10 +6,11 @@ def load_env_vars
6
6
 
7
7
  check_dependencies
8
8
  {
9
+ artifact_bucket: ENV["ARTIFACTBUCKET"],
9
10
  aws_region: ENV["AWS_REGION"],
10
11
  aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"],
11
12
  aws_secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
12
- artifact_bucket: ENV["ARTIFACTBUCKET"],
13
+ cloudformation_bucket: ENV["CLOUDFORMATIONBUCKET"],
13
14
  environment: ENV["ENVIRONMENT"],
14
15
  stack_name: ENV["STACK_NAME"]
15
16
  }
@@ -17,9 +18,10 @@ end
17
18
 
18
19
  def check_dependencies
19
20
  ENV["AWS_REGION"] ||= ENV["AWS_DEFAULT_REGION"]
20
- raise "AWS_REGION not set" unless ENV["AWS_REGION"]
21
- raise "ARTIFACTBUCKET not set" unless ENV["ARTIFACTBUCKET"]
22
- raise "ENVIRONMENT not set" unless ENV["ENVIRONMENT"]
21
+ raise "AWS_REGION not set." unless ENV["AWS_REGION"]
22
+ raise "CLOUDFORMATIONBUCKET not set. Run `rake init` and `rake update` first!" unless ENV["CLOUDFORMATIONBUCKET"]
23
+ raise "ARTIFACTBUCKET not set. Run `rake init` and `rake update` first!" unless ENV["ARTIFACTBUCKET"]
24
+ raise "ENVIRONMENT not set." unless ENV["ENVIRONMENT"]
23
25
  raise "STACK_NAME not set" unless ENV["STACK_NAME"]
24
26
  raise "AWS CREDENTIALS NOT SET" unless ENV["AWS_ACCESS_KEY_ID"] && ENV["AWS_SECRET_ACCESS_KEY"]
25
27
  end
@@ -45,7 +45,6 @@ def get_parent_stack_s3_location(bucket, environment)
45
45
  JSON.parse(stack)["Resources"].each do |_resource, payload|
46
46
  if payload["Type"] == "AWS::CloudFormation::Stack"
47
47
  parent_stack = stack_name
48
- json_file = "build/#{environment}-#{stack_name.downcase}.json"
49
48
  file_hash = git_revision
50
49
  break
51
50
  end
@@ -10,10 +10,16 @@ ENV["AWS_DEFAULT_REGION"] ||= "eu-west-1"
10
10
  ENV["AWS_REGION"] ||= ENV["AWS_DEFAULT_REGION"]
11
11
 
12
12
  client = Aws::CloudFormation::Client.new(region: ENV["AWS_REGION"])
13
- res = client.describe_stacks(
14
- stack_name: "DependencyStack"
15
- )
16
13
 
14
+ begin
15
+ res = client.describe_stacks(
16
+ stack_name: "DependencyStack"
17
+ )
18
+ rescue Aws::CloudFormation::Errors::InvalidClientTokenId
19
+ raise "ERROR: Your AWS credentials are not set or invalid."
20
+ end
21
+
22
+ raise "ERROR: .env.dependencies does not exist. Run `rake init` and `rake dependencies` first!" unless File.file?(".env.dependencies")
17
23
  dep_file = File.open(".env.dependencies", "w")
18
24
  res[:stacks].each do |stack|
19
25
  stack[:outputs].each do |output|
@@ -8,7 +8,7 @@ require_relative "../aws_helper/main"
8
8
 
9
9
  Dotenv.load(".env.private")
10
10
  Dotenv.load(".env.dependencies")
11
- raise "CLOUDFORMATIONBUCKET not found in DependencyStack outputs" unless ENV["CLOUDFORMATIONBUCKET"]
11
+ raise "CLOUDFORMATIONBUCKET not set. Run `rake init` and `rake update` first!" unless ENV["CLOUDFORMATIONBUCKET"]
12
12
 
13
13
  env_vars = load_env_vars
14
14
 
@@ -35,7 +35,9 @@ module Concerns
35
35
  end
36
36
 
37
37
  def generate_bootstrap_parameters
38
- File.open(".env.dependencies#{environment == "rspec" && ".rspec" || ""}").read.each_line do |line|
38
+ warn "WARNING: .env.dependencies does not exist. Run `rake dependencies` first!" unless File.file?(".env.dependencies")
39
+ filename = File.file?(".env.dependencies") && ".env.dependencies#{environment == "rspec" && ".rspec" || ""}" || ".env.dependencies.rspec"
40
+ File.open(filename).read.each_line do |line|
39
41
  line.strip!
40
42
  param, _value = line.split("=")
41
43
  parameter param.to_sym,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Vink