squared 0.6.12 → 0.6.14

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: 05f58e158cd533725a7c9e6eaacead60da71dddbf311e2f63a4f69f2e51ec998
4
- data.tar.gz: 4d400ce46ffaf7dd7c2a7a48ea28019bca1e313c46cef7dc666f64be492808e7
3
+ metadata.gz: bf000f3929e009426b937626a3935e366f952b7faccfe57b7217c2f6bac02975
4
+ data.tar.gz: 8612731d94dda35b871c85dc08f8e35a54c061d40e0846861ca70696a65e7abc
5
5
  SHA512:
6
- metadata.gz: 0dd82a720a4f3d63a8d342ee09cb582c818299d6a25922dd4a366602392afb47a89b6138a69f8d30875e617b18a0b3e929de554c0a9512a8bfe10b526569c33a
7
- data.tar.gz: 0e99a815e0c8e769edc40171d9e3f039f82fcd366b6d66a094ef35425dc0cb44cc83eb67cad605dd8a7bf25dbf6daf15e18ee2605da866b57e2ed1f8a4011849
6
+ metadata.gz: eda3163e0814ff4b26022284f187ad5137d229cfdc847ee86979fc1a1ec770b640de4261af38cff5df41878bd691d6f180dfb13b9bbd801ac22fad904e77d087
7
+ data.tar.gz: fe40717e98e88842f50c3c253ca2bc7df7164a4d95a90c89f4f3f87b359c389a77cd49f4a68786bb98575d56f5100d77483f4ba6410b20001af8d251d556a965
data/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.14] - 2026-06-14
4
+
5
+ ### Added
6
+
7
+ - Node task depend can run approve-scripts with NPM_APPROVE_SCRIPTS.
8
+
9
+ ### Fixed
10
+
11
+ - Docker command bake action build did not append context directory.
12
+
13
+ ## [0.5.24] - 2026-06-14
14
+
15
+ ### Fixed
16
+
17
+ - See `0.4.38`.
18
+
19
+ ## [0.4.38] - 2026-06-14
20
+
21
+ ### Added
22
+
23
+ - Application project commands can be defined without a reference.
24
+ - Git command branch action all was implemented.
25
+
26
+ ### Changed
27
+
28
+ - Override alias methods were created for suffix "!" to "\_".
29
+ - Project banners do not display boolean attributes.
30
+ - OptionPartition method append strips single quotes when quoting strings.
31
+
32
+ ### Fixed
33
+
34
+ - Application methods log and exclude were non-functional.
35
+ - Docker command bake action build does not support changing context.
36
+ - Project base method semver did not include prerelease delimiter.
37
+ - Project session cleanup did not compare by reference.
38
+
39
+ ## [0.6.13] - 2026-05-04
40
+
41
+ ### Added
42
+
43
+ - Application project commands can be defined without a reference.
44
+
45
+ ### Fixed
46
+
47
+ - Application methods log and exclude were non-functional.
48
+ - Project base tasks did not detect build scripts using Arrays.
49
+
3
50
  ## [0.6.12] - 2026-04-29
4
51
 
5
52
  ### Fixed
@@ -1664,6 +1711,8 @@
1664
1711
 
1665
1712
  - Changelog was created.
1666
1713
 
