kite 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kite/module.rb +16 -13
- data/lib/kite/terraform.rb +8 -1
- data/lib/kite/version.rb +1 -1
- data/tpl/skel/config/cloud.yml +9 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce668dcff72a31fec89244639d06f41cb92d6210d904077982282f10a6d39f67
|
4
|
+
data.tar.gz: cfca7d98a7654c1c6fb3697b34621994de3832c9fe091c679c9fb7a6bd933f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d16e609a4ef22244c79a23fed8852e631e8ccd0cc4dfadaefe4aec6cd3ed82932c0369f02798ab79e1d366629d0625dd344eac606fa65793eeb28dbd37af2d84
|
7
|
+
data.tar.gz: d3af22b47cbb0761285ed6c3df2a0cc9ba75032239f3ee88436fd0805fcd5c5eafc9ba2d8f3bf9800b696fd6fde5765c2f2efe4958ac22c1c01154a363b0cb99
|
data/lib/kite/module.rb
CHANGED
@@ -4,26 +4,29 @@ module Kite
|
|
4
4
|
|
5
5
|
method_option :env, type: :string, desc: "Environment", required: true, default: ENV['KITE_ENV']
|
6
6
|
desc 'init https://github.com/foo/bar-module', 'Initialize a kite module and render its vars.module.yml'
|
7
|
-
def init(
|
8
|
-
@uri = uri
|
9
|
-
@name = uri.gsub(/(.*:|.git)/, '').split('/').last
|
10
|
-
@path = "modules/#{@name}"
|
7
|
+
def init(path)
|
11
8
|
@env = options[:env]
|
9
|
+
@path = path
|
10
|
+
@name = path.gsub(/(.*:|.git)/, '').split('/').last
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
unless File.exist? path
|
13
|
+
@uri = path
|
14
|
+
@path = "modules/#{@name}"
|
15
|
+
|
16
|
+
say "Cloning the module"
|
17
|
+
clone_module
|
18
|
+
say "Use git submodule add #{@path} to be able to commit this module as a submodule", :yellow
|
19
|
+
end
|
15
20
|
|
16
|
-
say "Rendering vars"
|
17
21
|
render_vars
|
18
22
|
|
19
|
-
say "Use git submodule add #{@path} to be able to commit this module as a submodule", :yellow
|
20
23
|
say "Rendered successfully, please fill out config/environments/#{@env}/vars.#{@name}.yml with correct values", :green
|
21
24
|
end
|
22
25
|
|
23
26
|
method_option :env, type: :string, desc: "Environment", required: true, default: ENV['KITE_ENV']
|
24
27
|
desc 'render PATH', 'Render kite module files using vars.*module*.yml'
|
25
28
|
def render(path)
|
26
|
-
@path = path
|
29
|
+
@path = File.expand_path(path)
|
27
30
|
@name = @path.split('/').last
|
28
31
|
@env = options[:env]
|
29
32
|
@vars = load_vars
|
@@ -45,9 +48,9 @@ module Kite
|
|
45
48
|
if overwrite.downcase == 'y'
|
46
49
|
remove_dir @path
|
47
50
|
Git.clone(@uri, @path)
|
48
|
-
say "Successfully cloned the fresh
|
51
|
+
say "Successfully cloned the fresh #{@name}!", :green
|
49
52
|
else
|
50
|
-
say "Keeping the current module"
|
53
|
+
say "Keeping the current module version"
|
51
54
|
end
|
52
55
|
else
|
53
56
|
Git.clone(@uri, @path)
|
@@ -59,7 +62,7 @@ module Kite
|
|
59
62
|
end
|
60
63
|
|
61
64
|
def render_templates
|
62
|
-
directory "#{
|
65
|
+
directory "#{@path}/templates", ".", mode: :preserve
|
63
66
|
chmod "bin", 0755
|
64
67
|
end
|
65
68
|
|
@@ -68,7 +71,7 @@ module Kite
|
|
68
71
|
end
|
69
72
|
|
70
73
|
def manifest
|
71
|
-
YAML.load(File.open("
|
74
|
+
YAML.load(File.open("#{@path}/manifest.yml"))
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
data/lib/kite/terraform.rb
CHANGED
@@ -19,6 +19,7 @@ module Kite
|
|
19
19
|
|
20
20
|
def load_env
|
21
21
|
load_vars
|
22
|
+
load_cloud
|
22
23
|
@vars.each do |var, val|
|
23
24
|
key = "TF_VAR_#{var}"
|
24
25
|
ENV[key] = val
|
@@ -33,9 +34,15 @@ module Kite
|
|
33
34
|
YAML.load(File.read('config/cloud.yml'))[@env_name]
|
34
35
|
end
|
35
36
|
|
37
|
+
def load_cloud
|
38
|
+
cloud.each do |k, v|
|
39
|
+
(v.is_a? Hash) ? @vars.merge!(v) : @vars[k] = v
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
36
43
|
def load_vars
|
37
|
-
vars_files = Dir["config/environments/#{@env_name}/vars.*.yml"]
|
38
44
|
@vars = Hash.new
|
45
|
+
vars_files = Dir["config/environments/#{@env_name}/vars.*.yml"]
|
39
46
|
vars_files.each do |f|
|
40
47
|
tf_vars = YAML.load(File.read(f))['terraform']
|
41
48
|
@vars.merge!(tf_vars) unless tf_vars.nil?
|
data/lib/kite/version.rb
CHANGED
data/tpl/skel/config/cloud.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
default: &default
|
2
|
-
|
3
|
-
|
2
|
+
# Note that region formats differ between AWS and GCP
|
3
|
+
region: "europe-west4"
|
4
|
+
zone: "europe-west4-c"
|
4
5
|
gcp:
|
5
|
-
project:
|
6
|
-
service_account:
|
7
|
-
bucket_name:
|
6
|
+
project: "helios-devel"
|
7
|
+
service_account: "~/safe/helios-devel.json"
|
8
|
+
bucket_name: "kite-state-helios-devel"
|
8
9
|
aws:
|
9
|
-
access_key:
|
10
|
-
secret_key:
|
11
|
-
bucket_name:
|
10
|
+
access_key: "********************"
|
11
|
+
secret_key: "****************************************"
|
12
|
+
bucket_name: "kite-state-helios-devel"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis Bellet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|