dh-proteus 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/proteus/app.rb +2 -0
- data/lib/proteus/commands/remove.rb +0 -2
- data/lib/proteus/context_management/helpers.rb +0 -2
- data/lib/proteus/global_commands/version.rb +19 -0
- data/lib/proteus/helpers/path_helpers.rb +5 -0
- data/lib/proteus/modules/terraform_module.rb +39 -0
- data/lib/proteus/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84826a1c3ec618db8cb183f9473c01f29632303c1edaf9a4891020cbbe58b0e0
|
4
|
+
data.tar.gz: 86b594f6df68cd0a5a538f907922d1bd59a5bfb04beb612c1f57e3610bd2373b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cb7eac70882a21b5d9fbfef7c8e8ebd01f8418047a9b011bf1972a60a23dd147372f01b95d99827475e7a2ae6812c79093f278cd4588dac93ba2210d769d6ea
|
7
|
+
data.tar.gz: c7892a7415cee30fb7cbf93b4f1d103db1a9b1d7a714c88006e8b668106f44b1fb040896eb201da98969d024d3201905b3fa9878e919dda529fc8d3921a40f18
|
data/lib/proteus/app.rb
CHANGED
@@ -2,6 +2,7 @@ require 'proteus/common'
|
|
2
2
|
require 'proteus/generate'
|
3
3
|
require 'proteus/init'
|
4
4
|
require 'proteus/global_commands/validate'
|
5
|
+
require 'proteus/global_commands/version'
|
5
6
|
require 'proteus/context_management/context'
|
6
7
|
require 'proteus/context_management/helpers'
|
7
8
|
require 'proteus/templates/template_binding'
|
@@ -82,5 +83,6 @@ module Proteus
|
|
82
83
|
subcommand('init', Proteus::Init)
|
83
84
|
|
84
85
|
include Proteus::GlobalCommands::Validate
|
86
|
+
include Proteus::GlobalCommands::Version
|
85
87
|
end
|
86
88
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Proteus
|
2
|
+
module GlobalCommands
|
3
|
+
module Version
|
4
|
+
|
5
|
+
def self.included(thor_class)
|
6
|
+
thor_class.class_eval do
|
7
|
+
desc "version", "Print version information"
|
8
|
+
|
9
|
+
long_desc <<-LONGDESC
|
10
|
+
Print version information
|
11
|
+
LONGDESC
|
12
|
+
def version
|
13
|
+
say Proteus::VERSION, :green
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -85,6 +85,11 @@ module Proteus
|
|
85
85
|
def module_hooks_path(context, module_name)
|
86
86
|
File.join(module_config_path(context, module_name), 'hooks')
|
87
87
|
end
|
88
|
+
|
89
|
+
def module_data_path(context, module_name)
|
90
|
+
File.join(module_config_path(context, module_name), 'data')
|
91
|
+
end
|
92
|
+
|
88
93
|
end
|
89
94
|
end
|
90
95
|
end
|
@@ -78,11 +78,50 @@ module Proteus
|
|
78
78
|
|
79
79
|
if File.file?(config_file)
|
80
80
|
@data = YAML.load_file(config_file, {}).with_indifferent_access
|
81
|
+
load_referenced_data(@data)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def i(i)
|
86
|
+
' ' * 2 * i
|
87
|
+
end
|
88
|
+
|
89
|
+
def read(data)
|
90
|
+
if data.end_with?('.yaml')
|
91
|
+
# single file load request
|
92
|
+
file = File.join(module_data_path(@context, @name), data)
|
93
|
+
YAML.load_file(file)
|
94
|
+
else
|
95
|
+
files = Dir.glob(
|
96
|
+
File.join(module_data_path(@context, @name), data, '*.yaml')
|
97
|
+
)
|
98
|
+
|
99
|
+
files.collect do |f|
|
100
|
+
YAML.load_file(f)
|
101
|
+
end.flatten
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def load_referenced_data(data, indent: 0, debug: false)
|
106
|
+
if data.is_a?(Array)
|
107
|
+
data.each_with_index do |_, index|
|
108
|
+
load_referenced_data(data[index], indent: indent + 1)
|
109
|
+
end
|
110
|
+
elsif data.is_a?(Hash)
|
111
|
+
data.each do |key, value|
|
112
|
+
if value =~ /__load: (.*)/
|
113
|
+
data[key] = read(Regexp.last_match(1))
|
114
|
+
end
|
115
|
+
load_referenced_data(data[key], indent: indent + 1)
|
116
|
+
end
|
117
|
+
elsif debug
|
118
|
+
# scalar value
|
81
119
|
end
|
82
120
|
end
|
83
121
|
|
84
122
|
def data?
|
85
123
|
return false unless @data
|
124
|
+
|
86
125
|
@data.any?
|
87
126
|
end
|
88
127
|
|
data/lib/proteus/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dh-proteus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Albrecht
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- lib/proteus/generators/templates/module/module.tf.erb
|
203
203
|
- lib/proteus/generators/templates/module/validator.rb.erb
|
204
204
|
- lib/proteus/global_commands/validate.rb
|
205
|
+
- lib/proteus/global_commands/version.rb
|
205
206
|
- lib/proteus/helpers.rb
|
206
207
|
- lib/proteus/helpers/path_helpers.rb
|
207
208
|
- lib/proteus/helpers/string_helpers.rb
|