squared 0.5.23 → 0.5.24

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: 45a01f6cbe5a1aac8bb8569a17d8e1367e2b31bb4cd38ed3be1a406462983f48
4
- data.tar.gz: 5380204c9a5c8e411448b437b67f037d89ac30a6835158dfbaad3e704bef9739
3
+ metadata.gz: '028d4b5e86e6d05c09f73ecab333c5332dc87e6a4fc9491965eb5ed51f34499e'
4
+ data.tar.gz: 464d5a95488fafbcc13f0569ccc31d80732e5181572627ca02bd58ec040819c3
5
5
  SHA512:
6
- metadata.gz: 168617a435a76d164f939965060d5e75fe7d3e4195fc09b6dce3870397df137c0760d2a99c599bcb05df65a1d78f184d9bb8e1df6de761a70f9a344c7950ba31
7
- data.tar.gz: 3c825837cb557a12c4df649833340d26add03f391ebbd382afee1dcbf7d2971f538588af7c08b39494d6b76e2c7202d1e7a974339ba68b4fa4f4720ebab64b79
6
+ metadata.gz: 25457fbc4821b604ccbe49e7ac6dbcdd677996ead1d39a089e8f745a7ee2d94215c065c54aa7abb9335c04cb72dc73832ca209cb8e8bda6dc9979f84dcda66c5
7
+ data.tar.gz: 10e04c8c835b34ec1bb2f34e14a4f4ac25551b89ee7f1bd07cdd9d3503f87d3fff1980073ac6142a37c184d05e704a6b0d8608d50023f94511db197d2a659e83
data/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.24] - 2026-06-14
4
+
5
+ ### Fixed
6
+
7
+ - See `0.4.38`.
8
+
9
+ ## [0.4.38] - 2026-06-14
10
+
11
+ ### Added
12
+
13
+ - Application project commands can be defined without a reference.
14
+ - Git command branch action all was implemented.
15
+
16
+ ### Changed
17
+
18
+ - Override alias methods were created for suffix "!" to "\_".
19
+ - Project banners do not display boolean attributes.
20
+ - OptionPartition method append strips single quotes when quoting strings.
21
+
22
+ ### Fixed
23
+
24
+ - Application methods log and exclude were non-functional.
25
+ - Docker command bake action build does not support changing context.
26
+ - Project base method semver did not include prerelease delimiter.
27
+ - Project session cleanup did not compare by reference.
28
+
3
29
  ## [0.5.23] - 2026-04-29
4
30
 
5
31
  ### Fixed
@@ -1394,6 +1420,7 @@
1394
1420
 
1395
1421
  - Changelog was created.
1396
1422
 
