squared 0.4.37 → 0.4.38

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: 3717cf9c708b4a265d919790f7713bc6c35187c7229d956411d2dcf80ab7dfab
4
- data.tar.gz: 1659d367915ab16c72c148ddc3ea95312664afe5c92a7b77e31158318f0d1f3b
3
+ metadata.gz: dc06fd43c026c03e1a4ef6b082967f726f0a6a75dd3ab2ecca128198f8f51985
4
+ data.tar.gz: 6547492956431f6272a7f1165b2cb3a24f0e8b20787969837dabf13560c11815
5
5
  SHA512:
6
- metadata.gz: 330278fdc20d09076437c13530569ab1b09174ba7133558f7f5decdf8da25bff8ee22e0c9054c564f15c80f3a0dae79c859099d875aad2613bd14a244519ebf0
7
- data.tar.gz: f83310b3557945985db8a70b2f283bd2376b44e50fba64f5a1dc267c3f753bee4aab328906a66b9b888f042a533e75ec74a3c8c3a8147ad444a2e215549a87a2
6
+ metadata.gz: 8982c15e41b7de8e786b7d10515ff44b23e15c8e3e0b403f82db79067b792119b1df6a2b62756314f065fc21f7322c8c27e68edc5f1530fa098747272a703abb
7
+ data.tar.gz: eb886ff5f4d5d15afb15c84f1f739d410a53b7fd5aa22ac5b15112e3e5438b2ed7f590d2fd2b3601579212309565be9c51f65c1978b49cf1f78dc11ffeb0ed2c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.38] - 2026-06-14
4
+
5
+ ### Added
6
+
7
+ - Application project commands can be defined without a reference.
8
+ - Git command branch action all was implemented.
9
+
10
+ ### Changed
11
+
12
+ - Override alias methods were created for suffix "!" to "\_".
13
+ - Project banners do not display boolean attributes.
14
+ - OptionPartition method append strips single quotes when quoting strings.
15
+
16
+ ### Fixed
17
+
18
+ - Application methods log and exclude were non-functional.
19
+ - Docker command bake action build does not support changing context.
20
+ - Project base method semver did not include prerelease delimiter.
21
+ - Project session cleanup did not compare by reference.
22
+
3
23
  ## [0.4.37] - 2026-04-29
4
24
 
5
25
  ### Changed
@@ -1209,6 +1229,7 @@
1209
1229
 
1210
1230
  - Changelog was created.
1211
1231
 
