cloudspin-stack 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloudspin/cli.rb +32 -6
- data/lib/cloudspin/stack/instance.rb +16 -6
- data/lib/cloudspin/stack/version.rb +1 -1
- data/lib/cloudspin/stack.rb +1 -0
- data/lib/cloudspin/util.rb +8 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c885e8c2a9014973458e691e79b350769043e562
|
4
|
+
data.tar.gz: d008d0062896585c367f314110768f02ab6325b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f1cea03a705b02c92e805dcbb9de31a698e93f9f1865bd8fc9bdb60f84d8a6dd4e0e14ed9f8a4901d358c5a629f1ac6adb75cee03029e8f1313e83748557247
|
7
|
+
data.tar.gz: 06c98e0cdaec56f173cdb2c90401cb10a05964c76ada6226c6ccf3d9835ecc13503827cde70abb1f09c67fa2a6181d6c629ea93dc18596d1ff6b9078f8090544
|
data/lib/cloudspin/cli.rb
CHANGED
@@ -2,36 +2,60 @@ require 'thor'
|
|
2
2
|
require 'cloudspin/stack'
|
3
3
|
|
4
4
|
module Cloudspin
|
5
|
+
|
5
6
|
class CLI < Thor
|
6
7
|
|
7
8
|
class_option :file,
|
8
9
|
:aliases => '-f',
|
9
10
|
:banner => 'YAML-CONFIG-FILE',
|
10
11
|
:type => :array,
|
11
|
-
:default => [
|
12
|
+
:default => [
|
13
|
+
Util.full_path_to('spin-default.yaml'),
|
14
|
+
Util.full_path_to('spin-local.yaml')
|
15
|
+
],
|
12
16
|
:desc => 'A list of configuration files to load for the stack instance. Values in files listed later override those from earlier files.'
|
13
17
|
|
14
18
|
class_option :terraform_source,
|
15
19
|
:aliases => '-t',
|
16
20
|
:banner => 'PATH',
|
17
|
-
:default => './src',
|
21
|
+
:default => Util.full_path_to('./src'),
|
18
22
|
:desc => 'Folder with the terraform project source files'
|
19
23
|
|
20
24
|
class_option :work,
|
21
25
|
:aliases => '-w',
|
22
26
|
:banner => 'PATH',
|
23
|
-
:default => './work',
|
27
|
+
:default => Util.full_path_to('./work'),
|
24
28
|
:desc => 'Folder to create and copy working files into'
|
25
29
|
|
26
30
|
class_option :state,
|
27
31
|
:aliases => '-s',
|
28
32
|
:banner => 'PATH',
|
29
|
-
:default => './state',
|
33
|
+
:default => Util.full_path_to('./state'),
|
30
34
|
:desc => 'Folder to create and store local state'
|
31
35
|
|
32
|
-
desc 'plan', 'Print the changes that will by applied when the \'
|
36
|
+
desc 'plan', 'Print the changes that will by applied when the \'up\' command is run'
|
37
|
+
option :dry, :type => :boolean, :default => false
|
33
38
|
def plan
|
34
|
-
|
39
|
+
if options[:dry]
|
40
|
+
puts instance.plan_dry
|
41
|
+
else
|
42
|
+
instance.plan
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'up', 'Create or update the stack instance'
|
47
|
+
option :dry, :type => :boolean, :default => false
|
48
|
+
def up
|
49
|
+
if options[:dry]
|
50
|
+
puts instance.up_dry
|
51
|
+
else
|
52
|
+
instance.up
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'down', 'Destroy the stack instance'
|
57
|
+
def down
|
58
|
+
instance.down
|
35
59
|
end
|
36
60
|
|
37
61
|
desc 'version', 'Print the version number'
|
@@ -70,4 +94,6 @@ module Cloudspin
|
|
70
94
|
end
|
71
95
|
|
72
96
|
end
|
97
|
+
|
73
98
|
end
|
99
|
+
|
@@ -53,14 +53,13 @@ module Cloudspin
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
57
|
-
options = {
|
58
|
-
:state => terraform_statefile,
|
59
|
-
:vars => terraform_variables
|
60
|
-
}
|
56
|
+
def plan_dry
|
61
57
|
plan_command = RubyTerraform::Commands::Plan.new
|
62
58
|
command_line_builder = plan_command.instantiate_builder
|
63
|
-
configured_command = plan_command.configure_command(command_line_builder,
|
59
|
+
configured_command = plan_command.configure_command(command_line_builder, {
|
60
|
+
:state => terraform_statefile,
|
61
|
+
:vars => terraform_variables
|
62
|
+
})
|
64
63
|
built_command = configured_command.build
|
65
64
|
built_command.to_s
|
66
65
|
end
|
@@ -79,6 +78,17 @@ module Cloudspin
|
|
79
78
|
end
|
80
79
|
end
|
81
80
|
|
81
|
+
def up_dry
|
82
|
+
up_command = RubyTerraform::Commands::Apply.new
|
83
|
+
command_line_builder = up_command.instantiate_builder
|
84
|
+
configured_command = up_command.configure_command(command_line_builder, {
|
85
|
+
:state => terraform_statefile,
|
86
|
+
:vars => terraform_variables
|
87
|
+
})
|
88
|
+
built_command = configured_command.build
|
89
|
+
built_command.to_s
|
90
|
+
end
|
91
|
+
|
82
92
|
def down
|
83
93
|
RubyTerraform.clean(directory: working_folder)
|
84
94
|
mkdir_p File.dirname(working_folder)
|
data/lib/cloudspin/stack.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudspin-stack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 'kief '
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/cloudspin/stack/definition.rb
|
106
106
|
- lib/cloudspin/stack/instance.rb
|
107
107
|
- lib/cloudspin/stack/version.rb
|
108
|
+
- lib/cloudspin/util.rb
|
108
109
|
homepage: https://github.com/cloudspinners
|
109
110
|
licenses:
|
110
111
|
- MIT
|