cloudspin-stack 0.1.8 → 0.1.9

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
  SHA1:
3
- metadata.gz: 4170afe9007ab5cebf6f4e58af38922acc5fce87
4
- data.tar.gz: 8c5c4ce80a36b5466f00a6b12c6128a9d39876a8
3
+ metadata.gz: 5e178ce62e9a31330889dc2267257be6ed7ad348
4
+ data.tar.gz: ebc785974df577a49b9397576e1b8b837683ad19
5
5
  SHA512:
6
- metadata.gz: da540b6e8568124062af22ac849116136ab90bce97ad40ef05a9f3b8dd4689315af237503e4ee4b1453d4d64bc0f593c87c3b2f0245b868a007b0a5334c45ef4
7
- data.tar.gz: d31bf8166024b87d4637d5b3519a69e9b95a3a853931bccd0eab9583ca7fd902fb8397c9099a536e2b12cace39eab1759034a93e84ebaca6053f89d4defffe33
6
+ metadata.gz: '09ed7657a6cd3b3768d152b54d9f6388f3b737edc320b19edc2ddb7588181301fd3cea4c50bbe5997e190f6773e994e2910e945f91b1a8992cb9174846ff24f4'
7
+ data.tar.gz: 9ee0318f4c9eb5452ea459a18314b80fce67b4e4c46531b929af5a99066ce1518212d025f2a2f70175840998b4c7334a4509010c257579b152de1975561148a2
data/lib/cloudspin/cli.rb CHANGED
@@ -9,28 +9,25 @@ module Cloudspin
9
9
  :aliases => '-f',
10
10
  :banner => 'YAML-CONFIG-FILE',
11
11
  :type => :array,
12
- :default => [
13
- Util.full_path_from_local('spin-default.yaml'),
14
- Util.full_path_from_local('spin-local.yaml')
15
- ],
12
+ :default => ['spin-default.yaml', 'spin-local.yaml'],
16
13
  :desc => 'A list of configuration files to load for the stack instance. Values in files listed later override those from earlier files.'
17
14
 
18
15
  class_option :terraform_source,
19
16
  :aliases => '-t',
20
17
  :banner => 'PATH',
21
- :default => Util.full_path_from_local('./src'),
18
+ :default => './src',
22
19
  :desc => 'Folder with the terraform project source files'
23
20
 
24
21
  class_option :work,
25
22
  :aliases => '-w',
26
23
  :banner => 'PATH',
27
- :default => Util.full_path_from_local('./work'),
24
+ :default => './work',
28
25
  :desc => 'Folder to create and copy working files into'
29
26
 
30
27
  class_option :state,
31
28
  :aliases => '-s',
32
29
  :banner => 'PATH',
33
- :default => Util.full_path_from_local('./state'),
30
+ :default => './state',
34
31
  :desc => 'Folder to create and store local state'
35
32
 
36
33
  desc 'up INSTANCE_ID', 'Create or update the stack instance'
@@ -48,7 +45,7 @@ module Cloudspin
48
45
  end
49
46
  end
50
47
 
51
- desc 'down', 'Destroy the stack instance'
48
+ desc 'down INSTANCE_ID', 'Destroy the stack instance'
52
49
  option :dry, :type => :boolean, :default => false
53
50
  option :plan, :type => :boolean, :default => false
54
51
  def down(id)
@@ -15,6 +15,7 @@ module Cloudspin
15
15
  end
16
16
 
17
17
  def self.from_file(specfile)
18
+ raise "Cloudspin definition file not found: #{specfile}" unless File.exists?(specfile)
18
19
  spec_hash = YAML.load_file(specfile)
19
20
  stack_spec = symbolize(spec_hash)
20
21
  terraform_source_path = File.dirname(specfile)
@@ -25,7 +25,7 @@ module Cloudspin
25
25
  @stack_definition = stack_definition
26
26
  @backend_config = backend_config
27
27
  @working_folder = working_folder
28
- @statefile_folder = statefile_folder
28
+ @statefile_folder = Pathname.new(statefile_folder).realdirpath.to_s
29
29
  @parameter_values = {}
30
30
  @resource_values = {}
31
31
  end
@@ -73,7 +73,7 @@ module Cloudspin
73
73
  :vars => terraform_variables
74
74
  })
75
75
  built_command = configured_command.build
76
- built_command.to_s
76
+ "cd #{working_folder} && #{built_command.to_s}"
77
77
  end
78
78
 
79
79
  def up
@@ -98,7 +98,7 @@ module Cloudspin
98
98
  :vars => terraform_variables
99
99
  })
100
100
  built_command = configured_command.build
101
- built_command.to_s
101
+ "cd #{working_folder} && #{built_command.to_s}"
102
102
  end
103
103
 
104
104
  def down
@@ -123,7 +123,7 @@ module Cloudspin
123
123
  :vars => terraform_variables
124
124
  })
125
125
  built_command = configured_command.build
126
- built_command.to_s
126
+ "cd #{working_folder} && #{built_command.to_s}"
127
127
  end
128
128
 
129
129
  def terraform_variables
@@ -1,5 +1,5 @@
1
1
  module Cloudspin
2
2
  module Stack
3
- VERSION = '0.1.8'
3
+ VERSION = '0.1.9'
4
4
  end
5
5
  end
@@ -1,5 +1,4 @@
1
1
  require 'cloudspin/stack/version'
2
- require 'cloudspin/util'
3
2
  require 'cloudspin/stack/definition'
4
3
  require 'cloudspin/stack/instance'
5
4
 
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.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'kief '
@@ -105,7 +105,6 @@ 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
109
108
  homepage: https://github.com/cloudspinners
110
109
  licenses:
111
110
  - MIT
@@ -1,17 +0,0 @@
1
- module Cloudspin
2
- class Util
3
- def self.full_path_from_local(relative_path)
4
- raw_path = self.raw_path_from_local(relative_path)
5
- if File.exists?(raw_path)
6
- Pathname.new(raw_path).realpath.to_s
7
- else
8
- relative_path
9
- end
10
- end
11
-
12
- def self.raw_path_from_local(relative_path)
13
- Dir.pwd + '/' + relative_path
14
- end
15
- end
16
- end
17
-