kameleon-builder 2.8.1 → 2.8.2
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 +4 -4
- data/.bumpversion.cfg +1 -1
- data/CHANGES +7 -0
- data/erb/extend.erb +11 -3
- data/lib/kameleon/cli.rb +25 -8
- data/version.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def867b869a1c6ed76375aebff04d4853b6c2f82
|
4
|
+
data.tar.gz: 3ee480f10fb325ed7a38ba4435276b63c5bba5d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 259d3652480915e9bf0de35d7ee7f64f98a398076656e349a16a83474d11b89d1e484fafd73be2cebc73ceedba92362567f5ed301c1c2f11c2df7c35fab9046e
|
7
|
+
data.tar.gz: 92a70030504ab7e5156d40058c39b3c9cbed9e86b6a849aeeba077d0e73e4e4decf5808568ce0b204488de1cf9a1f14da5c67971c849774f80d82e567698c593
|
data/.bumpversion.cfg
CHANGED
data/CHANGES
CHANGED
data/erb/extend.erb
CHANGED
@@ -5,13 +5,21 @@
|
|
5
5
|
# DESCRIPTION: <MY RECIPE DESCRIPTION>
|
6
6
|
#
|
7
7
|
#==============================================================================
|
8
|
-
|
9
8
|
---
|
10
9
|
extend: <%= tpl.relative_path_from_recipe(recipe_path) %>
|
11
10
|
|
12
11
|
global:
|
13
|
-
|
14
|
-
|
12
|
+
<% if Kameleon.env.global["backend"] %>
|
13
|
+
# This is the backend you have imported to switch to an other backend BCKD do:
|
14
|
+
#
|
15
|
+
# kameleon template import <%= tpl.relative_path_from_recipe(recipe_path) %> --global backend:BCKB
|
16
|
+
#
|
17
|
+
# and update the following variable.
|
18
|
+
backend: <%= Kameleon.env.global["backend"] %>
|
19
|
+
<% end %>
|
20
|
+
# To see the variables that you can override, use the following command:
|
21
|
+
#
|
22
|
+
# kameleon info <%= recipe_name %>
|
15
23
|
|
16
24
|
bootstrap:
|
17
25
|
- "@base"
|
data/lib/kameleon/cli.rb
CHANGED
@@ -33,6 +33,7 @@ module Kameleon
|
|
33
33
|
map %w(ls) => :list
|
34
34
|
end
|
35
35
|
|
36
|
+
|
36
37
|
class Template < Thor
|
37
38
|
include Thor::Actions
|
38
39
|
|
@@ -50,12 +51,19 @@ module Kameleon
|
|
50
51
|
end
|
51
52
|
|
52
53
|
desc "import [TEMPLATE_NAME]", "Imports the given template"
|
54
|
+
method_option :global, :type => :hash ,
|
55
|
+
:default => {}, :aliases => "-g",
|
56
|
+
:desc => "Set custom global variables."
|
53
57
|
def import(template_name)
|
54
58
|
Kameleon.env.root_dir = Kameleon.env.repositories_path
|
55
59
|
template_path = File.join(Kameleon.env.repositories_path, template_name)
|
56
60
|
unless template_name.end_with? '.yaml'
|
57
61
|
template_path = template_path + '.yaml'
|
58
62
|
end
|
63
|
+
# Manage global as it is not passed to env by default
|
64
|
+
if options[:global]
|
65
|
+
Kameleon.env.global.merge!(options[:global])
|
66
|
+
end
|
59
67
|
begin
|
60
68
|
tpl = RecipeTemplate.new(template_path)
|
61
69
|
tpl.resolve! :strict => false
|
@@ -83,6 +91,10 @@ module Kameleon
|
|
83
91
|
unless template_name.end_with? '.yaml'
|
84
92
|
template_path = template_path + '.yaml'
|
85
93
|
end
|
94
|
+
# Manage global as it is not passed to env by default
|
95
|
+
if options[:global]
|
96
|
+
Kameleon.env.global.merge!(options[:global])
|
97
|
+
end
|
86
98
|
tpl = RecipeTemplate.new(template_path)
|
87
99
|
tpl.resolve! :strict => false
|
88
100
|
tpl.display_info(false)
|
@@ -128,31 +140,36 @@ module Kameleon
|
|
128
140
|
map %w(ls) => :list
|
129
141
|
|
130
142
|
desc "new [RECIPE_PATH] [TEMPLATE_NAME]", "Creates a new recipe"
|
131
|
-
|
143
|
+
method_option :global, :type => :hash ,
|
144
|
+
:default => {}, :aliases => "-g",
|
145
|
+
:desc => "Set custom global variables."
|
146
|
+
def new(recipe_name, template_name)
|
132
147
|
Kameleon.env.root_dir = Kameleon.env.repositories_path
|
133
148
|
unless template_name.end_with? '.yaml'
|
134
149
|
template_name = template_name + '.yaml'
|
135
150
|
end
|
136
151
|
|
137
|
-
unless
|
138
|
-
|
152
|
+
unless recipe_name.end_with? '.yaml'
|
153
|
+
recipe_name = recipe_name + '.yaml'
|
139
154
|
end
|
140
155
|
|
141
|
-
if
|
156
|
+
if recipe_name == template_name
|
142
157
|
fail RecipeError, "Recipe path should be different from template name"
|
143
158
|
end
|
144
159
|
|
145
160
|
template_path = File.join(Kameleon.env.repositories_path, template_name)
|
146
161
|
|
147
|
-
recipe_path = Pathname.new(Kameleon.env.workspace).join(
|
162
|
+
recipe_path = Pathname.new(Kameleon.env.workspace).join(recipe_name).to_s
|
148
163
|
|
149
164
|
begin
|
150
165
|
tpl = Kameleon::RecipeTemplate.new(template_path)
|
151
166
|
tpl.resolve! :strict => false
|
152
167
|
rescue
|
153
|
-
|
154
|
-
|
155
|
-
|
168
|
+
raise if Kameleon.ui.level("verbose")
|
169
|
+
raise TemplateNotFound, "Template '#{template_name}' invalid (try" \
|
170
|
+
" --verbose) or not found. To see all templates, run the command "\
|
171
|
+
"`kameleon template list`"
|
172
|
+
|
156
173
|
else
|
157
174
|
tpl.all_files.each do |path|
|
158
175
|
relative_path = path.relative_path_from(Kameleon.env.repositories_path)
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.8.
|
1
|
+
2.8.2
|