1232
+ [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1212
1233
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1213
1234
  [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1214
1235
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
@@ -49,15 +49,22 @@ module Squared
49
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
+ return val if option && val.match?(/\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m)
52
53
 
53
- if option
54
- pat = /\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m
55
- return val if val.match?(pat)
56
- end
57
54
  if val =~ QUOTE_VALUE
58
- return val if pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
59
-
60
- base = $2 unless preserve
55
+ if pass == '"' || pass == "'"
56
+ return val if pass == $1
57
+ elsif pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
58
+ return val
59
+ end
60
+ case preserve
61
+ when false
62
+ base = $2
63
+ when '"'
64
+ base = $2 if $1 == "'"
65
+ when "'"
66
+ base = $2 if $1 == '"'
67
+ end
61
68
  end
62
69
  q = -> { (base || val).gsub("'\\\\''", "'") }
63
70
  if double || Rake::Win32.windows? || (ARG[:QUOTE] == '"' && !override)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.37'
4
+ VERSION = '0.4.38'
5
5
  end
@@ -837,7 +837,7 @@ module Squared
837
837
  log_console(*args, pipe: kwargs[:pipe] || pipe)
838
838
  end
839
839
 
840
- def script_command(task, val, group, ref, on, &blk)
840
+ def script_command(task, val, group, ref, on = nil, &blk)
841
841
  if block_given?
842
842
  val = Struct::RunData.new(val, blk)
843
843
  elsif !val
@@ -848,7 +848,7 @@ module Squared
848
848
  items = as_a(group, :to_sym)
849
849
  else
850
850
  label = :ref
851
- items = as_a(ref, :to_sym)
851
+ items = as_a(ref || :_, :to_sym)
852
852
  end
853
853
  items.each do |name|
854
854
  @script[label][name][task] = val
@@ -881,6 +881,8 @@ module Squared
881
881
  nil
882
882
  elsif ref && target[:ref].key?(ref)
883
883
  target[:ref][ref]
884
+ else
885
+ target[:ref][:_]
884
886
  end
885
887
  end
886
888
 
@@ -20,7 +20,7 @@ module Squared
20
20
  VAR_SET = %i[parent global script index envname desc dependfile dependindex theme archive env dev prod graph
21
21
  pass only exclude].freeze
22
22
  BLK_SET = %i[run depend doc lint test copy clean].freeze
23
- SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?[-.]?(\S+)?\b/.freeze
23
+ SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?(?:([-.])?(\S+))?\b/.freeze
24
24
  URI_SCHEME = %r{\A([a-z][a-z\d+-.]*)://[^@:\[\]\\^<>|\s]}i.freeze
25
25
  TASK_METADATA = Rake::TaskManager.record_task_metadata
26
26
  private_constant :VAR_SET, :BLK_SET, :SEM_VER, :URI_SCHEME, :TASK_METADATA
@@ -818,7 +818,7 @@ module Squared
818
818
  def run(cmd = @session, var = nil, exception: self.exception, sync: true, from: nil, banner: true, chdir: path,
819
819
  interactive: nil, hint: nil, send: :system, **)
820
820
  unless cmd
821
- print_error('no command session started', subject: project, hint: from || 'unknown', pass: true)
821
+ print_error('no command session started', subject: project, hint: from, pass: true)
822
822
  return
823
823
  end
824
824
  cmd = cmd.target if cmd.is_a?(OptionPartition)
@@ -1268,7 +1268,7 @@ module Squared
1268
1268
  return cmd unless cmd.respond_to?(:done)
1269
1269
 
1270
1270
  raise_error('no args added', hint: cmd.first) unless cmd.size > 1
1271
- @session = nil if cmd == @session
1271
+ @session = nil if cmd.equal?(@session)
1272
1272
  cmd.done
1273
1273
  end
1274
1274
 
@@ -1409,7 +1409,7 @@ module Squared
1409
1409
  __send__(meth)
1410
1410
  end
1411
1411
  end
1412
- val = val.compact.join(s)
1412
+ val = val.reject { |item| !item || item == true }.join(s)
1413
1413
  next unless found && !val.empty?
1414
1414
  elsif (val = __send__(val)).nil?
1415
1415
  next
@@ -1790,9 +1790,9 @@ module Squared
1790
1790
 
1791
1791
  a, b = [a.first, b.first].map! do |c|
1792
1792
  begin
1793
- d = Integer(c[5]).to_s
1793
+ d = Integer(c[6]).to_s
1794
1794
  rescue StandardError
1795
- d = c[5] ? '-1' : '0'
1795
+ d = c[6] ? '-1' : '0'
1796
1796
  end
1797
1797
  [c[0], c[2], c[4] || '0', d]
1798
1798
  end
@@ -2077,7 +2077,7 @@ module Squared
2077
2077
  end
2078
2078
 
2079
2079
  def semmajor?(cur, want)
2080
- (cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[5]
2080
+ (cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[6]
2081
2081
  end
2082
2082
 
2083
2083
  def printfirst?
@@ -330,19 +330,8 @@ module Squared
330
330
  append_tag(tag || option('tag', ignore: false) || self.tag)
331
331
  append_context context
332
332
  when :bake
333
- unless op.empty?
334
- args = op.dup
335
- op.reset
336
- if Dir.exist?(args.last)
337
- if projectpath?(val = args.pop)
338
- context = val
339
- else
340
- args << val
341
- end
342
- end
343
- op.append(args, escape: true, strip: /^:/)
344
- contextdir context if context
345
- end
333
+ op.append(escape: true, strip: /^:/, clear: true)
334
+ op.push(context) if context
346
335
  end
347
336
  op.clear(pass: false)
348
337
  run(from: :"buildx:#{flag}")
@@ -362,6 +351,7 @@ module Squared
362
351
  end
363
352
  run(from: :"compose:#{flag}")
364
353
  end
354
+ alias compose_ compose!
365
355
 
366
356
  def container(flag, opts = [], id: nil)
367
357
  cmd, opts = docker_session('container', flag, opts: opts)
@@ -339,7 +339,7 @@ module Squared
339
339
  end
340
340
 
341
341
  subtasks({
342
- 'branch' => %i[create track delete move copy list current].freeze,
342
+ 'branch' => %i[create track delete move copy list all current].freeze,
343
343
  'checkout' => %i[commit branch track detach path].freeze,
344
344
  'commit' => %i[add all amend amend-orig fixup].freeze,
345
345
  'diff' => %i[head branch files view between contain].freeze,
@@ -697,12 +697,7 @@ module Squared
697
697
  task flag do |_, args|
698
698
  branch flag, args.to_a
699
699
  end
700
- when :current
701
- format_desc action, flag
702
- task flag do
703
- branch flag
704
- end
705
- else
700
+ when :move, :copy
706
701
  format_desc action, flag, 'branch,oldbranch?'
707
702
  task flag, [:branch, :oldbranch] do |_, args|
708
703
  if (branch = args.branch)
@@ -713,6 +708,11 @@ module Squared
713
708
  end
714
709
  branch(flag, refs: [oldbranch, branch])
715
710
  end
711
+ else
712
+ format_desc action, flag
713
+ task flag do
714
+ branch flag
715
+ end
716
716
  end
717
717
  when 'switch'
718
718
  case flag
@@ -1357,6 +1357,7 @@ module Squared
1357
1357
  append_pathspec op.extras
1358
1358
  source(exception: false)
1359
1359
  end
1360
+ alias log_ log!
1360
1361
 
1361
1362
  def diff(flag, opts = [], refs: [], branch: nil, range: [], index: [])
1362
1363
  cmd, opts = git_session('diff', opts: opts)
@@ -1800,6 +1801,10 @@ module Squared
1800
1801
 
1801
1802
  def source(cmd = @session, exception: true, io: false, sync: true, stdout: false, stderr: false, banner: true,
1802
1803
  multiple: false, hint: nil, from: nil, send: :system, **kwargs)
1804
+ unless cmd
1805
+ print_error('no git session started', subject: project, hint: from, pass: true)
1806
+ return
1807
+ end
1803
1808
  cmd = cmd.target if cmd.is_a?(OptionPartition)
1804
1809
  if io && banner == false
1805
1810
  from = nil
@@ -1986,7 +1991,7 @@ module Squared
1986
1991
  end
1987
1992
  op << '--verbose' if (flag || from == :fetch) && stdout? && !op.arg?('quiet')
1988
1993
  if remote
1989
- op.append(remote, delim: true)
1994
+ op.append(remote)
1990
1995
  if (val = option('refspec', target: target, strict: true))
1991
1996
  op.append(*split_escape(val))
1992
1997
  else
@@ -552,7 +552,7 @@ module Squared
552
552
  when :patch
553
553
  upgrade = a == c && b == d && f[4] != w[4]
554
554
  end
555
- if upgrade && !w[5]
555
+ if upgrade && !w[6]
556
556
  next if file == want
557
557
 
558
558
  found << [key, file, want, if a != c
@@ -176,11 +176,11 @@ module Squared
176
176
  end
177
177
  break
178
178
  end
179
- unless found.anybits?(1)
180
- puts log_message(found == 0 ? Logger::INFO : Logger.WARN,
181
- "no scripts #{found == 0 ? 'found' : 'executed'}",
182
- subject: name, hint: pyprojectfile)
183
- end
179
+ next if found.anybits?(1)
180
+
181
+ puts log_message(found == 0 ? Logger::INFO : Logger::WARN,
182
+ "no scripts #{found == 0 ? 'found' : 'executed'}",
183
+ subject: name, hint: pyprojectfile)
184
184
  end
185
185
  when 'exec'
186
186
  format_desc action, nil, 'command|:,args*'
@@ -516,6 +516,7 @@ module Squared
516
516
  op.clear
517
517
  run(from: :"#{flag}:build")
518
518
  end
519
+ alias build_ build!
519
520
 
520
521
  def publish(flag, opts = [])
521
522
  case flag
@@ -7,7 +7,7 @@ module Squared
7
7
  GEMFILE = %w[Gemfile Gemfile.lock gem.deps.rb gems.rb Isolate].freeze
8
8
  DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
9
9
  OPT_RUBY = {
10
- ruby: %w[0=im? a c C=pm e=q E=bm F=qm i=bm? I=pm l n p r=bm s S w W=bm? x=pm? d|debug jit rjit verbose
10
+ ruby: %w[a c l n p s S w 0=im? C=pm e=q E=bm F=qm i=bm? I=pm r=bm W=bm? x=pm? d|debug jit rjit verbose
11
11
  y|yydebug backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
12
12
  internal-encoding=b parser=b].freeze,
13
13
  rake: %w[A|all B|build-all comments n|dry-run m|multitask P|prereqs q|quiet X|no-deprecation-warnings
@@ -496,7 +496,7 @@ module Squared
496
496
  ].each do |val|
497
497
  next unless val.empty? || File.exist?(val.sub('$HOME', Dir.home))
498
498
 
499
- trim = ->(s) { s[/\A\D+\d+\.\d+(?:\.\S+)?/, 0].sub(/\A([a-z]+)-/i, '\1 ') }
499
+ trim = ->(s) { s =~ /^\D+\d+\.\d+(?:\.\S+)?/ ? $&.sub(/^([a-z]+)-/i, '\1 ') : s }
500
500
  ver = '.ruby-version'
501
501
  out << trim.call(case (cmd = File.basename(val))
502
502
  when 'rvm'
@@ -21,7 +21,7 @@ module Squared
21
21
  include Prompt
22
22
 
23
23
  def append(target, *args, delim: false, escape: false, quote: true, strip: nil, force: true, double: false,
24
- **)
24
+ preserve: true, **)
25
25
  return if (ret = args.flatten).empty?
26
26
 
27
27
  target << '--' if delim && !target.include?('--')
@@ -35,7 +35,7 @@ module Squared
35
35
  if !(pa = val.is_a?(Pathname)) && escape
36
36
  shell_escape(val, quote: quote, double: double)
37
37
  elsif quote || pa
38
- shell_quote(val, force: force, double: double)
38
+ shell_quote(val, force: force, double: double, preserve: preserve)
39
39
  else
40
40
  val
41
41
  end
@@ -294,9 +294,9 @@ module Squared
294
294
  self
295
295
  end
296
296
 
297
- def append(*args, **kwargs)
298
- args = extras if args.empty?
299
- OptionPartition.append(target, *args, **kwargs)
297
+ def append(*args, clear: false, preserve: '"', **kwargs)
298
+ args = clear ? extras.dup.tap { extras.clear } : extras if args.empty?
299
+ OptionPartition.append(target, *args, preserve: preserve, **kwargs)
300
300
  self
301
301
  end
302
302
 
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.37
4
+ version: 0.4.38
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.6
128
+ rubygems_version: 4.0.10
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []