kameleon-builder 2.10.3 → 2.10.4

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: c3e726c2e8f9ca4aa09d3e5c6ef46ddc96f76f815ed8d740c431deb7e46f9433
4
- data.tar.gz: 2fc324e1b1f507886d628ff27c6daa94ec50ef7e04f57f30af6614f8db7d3f1d
3
+ metadata.gz: 6efa8300acf90e4c5889f75b3682ff4e2d7e27cedfd1bb4d1856aa45b4c474d4
4
+ data.tar.gz: 9307cd1aecbd38b8e81b20ef4b6234c246e1eefb0960d316989c56959576fbef
5
5
  SHA512:
6
- metadata.gz: 83abce13fbf9368ed09392794a572065fc6959ff3071a61d2a4f1231288f2d4ad176d1003d57027320728042de7b8c5a5abf0e068c52c7b203faaae4d29faff7
7
- data.tar.gz: c6f6f3bb93d99b960fd1650fb1247d21a5e306c5f334e19bc969a6d2195d3c93fe931de68640c84d87f2e6afc75c36b938c3b490a0aef482e5d66af31ce8cb0e
6
+ metadata.gz: e9e8fe682ad005bcf49d8845658251b53b626da2759822ee59162372db962fc79e574685e615330dc6d437864477379984a1821953d57cdae9958553b1c2dfd0
7
+ data.tar.gz: 376ff16804dd6a321401463f37612140d9b9b493e143db623586cb15830817d92095c8809b6c140f47095bab18401cc2e1fa5e50323a6392e61feeb8b83f4e65
@@ -1,7 +1,7 @@
1
1
  [bumpversion]
2
2
  commit = True
3
3
  tag = True
4
- current_version = 2.10.3
4
+ current_version = 2.10.4
5
5
  parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+))?
6
6
  serialize =
7
7
  {major}.{minor}.{patch}.{release}
data/CHANGES CHANGED
@@ -1,6 +1,16 @@
1
1
  Kameleon CHANGELOG
2
2
  ==================
3
3
 
4
+ Version 2.10.4
5
+ --------------
6
+
7
+ Released on May 11th 2020
8
+
9
+ - Fix support for extend ERB
10
+ - Add the `kameleon template erb` command
11
+ - Fix bash completion
12
+ - Cosmetic code fixes
13
+
4
14
  Version 2.10.3
5
15
  --------------
6
16
 
@@ -15,6 +25,7 @@ Version 2.10.2
15
25
  --------------
16
26
 
17
27
  Released on April 09th 2020
28
+
18
29
  - Fix cli help for the repository and template sub-commands
19
30
  - Add the git remote url and branch to kameleon repo list
20
31
  - Add the 'kameleon repository remove' command
@@ -14,8 +14,8 @@ _kameleon() {
14
14
  ((i++))
15
15
  done
16
16
  if [ "$COMP_CWORD" -eq $((i+1)) ] && kameleon commands | grep -q "${COMP_WORDS[$i]}" ; then
17
- if wordlist=$(kameleon ${COMP_WORDS[$i]} commands); then
18
- local commands="$(compgen -W "$wordlist" -- "${COMP_WORDS[$((i+1))]}")"
17
+ if kameleon help | grep -qe "^ kameleon ${COMP_WORDS[$i]}[a-z]* <SUBCOMMAND>"; then
18
+ local commands="$(compgen -W "$(kameleon ${COMP_WORDS[$i]} commands)" -- "${COMP_WORDS[$((i+1))]}")"
19
19
  COMPREPLY=( $commands $projects )
20
20
  fi
21
21
  fi
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  repositories_path: <%= Kameleon.default_values[:repositories_path] %>
3
+ extend_yaml_erb: <%= Kameleon.default_values[:extend_yaml_erb] %>
3
4
  script: <%= Kameleon.default_values[:script] %>
4
5
  color: <%= Kameleon.default_values[:color] %>
5
6
  debug: <%= Kameleon.default_values[:debug] %>
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
12
12
  'Cristan Ruiz',
13
13
  'Pierre Neyron',
14
14
  'Bruno Bzeznik']
