squared 0.4.36 → 0.4.37

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: 31323c0d6d0f5d2d45c7e4cc882237fb5cc687d6f7f1d3b618b86385f26d6398
4
- data.tar.gz: ddb3271ef90874b2a716418bfc344744c58a2b433954bd8034551621de500232
3
+ metadata.gz: 3717cf9c708b4a265d919790f7713bc6c35187c7229d956411d2dcf80ab7dfab
4
+ data.tar.gz: 1659d367915ab16c72c148ddc3ea95312664afe5c92a7b77e31158318f0d1f3b
5
5
  SHA512:
6
- metadata.gz: 281d00f10b66df75ed5e2269f566b892a768fa493e68701fd9a73de787c77e0d191e10e1165e846dbd7d93d6de8427811e6193e8970564310d56a42085dd7e5b
7
- data.tar.gz: 6672b181a9e792ff624dc8876d0b45b954c3b304f8e78abcb6a2ac674e2188aabd347e6f4d86a91c6550c11c2ac6ba842e728562a74dfb8a0740f7214a5200f3
6
+ metadata.gz: 330278fdc20d09076437c13530569ab1b09174ba7133558f7f5decdf8da25bff8ee22e0c9054c564f15c80f3a0dae79c859099d875aad2613bd14a244519ebf0
7
+ data.tar.gz: f83310b3557945985db8a70b2f283bd2376b44e50fba64f5a1dc267c3f753bee4aab328906a66b9b888f042a533e75ec74a3c8c3a8147ad444a2e215549a87a2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.37] - 2026-04-29
4
+
5
+ ### Changed
6
+
7
+ - Project base method dependindex replaces private instance variable.
8
+
9
+ ### Fixed
10
+
11
+ - Ruby command version did not abort asdf "Not installed" error.
12
+ - Git command pull action all did not pass option flags to branches.
13
+ - Python command exec did not activate virtual environment.
14
+ - Docker command bake did not reinsert failed check for context directory.
15
+ - Common method shell_quote argument preserve did not bypass requoting.
16
+
3
17
  ## [0.4.36] - 2026-03-11
4
18
 
5
19
  ### Added
@@ -1195,6 +1209,7 @@
1195
1209
 
1196
1210
  - Changelog was created.
1197
1211
 
1212
+ [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1198
1213
  [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1199
1214
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
1200
1215
  [0.4.34]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.34
@@ -46,7 +46,7 @@ module Squared
46
46
  end
47
47
  end
48
48
 
49
- def shell_quote(val, option: true, force: true, double: false, preserve: true, override: false)
49
+ def shell_quote(val, option: true, force: true, double: false, preserve: true, pass: false, override: false)
50
50
  val = val.to_s
51
51
  return val if (!force && !val.include?(' ')) || val.empty?
52
52
 
@@ -54,16 +54,16 @@ module Squared
54
54
  pat = /\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m
55
55
  return val if val.match?(pat)
56
56
  end
57
- q = ->(s) { s.gsub("'\\\\''", "'") }
58
57
  if val =~ QUOTE_VALUE
59
- return val if $1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o)
58
+ return val if pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
60
59
 
61
60
  base = $2 unless preserve
62
61
  end
62
+ q = -> { (base || val).gsub("'\\\\''", "'") }
63
63
  if double || Rake::Win32.windows? || (ARG[:QUOTE] == '"' && !override)
64
- "\"#{q.call(base || val).gsub(/(?<!\\)"/, '\\"')}\""
64
+ "\"#{q.call.gsub(/(?<!\\)"/, '\\"')}\""
65
65
  else
66
- base ? val : "'#{q.call(val).gsub("'", "'\\\\''")}'"
66
+ "'#{q.call.gsub("'", "'\\\\''")}'"
67
67
  end
68
68
  end
69
69
 
@@ -9,6 +9,7 @@ module Squared
9
9
  module_function
10
10
 
11
11
  def shell(*args, name: :system, **kwargs)
12
+ kwargs.delete(:exception) unless name == :system
12
13
  if RUBY_ENGINE == 'jruby' && Rake::Win32.windows?
13
14
  e = kwargs[:exception]
14
15
  if (dir = kwargs[:chdir]) && ((pwd = Dir.pwd) != dir)
@@ -24,7 +25,7 @@ module Squared
24
25
  else
25
26
  return Kernel.send(name, *args, **kwargs)
26
27
  end
27
- return ret unless e && !ret && name == :system
28
+ return ret unless e && !ret
28
29
 
29
30
  raise $?.to_s
30
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.36'
4
+ VERSION = '0.4.37'
5
5
  end
@@ -816,7 +816,7 @@ module Squared
816
816
  end
817
817
 
818
818
  def run(cmd = @session, var = nil, exception: self.exception, sync: true, from: nil, banner: true, chdir: path,
819
- interactive: nil, hint: nil, **)
819
+ interactive: nil, hint: nil, send: :system, **)
820
820
  unless cmd
821
821
  print_error('no command session started', subject: project, hint: from || 'unknown', pass: true)
822
822
  return
@@ -854,7 +854,7 @@ module Squared
854
854
  end
855
855
  end
856
856
  args = var.is_a?(Hash) ? [var, cmd] : [cmd]
857
- ret = shell(*args, chdir: chdir, exception: exception)
857
+ ret = shell(*args, name: send, chdir: chdir, exception: exception)
858
858
  end
859
859
  rescue StandardError => e
860
860
  on_error(e, from, exception: true)
@@ -904,7 +904,7 @@ module Squared
904
904
  run_set(output[0], *args, **kwargs)
905
905
  when :dependfile
906
906
  @dependindex = nil
907
- @dependfile = val.nil? ? nil : basepath(*args)
907
+ @dependfile = (basepath(*args) if val)
908
908
  else
909
909
  if block_given?
910
910
  if blocks.include?(key)
@@ -1009,7 +1009,7 @@ module Squared
1009
1009
  end
1010
1010
 
1011
1011
  def dependtype(*)
1012
- @dependindex ? @dependindex.succ : 0
1012
+ dependindex&.succ || 0
1013
1013
  end
1014
1014
 
1015
1015
  def log
@@ -2012,10 +2012,21 @@ module Squared
2012
2012
  end
2013
2013
  end
2014
2014
 
2015
- def dependfile_set(list)
2016
- @dependindex = list.index { |file| basepath(file).exist? }.tap do |index|
2017
- @dependfile = basepath(list[index || 0])
2018
- end
2015
+ def dependfile_set(list, default: 0)
2016
+ @dependindex = if @dependname
2017
+ @dependfile = basepath @dependname
2018
+ list.index(@dependname)
2019
+ else
2020
+ list.index { |file| basepath(file).exist? }.tap do |i|
2021
+ @dependfile = basepath(list[i || default])
2022
+ end
2023
+ end || (list unless enabled?)
2024
+ end
2025
+
2026
+ def dependindex
2027
+ dependfile_set @dependindex if @dependindex.is_a?(Array)
2028
+
2029
+ @dependindex unless @dependindex.is_a?(Array)
2019
2030
  end
2020
2031
 
2021
2032
  def as_get(val, from)
@@ -20,7 +20,7 @@ module Squared
20
20
  sbom=q].freeze
21
21
  }.freeze,
22
22
  compose: {
23
- common: %w[all-resources compatibility dry-run ansi|b env-file=p f|file=p parallel=n profile=b progress=b
23
+ common: %w[all-resources compatibility dry-run ansi=b env-file=p f|file=p parallel=n profile=b progress=b
24
24
  project-directory=p p|project-name=e].freeze,
25
25
  build: %w[check no-cache print pull push with-dependencies q|quiet build-arg=qq builder=b m|memory=b
26
26
  provenance=q sbom=q ssh=qq].freeze,
@@ -337,7 +337,7 @@ module Squared
337
337
  if projectpath?(val = args.pop)
338
338
  context = val
339
339
  else
340
- op.push(val)
340
+ args << val
341
341
  end
342
342
  end
343
343
  op.append(args, escape: true, strip: /^:/)
@@ -983,12 +983,8 @@ module Squared
983
983
  printsucc
984
984
  end
985
985
  op = OptionPartition.new(opts, OPT_GIT[:pull], cmd, project: self, no: OPT_GIT[:no][:pull])
986
- reg = if op.empty?
987
- []
988
- else
989
- opts = op.uniq(opts)
990
- matchmap op
991
- end
986
+ opts -= op.extras
987
+ reg = matchmap op
992
988
  session_done op.target
993
989
  heads = []
994
990
  cur = nil
@@ -87,7 +87,7 @@ module Squared
87
87
  initialize_build(Python.ref, **kwargs)
88
88
  initialize_env(**kwargs)
89
89
  end
90
- dependfile_set DEP_PYTHON
90
+ dependfile_set(DEP_PYTHON, default: 2)
91
91
  editable_set editable
92
92
  venv_set kwargs[:venv]
93
93
  end
@@ -196,7 +196,7 @@ module Squared
196
196
  end
197
197
  args.join(' ')
198
198
  end
199
- shell(cmd, name: :exec, chdir: path)
199
+ run(cmd, send: :exec, banner: false)
200
200
  end
201
201
  end
202
202
  else
@@ -509,7 +509,8 @@ module Squared
509
509
  `#{chruby.with('ruby --version')}`
510
510
  when 'install'
511
511
  ver = '.tool-versions'
512
- `asdf current ruby`[/ruby\s+\S+/, 0].sub(/\s+/, ' ')
512
+ exit 1 unless (cur = `asdf current ruby`[/ruby\s+\S+/, 0])
513
+ cur.sub(/\s+/, ' ')
513
514
  else
514
515
  ver = nil
515
516
  `ruby --version`
@@ -16,7 +16,7 @@ module Squared
16
16
  attr_reader :manifest_url, :manifest
17
17
 
18
18
  def repo(url, manifest = 'latest', run: nil, script: nil, args: nil, dev: nil, prod: nil,
19
- ref: @ref, group: @group)
19
+ ref: @ref, group: @group, **)
20
20
  @home = if (val = env('REPO_HOME'))
21
21
  path = Pathname.new(val)
22
22
  if main == path.basename.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.36
4
+ version: 0.4.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 4.0.3
128
+ rubygems_version: 4.0.6
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []