kameleon-builder 2.10.6 → 2.10.7

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: e3fd959d36bbd756d9a632b39e1d9bdd1bcaa5a0c4fd8104187041473dbd4ae0
4
- data.tar.gz: 3d36533205a0a55d3e2622ff1f713f4c2432f6cd48c34afc9bd35006855e9302
3
+ metadata.gz: aa12710602f297326fe8253eab48928c5e527a07bdc91b3f6686375faa83c8c5
4
+ data.tar.gz: 306b743b116a9a53801208368f54a2e71bcf2b1bdb55f17d7549eac003403e0d
5
5
  SHA512:
6
- metadata.gz: 2915fa5554adacbbeda1d03655bf995ab8191e9396649adc2cd158a386926b00f991da040144bb35b5d15ca37e127222400749f3d82c6e00fe934cce4bf851f2
7
- data.tar.gz: c0c5754fcffb10f0c1d80b5523accf99768facc1468190ffd3991842d05edeacdedfef9d0b5651dc844b90dddc8c535234de2214f1d47177c42fbeada596531c
6
+ metadata.gz: a97ddc0ccb77269a2084ad51022b66393300404cd220d1eff6c51e85d2de8f33122d8d44d308c8c27ff4bcda6122076d5ed6e269ca01c2af51059a45eb4aa31b
7
+ data.tar.gz: 5290bd82ceb90cabe2ee472485feb652c6b653638b45bff99e1869b56c86edf6845241082ea2561a0b33ea6ce52e2130d775dbcf59ec673e749cdedb1fb4612a
data/.bumpversion.cfg CHANGED
@@ -1,7 +1,7 @@
1
1
  [bumpversion]
2
2
  commit = True
3
3
  tag = True
4
- current_version = 2.10.6
4
+ current_version = 2.10.7
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,13 @@
1
1
  Kameleon CHANGELOG
2
2
  ==================
3
3
 
4
+ Version 2.10.7
5
+ --------------
6
+
7
+ Released on December 02nd 2021
8
+
9
+ - Add support for the .filter file to filter recipes/template lists
10
+
4
11
  Version 2.10.6
5
12
  --------------
6
13
 
data/lib/kameleon/cli.rb CHANGED
@@ -60,7 +60,7 @@ module Kameleon
60
60
  method_option :progress, :type => :boolean, :default => true,
61
61
  :desc => "Show progress bar while resolving templates",
62
62
  :aliases => "-p"
63
- method_option :filter, :type => :string, :default => '',
63
+ method_option :filter, :type => :string, :default => nil,
64
64
  :desc => "Filter templates with the given regexp",
65
65
  :aliases => "-f"
66
66
  def list
@@ -175,7 +175,7 @@ module Kameleon
175
175
  method_option :progress, :type => :boolean, :default => false,
176
176
  :desc => "Show progress bar while resolving recipes",
177
177
  :aliases => "-p"
178
- method_option :filter, :type => :string, :default => '',
178
+ method_option :filter, :type => :string, :default => nil,
179
179
  :desc => "Filter recipes with the given regexp",
180
180
  :aliases => "-f"
181
181
  def list
@@ -125,11 +125,11 @@ module Kameleon
125
125
  end
126
126
  end
127
127
 
128
- def self.list_recipes(recipes_path, filter = '', do_progressbar = false, is_repository = false, kwargs = {})
128
+ def self.list_recipes(recipes_path, filter, do_progressbar = false, is_repository = false, kwargs = {})
129
129
  Kameleon.env.root_dir = recipes_path
130
130
  catch_exception = kwargs.fetch(:catch_exception, true)
131
131
  recipes_hash = []
132
- recipes_files = get_recipes(recipes_path).select { |f| Regexp.new(filter).match(f.to_s.gsub(recipes_path.to_s + '/', '').chomp('.yaml')) }
132
+ recipes_files = get_recipes(recipes_path, filter)
133
133
  if recipes_files.empty?
134
134
  Kameleon.ui.shell.say " <None>", :cyan
135
135
  return
@@ -162,7 +162,7 @@ module Kameleon
162
162
  desc_width = (80 - name_width - 3) if desc_width < 0
163
163
  end
164
164
  repo_str_old = nil
165
- recipes_hash.sort_by{ |k| k["name"] }.each do |r|
165
+ recipes_hash.each do |r|
166
166
  if is_repository
167
167
  repo_str,recipe_dir_str,recipe_str = r["name"].match(%r{^([^/]+/)(.+/)?([^/]+)$}).to_a[1..3].map{|m| m.to_s}
168
168
  else
@@ -184,18 +184,28 @@ module Kameleon
184
184
  end
185
185
  end
186
186
 
187
- def self.get_recipes(path)
188
- path.children.collect do |child|
189
- if child.file?
190
- if child.extname == ".yaml"
191
- unless child.to_s.include? "/steps/" or child.to_s.include? "/.steps/"
192
- child
193
- end
194
- end
195
- elsif child.directory?
196
- get_recipes(child)
187
+ def self.get_recipes(path, filter = nil, base = nil)
188
+ base = path if base.nil?
189
+ if filter.nil?
190
+ begin
191
+ filter = File.read(File.join(path, "/.filter")).chomp
192
+ Kameleon.ui.verbose("Found filter #{filter} in #{path}")
193
+ base = path
194
+ rescue
195
+ end
196
+ end
197
+ recipes = path.children.select{|child| child.file? and child.extname == ".yaml"}.map do |child|
198
+ recipe = child.to_s.gsub(base.to_s + '/', '').chomp('.yaml')
199
+ if filter.nil? or Regexp.new(filter).match(recipe)
200
+ child
201
+ else
202
+ Kameleon.ui.verbose("Filters out #{recipe}, does not match #{filter}")
203
+ nil
197
204
  end
198
- end.select { |x| x }.flatten(1)
205
+ end.select { |x| x }.flatten(1).sort{|a,b| a.to_s <=> b.to_s}
206
+ recipes + path.children.select{|child| child.directory? and child.basename.to_s != "steps" and child.basename.to_s != ".steps"}.sort{|a,b| a.to_s <=> b.to_s}.map do |child|
207
+ get_recipes(child, filter, base)
208
+ end.flatten(1)
199
209
  end
200
210
 
201
211
  def self.which(cmd)
@@ -1,3 +1,3 @@
1
1
  module Kameleon
2
- VERSION = '2.10.6'
2
+ VERSION = '2.10.7'
3
3
  end
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.6
4
+ version: 2.10.7
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: 2021-11-24 00:00:00.000000000 Z
15
+ date: 2021-12-07 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: childprocess