15
- s.email = ['salem.harrache@inria.fr',
16
- 'michael.mercier@inria.fr',
17
- 'cristian.ruiz@imag.fr',
15
+ s.email = ['salem@harrache.info',
16
+ 'michael.mercier@libr.fr',
17
+ 'camilo1729@gmail.com',
18
18
  'pierre.neyron@imag.fr',
19
19
  'bruno.bzeznik@imag.fr']
20
20
  s.description = %q{The mindful appliance builder}
@@ -73,7 +73,8 @@ module Kameleon
73
73
  :debug => userconf.fetch("debug", false),
74
74
  :script => userconf.fetch("script", false),
75
75
  :repositories_path => userconf.fetch("repositories_path",
76
- File.join(userdir.to_s, 'repos')),
76
+ File.join(userdir.to_s, 'repos')),
77
+ :extend_yaml_erb => userconf.fetch("extend_yaml_erb", ".extend.yaml.erb")
77
78
  }
78
79
  end
79
80
 
@@ -12,7 +12,7 @@ module Kameleon
12
12
  include Thor::Actions
13
13
 
14
14
  desc "add <NAME> <GIT_URL>", "Adds a new repository named <NAME> cloned from <GIT_URL>."
15
- method_option :branch, :type => :string ,
15
+ method_option :branch, :type => :string,
16
16
  :default => nil,
17
17
  :desc => "checkout <BRANCH>",
18
18
  :aliases => "-b"
@@ -67,7 +67,7 @@ module Kameleon
67
67
  end
68
68
 
69
69
  desc "import <TEMPLATE_NAME>", "Imports the given template"
70
- method_option :global, :type => :hash ,
70
+ method_option :global, :type => :hash,
71
71
  :default => {}, :aliases => "-g",
72
72
  :desc => "Set custom global variables."
73
73
  def import(template_name)
@@ -98,7 +98,7 @@ module Kameleon
98
98
  end
99
99
 
100
100
  desc "info <TEMPLATE_NAME>", "Display detailed information about a template"
101
- method_option :global, :type => :hash ,
101
+ method_option :global, :type => :hash,
102
102
  :default => {}, :aliases => "-g",
103
103
  :desc => "Set custom global variables."
104
104
  def info(template_name)
@@ -116,6 +116,19 @@ module Kameleon
116
116
  tpl.display_info(false)
117
117
  end
118
118
 
119
+ desc "erb <PATH>", "Create a extend recipe ERB file"
120
+ def erb(path)
121
+ if File.directory?(path)
122
+ erb_file = Pathname.new(path).join(Kameleon.default_values[:extend_yaml_erb])
123
+ elsif File.file?(path) and path.end_with?(".yaml")
124
+ erb_file = Pathname.new(path.gsub(%r{^(.+?/)?([^/]+?)(\.yaml)?$},'\1.\2') + Kameleon.default_values[:extend_yaml_erb])
125
+ else
126
+ fail KameleonError, "Invalid path '#{path}', please give a path to a yaml file or a directory"
127
+ end
128
+ Kameleon.ui.verbose("Create extend recipe ERB '#{erb_file}'")
129
+ copy_file(Pathname.new(Kameleon.erb_dirpath).join("extend.yaml.erb"), erb_file)
130
+ end
131
+
119
132
  desc "commands", "Lists all available commands", :hide => true
120
133
  def commands
121
134
  puts Template.all_commands.keys - ["commands"]
@@ -164,7 +177,7 @@ module Kameleon
164
177
  end
165
178
 
166
179
  desc "new <RECIPE_PATH> <TEMPLATE_NAME>", "Creates a new recipe from template <TEMPLATE_NAME>"
167
- method_option :global, :type => :hash ,
180
+ method_option :global, :type => :hash,
168
181
  :default => {}, :aliases => "-g",
169
182
  :desc => "Set custom global variables."
170
183
  def new(recipe_name, template_name)
@@ -204,20 +217,19 @@ module Kameleon
204
217
  recipe_temp = File.join(tmp_dir, File.basename(recipe_path))
205
218
  ## copying recipe
206
219
  File.open(recipe_temp, 'w+') do |file|
