cloudspin-stack-rake 0.1.9 → 0.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e3b1a6ee0e4eac1e4161d0349614067a33200e6da491f23f03b87fdb02fafcc
4
- data.tar.gz: 8b3b11512a7579c2188cb5571edcc182b3ff602c15ec91cfcd4bf83ab7f082c1
3
+ metadata.gz: a360fb5e777448d7d93e031810b7a612a74ac2b66e2d2da3e653e5766dee0b8c
4
+ data.tar.gz: 2f7ee363e8b54f68f799141761272b9db7fefdf8a57379925b8865a5d4a2d21d
5
5
  SHA512:
6
- metadata.gz: 8b3dded1736b8aefdc85585faecbcbcf9a246480e9f3e8d3d9cf26a96549eeb53bd5d464a1ba910b2862bdda59848d91344a4448e78913732aa73aa95c3c5323
7
- data.tar.gz: 10748e3997ee787961db8f04724db94634de1b30dcabb0777b088bc1dc6053c524bbd6f5889509f113f5da1075b0d7bf66e92be0dc5703bf99ed19d21e69e63d
6
+ metadata.gz: '0964c659f2c790cebc4e4e0069c062ec042992c370c170cf61036657017dd7e5ed7017c640f58fb9329c15ef1591504233ac7367af2b0b28f4b9072a59aac9b8'
7
+ data.tar.gz: 9ce9b56cfac88d08a5d227c910726dbf9ff55f784e22b38a5b77a60a7b25d644c8326e102e007fed527d10b16140d8a37cef774ca94804721e6c86725113b2f2
@@ -5,31 +5,48 @@ module Cloudspin
5
5
 
6
6
  class StackTask < ::Rake::TaskLib
7
7
 
8
- attr_reader :id
9
8
  attr_reader :instance
10
- attr_reader :definition_folder
11
- attr_reader :instance_folder
12
9
 
13
- def initialize(id:, definition_folder: './src', instance_folder: '.')
10
+ def initialize(
11
+ environment = nil,
12
+ definition_folder: './src',
13
+ base_folder: '.'
14
+ )
15
+ @environment = environment
16
+ @base_folder = base_folder
17
+
14
18
  @instance = Cloudspin::Stack::Instance.from_folder(
15
- default_instance_configuration_files(instance_folder),
16
- definition_folder: definition_folder,
17
- base_working_folder: "#{instance_folder}/work",
18
- base_statefile_folder: "#{instance_folder}/state"
19
+ instance_configuration_files,
20
+ definition_folder: definition_folder,
21
+ base_working_folder: "#{base_folder}/work",
22
+ base_statefile_folder: "#{base_folder}/state"
19
23
  )
20
24
  define
21
25
  end
22
26
 
23
- def default_instance_configuration_files(instance_folder)
27
+ def instance_configuration_files
28
+ file_list = default_configuration_files
29
+ if @environment
30
+ if File.exists? environment_config_file
31
+ file_list << environment_config_file
32
+ else
33
+ raise "Missing configuration file for environment #{options[:environment]} (#{environment_config_file})"
34
+ end
35
+ end
36
+ file_list
37
+ end
38
+
39
+ def default_configuration_files
24
40
  [
25
- "#{instance_folder}/spin-default.yaml",
26
- "#{instance_folder}/stack-instance-default.yaml",
27
- "#{instance_folder}/stack-instance-defaults.yaml",
28
- "#{instance_folder}/spin-local.yaml",
29
- "#{instance_folder}/stack-instance-local.yaml"
41
+ "#{@base_folder}/stack-instance-defaults.yaml",
42
+ "#{@base_folder}/stack-instance-local.yaml"
30
43
  ]
31
44
  end
32
45
 
46
+ def environment_config_file
47
+ Pathname.new("#{@base_folder}/environments/stack-instance-#{@environment}.yaml").realdirpath.to_s
48
+ end
49
+
33
50
  def define
34
51
 
35
52
  desc "Create or update stack #{@instance.id}"
@@ -1,7 +1,7 @@
1
1
  module Cloudspin
2
2
  module Stack
3
3
  module Rake
4
- VERSION = '0.1.9'
4
+ VERSION = '0.1.10'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudspin-stack-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - 'kief '