terraspace 1.1.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/.cody/all/{role.rb → iam_role.rb} +0 -0
  3. data/.cody/all/project.rb +6 -2
  4. data/.cody/aws/bin/build.sh +5 -0
  5. data/.cody/aws/{role.rb → iam_role.rb} +0 -0
  6. data/.cody/aws/project.rb +6 -2
  7. data/.cody/azurerm/bin/build.sh +5 -0
  8. data/.cody/azurerm/{role.rb → iam_role.rb} +0 -0
  9. data/.cody/azurerm/project.rb +5 -3
  10. data/.cody/google/bin/build.sh +5 -0
  11. data/.cody/google/{role.rb → iam_role.rb} +0 -0
  12. data/.cody/google/project.rb +5 -3
  13. data/.cody/none/bin/build.sh +5 -0
  14. data/.cody/none/{role.rb → iam_role.rb} +0 -0
  15. data/.cody/none/project.rb +6 -2
  16. data/.cody/shared/script/install/terraform.sh +2 -1
  17. data/.cody/shared/script/update/gemfile.sh +2 -0
  18. data/.cody/unit/project.rb +2 -2
  19. data/.gitignore +2 -0
  20. data/.pipedream/pipeline.rb +3 -3
  21. data/CHANGELOG.md +24 -0
  22. data/exe/terraspace +0 -7
  23. data/lib/templates/base/project/config/app.rb +3 -0
  24. data/lib/templates/plugin/ci/%gem_name%.gemspec.tt +32 -0
  25. data/lib/templates/plugin/ci/.gitignore +12 -0
  26. data/lib/templates/plugin/{.rspec → ci/.rspec} +0 -0
  27. data/lib/templates/plugin/ci/.rubocop.yml +13 -0
  28. data/lib/templates/plugin/ci/CHANGELOG.md.tt +5 -0
  29. data/lib/templates/plugin/ci/Gemfile +10 -0
  30. data/lib/templates/plugin/ci/LICENSE.txt +21 -0
  31. data/lib/templates/plugin/ci/README.md.tt +19 -0
  32. data/lib/templates/plugin/ci/Rakefile +12 -0
  33. data/lib/templates/plugin/ci/lib/%gem_name%/autoloader.rb.tt +23 -0
  34. data/lib/templates/plugin/ci/lib/%gem_name%/interface.rb.tt +15 -0
  35. data/lib/templates/plugin/ci/lib/%gem_name%/pr.rb.tt +15 -0
  36. data/lib/templates/plugin/ci/lib/%gem_name%/vars.rb.tt +26 -0
  37. data/lib/templates/plugin/ci/lib/%gem_name%/version.rb.tt +5 -0
  38. data/lib/templates/plugin/ci/lib/%gem_name%.rb.tt +17 -0
  39. data/lib/templates/plugin/ci/spec/%gem_name%_spec.rb.tt +7 -0
  40. data/lib/templates/plugin/ci/spec/spec_helper.rb.tt +15 -0
  41. data/lib/templates/plugin/{.gitignore → core/.gitignore} +0 -0
  42. data/lib/templates/plugin/core/.rspec +3 -0
  43. data/lib/templates/plugin/{CHANGELOG.md → core/CHANGELOG.md} +0 -0
  44. data/lib/templates/plugin/{Gemfile → core/Gemfile} +0 -0
  45. data/lib/templates/plugin/{LICENSE.txt → core/LICENSE.txt} +0 -0
  46. data/lib/templates/plugin/{README.md.tt → core/README.md.tt} +0 -0
  47. data/lib/templates/plugin/{Rakefile → core/Rakefile} +0 -0
  48. data/lib/templates/plugin/{bin → core/bin}/console.tt +0 -0
  49. data/lib/templates/plugin/{bin → core/bin}/setup +0 -0
  50. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/module/main.tf +0 -0
  51. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/module/outputs.tf +0 -0
  52. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/module/variables.tf +0 -0
  53. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/project/config/terraform/backend.tf.tt +0 -0
  54. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/project/config/terraform/provider.tf +0 -0
  55. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/stack/main.tf +0 -0
  56. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/stack/outputs.tf +0 -0
  57. data/lib/templates/plugin/{lib → core/lib}/templates/hcl/stack/variables.tf +0 -0
  58. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/module/main.rb +0 -0
  59. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/module/outputs.rb +0 -0
  60. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/module/variables.rb +0 -0
  61. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/project/config/terraform/backend.rb.tt +0 -0
  62. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/project/config/terraform/provider.rb +0 -0
  63. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/stack/main.rb +0 -0
  64. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/stack/outputs.rb +0 -0
  65. data/lib/templates/plugin/{lib → core/lib}/templates/ruby/stack/variables.rb +0 -0
  66. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/.rspec +0 -0
  67. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/Gemfile +0 -0
  68. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/spec/fixtures/stack/main.tf +0 -0
  69. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/spec/fixtures/stack/outputs.tf +0 -0
  70. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/spec/fixtures/stack/variables.tf +0 -0
  71. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/spec/main_spec.rb +0 -0
  72. data/lib/templates/plugin/{lib → core/lib}/templates/test/rspec/module/test/spec/spec_helper.rb +0 -0
  73. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/autoloader.rb.tt +0 -0
  74. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/clients.rb.tt +0 -0
  75. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/interfaces/backend.rb.tt +0 -0
  76. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/interfaces/config.rb.tt +0 -0
  77. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/interfaces/expander.rb.tt +0 -0
  78. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/interfaces/layer.rb.tt +0 -0
  79. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%/version.rb.tt +0 -0
  80. data/lib/templates/plugin/{lib → core/lib}/terraspace_plugin_%name%.rb.tt +0 -0
  81. data/lib/templates/plugin/{spec → core/spec}/spec_helper.rb.tt +0 -0
  82. data/lib/templates/plugin/{spec → core/spec}/terraspace_provider_%name%_spec.rb.tt +0 -0
  83. data/lib/templates/plugin/{terraspace_plugin_%name%.gemspec.tt → core/terraspace_plugin_%name%.gemspec.tt} +0 -0
  84. data/lib/terraspace/all/runner.rb +2 -0
  85. data/lib/terraspace/all/summary.rb +2 -0
  86. data/lib/terraspace/app.rb +23 -4
  87. data/lib/terraspace/builder.rb +1 -1
  88. data/lib/terraspace/cli/concerns/plan_path.rb +8 -0
  89. data/lib/terraspace/cli/down.rb +4 -0
  90. data/lib/terraspace/cli/init.rb +1 -1
  91. data/lib/terraspace/cli/new/ci.rb +121 -0
  92. data/lib/terraspace/cli/new/example.rb +1 -1
  93. data/lib/terraspace/cli/new/helpers/plugin_gem.rb +1 -1
  94. data/lib/terraspace/cli/new/plugin/ci.rb +46 -0
  95. data/lib/terraspace/cli/new/plugin/core.rb +26 -0
  96. data/lib/terraspace/cli/new/plugin/helper.rb +4 -1
  97. data/lib/terraspace/cli/new/plugin.rb +8 -15
  98. data/lib/terraspace/cli/new/test.rb +1 -1
  99. data/lib/terraspace/cli/new.rb +17 -13
  100. data/lib/terraspace/cli/plan.rb +13 -0
  101. data/lib/terraspace/cli/setup/check.rb +8 -0
  102. data/lib/terraspace/cli/up.rb +8 -12
  103. data/lib/terraspace/cli.rb +2 -2
  104. data/lib/terraspace/cloud/api/cani.rb +30 -0
  105. data/lib/terraspace/cloud/api/concern/errors.rb +12 -0
  106. data/lib/terraspace/cloud/api/concern/record.rb +18 -0
  107. data/lib/terraspace/cloud/api/concern.rb +38 -0
  108. data/lib/terraspace/cloud/api/http_methods.rb +116 -0
  109. data/lib/terraspace/cloud/api/validate.rb +24 -0
  110. data/lib/terraspace/cloud/api.rb +33 -0
  111. data/lib/terraspace/cloud/base.rb +97 -0
  112. data/lib/terraspace/cloud/ci/generic.rb +25 -0
  113. data/lib/terraspace/cloud/ci/manual.rb +81 -0
  114. data/lib/terraspace/cloud/ci/vcs/base.rb +36 -0
  115. data/lib/terraspace/cloud/ci/vcs/bitbucket.rb +11 -0
  116. data/lib/terraspace/cloud/ci/vcs/github.rb +11 -0
  117. data/lib/terraspace/cloud/ci/vcs/gitlab.rb +11 -0
  118. data/lib/terraspace/cloud/ci/vcs.rb +18 -0
  119. data/lib/terraspace/cloud/ci.rb +56 -0
  120. data/lib/terraspace/cloud/context.rb +14 -0
  121. data/lib/terraspace/cloud/folder/base.rb +17 -0
  122. data/lib/terraspace/cloud/folder/package.rb +33 -0
  123. data/lib/terraspace/cloud/folder/tidy.rb +54 -0
  124. data/lib/terraspace/cloud/folder/uploader.rb +37 -0
  125. data/lib/terraspace/cloud/folder.rb +11 -0
  126. data/lib/terraspace/cloud/plan.rb +47 -0
  127. data/lib/terraspace/cloud/update.rb +37 -0
  128. data/lib/terraspace/command.rb +16 -1
  129. data/lib/terraspace/compiler/dsl/syntax/mod.rb +2 -2
  130. data/lib/terraspace/compiler/dsl/syntax/tfvar.rb +1 -1
  131. data/lib/terraspace/compiler/expander/backend.rb +1 -1
  132. data/lib/terraspace/compiler/expander.rb +1 -1
  133. data/lib/terraspace/compiler/strategy/tfvar/layer.rb +56 -29
  134. data/lib/terraspace/core.rb +36 -3
  135. data/lib/terraspace/ext/core/module.rb +9 -4
  136. data/lib/terraspace/hooks/builder.rb +1 -1
  137. data/lib/terraspace/logger.rb +32 -5
  138. data/lib/terraspace/mod.rb +21 -9
  139. data/lib/terraspace/plugin/expander/interface.rb +15 -11
  140. data/lib/terraspace/plugin.rb +14 -5
  141. data/lib/terraspace/shell.rb +7 -2
  142. data/lib/terraspace/terraform/args/thor.rb +8 -2
  143. data/lib/terraspace/terraform/ihooks/after/apply.rb +8 -0
  144. data/lib/terraspace/terraform/ihooks/after/destroy.rb +8 -0
  145. data/lib/terraspace/terraform/ihooks/after/plan.rb +31 -2
  146. data/lib/terraspace/terraform/ihooks/base.rb +7 -3
  147. data/lib/terraspace/terraform/ihooks/before/apply.rb +8 -0
  148. data/lib/terraspace/terraform/ihooks/before/destroy.rb +8 -0
  149. data/lib/terraspace/terraform/ihooks/before/plan.rb +11 -3
  150. data/lib/terraspace/terraform/runner.rb +19 -5
  151. data/lib/terraspace/version.rb +1 -1
  152. data/lib/terraspace.rb +2 -0
  153. data/terraspace.gemspec +1 -0
  154. metadata +116 -52
  155. data/.pipedream/schedule.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82379236de38c541366efe70b69e9393490f5da74a4aecd4a975b3b9be0af907