207
- message="Use extend ERB template: "
208
- extend_erb_tpl = [
209
- Kameleon.env.repositories_path.join(template_name + ".erb"),
210
- Pathname.new(template_name).dirname.ascend.to_a.push(Pathname.new("")).map do |p|
211
- Kameleon.env.repositories_path.join(p, ".kameleon-extend.yaml.erb")
212
- end,
213
- Pathname.new(Kameleon.erb_dirpath).join("extend.yaml.erb")
214
- ].flatten.find do |f|
220
+ message="Try and use extend recipe ERB: "
221
+ extend_yaml_erb_list = Pathname.new(template_name).dirname.ascend.to_a.map do |p|
222
+ Kameleon.env.repositories_path.join(p, Kameleon.default_values[:extend_yaml_erb])
223
+ end
224
+ extend_yaml_erb_list.unshift(Kameleon.env.repositories_path.join(template_name.gsub(%r{^(.+?/)?([^/]+?)(\.yaml)?$},'\1.\2') + Kameleon.default_values[:extend_yaml_erb]))
225
+ extend_yaml_erb_list.push(Pathname.new(Kameleon.erb_dirpath).join("extend.yaml.erb"))
226
+ extend_yaml_erb = extend_yaml_erb_list.find do |f|
215
227
  Kameleon.ui.verbose(message + f.to_s)
216
228
  message = "-> Not found, fallback: "
217
229
  File.readable?(f)
218
230
  end
219
- erb = ERB.new(File.open(extend_erb_tpl, 'rb') { |f| f.read })
220
- result = erb.result(binding)
231
+ Kameleon.ui.debug("Open ERB file: '#{extend_yaml_erb}'")
232
+ result = ERB.new(File.open(extend_yaml_erb, 'rb') { |f| f.read }).result(binding)
221
233
  file.write(result)
222
234
  end
223
235
  copy_file(recipe_temp, recipe_path)
@@ -226,13 +238,13 @@ module Kameleon
226
238
  end
227
239
 
228
240
  desc "info <RECIPE_PATH>", "Display detailed information about a recipe"
229
- method_option :global, :type => :hash ,
241
+ method_option :global, :type => :hash,
230
242
  :default => {}, :aliases => "-g",
231
243
  :desc => "Set custom global variables."
232
- method_option :from_cache, :type => :string ,
244
+ method_option :from_cache, :type => :string,
233
245
  :default => nil,
234
246
  :desc => "Get info from a persistent cache tar file (ignore recipe path)"
235
- method_option :relative, :type => :boolean ,
247
+ method_option :relative, :type => :boolean,
236
248
  :default => false,
237
249
  :desc => "Make pathnames relative to the current working directory"
238
250
  def info(*recipe_paths)
@@ -258,18 +270,18 @@ module Kameleon
258
270
  end
259
271
 
260
272
  desc "dag <RECIPE_PATH> [<RECIPE_PATH> [<...>]]", "Draw a DAG of the steps to build one or more recipes"
261
- method_option :global, :type => :hash ,
273
+ method_option :global, :type => :hash,
262
274
  :default => {}, :aliases => "-g",
263
275
  :desc => "Set custom global variables."
264
- method_option :file, :type => :string ,
276
+ method_option :file, :type => :string,
265
277
  :default => "/tmp/kameleon.dag",
266
278
  :desc => "DAG output filename"
267
- method_option :format, :type => :string ,
279
+ method_option :format, :type => :string,
268
280
  :desc => "DAG GraphViz format"
269
- method_option :relative, :type => :boolean ,
281
+ method_option :relative, :type => :boolean,
270
282
  :default => false,
271
283
  :desc => "Make pathnames relative to the current working directory"
272
- method_option :recipes_only, :type => :boolean ,
284
+ method_option :recipes_only, :type => :boolean,
273
285
  :default => false,
274
286
  :desc => "Show recipes only (mostly useful to display multiple recipes inheritance)"
275
287
  def dag(*recipe_paths)
@@ -300,10 +312,10 @@ module Kameleon
300
312
  end
301
313
 
302
314
  desc "dryrun <RECIPE_PATH>", "Show the steps the build would process"
303
- method_option :global, :type => :hash ,
315
+ method_option :global, :type => :hash,
304
316
  :default => {}, :aliases => "-g",
305
317
  :desc => "Set custom global variables."
306
- method_option :relative, :type => :boolean ,
318
+ method_option :relative, :type => :boolean,
307
319
  :default => false,
308
320
  :desc => "Make pathnames relative to the current working directory"
309
321
  def dryrun(*recipe_paths)
@@ -315,10 +327,10 @@ module Kameleon
315
327
  end
316
328
 
