founders_template 0.2.3 → 0.3.0

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: 4cdc29895e665803c7b35555ec090faaeee2e2843cbb1d8d65421556375ce4b4
4
- data.tar.gz: ffbae93bf4d2032a50cec815a6db168ea33b9906649650b84f99f3ed0583a95b
3
+ metadata.gz: 22beacd3b13e3f9a383977e26de4300229026869412156f6e007c5457964b7c6
4
+ data.tar.gz: 6508f48c216d57ed5e8fe1919839229be715bb42f4611acce97787a9b18e5e36
5
5
  SHA512:
6
- metadata.gz: 762c09c7b11a0bc97b8367848e62610405e57013d1c9d43d885e782c1f77e335e01a815df939ae46302cbd59aeb66f8d158986e6437be29d29a13867a884db55
7
- data.tar.gz: 430acb4d185b35a17e1d08a4a6abcd7d524b1c3c9eed4282aa796e362cbdd82dbc384da277a15c5ab1a83d79b554eacaedfa9eb1199213ce51518075574be721
6
+ metadata.gz: 6faab674011be1bd26704aeebe296ba8fe6374ccbac85685f18bb768f0fb58b2cd928b0bcc69e4f720e31a9a549235e8783a4514de62dd0162d26b63353d41f8
7
+ data.tar.gz: bafb6e405ea20d725928a0c2d7fdcc15f90905ce5921376aaecab141e39a696c7aaf6063a9ca212918c318f8c132594c8110a2a0534dbb34f9742e8cf68e3cf5
data/Gemfile-rails6.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- founders_template (0.2.3)
4
+ founders_template (0.3.0)
5
5
  activesupport
6
6
  aws-sdk-core
7
7
  aws-sdk-ec2
@@ -11,7 +11,7 @@ require 'yaml'
11
11
  require 'founders_template/utils'
12
12
  require 'founders_template/config_file'
13
13
 
14
- REQUIRED_SYSTEM_TOOLS = %w( direnv ).freeze
14
+ REQUIRED_SYSTEM_TOOLS = %w( direnv chamber ).freeze
15
15
  SCRIPT_PATH = File.expand_path(File.join(__dir__, '..', '..', 'bash')).freeze
16
16
  CREDENTIALS_PATH = 'config/credentials'
17
17
  CREDENTIALS_KEY_FILE = File.join(CREDENTIALS_PATH, 'production.key').freeze
@@ -48,6 +48,7 @@ module FoundersTemplate
48
48
  ensure_aws_credentials
49
49
  ensure_credentials_key
50
50
  ensure_secret_key
51
+ ensure_github_oauth_token
51
52
 
52
53
  template 'buildspec.yml.erb', 'buildspec.yml'
53
54
  template 'dockerignore.erb', '.dockerignore'
@@ -73,9 +74,26 @@ module FoundersTemplate
73
74
 
74
75
  template 'terraform-production-backend.tf.erb', 'terraform/production/backend.tf'
75
76
  template 'terraform-production.tfvars.erb', 'terraform/production/terraform.tfvars'
77
+ template 'terraform-production-envrc.erb', 'terraform/production/.envrc'
76
78
  template 'terraform-shared.tfvars.erb', 'terraform/shared/terraform.tfvars'
77
79
  end
78
80
 
81
+ def ensure_github_oauth_token
82
+ chamber_write(:github_token, ask('GitHub Oauth Token:')) unless chamber_key?(:github_token)
83
+ end
84
+
85
+ def chamber_key?(key)
86
+ system("chamber read #{chamber_repo_key} #{key} > /dev/null 2>&1")
87
+ end
88
+
89
+ def chamber_write(key, value)
90
+ system("chamber write #{chamber_repo_key} #{key} #{value} > /dev/null 2>&1")
91
+ end
92
+
93
+ def chamber_repo_key
94
+ "#{app_config.slugified_name}-terraform"
95
+ end
96
+
79
97
  def ensure_aws_credentials
80
98
  return if aws_credentials?
81
99
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FoundersTemplate
4
- VERSION = '0.2.3'
4
+ VERSION = '0.3.0'
5
5
  end
@@ -0,0 +1,3 @@
1
+ source_env ../../.envrc
2
+
3
+ export $(chamber export --format dotenv <%= app_config.slugified_name %>-terraform | sed 's/"//g')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: founders_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trae Robrock
@@ -137,6 +137,7 @@ files:
137
137
  - templates/dockerignore.erb
138
138
  - templates/ft.yml.erb
139
139
  - templates/terraform-production-backend.tf.erb
140
+ - templates/terraform-production-envrc.erb
140
141
  - templates/terraform-production.tfvars.erb
141
142
  - templates/terraform-shared.tfvars.erb
142
143
  - templates/terraform/modules/application/main.tf