biosphere 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/biosphere +1 -1
- data/lib/biosphere/deployment.rb +7 -2
- data/lib/biosphere/settings.rb +46 -3
- data/lib/biosphere/terraformproxy.rb +1 -0
- data/lib/biosphere/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 045992d0dc9ffbcdd966f6ff94110d9d9e8b5378
|
4
|
+
data.tar.gz: 9002f10cb4b3dccbf4b0fd9d22400c81e0053afe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f2c56774a1236da21a63956b7487b7f7e04b9f1d6524ed1b03666cd21c58fc6cea82835f6a7ceb31e091904ddb4256e1c76cbc6129ed812f21a2371419e2f6
|
7
|
+
data.tar.gz: 80026305f5df130666ad2e3e1d4706560a84392c1d32eb8197a42df6a435d47c7d104b54e63b2c0fbe0e1dfbeb1a9a15c1c5abf78e8f83848bb9b8c4ccd6feda
|
data/bin/biosphere
CHANGED
@@ -216,7 +216,7 @@ elsif ARGV[0] == "destroy" && options.src
|
|
216
216
|
puts "\nAborted!"
|
217
217
|
elsif answer == "y"
|
218
218
|
puts "\nDestroying deployment #{deployment} (this may take several minutes)"
|
219
|
-
tf_apply = %x( terraform destroy -state=#{options.build_dir}/#{deployment}.tfstate #{options.build_dir})
|
219
|
+
tf_apply = %x( terraform destroy -force -state=#{options.build_dir}/#{deployment}.tfstate #{options.build_dir})
|
220
220
|
puts "\n" + tf_apply
|
221
221
|
s3.save("#{options.build_dir}/#{deployment}.tfstate")
|
222
222
|
s3.save("#{options.build_dir}/state.node")
|
data/lib/biosphere/deployment.rb
CHANGED
@@ -5,7 +5,7 @@ class Biosphere
|
|
5
5
|
|
6
6
|
class Deployment
|
7
7
|
|
8
|
-
attr_reader :export, :name, :_settings
|
8
|
+
attr_reader :export, :name, :_settings, :feature_manifests
|
9
9
|
attr_accessor :state, :node
|
10
10
|
def initialize(*args)
|
11
11
|
|
@@ -25,8 +25,10 @@ class Biosphere
|
|
25
25
|
elsif args[0].kind_of?(::Biosphere::Settings)
|
26
26
|
@_settings = args.shift
|
27
27
|
settings = @_settings.settings
|
28
|
+
@feature_manifests = @_settings.feature_manifests
|
28
29
|
end
|
29
30
|
|
31
|
+
|
30
32
|
@export = {
|
31
33
|
"provider" => {},
|
32
34
|
"resource" => {},
|
@@ -60,6 +62,10 @@ class Biosphere
|
|
60
62
|
@deployments = []
|
61
63
|
@outputs = []
|
62
64
|
|
65
|
+
if @feature_manifests
|
66
|
+
node[:feature_manifests] = @feature_manifests
|
67
|
+
end
|
68
|
+
|
63
69
|
self.setup(settings)
|
64
70
|
|
65
71
|
end
|
@@ -187,7 +193,6 @@ class Biosphere
|
|
187
193
|
|
188
194
|
@export["resource"][resource[:type].to_s][resource[:name].to_s] = proxy.output
|
189
195
|
end
|
190
|
-
|
191
196
|
end
|
192
197
|
|
193
198
|
def to_json(pretty=false)
|
data/lib/biosphere/settings.rb
CHANGED
@@ -43,17 +43,58 @@ class Biosphere
|
|
43
43
|
return @settings_hash
|
44
44
|
end
|
45
45
|
|
46
|
+
def add_feature_manifest(feature, manifests=nil)
|
47
|
+
if manifests
|
48
|
+
if !manifests.is_a?(Array)
|
49
|
+
manifests = [manifests]
|
50
|
+
end
|
51
|
+
|
52
|
+
c = @feature_manifests_hash ||= ::Hash.new
|
53
|
+
c = DeepDup.deep_dup(c)
|
54
|
+
a = (c[feature] ||= ::Array.new)
|
55
|
+
c[feature] = (a + manifests).uniq
|
56
|
+
@feature_manifests_hash = c
|
57
|
+
end
|
58
|
+
|
59
|
+
return feature_manifests(feature)
|
60
|
+
end
|
61
|
+
|
62
|
+
def set_feature_manifests(obj)
|
63
|
+
@feature_manifests_hash = obj
|
64
|
+
end
|
65
|
+
|
66
|
+
def feature_manifests(feature=nil)
|
67
|
+
if feature
|
68
|
+
if @feature_manifests_hash
|
69
|
+
return @feature_manifests_hash[feature]
|
70
|
+
else
|
71
|
+
return nil
|
72
|
+
end
|
73
|
+
else
|
74
|
+
return @feature_manifests_hash
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
46
78
|
def path()
|
47
79
|
return @path
|
48
|
-
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Finds files from relative path
|
83
|
+
def find_files(p)
|
84
|
+
entries = Dir[($current_biosphere_path_stack + "/" + p)] - [".", ".."]
|
85
|
+
return entries
|
86
|
+
end
|
87
|
+
|
88
|
+
|
49
89
|
end
|
50
90
|
|
51
|
-
class_attribute :settings_hash, :path
|
91
|
+
class_attribute :settings_hash, :feature_manifests_hash, :path
|
52
92
|
|
53
|
-
attr_accessor :settings, :path
|
93
|
+
attr_accessor :settings, :path, :feature_manifests
|
54
94
|
|
55
95
|
def initialize(settings = {})
|
56
96
|
@settings = DeepDup.deep_dup(self.class.settings_hash)
|
97
|
+
@feature_manifests = DeepDup.deep_dup(self.class.feature_manifests_hash)
|
57
98
|
@path = self.class.path
|
58
99
|
if settings
|
59
100
|
@settings.deep_merge!(settings)
|
@@ -64,7 +105,9 @@ class Biosphere
|
|
64
105
|
return @settings[key]
|
65
106
|
end
|
66
107
|
|
108
|
+
# Initiate defaults
|
67
109
|
settings({})
|
110
|
+
set_feature_manifests({})
|
68
111
|
|
69
112
|
self.path = ""
|
70
113
|
|
@@ -144,6 +144,7 @@ class Biosphere
|
|
144
144
|
src_path = Pathname.new(@src_path.last + "/" + File.dirname(filename)).cleanpath.to_s
|
145
145
|
# Push current src_path and overwrite @src_path so that it tracks recursive loads
|
146
146
|
@src_path << src_path
|
147
|
+
$current_biosphere_path_stack = src_path
|
147
148
|
|
148
149
|
#puts "Trying to open file: " + src_path + "/" + File.basename(filename)
|
149
150
|
if File.exists?(src_path + "/" + File.basename(filename))
|
data/lib/biosphere/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: biosphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juho Mäkinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|