kameleon-builder 2.10.6 → 2.10.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3fd959d36bbd756d9a632b39e1d9bdd1bcaa5a0c4fd8104187041473dbd4ae0
4
- data.tar.gz: 3d36533205a0a55d3e2622ff1f713f4c2432f6cd48c34afc9bd35006855e9302
3
+ metadata.gz: 553ea238eb5037446a3a2fd352806d8f32bc19d728288b60b515d00c606c8862
4
+ data.tar.gz: 8ec292f91ce56340f1492f1c8f9533b4615fb108029d4985eb515d5c08a97a14
5
5
  SHA512:
6
- metadata.gz: 2915fa5554adacbbeda1d03655bf995ab8191e9396649adc2cd158a386926b00f991da040144bb35b5d15ca37e127222400749f3d82c6e00fe934cce4bf851f2
7
- data.tar.gz: c0c5754fcffb10f0c1d80b5523accf99768facc1468190ffd3991842d05edeacdedfef9d0b5651dc844b90dddc8c535234de2214f1d47177c42fbeada596531c
6
+ metadata.gz: 9b57c04cd35dbeb46a61dbb9b1a433b141f7952e8db071795505c061781ccbf63df33f4d3540f9c3c9d530ba7c4e3fa9d25f3397ea81e3abd17b85bbf7a75e35
7
+ data.tar.gz: 69179ec31b646c1b98c42817a880aa2423a316ada9338383f7fb88f7d4f9f0aefd40808803df4e5dd129d50a2f85218544c57223126f79121f6af2427a821691
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.8
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,21 @@
1
1
  Kameleon CHANGELOG
2
2
  ==================
3
3
 
4
+ Version 2.10.8
5
+ --------------
6
+
7
+ Released on October 21st 2022
8
+
9
+ - Fix a fatal error with the pipe command: make sure the destination context is started.
10
+ - Avoid git warning when running kameleon repo update: use git pull --ff-only
11
+
12
+ Version 2.10.7
13
+ --------------
14
+
15
+ Released on December 02nd 2021
16
+
17
+ - Add support for the .filter file to filter recipes/template lists
18
+
4
19
  Version 2.10.6
5
20
  --------------
6
21
 
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
@@ -106,6 +106,7 @@ module Kameleon
106
106
 
107
107
  Kameleon.ui.verbose("Forwarding #{tmp.path} to STDIN of #{other_ctx.name}_ctx")
108
108
  dest_pipe_path = "${KAMELEON_WORKDIR}/pipe-#{ Kameleon::Utils.generate_slug(other_cmd)[0..20] }"
109
+ other_ctx.load_shell
109
110
  other_ctx.send_file(tmp.path, dest_pipe_path)
110
111
  other_cmd_with_pipe = "cat #{dest_pipe_path} | #{other_cmd} && rm #{dest_pipe_path}"
111
112
  other_ctx.execute(other_cmd_with_pipe, kwargs)
@@ -30,7 +30,7 @@ module Kameleon
30
30
  git_repo = File.join(Kameleon.env.repositories_path, name)
31
31
  raise RepositoryError, "Repository not found '#{name}'" if not File.directory?(git_repo)
32
32
  cmd = ["git", "--git-dir", File.join(git_repo, ".git"), "--work-tree",
33
- git_repo, "pull", "--verbose"]
33
+ git_repo, "pull", "--ff-only"]
34
34
  process = ChildProcess.build(*cmd)
35
35
  process.io.inherit!
36
36
  process.start
@@ -177,7 +177,7 @@ SCRIPT
177
177
 
178
178
  def execute(cmd, kwargs = {})
179
179
  cmd_obj = Command.new(cmd)
180
- send_command cmd_obj = Command.new(cmd)
180
+ send_command(cmd_obj)
181
181
  iodata = {:stderr => { :io => @stderr,
182
182
  :name => 'stderr',
183
183
  :begin => false,
@@ -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.8'
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.8
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: 2022-10-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: childprocess