pleme 0.0.11 → 0.0.16

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: fcd0b3e57aafa2ca97c4fe4622e968d6a72bdd6fc26b52568f16a06b506beb42
4
- data.tar.gz: 4bc9de4677a0fa82c6d8758b0a6777cfe7f5c67e3226a76919cbd65b04390a4c
3
+ metadata.gz: b013cdf6c10af149e53aed54c879fe0ef7468593d9ac0ee7e91e7859966fdc43
4
+ data.tar.gz: '0613775845b7d3d923ebf1240384d31846eebe8d94df5b9ba3187c0598a99276'
5
5
  SHA512:
6
- metadata.gz: 30d83c8767a7e4e37ad645d4d2b37f13ce4633a90d04ba19bdb0c55b97977a5c617e98ee618d46172bfc9949b8d4cdc2affe5151a40c5b5e47e67bfcbc088768
7
- data.tar.gz: 8fc27ed834e664449948b4606b9d0e7a039362fb369206232d96538b8b90dd310c9ec408f2e56666bf250a38ca960979b5b778262153ac14215577e218b954a0
6
+ metadata.gz: d8eb802df52e817f28ef1ccb6a9f3974f6df96aa3d8735e0bfdda28c2d7409002adc7681d2c04a7163a5501c345fae3b1762628081e576e34fe9fff6124fdb3c
7
+ data.tar.gz: 8c5f21ffcf5f699b6d31580604173ba99cd3b649183c11f47a7919fa60394d6f666478f730ebb24c8558663e0cdbe4cbe4d91183688ab5dd563f502cd97e520b
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Pleme
4
4
  module Gem
5
- VERSION = '0.0.11'
5
+ VERSION = '0.0.16'
6
6
  end
7
7
  end
@@ -11,9 +11,9 @@ require 'json'
11
11
 
12
12
  class Runner
13
13
  def initialize
14
- @translator = PlemecTranslator.new
15
- @spec = nil
16
- @config_path = 'plemec.rb'
14
+ @config_path = 'plemec.rb'
15
+ @translator = PlemecTranslator.new
16
+ @spec = nil
17
17
  end
18
18
 
19
19
  # run a shell command
@@ -38,54 +38,52 @@ 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
- @translator.inspect[:pleme].keys.each do |pkey|
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
77
61
  sh "rm -rf #{File.join(cmd, 'template.json')}"
78
62
  end
79
63
 
80
- def apply
81
- tf 'apply'
64
+ def apply(_spec)
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
+ dc 'up'
77
+ end
78
+ end
79
+ end
82
80
  end
83
81
 
84
- def plan
82
+ def plan(_spec)
85
83
  tf 'plan'
86
84
  end
87
85
 
88
- def destroy
86
+ def destroy(_spec)
89
87
  tf 'destroy'
90
88
  end
91
89
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pleme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''