1423
+ [0.5.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.24
1397
1424
  [0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
1398
1425
  [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
1399
1426
  [0.5.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.21
@@ -1418,6 +1445,7 @@
1418
1445
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1419
1446
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1420
1447
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1448
+ [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1421
1449
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1422
1450
  [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1423
1451
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
@@ -51,15 +51,22 @@ module Squared
51
51
  def shell_quote(val, option: true, force: true, double: false, preserve: true, pass: false, override: false)
52
52
  val = val.to_s
53
53
  return val if (!force && !val.include?(' ')) || val.empty?
54
+ return val if option && val.match?(/\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m)
54
55
 
55
- if option
56
- pat = /\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m
57
- return val if val.match?(pat)
58
- end
59
56
  if val =~ QUOTE_VALUE
60
- return val if pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
61
-
62
- base = $2 unless preserve
57
+ if pass == '"' || pass == "'"
58
+ return val if pass == $1
59
+ elsif pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
60
+ return val
61
+ end
62
+ case preserve
63
+ when false
64
+ base = $2
65
+ when '"'
66
+ base = $2 if $1 == "'"
67
+ when "'"
68
+ base = $2 if $1 == '"'
69
+ end
63
70
  end
64
71
  q = -> { (base || val).gsub("'\\\\''", "'") }
65
72
  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.5.23'
4
+ VERSION = '0.5.24'
5
5
  end
@@ -844,7 +844,7 @@ module Squared
844
844
  log_console(*args, pipe: kwargs[:pipe] || pipe)
845
845
  end
846
846
 
847
- def script_command(task, val, group, ref, on, &blk)
847
+ def script_command(task, val, group, ref, on = nil, &blk)
848
848
  if block_given?
849
849
  val = Struct::RunData.new(val, blk)
850
850
  elsif !val
@@ -855,7 +855,7 @@ module Squared
855
855
  items = as_a(group, :to_sym)
856
856
  else
857
857
  label = :ref
858
- items = as_a(ref, :to_sym)
858
+ items = as_a(ref || :_, :to_sym)
859
859
  end
860
860
  items.each do |name|
861
861
  @script[label][name][task] = val
@@ -888,6 +888,8 @@ module Squared
888
888
  nil
889
889
  elsif ref && target[:ref].key?(ref)
890
890
  target[:ref][ref]
891
+ else
892
+ target[:ref][:_]
891
893
  end
892
894
  end
893
895
 
@@ -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 asdf].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
@@ -1339,7 +1339,7 @@ module Squared
1339
1339
  return cmd unless cmd.respond_to?(:done)
1340
1340
 
1341
1341
  raise_error('no args added', hint: cmd.first) unless cmd.size > 1
1342
- @session = nil if cmd == @session
1342
+ @session = nil if cmd.equal?(@session)
1343
1343
  cmd.done
1344
1344
  end
1345
1345
 
@@ -1475,7 +1475,7 @@ module Squared
1475
1475
  __send__ meth
1476
1476
  end
1477
1477
  end
1478
- val = val.compact.join(s)
1478
+ val = val.reject { |item| !item || item == true }.join(s)
1479
1479
  next unless found && !val.empty?
1480
1480
  elsif (val = __send__(val)).nil?
1481
1481
  next
@@ -1847,9 +1847,9 @@ module Squared
1847
1847
 
1848
1848
  a, b = [a.first, b.first].map! do |c|
1849
1849
  d = begin
1850
- Integer(c[5]).to_s
1850
+ Integer(c[6]).to_s
1851
1851
  rescue StandardError
1852
- c[5] ? '-1' : '0'
1852
+ c[6] ? '-1' : '0'
1853
1853
  end
1854
1854
  [c[0], c[2], c[4] || '0', d]
1855
1855
  end
@@ -2124,7 +2124,7 @@ module Squared
2124
2124
  end
2125
2125
 
2126
2126
  def semmajor?(cur, want)
2127
- (cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[5]
2127
+ (cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[6]
2128
2128
  end
2129
2129
 
2130
2130
  def printfirst?
@@ -328,19 +328,8 @@ module Squared
328
328
  append_tag(tag || option('tag', ignore: false) || self.tag)
329
329
  append_context context
330
330
  when :bake
331
- unless op.empty?
332
- args = op.dup
333
- op.reset
334
- if Dir.exist?(args.last)
335
- if projectpath?(val = args.pop)
336
- context = val
337
- else
338
- args << val
339
- end
340
- end
341
- op.append(args, escape: true, strip: /^:/)
342
- contextdir context if context
343
- end
331
+ op.append(escape: true, strip: /^:/, clear: true)
332
+ op.push(context) if context
344
333
  end
345
334
  op.clear(pass: false)
346
335
  run(from: :"buildx:#{flag}")
@@ -373,6 +362,7 @@ module Squared
373
362
  end
374
363
  run(from: :"compose:#{flag}")
375
364
  end
365
+ alias compose_ compose!
376
366
 
377
367
  def container(flag, opts = [], id: nil)
378
368
  cmd, opts = docker_session('container', flag, opts: opts)
@@ -342,7 +342,7 @@ module Squared
342
342
  end
343
343
 
344
344
  subtasks({
345
- 'branch' => %i[create track delete move copy list current].freeze,
345
+ 'branch' => %i[create track delete move copy list all current].freeze,
346
346
  'checkout' => %i[commit branch track detach path].freeze,
347
347
  'commit' => %i[add all amend amend-orig fixup].freeze,
348
348
  'diff' => %i[head branch files view between contain].freeze,
@@ -698,12 +698,7 @@ module Squared
698
698
  task flag do |_, args|
699
699
  branch flag, args.to_a
700
700
  end
701
- when :current
702
- format_desc action, flag
703
- task flag do
704
- branch flag
705
- end
706
- else
701
+ when :move, :copy
707
702
  format_desc action, flag, 'branch,oldbranch?'
708
703
  task flag, [:branch, :oldbranch] do |_, args|
709
704
  if (branch = args.branch)
@@ -714,6 +709,11 @@ module Squared
714
709
  end
715
710
  branch(flag, refs: [oldbranch, branch])
716
711
  end
712
+ else
713
+ format_desc action, flag
714
+ task flag do
715
+ branch flag
716
+ end
717
717
  end
718
718
  when 'switch'
719
719
  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)
@@ -1805,6 +1806,10 @@ module Squared
1805
1806
 
1806
1807
  def source(cmd = @session, exception: true, io: false, sync: true, stdout: false, stderr: false, banner: true,
1807
1808
  multiple: false, hint: nil, from: nil, send: :system, **kwargs)
1809
+ unless cmd
1810
+ print_error('no git session started', subject: project, hint: from, pass: true)
1811
+ return
1812
+ end
1808
1813
  cmd = cmd.target if cmd.is_a?(OptionPartition)
1809
1814
  if io && banner == false
1810
1815
  from = nil
@@ -1991,7 +1996,7 @@ module Squared
1991
1996
  end
1992
1997
  op << '--verbose' if (flag || from == :fetch) && stdout? && !op.arg?('quiet')
1993
1998
  if remote
1994
- op.append(remote, delim: true)
1999
+ op.append(remote)
1995
2000
  if (val = option('refspec', target: target, strict: true))
1996
2001
  op.append(*split_escape(val))
1997
2002
  else
@@ -560,7 +560,7 @@ module Squared
560
560
  when :patch
561
561
  upgrade = a == c && b == d && f[4] != w[4]
562
562
  end
563
- if upgrade && !w[5]
563
+ if upgrade && !w[6]
564
564
  next if file == want
565
565
 
566
566
  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*'
@@ -525,6 +525,7 @@ module Squared
525
525
  op.clear
526
526
  run(from: :"#{flag}:build")
527
527
  end
528
+ alias build_ build!
528
529
 
529
530
  def publish(flag, opts = [], test: false)
530
531
  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
@@ -530,7 +530,7 @@ module Squared
530
530
  .each do |val|
531
531
  next unless val.empty? || File.exist?(val.sub('$HOME', Dir.home))
532
532
 
533
- trim = ->(s) { s[/\A\D+\d+\.\d+(?:\.\S+)?/, 0].sub(/\A([a-z]+)-/i, '\1 ') }
533
+ trim = ->(s) { s =~ /^\D+\d+\.\d+(?:\.\S+)?/ ? $&.sub(/^([a-z]+)-/i, '\1 ') : s }
534
534
  ver = '.ruby-version'
535
535
  out << trim.call(case (cmd = File.basename(val))
536
536
  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.5.23
4
+ version: 0.5.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  requirements: []
127
- rubygems_version: 4.0.6
127
+ rubygems_version: 4.0.10
128
128
  specification_version: 4
129
129
  summary: Rake task generator for managing multi-language workspaces.
130
130
  test_files: []