1714
+ [0.6.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.14
1715
+ [0.6.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.13
1667
1716
  [0.6.12]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.12
1668
1717
  [0.6.11]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.11
1669
1718
  [0.6.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.10
@@ -1677,6 +1726,7 @@
1677
1726
  [0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
1678
1727
  [0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
1679
1728
  [0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
1729
+ [0.5.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.24
1680
1730
  [0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
1681
1731
  [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
1682
1732
  [0.5.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.21
@@ -1701,6 +1751,7 @@
1701
1751
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1702
1752
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1703
1753
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1754
+ [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1704
1755
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1705
1756
  [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1706
1757
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
data/README.md CHANGED
@@ -838,11 +838,12 @@ Features can be enabled through ENV when calling global tasks such as through *C
838
838
  | outdated | - | U|UPDATE=major|minor|patch DIFF DRY_RUN |
839
839
  | publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN Y |
840
840
  | depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y |
841
- | npm pnpm | depend package | CPU=s OS=s LIBC=s |
841
+ | npm | depend | APPROVE_SCRIPTS=s |
842
842
  | npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS |
843
843
  | pnpm | depend | PUBLIC_HOIST_PATTERN=s APPROVE_BUILDS |
844
844
  | pnpm | depend:add | ALLOW_BUILD=s |
845
845
  | yarn | depend package | IGNORE_ENGINES=0 |
846
+ | npm pnpm | depend package | CPU=s OS=s LIBC=s |
846
847
 
847
848
  #### Python
848
849
 
@@ -54,15 +54,22 @@ module Squared
54
54
  def shell_quote(val, option: true, force: true, double: false, preserve: true, pass: false, override: false)
55
55
  val = val.to_s
56
56
  return val if (!force && !val.include?(' ')) || val.empty?
57
+ return val if option && val.match?(/\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m)
57
58
 
58
- if option
59
- pat = /\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m
60
- return val if val.match?(pat)
61
- end
62
59
  if val =~ QUOTE_VALUE
63
- return val if pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
64
-
65
- base = $2 unless preserve
60
+ if pass == '"' || pass == "'"
61
+ return val if pass == $1
62
+ elsif pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
63
+ return val
64
+ end
65
+ case preserve
66
+ when false
67
+ base = $2
68
+ when '"'
69
+ base = $2 if $1 == "'"
70
+ when "'"
71
+ base = $2 if $1 == '"'
72
+ end
66
73
  end
67
74
  q = -> { (base || val).gsub("'\\\\''", "'") }
68
75
  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.6.12'
4
+ VERSION = '0.6.14'
5
5
  end
@@ -867,7 +867,7 @@ module Squared
867
867
  log_console(*args, pipe: kwargs[:pipe] || pipe)
868
868
  end
869
869
 
870
- def script_command(task, val, group, ref, on, &blk)
870
+ def script_command(task, val, group, ref, on = nil, &blk)
871
871
  if block_given?
872
872
  val = Struct::RunData.new(val, blk)
873
873
  elsif !val
@@ -878,7 +878,7 @@ module Squared
878
878
  as_a group, :to_sym
879
879
  else
880
880
  label = :ref
881
- as_a ref, :to_sym
881
+ as_a(ref || :_, :to_sym)
882
882
  end.each do |name|
883
883
  @script[label][name][task] = val
884
884
  @events[label][name][task] = on if on.is_a?(Hash)
@@ -910,6 +910,8 @@ module Squared
910
910
  nil
911
911
  elsif ref && target[:ref].key?(ref)
912
912
  target[:ref][ref]
913
+ else
914
+ target[:ref][:_]
913
915
  end
914
916
  end
915
917
 
@@ -23,7 +23,7 @@ module Squared
23
23
  VAR_SET = %i[parent global script index envname desc dependfile dependname dependindex theme archive env graph
24
24
  dev prod pass only exclude asdf].freeze
25
25
  BLK_SET = %i[run depend doc lint test copy clean].freeze
26
- SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?[-.]?(\S+)?\b/.freeze
26
+ SEM_VER = /\b(\d+)(?:(\.)(\d+))?(?:(\.)(\d+))?(?:([-.])?(\S+))?\b/.freeze
27
27
  URI_SCHEME = %r{\A([a-z][a-z\d+-.]*)://[^@:\[\]\\^<>|\s]}i.freeze
28
28
  TASK_METADATA = Rake::TaskManager.record_task_metadata
29
29
  private_constant :OPTIONS, :VAR_SET, :BLK_SET, :SEM_VER, :URI_SCHEME, :TASK_METADATA
@@ -1249,7 +1249,7 @@ module Squared
1249
1249
  else
1250
1250
  if series?(obj)
1251
1251
  obj.each(&:call)
1252
- elsif obj.is_a?(Array) && obj.none?(String)
1252
+ elsif obj.is_a?(Array) && obj.any? { |val| !val.is_a?(String) }
1253
1253
  build(*obj, **kwargs)
1254
1254
  elsif obj
1255
1255
  run_s(*Array(obj), **kwargs)
@@ -1502,7 +1502,7 @@ module Squared
1502
1502
  return cmd.to_s unless cmd.respond_to?(:done)
1503
1503
 
1504
1504
  raise_error 'no command added', hint: cmd.first unless cmd.size > 1
1505
- @session = nil if cmd == @session
1505
+ @session = nil if cmd.equal?(@session)
1506
1506
  cmd.done
1507
1507
  end
1508
1508
 
@@ -1653,7 +1653,7 @@ module Squared
1653
1653
  __send__ meth
1654
1654
  end
1655
1655
  end
1656
- val = val.compact.join(s)
1656
+ val = val.reject { |item| !item || item == true }.join(s)
1657
1657
  next unless found && !val.empty?
1658
1658
  elsif (val = __send__(val)).nil?
1659
1659
  next
@@ -2086,9 +2086,9 @@ module Squared
2086
2086
 
2087
2087
  a, b = [a.first, b.first].map! do |c|
2088
2088
  d = begin
2089
- Integer(c[5]).to_s
2089
+ Integer(c[6]).to_s
2090
2090
  rescue StandardError
2091
- c[5] ? '-1' : '0'
2091
+ c[6] ? '-1' : '0'
2092
2092
  end
2093
2093
  [c[0], c[2], c[4] || '0', d]
2094
2094
  end
@@ -2434,7 +2434,7 @@ module Squared
2434
2434
  end
2435
2435
 
2436
2436
  def semmajor?(cur, want)
2437
- (cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[5]
2437
+ (cur[0] == '0' && want[0] == '0' ? cur[2] != want[2] : cur[0] != want[0]) && !want[6]
2438
2438
  end
2439
2439
 
2440
2440
  def printfirst?
@@ -2484,7 +2484,7 @@ module Squared
2484
2484
  when FalseClass
2485
2485
  false
2486
2486
  else
2487
- $?.success?
2487
+ $?&.success?
2488
2488
  end.tap do |ret|
2489
2489
  next unless cond.none? { |val| val == false }
2490
2490
 
@@ -2509,7 +2509,7 @@ module Squared
2509
2509
  end
2510
2510
 
2511
2511
  def stdout?
2512
- !!verbose && !stdin?
2512
+ !quiet? && !stdin?
2513
2513
  end
2514
2514
 
2515
2515
  def verbose?
@@ -394,17 +394,15 @@ module Squared
394
394
  append_context context
395
395
  when :bake
396
396
  unless op.empty?
397
- args = op.dup
398
- op.reset
399
- if Dir.exist?(args.last)
400
- if projectpath?(val = args.pop)
401
- context = val
402
- else
403
- args << val
404
- end
397
+ if !context && op.size > 1 && basepath(op.last).directory?
398
+ pat = /\btarget\s+"#{Regexp.escape(op.last)}"/
399
+ context = op.pop if op.values_of('f', 'file').none? { |f| basepath!(f)&.read&.match?(pat) }
400
+ end
401
+ if context
402
+ context = basepath context
403
+ op.each { |name| op.add_option('set', "#{name}.context=#{context}", escape: false) }
405
404
  end
406
- op.append(args, escape: true, strip: /^:/)
407
- contextdir context if context
405
+ op.append(escape: true, strip: /^:/, clear: true)
408
406
  end
409
407
  end
410
408
  op.clear(pass: false)
@@ -447,6 +445,7 @@ module Squared
447
445
  end
448
446
  run(from: from)
449
447
  end
448
+ alias compose_ compose!
450
449
 
451
450
  def container(flag, opts = [], id: nil)
452
451
  cmd, opts = docker_session('container', flag, opts: opts)
@@ -320,7 +320,7 @@ module Squared
320
320
  end
321
321
 
322
322
  subtasks({
323
- 'branch' => %i[create track delete move copy list current].freeze,
323
+ 'branch' => %i[create track delete move copy list all current].freeze,
324
324
  'checkout' => %i[commit branch track detach path].freeze,
325
325
  'commit' => %i[add all amend amend-orig fixup].freeze,
326
326
  'diff' => %i[head branch files view between contain].freeze,
@@ -717,12 +717,7 @@ module Squared
717
717
  task flag do |_, args|
718
718
  branch flag, args.to_a
719
719
  end
720
- when :current
721
- format_desc action, flag
722
- task flag do
723
- branch flag
724
- end
725
- else
720
+ when :move, :copy
726
721
  format_desc action, flag, 'branch,oldbranch?'
727
722
  task flag, [:branch, :oldbranch] do |_, args|
728
723
  if (branch = args.branch)
@@ -733,6 +728,11 @@ module Squared
733
728
  end
734
729
  branch(flag, refs: [oldbranch, branch])
735
730
  end
731
+ else
732
+ format_desc action, flag
733
+ task flag do
734
+ branch flag
735
+ end
736
736
  end
737
737
  when 'switch'
738
738
  case flag
@@ -1122,7 +1122,7 @@ module Squared
1122
1122
  option('no-tags') { opts[:'no-tags'] = true }
1123
1123
  opts.delete(:'recurse-submodules') || opts.delete(:'no-recurse-submodules') if append_submodules(from: :clone)
1124
1124
  append_hash opts
1125
- cmd << '--quiet' if option('quiet') || !verbose
1125
+ cmd << '--quiet' if quiet? || option('quiet')
1126
1126
  append_value(data[0], path, delim: true)
1127
1127
  source(sync: sync, banner: sync && !quiet?, multiple: !sync || quiet?)
1128
1128
  end
@@ -1400,6 +1400,7 @@ module Squared
1400
1400
  append_pathspec op.extras
1401
1401
  source(exception: false)
1402
1402
  end
1403
+ alias log_ log!
1403
1404
 
1404
1405
  def diff(flag, opts = [], refs: [], branch: nil, range: [], index: [])
1405
1406
  cmd, opts = git_session('diff', opts: opts)
@@ -1885,6 +1886,10 @@ module Squared
1885
1886
 
1886
1887
  def source(cmd = @session, exception: true, io: false, sync: true, stdout: false, stderr: false, banner: true,
1887
1888
  multiple: false, hint: nil, from: nil, send: :system, **kwargs)
1889
+ unless cmd
1890
+ print_error('no git session started', subject: project, hint: from, pass: true)
1891
+ return
1892
+ end
1888
1893
  cmd = cmd.target if cmd.is_a?(OptionPartition)
1889
1894
  if io && banner == false
1890
1895
  from = nil
@@ -2078,7 +2083,7 @@ module Squared
2078
2083
  end
2079
2084
  op << '--verbose' if (flag || from == :fetch) && stdout? && !op.arg?('quiet')
2080
2085
  if remote
2081
- op.append(remote, delim: true)
2086
+ op.append(remote)
2082
2087
  if (val = option('refspec', target: target, strict: true))
2083
2088
  op.append(*split_escape(val))
2084
2089
  else
@@ -181,7 +181,7 @@ module Squared
181
181
  when 'add'
182
182
  format_desc action, nil, 'save?=[=-]prod|dev|optional|peer|bundle,(-)name+'
183
183
  task action, [:save] do |_, args|
184
- packages = if args.save =~ /\A([=-]*)?(prod|dev|optional|peer|bundle)\z/
184
+ packages = if args.save =~ /^([=-]*)(prod|dev|optional|peer|bundle)$/
185
185
  save = [$2, $1.include?('='), $1.include?('-')]
186
186
  args.extras
187
187
  else
@@ -508,7 +508,6 @@ module Squared
508
508
  end
509
509
  save, exact, omit = save if save.is_a?(Array)
510
510
  ws = env('NODE_WORKSPACES', equals: '0')
511
- ci = option('ci')
512
511
  om = lambda do |cmd|
513
512
  if omit
514
513
  save = case save
@@ -545,7 +544,7 @@ module Squared
545
544
  end
546
545
  if nolockfile?('yarn')
547
546
  cmd << '--no-lockfile'
548
- elsif ci
547
+ elsif option('ci')
549
548
  if yarn == 1
550
549
  cmd << '--frozen-lockfile'
551
550
  elsif !flag
@@ -581,13 +580,27 @@ module Squared
581
580
  '--force'
582
581
  elsif nolockfile?('pnpm')
583
582
  '--no-lockfile'
584
- elsif ci
583
+ elsif option('ci')
585
584
  '--frozen-lockfile'
586
585
  end
587
586
  cmd << '--ignore-scripts' if option('ignore-scripts')
588
587
  cmd << '--dangerously-allow-all-builds' if option('approve-builds')
589
588
  else
590
- cmd = session('npm', ci ? 'ci' : 'install')
589
+ cmd = session 'npm'
590
+ cmd << (ci = option('ci') ? 'ci' : 'install')
591
+ option('approve-scripts') do |val|
592
+ cmd = npm_output 'approve-scripts'
593
+ cmd << case val
594
+ when '1'
595
+ '--all --no-allow-scripts-pin'
596
+ when 'true', 'all'
597
+ '--all'
598
+ else
599
+ val.split(/\s+/).quote!.join(' ')
600
+ end
601
+ print_run cmd, quiet?
602
+ run(cmd, banner: false)
603
+ end
591
604
  cmd << '--workspaces=false' if ws
592
605
  cmd << '--force' if option('force')
593
606
  append_nocolor
@@ -701,7 +714,7 @@ module Squared
701
714
  when :patch
702
715
  a == c && b == d && f[4] != w[4]
703
716
  end
704
- if upgrade && !w[5]
717
+ if upgrade && !w[6]
705
718
  next if file == want
706
719
 
707
720
  found << [key, file, want, if a != c
@@ -857,13 +870,18 @@ module Squared
857
870
  package(:update, from: :update)
858
871
  end
859
872
 
860
- def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil)
873
+ def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, access: nil, dryrun: nil,
874
+ workspace: false)
861
875
  if read_package('private')
876
+ return if workspace
877
+
862
878
  ws = children.select { |proj| proj.ref?(Node.ref) }
863
879
  if ws.empty?
864
880
  print_error('nothing to publish', subject: name, hint: 'private')
865
881
  elsif confirm_basic('Publish workspace?', ws.map(&:name).join(', '), 'N')
866
- ws.each { |proj| proj.publish(flag, sync: sync, otp: otp, tag: tag, access: access, dryrun: dryrun) }
882
+ ws.each do |proj|
883
+ proj.publish(flag, sync: sync, otp: otp, tag: tag, access: access, dryrun: dryrun, workspace: true)
884
+ end
867
885
  end
868
886
  return
869
887
  end
@@ -1247,6 +1265,10 @@ module Squared
1247
1265
 
1248
1266
  private
1249
1267
 
1268
+ def npm_output(*cmd, **kwargs)
1269
+ session_output('npm', *cmd, **kwargs)
1270
+ end
1271
+
1250
1272
  def read_package(key = 'packageManager', update: false)
1251
1273
  if !@pm.key?(key) || update
1252
1274
  doc = JSON.parse(dependfile.read)
@@ -204,7 +204,7 @@ module Squared
204
204
  end
205
205
  next if found.anybits?(1)
206
206
 
207
- puts log_message(found == 0 ? Logger::INFO : Logger.WARN,
207
+ puts log_message(found == 0 ? Logger::INFO : Logger::WARN,
208
208
  "no scripts #{found == 0 ? 'found' : 'executed'}",
209
209
  subject: name, hint: pyprojectfile)
210
210
  end
@@ -610,6 +610,7 @@ module Squared
610
610
  op.clear
611
611
  run(from: :"#{flag}:build")
612
612
  end
613
+ alias build_ build!
613
614
 
614
615
  def publish(flag, opts = [], test: false)
615
616
  list = case flag
@@ -8,7 +8,7 @@ module Squared
8
8
  GEMNAME = /\A[A-Za-z\d][A-Za-z\d_.-]*\z/.freeze
9
9
  DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
10
10
  OPT_RUBY = {
11
- 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
11
+ 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
12
12
  y|yydebug backtrace-limit=i crash-report=q disable=q dump=q enable=q encoding=b external-encoding=b
13
13
  internal-encoding=b parser=b].freeze,
14
14
  rake: %w[A|all B|build-all comments n|dry-run m|multitask P|prereqs q|quiet X|no-deprecation-warnings
@@ -21,7 +21,7 @@ module Squared
21
21
  nomultiline noprompt noscript nosingleline noverbose regexp-completor sample-book-mode script
22
22
  simple-prompt single-irb singleline tracer truncate-echo-on-assignment type-completor verbose
23
23
  back-trace-limit=i context-mode=i prompt=b prompt-mode=b].freeze,
24
- rbs: %w[I=pm r=bm no-stdlib no-collection collection=p log-level=b log-output=p repo=p].freeze,
24
+ rbs: %w[I=pm r=bm no-collection no-stdlib collection=p log-level=b log-output=p repo=p].freeze,
25
25
  rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
26
26
  display-only-correctable display-only-fail-level-offenses display-only-failed
27
27
  display-only-safe-correctable S|display-style-guide display-time editor-mode enable-pending-cops
@@ -805,7 +805,7 @@ module Squared
805
805
  end.each do |val|
806
806
  next unless val.empty? || File.exist?(val.sub('$HOME', Dir.home))
807
807
 
808
- trim = ->(s) { s[/^\D+\d+\.\d+(?:\.\S+)?/, 0].sub(/^([a-z]+)-/i, '\1 ') }
808
+ trim = ->(s) { s =~ /^\D+\d+\.\d+(?:\.\S+)?/ ? $&.sub(/^([a-z]+)-/i, '\1 ') : s }
809
809
  ver = '.ruby-version'
810
810
  out << trim.call(case (cmd = File.basename(val))
811
811
  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
- filter: nil, **)
24
+ filter: nil, preserve: true, **)
25
25
  return if (ret = args.flatten).empty?
26
26
 
27
27
  target << '--' if delim && !target.include?('--')
@@ -51,7 +51,7 @@ module Squared
51
51
  if !(pa = val.is_a?(Pathname)) && escape
52
52
  shell_escape(val, quote: quote, double: double)
53
53
  elsif quote || pa
54
- shell_quote(val, force: force, double: double)
54
+ shell_quote(val, force: force, double: double, preserve: preserve)
55
55
  else
56
56
  val
57
57
  end
@@ -354,9 +354,9 @@ module Squared
354
354
  self
355
355
  end
356
356
 
357
- def append(*args, **kwargs, &blk)
358
- args = extras if args.empty?
359
- out = OptionPartition.append(target, *args, **kwargs, &blk)
357
+ def append(*args, clear: false, preserve: '"', **kwargs, &blk)
358
+ args = clear ? extras.dup.tap { extras.clear } : extras if args.empty?
359
+ out = OptionPartition.append(target, *args, preserve: preserve, **kwargs, &blk)
360
360
  errors.concat(out) if out && (block_given? || kwargs[:filter])
361
361
  self
362
362
  end
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.6.12
4
+ version: 0.6.14
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: []