rspec-terraspace 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/rspec/terraspace/project.rb +24 -1
- data/lib/rspec/terraspace/ts.rb +9 -0
- data/lib/rspec/terraspace/version.rb +1 -1
- data/lib/rspec/terraspace.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b718772c65d61edfd892aab57116ec4414f6302162d59c7369090a2864cd50
|
4
|
+
data.tar.gz: d27b219c170bd11a122d71ca07f6d06b3f10a3056524f23a4a9a55104b3c8b48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cf1300e159a1bd5be2c0ad59236e889b426a83f955829be294b504981290e3da22a5af83835f8bc5b6dafb780e8350835b4acda49a3aa6f349d50a92b1d8002
|
7
|
+
data.tar.gz: cd0486c714961d6e4d34e577e2c60b313dcae8112e59affead2a1228588eaf517d5137acbe2cbae9952ded6c9624e0c925fc4f1c221f681ea7c3a91cb5989893
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [0.3.1] - 2021-12-29
|
7
|
+
- [#8](https://github.com/boltops-tools/rspec-terraspace/pull/8) provider autodetection
|
8
|
+
|
6
9
|
## [0.3.0] - 2021-07-26
|
7
10
|
- [#5](https://github.com/boltops-tools/rspec-terraspace/pull/5) Improvements
|
8
11
|
- detect module or stack type so module specs can be written
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ So if you set it: `export TS_RSPEC_BUILD_ROOT=~/environment/terraspace-test-harn
|
|
21
21
|
|
22
22
|
The test helpers support both module-level and project-level tests. See:
|
23
23
|
|
24
|
-
* [Terraspace Testing](https://
|
24
|
+
* [Terraspace Testing](https://terraspace.cloud/docs/testing/)
|
25
25
|
|
26
26
|
## Installation
|
27
27
|
|
@@ -11,6 +11,7 @@ module RSpec::Terraspace
|
|
11
11
|
@stacks = options[:stacks]
|
12
12
|
@tfvars = options[:tfvars]
|
13
13
|
@folders = options[:folders]
|
14
|
+
@plugin = options[:plugin]
|
14
15
|
|
15
16
|
@remove_test_folder = options[:remove_test_folder].nil? ? true : options[:remove_test_folder]
|
16
17
|
end
|
@@ -44,7 +45,29 @@ module RSpec::Terraspace
|
|
44
45
|
FileUtils.mkdir_p(parent_dir)
|
45
46
|
Dir.chdir(parent_dir) do
|
46
47
|
project_name = File.basename(build_dir)
|
47
|
-
|
48
|
+
args = [project_name, "--no-config", "--quiet"] + plugin_option
|
49
|
+
::Terraspace::CLI::New::Project.start(args)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def plugin_option
|
54
|
+
if @plugin
|
55
|
+
["-p", @plugin]
|
56
|
+
else
|
57
|
+
provider = autodetect_provider || "none"
|
58
|
+
["-p", provider]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def autodetect_provider
|
63
|
+
providers = Terraspace::Plugin.meta.keys
|
64
|
+
if providers.size == 1
|
65
|
+
providers.first
|
66
|
+
else
|
67
|
+
precedence = %w[aws azurerm google]
|
68
|
+
precedence.find do |p|
|
69
|
+
providers.include?(p)
|
70
|
+
end
|
48
71
|
end
|
49
72
|
end
|
50
73
|
|
data/lib/rspec/terraspace/ts.rb
CHANGED
@@ -8,11 +8,20 @@ module RSpec::Terraspace
|
|
8
8
|
CLI = ::Terraspace::CLI
|
9
9
|
|
10
10
|
def build_test_harness(options={})
|
11
|
+
setup
|
11
12
|
project = Project.new(options)
|
12
13
|
root = project.create
|
13
14
|
Terraspace.root = root # switch root to the generated test harness
|
14
15
|
end
|
15
16
|
|
17
|
+
def setup
|
18
|
+
# Require gems in Gemfile so terraspace_plugin_* gets loaded and registered
|
19
|
+
# This it test Gemfile. IE: app/stacks/demo/test/Gemfile
|
20
|
+
Kernel.require "bundler/setup"
|
21
|
+
Bundler.require # Same as Bundler.require(:default)
|
22
|
+
Terraspace.check_project = false
|
23
|
+
end
|
24
|
+
|
16
25
|
def up(args)
|
17
26
|
run("up #{args} -y")
|
18
27
|
mod = args.split(' ').first
|
data/lib/rspec/terraspace.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-terraspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.2.
|
142
|
+
rubygems_version: 3.2.32
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Terraspace RSpec support
|