pleme 0.0.13 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pleme/gem/version.rb +1 -1
- data/lib/pleme/runner.rb +27 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b7215fb855677c01859eddb739d9a01b8614da1844bd33b85464306b523b5a7
|
4
|
+
data.tar.gz: 0646d9d35a42be800cdc4264a0419b48b1a312c935b898045987680ab2ff6167
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fee752140c800e9369f80f47c245068913541e7f957ccc7999faa4efb62e7fbed53ca799d8c07cf6ec268901debe5eea989c4fe38b7f42b1ec3017d5c533f481
|
7
|
+
data.tar.gz: 27992c6f9f60ec51d027e456b42564cab5a224cb193b9b0ceb36a2f89c6b073c3fe9db1396ca5e9b072553b04ce14baa51df0dab0d4ddc5f6489760756102420
|
data/lib/pleme/gem/version.rb
CHANGED
data/lib/pleme/runner.rb
CHANGED
@@ -11,9 +11,9 @@ require 'json'
|
|
11
11
|
|
12
12
|
class Runner
|
13
13
|
def initialize
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
14
|
+
@config_path = 'plemec.rb'
|
15
|
+
@translator = PlemecTranslator.new
|
16
|
+
@spec = nil
|
17
17
|
end
|
18
18
|
|
19
19
|
# run a shell command
|
@@ -38,39 +38,23 @@ class Runner
|
|
38
38
|
|
39
39
|
def read_config
|
40
40
|
@translator.eval_in_context(File.read(@config_path))
|
41
|
-
@translator.inspect
|
41
|
+
@translator.translation.inspect
|
42
42
|
end
|
43
43
|
|
44
44
|
def dotfiles(_spec)
|
45
45
|
hax_portal
|
46
46
|
end
|
47
47
|
|
48
|
-
def docker_compose(cwd = :cache)
|
49
|
-
sh "mkdir -p #{cwd}" unless Dir.exist?(cwd)
|
50
|
-
end
|
51
|
-
|
52
48
|
# shell interface for docker-compose
|
53
49
|
def dc(cmd, cwd = :cache)
|
54
|
-
sh "mkdir -p #{cwd}" unless Dir.exist?(cwd)
|
55
|
-
@translator.eval_in_context(File.read(@config_path))
|
56
50
|
cmd = "cd #{cwd} && docker-compose #{cmd}"
|
57
|
-
|
58
|
-
pkey = pkey.to_sym if pkey.instance_of?(String)
|
59
|
-
next unless pkey.eql? :compose
|
60
|
-
|
61
|
-
@translator.inspect[:pleme][:environment].keys.each do |env|
|
62
|
-
File.write(
|
63
|
-
yamilify(inspect[:pleme][:environment][env][:compose]),
|
64
|
-
File.join(cwd, 'docker-compose.yml')
|
65
|
-
)
|
66
|
-
end
|
67
|
-
end
|
51
|
+
sh "mkdir -p #{cwd}" unless Dir.exist?(cwd)
|
68
52
|
sh cmd
|
69
53
|
end
|
70
54
|
|
71
55
|
# shell interface for terraform
|
72
56
|
def tf(cmd, cwd = :cache)
|
73
|
-
sh "mkdir -p #{cwd}" unless Dir.exist?(cwd)
|
57
|
+
sh "mkdir -p #{cwd}" unless Dir.exist?(cwd.to_s)
|
74
58
|
cmd = "cd #{cwd} && terraform #{cmd}"
|
75
59
|
@translator.eval_in_context(File.read(@config_path))
|
76
60
|
sh cmd
|
@@ -78,16 +62,30 @@ class Runner
|
|
78
62
|
end
|
79
63
|
|
80
64
|
def apply(_spec)
|
81
|
-
|
65
|
+
config = read_config
|
66
|
+
puts config
|
67
|
+
config[:pleme].keys.each do |pkey|
|
68
|
+
pkey = pkey.to_sym if pkey.instance_of?(String)
|
69
|
+
case pkey
|
70
|
+
when :compose
|
71
|
+
@translator.inspect[:pleme][:environment].keys.each do |env|
|
72
|
+
File.write(
|
73
|
+
yamilify(config[:pleme][:environment][env][:compose]),
|
74
|
+
File.join(cwd, 'docker-compose.yml')
|
75
|
+
)
|
76
|
+
sh 'docker-compose up'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
82
80
|
end
|
83
81
|
|
84
|
-
def plan(_spec)
|
85
|
-
|
86
|
-
end
|
82
|
+
# def plan(_spec)
|
83
|
+
# tf 'plan'
|
84
|
+
# end
|
87
85
|
|
88
|
-
def destroy(_spec)
|
89
|
-
|
90
|
-
end
|
86
|
+
# def destroy(_spec)
|
87
|
+
# tf 'destroy'
|
88
|
+
# end
|
91
89
|
|
92
90
|
# read a local file into this space
|
93
91
|
# so you can test locally while importing
|