4
- data.tar.gz: b5cb25d94d6015f01768ec6970b66221b78851ef72ef5614f0a5e54e774aaa94
3
+ metadata.gz: e2e48b2824f50628986b242f0d8f751795b755f54ae1cf3cda72bf7ff2447807
4
+ data.tar.gz: cdaec82517675a111b57f15ef081f930bc4f4712003109452dda9c79222b2ee5
5
5
  SHA512:
6
- metadata.gz: 917fc2cd69a9eab564e2c8a69e9493a04e0a2e424784e09217a79f5c3433b9a790a1bfc9669e9b68a0f53cce32565900aeb4134861faf9a9266b91d847fea39d
7
- data.tar.gz: a2977e19c20a1841892f4b275623e080837ccd10359282108475cad9bdd993ccaac3d7d1f0f7e38a530b823ab4c8c2816e9564b882cb482618bd7701e306da6d
6
+ metadata.gz: 6cc7d06b5e877b2ff3a5dccf2a19c1a94028ed34f83ce8067600c1b6a0e1ba9b3a1dd27d558a7a3d6916af346b09a7eb5248536b4afc162e4268862a484b710f
7
+ data.tar.gz: c4293d7b1b496ea38c839113c1845d95552d11da8b041ff115ae1ecaab3b11e659a4e7f906b7b704150144ac70e48faa689e35cb75642b583db7e19a3c36ff79
File without changes
data/.cody/all/project.rb CHANGED
@@ -1,2 +1,6 @@
1
- github_url("https://github.com/boltops-tools/terraspace.git")
2
- linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
1
+ github("boltops-tools/terraspace")
2
+ image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
+ env_vars(
4
+ TS_ORG: "qa",
5
+ TS_TOKEN: "ssm:/#{Cody.env}/TS_TOKEN",
6
+ )
@@ -10,6 +10,11 @@ export PATH=~/bin:$PATH # ~/bin/terraspace wrapper
10
10
  set -x
11
11
  terraspace new project infra --examples
12
12
  cd infra
13
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
14
+
13
15
  terraspace new test demo --type stack
14
16
  cd app/stacks/demo
17
+ cd test
18
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
19
+ cd -
15
20
  terraspace test
File without changes
data/.cody/aws/project.rb CHANGED
@@ -1,2 +1,6 @@
1
- github_url("https://github.com/boltops-tools/terraspace.git")
2
- linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
1
+ github("boltops-tools/terraspace")
2
+ image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
+ env_vars(
4
+ TS_ORG: "qa",
5
+ TS_TOKEN: "ssm:/#{Cody.env}/TS_TOKEN",
6
+ )
@@ -17,6 +17,11 @@ export ARM_TENANT_ID=$(cat ~/.azure/app-client.json | jq -r '.tenant_id')
17
17
  set -x
18
18
  terraspace new project infra --examples --plugin azurerm
19
19
  cd infra
20
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
21
+
20
22
  terraspace new test demo --type stack
21
23
  cd app/stacks/demo
24
+ cd test
25
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
26
+ cd -
22
27
  terraspace test
File without changes
@@ -1,6 +1,8 @@
1
- github_url("https://github.com/boltops-tools/terraspace.git")
2
- linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
- environment_variables(
1
+ github("boltops-tools/terraspace")
2
+ image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
+ env_vars(
4
4
  # Used by .cody/azurerm/bin/az/configure.sh
5
5
  AZURE_APP_CLIENT_JSON: ssm("/terraspace/#{Cody.env}/azure_app_client_json"),
6
+ TS_ORG: "qa",
7
+ TS_TOKEN: "ssm:/#{Cody.env}/TS_TOKEN",
6
8
  )
@@ -14,6 +14,11 @@ export GOOGLE_PROJECT=$(cat $GOOGLE_APPLICATION_CREDENTIALS | jq -r '.project_id
14
14
  set -x
15
15
  terraspace new project infra --examples --plugin google
16
16
  cd infra
17
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
18
+
17
19
  terraspace new test demo --type stack
18
20
  cd app/stacks/demo
21
+ cd test
22
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
23
+ cd -
19
24
  terraspace test
File without changes
@@ -1,6 +1,8 @@
1
- github_url("https://github.com/boltops-tools/terraspace.git")
2
- linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
- environment_variables(
1
+ github("boltops-tools/terraspace")
2
+ image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
+ env_vars(
4
4
  # Used by .cody/google/bin/gcloud/configure.sh
5
5
  GOOGLE_CREDS_JSON: ssm("/terraspace/#{Cody.env}/google_creds_json"),
6
+ TS_ORG: "qa",
7
+ TS_TOKEN: "ssm:/#{Cody.env}/TS_TOKEN",
6
8
  )
@@ -10,6 +10,11 @@ export PATH=~/bin:$PATH # ~/bin/terraspace wrapper
10
10
  set -x
11
11
  terraspace new project infra --plugin none --examples
12
12
  cd infra
13
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
14
+
13
15
  terraspace new test demo --type stack
14
16
  cd app/stacks/demo
17
+ cd test
18
+ $CODEBUILD_SRC_DIR/.cody/shared/script/update/gemfile.sh
19
+ cd -
15
20
  terraspace test
File without changes
@@ -1,2 +1,6 @@
1
- github_url("https://github.com/boltops-tools/terraspace.git")
2
- linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
1
+ github("boltops-tools/terraspace")
2
+ image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
3
+ env_vars(
4
+ TS_ORG: "qa",
5
+ TS_TOKEN: "ssm:/#{Cody.env}/TS_TOKEN",
6
+ )
@@ -2,7 +2,8 @@
2
2
 
3
3
  set -eu
4
4
 
5
- TERRAFORM_VERSION=latest
5
+ #TERRAFORM_VERSION=latest
6
+ TERRAFORM_VERSION=1.1.9
6
7
 
7
8
  git clone https://github.com/tfutils/tfenv.git ~/.tfenv
8
9
  echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
@@ -0,0 +1,2 @@
1
+ #!/bin/bash
2
+ sed -i 's/gem "terraspace".*/gem "terraspace", path: ENV[\"CODEBUILD_SRC_DIR\"]/' Gemfile
@@ -1,2 +1,2 @@
1
- github_url("https://github.com/boltops-tools/terraspace.git")
2
- linux_image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
1
+ github("boltops-tools/terraspace")
2
+ image("aws/codebuild/amazonlinux2-x86_64-standard:3.0")
data/.gitignore CHANGED
@@ -18,3 +18,5 @@
18
18
  /test/tmp
19
19
  /test/version_tmp
20
20
  /tmp
21
+ .cody/output
22
+ .pipedream/output
@@ -1,8 +1,8 @@
1
1
  stage "Source" do
2
2
  github(
3
- source: "boltops-tools/terraspace",
4
- # branch: "master", # branch defaults to "master" or the `pipe deploy --branch` option
5
- auth_token: ssm("/github/boltopsbot/token")
3
+ Source: "boltops-tools/terraspace",
4
+ # Branch: "master", # branch defaults to "master" or the `pipe deploy --branch` option
5
+ AuthToken: ssm("/github/boltopsbot/token")
6
6
  )
7
7
  end
8
8
 
data/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [2.0.0] - 2022-06-10
7
+ * Terraspace Cloud Support
8
+
9
+ Highlights:
10
+ * Record updates to Terraspace Cloud API
11
+ * CI plugin support
12
+ * CI plugin generator
13
+ * VCS manual support in core for github, gitlab, bitbucket
14
+
15
+ More:
16
+ * Backend expander variables handle env vars in general
17
+ * Remove config.build.cache_root option
18
+ * Clean up Terraspace::Plugin.autodetect
19
+ * cloud.record = "changes". dont create cloud record when no changes
20
+ * ci generic
21
+ * edge case TS_ENV=''
22
+ * .cody/cloud test
23
+ * cloud warning message when TS_TOKEN is confiugred but cloud is not yet
24
+ * API expodential retry logic
25
+ * plugin autodetect cleanup
26
+ * TS_EXTRA in favor of instance option, deprecate instance option
27
+ * handle ctrl-c
28
+ * improve acceptannce codebuild scripts
29
+
6
30
  ## [1.1.7] - 2022-02-22
7
31
  - [#215](https://github.com/boltops-tools/terraspace/pull/215) fix all down by building child nodes
8
32
  - [#216](https://github.com/boltops-tools/terraspace/pull/216) add codebuild project with acceptance test for terraspace all
data/exe/terraspace CHANGED
@@ -1,12 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # Trap ^C
4
- Signal.trap("INT") {
5
- puts "\nCtrl-C detected. Exiting..."
6
- sleep 0.1
7
- exit
8
- }
9
-
10
3
  $:.unshift(File.expand_path("../../lib", __FILE__))
11
4
  require "terraspace"
12
5
  require "terraspace/cli"
@@ -1,4 +1,7 @@
1
1
  # Docs: https://terraspace.cloud/docs/config/reference/
2
2
  Terraspace.configure do |config|
3
3
  config.logger.level = :info
4
+
5
+ # config.cloud.org = "ORG" # replace with your org. only letters, numbers, underscore and dashes allowed
6
+ # config.cloud.project = "main" # optional. main is the default project name. only letters, numbers, underscore and dashes allowed
4
7
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/<%= gem_name %>/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "<%= gem_name %>"
7
+ spec.version = <%= gem_class_name %>::VERSION
8
+ spec.authors = ["Author Name"]
9
+ spec.email = ["example@email.com"]
10
+
11
+ spec.summary = "Terraspace CI <%= name %> support"
12
+ spec.homepage = "https://github.com/ORG/<%= gem_name %>"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/ORG/<%= gem_name %>"
18
+ spec.metadata["changelog_uri"] = "https://github.com/ORG/<%= gem_name %>/blob/master/CHANGELOG.md"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
25
+ end
26
+ end
27
+ spec.bindir = "exe"
28
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "zeitwerk"
32
+ end
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /Gemfile.lock
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
File without changes
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - <%= Time.now.strftime("%Y-%m-%d") %>
4
+
5
+ - Initial release
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in gemspec
6
+ gemspec
7
+
8
+ gem "rake"
9
+ gem "rspec"
10
+ gem "rubocop"
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ # <%= gem_name %>
2
+
3
+ Provides Terraspace CI support for <%= name %>.
4
+
5
+ ## Installation
6
+
7
+ Add gem to your Terraspace project
8
+
9
+ Gemfile
10
+
11
+ gem <%= gem_name %>
12
+
13
+ Then to install run
14
+
15
+ bundle
16
+
17
+ ## Contributing
18
+
19
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ORG/<%= gem_name %>/
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,23 @@
1
+ require "zeitwerk"
2
+
3
+ module <%= gem_class_name %>
4
+ class Autoloader
5
+ class Inflector < Zeitwerk::Inflector
6
+ def camelize(basename, _abspath)
7
+ map = { version: "VERSION" }
8
+ map[basename.to_sym] || super
9
+ end
10
+ end
11
+
12
+ class << self
13
+ def setup
14
+ loader = Zeitwerk::Loader.new
15
+ loader.inflector = Inflector.new
16
+ loader.push_dir(File.dirname(__dir__)) # lib
17
+ loader.log! if ENV["<%= gem_name.underscore.upcase %>_AUTOLOAD_LOG"]
18
+ loader.setup
19
+ end
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,15 @@
1
+ module <%= gem_class_name %>
2
+ class Interface
3
+ # required interface
4
+ def vars
5
+ Vars.new.data
6
+ end
7
+ <% if @options[:pr] %>
8
+ # optional interface
9
+ # uncomment to use
10
+ def comment(url)
11
+ Pr.new.comment(url)
12
+ end
13
+ <% end -%>
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module <%= gem_class_name %>
2
+ class Pr
3
+ # Implement this method.
4
+ # Method should update existing comment instead of always creating new comment.
5
+ # Otherwise it gets noisy.
6
+ # Remember to also uncomment out the definition in
7
+ #
8
+ # <%= gem_class_name %>::Interface#comment(url)
9
+ #
10
+ # If CI system does not support PRs and comments. Can delete this class entirely.
11
+ #
12
+ def comment(url)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,26 @@
1
+ module <%= gem_class_name %>
2
+ class Vars
3
+ # Interface method. Hash of properties to be stored
4
+ # Usually available from env vars.
5
+ # Provide as many CI system as possible.
6
+ def data
7
+ {
8
+ build_system: "REPLACE_ME",
9
+ host: ENV['REPLACE_ME'],
10
+ full_repo: ENV['REPLACE_ME'],
11
+ branch_name: ENV['REPLACE_ME'],
12
+ # urls
13
+ pr_url: ENV['REPLACE_ME'],
14
+ build_url: ENV['REPLACE_ME'],
15
+ # additional properties
16
+ build_type: ENV['REPLACE_ME'],
17
+ pr_number: ENV['REPLACE_ME'],
18
+ sha: ENV['REPLACE_ME'],
19
+ # additional properties
20
+ commit_message: ENV['REPLACE_ME'],
21
+ build_id: ENV['REPLACE_ME'],
22
+ build_number: ENV['REPLACE_ME'],
23
+ }
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module <%= gem_class_name %>
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "<%= gem_name %>/autoloader"
4
+ <%= gem_class_name %>::Autoloader.setup
5
+
6
+ require "json"
7
+
8
+ module <%= gem_class_name %>
9
+ class Error < StandardError; end
10
+ end
11
+
12
+ Terraspace::Cloud::Ci.register(
13
+ name: "<%= name %>",
14
+ env_key: "<%= name.upcase %>", # IMPORTANT: Env var used for CI detection. Probably have to change.
15
+ root: __dir__,
16
+ # exe: "bin", # terraspace new ci NAME generator will make files in this folder executable
17
+ )
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe TerraspaceCiGithub do
4
+ it "has a version number" do
5
+ expect(TerraspaceCiGithub::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "<%= gem_name %>"
4
+
5
+ RSpec.configure do |config|
6
+ # Enable flags like --only-failures and --next-failure
7
+ config.example_status_persistence_file_path = ".rspec_status"
8
+
9
+ # Disable RSpec exposing methods globally on `Module` and `main`
10
+ config.disable_monkey_patching!
11
+
12
+ config.expect_with :rspec do |c|
13
+ c.syntax = :expect
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
File without changes
File without changes
File without changes
File without changes
@@ -128,6 +128,8 @@ module Terraspace::All
128
128
  Terraspace::CLI::Up.new(o).run
129
129
  when "down"
130
130
  Terraspace::CLI::Down.new(o).run
131
+ when "plan"
132
+ Terraspace::CLI::Plan.new(o).run
131
133
  else
132
134
  Terraspace::CLI::Commander.new(name, o).run
133
135
  end