317
329
  desc "export <RECIPE_PATH> <EXPORT_PATH>", "Export the given recipe with its steps and data to a given directory"
318
- method_option :global, :type => :hash ,
330
+ method_option :global, :type => :hash,
319
331
  :default => {}, :aliases => "-g",
320
332
  :desc => "Set custom global variables."
321
- method_option :add, :type => :boolean ,
333
+ method_option :add, :type => :boolean,
322
334
  :default => false, :aliases => "-A",
323
335
  :desc => "export recipe and steps to an existing directory (this may overwrite some existing files)"
324
336
  def export(recipe_path,dest_path)
@@ -358,36 +370,36 @@ module Kameleon
358
370
  end
359
371
 
360
372
  desc "build <RECIPE_PATH>", "Builds the appliance from the given recipe"
361
- method_option :build_path, :type => :string ,
373
+ method_option :build_path, :type => :string,
362
374
  :default => nil, :aliases => "-b",
363
375
  :desc => "Sets the build directory path"
364
- method_option :clean, :type => :boolean ,
376
+ method_option :clean, :type => :boolean,
365
377
  :default => false,
366
378
  :desc => "Runs the command `kameleon clean` first"
367
- method_option :from_checkpoint, :type => :string ,
379
+ method_option :from_checkpoint, :type => :string,
368
380
  :default => nil,
369
381
  :desc => "Uses specific checkpoint to build the image. " \
370
382
  "Default value is the last checkpoint."
371
- method_option :enable_checkpoint, :type => :boolean ,
383
+ method_option :enable_checkpoint, :type => :boolean,
372
384
  :default => false,
373
385
  :desc => "Enables checkpoint [experimental]"
374
- method_option :list_checkpoints, :type => :boolean , :aliases => "--checkpoints",
386
+ method_option :list_checkpoints, :type => :boolean, :aliases => "--checkpoints",
375
387
  :default => false,
376
388
  :desc => "Lists all availables checkpoints"
377
389
  method_option :enable_cache, :type => :boolean,
378
390
  :default => false,
379
391
  :desc => "Generates a persistent cache for the appliance."
380
- method_option :cache_path, :type => :string ,
392
+ method_option :cache_path, :type => :string,
381
393
  :default => nil,
382
394
  :desc => "Sets the cache directory path"
383
- method_option :from_cache, :type => :string ,
395
+ method_option :from_cache, :type => :string,
384
396
  :default => nil,
385
397
  :desc => "Uses a persistent cache tar file to build the image."
386
- method_option :cache_archive_compression, :type => :string ,
398
+ method_option :cache_archive_compression, :type => :string,
387
399
  :enum => ["none", "gzip", "bz2", "xz"],
388
400
  :default => "gzip",
389
401
  :desc => "Set the persistent cache tar file compression."
390
- method_option :polipo_path, :type => :string ,
402
+ method_option :polipo_path, :type => :string,
391
403
  :default => nil,
392
404
  :desc => "Full path of the polipo binary to use for the persistent cache."
393
405
  method_option :proxy, :type => :string, :default => "",
@@ -397,7 +409,7 @@ module Kameleon
397
409
  :desc => "Specifies the username and password if the parent "\
398
410
  "proxy requires authorisation it should have the "\
399
411
  "form 'username:password'"
400
- method_option :proxy_offline, :type => :boolean ,
412
+ method_option :proxy_offline, :type => :boolean,
401
413
  :default => false, :aliases => "--offline",
402
414
  :desc => "Prevents Polipo from contacting remote servers"
403
415
  method_option :global, :type => :hash,
@@ -1 +1 @@
1
- 2.10.3
1
+ 2.10.4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kameleon-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.3
4
+ version: 2.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salem Harrache
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2020-04-11 00:00:00.000000000 Z
15
+ date: 2020-05-11 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: childprocess
@@ -112,9 +112,9 @@ dependencies:
112
112
  version: '1'
113
113
  description: The mindful appliance builder
114
114
  email:
115
- - salem.harrache@inria.fr
116
- - michael.mercier@inria.fr
117
- - cristian.ruiz@imag.fr
115
+ - salem@harrache.info
116
+ - michael.mercier@libr.fr
117
+ - camilo1729@gmail.com
118
118
  - pierre.neyron@imag.fr
119
119
  - bruno.bzeznik@imag.fr
120
120
  executables: