squared 0.4.23 → 0.4.25

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: 8d6cb2868bb0cf1337f5b55837f5347d280408fece9d5ced520fa0a4b4dcf66a
4
- data.tar.gz: 473e53ee64c8f98d4005ae4a36a31f652f67513fb9892f3beb9696a6eba27df4
3
+ metadata.gz: 11a03c7d13bf0170f8b60953148792df626cf1c1edb02f7a1da9c46a4668fc1d
4
+ data.tar.gz: ee42ffc6ac7b056604d9bb8ad81041dcd7787cb6d883b253f5390e7e94addc99
5
5
  SHA512:
6
- metadata.gz: e99a8c8804d50e7b051ccb3a3fc5233f8209a0a2ec9a4b8ca82fae5a5917da851b639123294f5948a1dbe1e1749157e0a150c9b7b9a4053f043fc600477d2f9a
7
- data.tar.gz: bbc77a9801a42360e468a388c008e24f7e2c5d2d431de46174871bcc11d482b7595d9339455824d9077861d889577c55649bcfada9a5617c058ab1ba95db04ad
6
+ metadata.gz: 23cf6af69c98270efe9894f77e646c6006e34652aae843cc621fd6248324efece67b90bd60ea107f28c7a38b522885984f8f0e5e962dc5dd67c6d52ae522ac05
7
+ data.tar.gz: 3cd04987351a9a9f98c878ab93307270ea7fa84d93207d361455ec008dc757ad98b258b2c098280ae1ae22aee78b90b179df9b654d9f01594b2c1198d02f4b0b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.25] - 2025-10-18
4
+
5
+ ### Fixed
6
+
7
+ - Project groups did not have their own copy of base events.
8
+
9
+ ## [0.4.24] - 2025-10-17
10
+
11
+ ### Added
12
+
13
+ - Repo task [init|all] can bypass dev? copy requirement with REPO_STAGE=4.
14
+
15
+ ### Changed
16
+
17
+ - Node command outdated does not check PNPM minimum version.
18
+
19
+ ### Fixed
20
+
21
+ - Project base rescue error handling used reversed parameters.
22
+ - Project absolute paths did not append wildcard with trailing slash.
23
+ - Powershell commands did not escape nested double quotes.
24
+ - OptionPartition did not strip flags without a value.
25
+ - Project base method add did not use parent context.
26
+ - Application property pipe did not parse numeric values.
27
+
3
28
  ## [0.4.23] - 2025-10-11
4
29
 
5
30
  ### Fixed
@@ -1018,6 +1043,8 @@
1018
1043
 
1019
1044
  - Changelog was created.
1020
1045
 
1046
+ [0.4.25]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.25
1047
+ [0.4.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.24
1021
1048
  [0.4.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.23
1022
1049
  [0.4.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.22
1023
1050
  [0.4.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.21
data/README.md CHANGED
@@ -723,7 +723,7 @@ REPO_SYNC # 0,1
723
723
  REPO_URL # manifest repository
724
724
  REPO_MANIFEST # e.g. latest,nightly,prod
725
725
  REPO_GROUPS # e.g. base,prod,docs
726
- REPO_STAGE # 0,1,2,3
726
+ REPO_STAGE # 0,1,2,3,4
727
727
  REPO_SUBMODULLES # 0,1
728
728
  REPO_TIMEOUT # confirm dialog (seconds)
729
729
  ```
@@ -178,8 +178,9 @@ module Squared
178
178
  args = args.map(&:to_s)
179
179
  if level.is_a?(::Numeric)
180
180
  if append && respond_to?(:log)
181
- ref = log rescue nil
182
- ref.add(level, message(subject, *args, hint: hint, space: ', ')) if ref.is_a?(Logger)
181
+ (log rescue nil).tap do |ref|
182
+ ref.add(level, message(subject, *args, hint: hint, space: ', ')) if ref.is_a?(Logger)
183
+ end
183
184
  end
184
185
  return false if !pass && level < ARG[:LEVEL]
185
186
  end
@@ -217,7 +218,8 @@ module Squared
217
218
  module_function
218
219
 
219
220
  def message(*args, hint: nil, empty: false, space: ARG[:SPACE])
220
- (empty ? args.reject { |val| val.nil? || val.empty? } : args).join(space) + (hint ? " (#{hint})" : '')
221
+ (empty ? args.reject { |val| val.nil? || (val.respond_to?(:empty?) && val.empty?) } : args)
222
+ .join(space) + (hint ? " (#{hint})" : '')
221
223
  end
222
224
 
223
225
  def emphasize(val, title: nil, footer: nil, right: false, cols: nil, sub: nil, pipe: nil,
@@ -16,15 +16,15 @@ module Squared
16
16
  elsif !r[3] || r[6]
17
17
  return val
18
18
  end
19
- if r[7].match?(/\A["']/)
20
- opt = "#{r[7]}#{r[7][0]}"
21
- elsif r[7].match?(/["']\z/)
22
- opt = "#{r[7][-1]}#{r[7]}"
23
- else
24
- return val unless r[7].match?(/\s/)
25
-
26
- opt = r[7]
27
- end
19
+ opt = if r[7].match?(/\A["']/)
20
+ "#{r[7]}#{r[7][0]}"
21
+ elsif r[7].match?(/["']\z/)
22
+ "#{r[7][-1]}#{r[7]}"
23
+ else
24
+ return val unless r[7].match?(/\s/)
25
+
26
+ r[7]
27
+ end
28
28
  r[1] + (data ? data[2] : r[2]) + r[4] + shell_quote(opt, double: double, force: force, override: override)
29
29
  elsif option && val =~ /\A([^=]+)=(.+)\z/m
30
30
  return val if $2.match?(/\A(["']).+\1\z/m)
@@ -65,15 +65,15 @@ module Squared
65
65
  escape = false
66
66
  override = true
67
67
  end
68
- if flag[0] == '-'
69
- b = flag[1] == '-' ? '=' : ' '
70
- elsif flag.size == 1
71
- a = '-'
72
- b = merge ? '' : ' '
73
- else
74
- a = '--'
75
- b = '='
76
- end
68
+ b = if flag[0] == '-'
69
+ flag[1] == '-' ? '=' : ' '
70
+ elsif flag.size == 1
71
+ a = '-'
72
+ merge ? '' : ' '
73
+ else
74
+ a = '--'
75
+ '='
76
+ end
77
77
  "#{a}#{flag}#{unless val.nil?
78
78
  "#{b}#{if escape
79
79
  shell_escape(val, quote: quote, double: double, override: override)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.23'
4
+ VERSION = '0.4.25'
5
5
  end
@@ -140,7 +140,7 @@ module Squared
140
140
  return unless @pipe.is_a?(Pathname)
141
141
 
142
142
  msg = "Session started on #{Time.now} by #{@main}"
143
- bord = '#' * s.size
143
+ bord = '#' * msg.size
144
144
  puts bord, msg, bord
145
145
  end
146
146
 
@@ -322,21 +322,9 @@ module Squared
322
322
  end
323
323
 
324
324
  def add(path, project = nil, **kwargs, &blk)
325
- if @withargs
326
- data = @withargs.dup
327
- data.merge!(kwargs)
328
- kwargs = data
329
- end
330
- ref = if kwargs.key?(:ref)
331
- kwargs = kwargs.dup unless @withargs
332
- kwargs.delete(:ref)
333
- elsif @ref.is_a?(Symbol)
334
- @ref
335
- end
336
- if @group.is_a?(String) && !kwargs.key?(:group)
337
- kwargs = kwargs.dup unless @withargs
338
- kwargs[:group] = @group
339
- end
325
+ kwargs = Support.hashdup(@withargs).update(kwargs) if @withargs
326
+ ref = kwargs.key?(:ref) ? kwargs.delete(:ref) : @ref
327
+ kwargs[:group] = @group if @group && !kwargs.key?(:group)
340
328
  path = root + path
341
329
  project = (project || path.basename).to_s
342
330
  name = task_name project
@@ -396,20 +396,12 @@ module Squared
396
396
  return self
397
397
  elsif !projectpath?(path = basepath(path)) || !checkdir?(path)
398
398
  return self
399
- else
400
- name = case name
401
- when String, Symbol
402
- name.to_s
403
- end
404
399
  end
405
- if @withargs
406
- data = @withargs.dup
407
- data.merge!(kwargs)
408
- kwargs = data
409
- end
410
- kwargs[:group] = group unless kwargs.key?(:group)
400
+ kwargs = hashdup(@withargs).update(kwargs) if @withargs
401
+ kwargs[:group] = group if group && !kwargs.key?(:group)
411
402
  kwargs[:ref] = ref unless kwargs.key?(:ref)
412
403
  parent = self
404
+ proj = nil
413
405
  name = case name
414
406
  when String, Symbol
415
407
  name.to_s
@@ -418,9 +410,10 @@ module Squared
418
410
  end
419
411
  workspace.add(path, name, **kwargs) do
420
412
  __send__ :parent_set, parent
421
- @children << self
413
+ proj = self
422
414
  instance_eval(&blk) if block_given?
423
415
  end
416
+ @children << proj
424
417
  self
425
418
  end
426
419
 
@@ -482,11 +475,9 @@ module Squared
482
475
  else
483
476
  cmd, opts, var, flags, extra = args
484
477
  end
485
- if cmd.is_a?(Proc) || cmd.is_a?(Method)
486
- run_b(cmd, sync: sync, from: from)
487
- return
488
- end
489
478
  if cmd
479
+ return run_b(cmd, sync: sync, from: from) if cmd.is_a?(Proc) || cmd.is_a?(Method)
480
+
490
481
  cmd = as_get(cmd, from)
491
482
  opts = compose(opts, script: false) if opts && respond_to?(:compose)
492
483
  flags = append_hash(flags, target: []).join(' ') if flags.is_a?(Hash)
@@ -528,7 +519,7 @@ module Squared
528
519
  proj.__send__(meth, sync: sync)
529
520
  next
530
521
  rescue StandardError => e
531
- on_error(:prereqs, e, exception: true)
522
+ on_error(e, :prereqs, exception: true)
532
523
  end
533
524
  end
534
525
  print_error(name, 'method not found', subject: 'prereqs', hint: meth)
@@ -548,7 +539,7 @@ module Squared
548
539
  end
549
540
 
550
541
  def doc(*, sync: invoked_sync?('doc'), **)
551
- run_b(@doc, sync: sync, from: :doc, banner: from_base?('doc') ? verbosetype > 1 : verbose)
542
+ run_b(@doc, sync: sync, banner: verbosetype > (from_base?('doc') ? 1 : 0), from: :doc)
552
543
  end
553
544
 
554
545
  def lint(*, sync: invoked_sync?('lint'), **)
@@ -569,9 +560,9 @@ module Squared
569
560
  on :first, :clean unless pass
570
561
  case @clean
571
562
  when Struct
572
- if (any = instance_eval(&@clean.block) || @clean.run)
563
+ if (val = instance_eval(&@clean.block) || @clean.run)
573
564
  temp = @clean
574
- @clean = any
565
+ @clean = val
575
566
  clean(*args, sync: sync, pass: true, **kwargs)
576
567
  @clean = temp
577
568
  end
@@ -589,7 +580,7 @@ module Squared
589
580
  entry = basepath(val = val.to_s)
590
581
  if entry.directory? && val.match?(%r{[\\/]\z})
591
582
  log&.warn "rm -rf #{entry}"
592
- rm_rf(entry, verbose: verbose)
583
+ rm_rf(entry, verbose: verbosetype > 0)
593
584
  else
594
585
  log&.warn "rm #{entry}"
595
586
  (val.include?('*') ? Dir[entry] : [entry]).each do |file|
@@ -630,7 +621,7 @@ module Squared
630
621
  end
631
622
  ret = graph_branch(self, data, tasks, out, sync: sync, pass: pass)
632
623
  rescue StandardError => e
633
- on_error(:graph, e, exception: true)
624
+ on_error(e, :graph, exception: true)
634
625
  else
635
626
  if out
636
627
  [out, ret]
@@ -688,7 +679,7 @@ module Squared
688
679
  case f.content_type
689
680
  when 'application/zip'
690
681
  ext = 'zip'
691
- when 'application/x-gzip'
682
+ when %r{application/(?:x-)?gzip}
692
683
  ext = 'tgz'
693
684
  when 'application/x-xz'
694
685
  ext = 'txz'
@@ -750,9 +741,7 @@ module Squared
750
741
  break unless entry.directory?
751
742
 
752
743
  i = 0
753
- while (dest = target + "#{File.basename(file)}-#{i}").exist?
754
- i += 1
755
- end
744
+ i += 1 while (dest = target + "#{File.basename(file)}-#{i}").exist?
756
745
  FileUtils.mv(entry, dest)
757
746
  dest.children.each { |child| FileUtils.mv(child, target) }
758
747
  dest.rmdir
@@ -852,7 +841,7 @@ module Squared
852
841
  ret = shell(*args, chdir: chdir, exception: exception)
853
842
  end
854
843
  rescue StandardError => e
855
- on_error(from, e, exception: true)
844
+ on_error(e, from, exception: true)
856
845
  false
857
846
  else
858
847
  on :last, from
@@ -1641,8 +1630,8 @@ module Squared
1641
1630
  confirm "Upgrade to #{a}? #{b + e} [#{c}] ", d
1642
1631
  end
1643
1632
 
1644
- def choice_index(msg, list, values: nil, accept: nil, series: false, trim: nil, column: nil,
1645
- multiple: false, force: true, **kwargs)
1633
+ def choice_index(msg, list, values: nil, accept: nil, series: false, trim: nil, column: nil, multiple: false,
1634
+ force: true, **kwargs)
1646
1635
  puts if !series && !printfirst?
1647
1636
  msg = "#{msg} (optional)" unless force
1648
1637
  unless (ret = choice(msg, list, multiple: multiple, force: force, **kwargs)) && !ret.empty?
@@ -1658,14 +1647,11 @@ module Squared
1658
1647
  if accept
1659
1648
  hint = Array(ret).map { |val| sub_style(val, styles: theme[:inline]) }.join(', ')
1660
1649
  accept = Array(accept).map { |val| Array(val) }
1661
- if accept.any? { |val| val[1] == true }
1662
- ret = [ret]
1663
- multiple = -1
1664
- end
1650
+ ret = Array(ret) if accept.any? { |val| val[1] == true }
1665
1651
  loop do
1666
1652
  item = accept.first
1667
1653
  d, e = item[2] ? ['Y', '[Y/n]'] : ['N', '[y/N]']
1668
- c = confirm("#{item[0]}#{a ? " [#{a}]" : ''} #{e} ", d, timeout: 60)
1654
+ c = confirm("#{item[0]}#{hint ? " [#{hint}]" : ''} #{e} ", d, timeout: 60)
1669
1655
  if item[1] == true
1670
1656
  ret << c
1671
1657
  elsif !c
@@ -1678,7 +1664,7 @@ module Squared
1678
1664
  exit 1 unless accept.empty?
1679
1665
  end
1680
1666
  if values
1681
- ret = [ret] unless accept && multiple == -1
1667
+ ret = Array(ret)
1682
1668
  values.each do |val|
1683
1669
  if val.is_a?(Array)
1684
1670
  val, force = val
@@ -1712,21 +1698,17 @@ module Squared
1712
1698
  end
1713
1699
 
1714
1700
  def command(*args)
1715
- if workspace.powershell?
1716
- "powershell.exe -Command \"& {#{args.join(' ; ')}}\""
1717
- else
1718
- args.join(' && ')
1719
- end
1701
+ return args.join(' && ') unless workspace.powershell?
1702
+
1703
+ "powershell.exe -Command #{shell_quote("& {#{args.join(' ; ')}}", option: false, double: true)}"
1720
1704
  end
1721
1705
 
1722
1706
  def relativepath(*list, all: false)
1723
1707
  return [] if list.empty?
1724
1708
 
1725
1709
  list.flatten.map! { |val| Pathname.new(val) }.select { |val| projectpath?(val) }.map! do |val|
1726
- val = val.absolute? ? val.relative_path_from(path).to_s : val.to_s
1727
- val = val[2..-1] if val.start_with?('./')
1728
- val = "#{val}*" if all && val.end_with?('/')
1729
- val
1710
+ ret = (val.absolute? ? val.relative_path_from(path) : val.cleanpath).to_s
1711
+ all && val.to_s.end_with?('/') ? "#{ret}/*" : ret
1730
1712
  end
1731
1713
  end
1732
1714
 
@@ -1811,8 +1793,7 @@ module Squared
1811
1793
  end
1812
1794
 
1813
1795
  def color(val)
1814
- ret = theme[val]
1815
- ret && !ret.empty? ? ret : [val]
1796
+ (ret = theme[val]) && !ret.empty? ? ret : [val]
1816
1797
  end
1817
1798
 
1818
1799
  def colormap(val)
@@ -2041,8 +2022,8 @@ module Squared
2041
2022
  end
2042
2023
 
2043
2024
  def projectpath?(val)
2044
- val = Pathname.new(val).cleanpath
2045
- val.absolute? ? val.to_s.start_with?(File.join(path, '')) : !val.to_s.start_with?(File.join('..', ''))
2025
+ ret = Pathname.new(val).cleanpath
2026
+ ret.absolute? ? ret.to_s.start_with?(File.join(path, '')) : !ret.to_s.start_with?(File.join('..', ''))
2046
2027
  end
2047
2028
 
2048
2029
  def checkdir?(val)
@@ -2149,6 +2130,10 @@ module Squared
2149
2130
  Workspace::Support.hashlist
2150
2131
  end
2151
2132
 
2133
+ def hashdup
2134
+ Workspace::Support.hashdup
2135
+ end
2136
+
2152
2137
  def borderstyle
2153
2138
  ((data = workspace.banner_get(*@ref, group: group)) && data[:border]) || theme[:border]
2154
2139
  end
@@ -113,7 +113,7 @@ module Squared
113
113
  return unless dockerfile(file).exist?
114
114
 
115
115
  @context = context
116
- @tag = tag || tagname("#{@project}:#{@version || 'latest'}")
116
+ self.tag = tag || tagname("#{@project}:#{@version || 'latest'}")
117
117
  @mounts = mounts
118
118
  @secrets = secrets
119
119
  @registry = tagjoin registry, kwargs[:username]
@@ -206,7 +206,7 @@ module Squared
206
206
  end
207
207
  end
208
208
  else
209
- format_desc(action, flag, 'opts*,id/name', after: flag == :update ? '+' : '*')
209
+ format_desc action, flag, "opts*,id/name#{flag == :update ? '+' : '*'}"
210
210
  task flag do |_, args|
211
211
  container flag, args.to_a
212
212
  end
@@ -522,7 +522,7 @@ module Squared
522
522
  list_image(flag, docker_output('image ls -a'), from: from) do |val|
523
523
  op << val
524
524
  if flag == :tag
525
- op << tagname("#{@project}:#{op.first}")
525
+ op << tagname("#{project}:#{op.first}")
526
526
  break
527
527
  end
528
528
  end
@@ -653,7 +653,7 @@ module Squared
653
653
  ver = option('version', target: target, ignore: false)
654
654
  list = case val
655
655
  when String
656
- val.split(',')
656
+ split_escape val
657
657
  when Array
658
658
  val
659
659
  else
@@ -637,7 +637,7 @@ module Squared
637
637
  task flag, [:commit] do |_, args|
638
638
  commit = commithead args.commit
639
639
  unless commit
640
- commit, merge = choice_commit(values: ['Merge? [y|N]'])
640
+ commit, merge = choice_commit(values: ['Merge? [y/N]'])
641
641
  merge = merge&.upcase == 'Y'
642
642
  end
643
643
  checkout(flag, commit: commit, merge: merge)
@@ -721,7 +721,7 @@ module Squared
721
721
  task flag, [:name, :commit] do |_, args|
722
722
  branch = param_guard(action, flag, args: args, key: :name)
723
723
  commit = commithead args.commit
724
- commit, track = choice_commit(values: ['Track? [Y|n]'], force: false) if commit == ':'
724
+ commit, track = choice_commit(values: ['Track? [Y/n]'], force: false) if commit == ':'
725
725
  switch(flag, branch: branch, commit: commit, track: track)
726
726
  end
727
727
  when :detach
@@ -366,7 +366,7 @@ module Squared
366
366
  subdir << target.to_s
367
367
  end
368
368
  begin
369
- FileUtils.cp(basepath(s), dest, verbose: verbose.is_a?(Numeric) && verbose > 0)
369
+ FileUtils.cp(basepath(s), dest, verbose: verbosetype > 0)
370
370
  rescue StandardError => e
371
371
  print_error e
372
372
  errors += 1
@@ -410,7 +410,7 @@ module Squared
410
410
  target.each do |src, to|
411
411
  glob.each { |val| log.info "cp #{from + val} #{to}" }
412
412
  begin
413
- copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbose)
413
+ copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbosetype > 0)
414
414
  rescue StandardError => e
415
415
  on_error e, :copy
416
416
  end
@@ -482,7 +482,7 @@ module Squared
482
482
 
483
483
  def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
484
484
  dryrun = opts.include?('dry-run') || opts.include?('d')
485
- if pnpm? && read_packagemanager(version: '7.15', update: true)
485
+ if pnpm?
486
486
  cmd = session 'pnpm', 'outdated'
487
487
  dryrun ||= dryrun?('pnpm')
488
488
  else
@@ -312,7 +312,7 @@ module Squared
312
312
  c = glob[i] || glob.first
313
313
  log.info "cp #{a + c} #{b}"
314
314
  begin
315
- copy_dir(a, b, c, pass: pass, verbose: verbose)
315
+ copy_dir(a, b, c, pass: pass, verbose: verbosetype > 0)
316
316
  rescue StandardError => e
317
317
  on_error e, :copy
318
318
  end
@@ -10,9 +10,10 @@ module Squared
10
10
  include Common::Shell
11
11
  extend Forwardable
12
12
 
13
+ OPT_NAME = /\A(?:(--)|-)((?(1)[A-Za-z\d]+|[A-Za-z\d]))\z/
13
14
  OPT_VALUE = /\A-{0,2}([^= ]+)(?: *= *| +)(.+)\z/
14
15
  OPT_SINGLE = /\A-([A-Za-z\d])(.+)\z/
15
- private_constant :OPT_VALUE, :OPT_SINGLE
16
+ private_constant :OPT_NAME, :OPT_VALUE, :OPT_SINGLE
16
17
 
17
18
  class << self
18
19
  include Common::Format
@@ -70,8 +71,8 @@ module Squared
70
71
  def strip(val)
71
72
  return [] unless val
72
73
 
73
- val = shell_split(val) if val.is_a?(String)
74
- val.map { |s| s.sub(OPT_SINGLE, '\1=\2').sub(OPT_VALUE, '\1=\2') }.reject(&:empty?)
74
+ val = shell_split val if val.is_a?(String)
75
+ val.map { |s| s.sub(OPT_SINGLE, '\1=\2').sub(OPT_VALUE, '\1=\2').sub(OPT_NAME, '\2') }.reject(&:empty?)
75
76
  end
76
77
 
77
78
  def select(list, bare: true, no: true, single: false, double: false)
@@ -246,9 +247,9 @@ module Squared
246
247
  add quote_option(key, val, double: qq.include?(key), merge: merge)
247
248
  elsif p.include?(key)
248
249
  if val.match?(/\A(["']).+\1\z/)
249
- add shell_option(key, val, escape: false, merge: merge, sep: sep)
250
+ add shell_option(key, val, escape: false, merge: merge)
250
251
  elsif path
251
- add quote_option(key, path + val, merge: merge, sep: sep)
252
+ add quote_option(key, path + val, merge: merge)
252
253
  else
253
254
  push opt
254
255
  end
@@ -132,19 +132,20 @@ module Squared
132
132
  task 'all' do |_, args|
133
133
  stage ||= 'all'
134
134
  ns['sync'].invoke(*args.to_a)
135
- next if env('REPO_STAGE', equals: '1')
135
+ next if (stage = env('REPO_STAGE')) == '1'
136
136
 
137
137
  @project.select do |_, proj|
138
138
  next unless proj.enabled?(proj.workspace.baseref)
139
139
 
140
140
  proj.depend(sync: true) if proj.depend?
141
- next if env('REPO_STAGE', equals: '2')
141
+ next if stage == '2'
142
142
 
143
143
  proj.build?
144
144
  end
145
145
  .each_value do |proj|
146
146
  proj.build(sync: true)
147
- next unless proj.dev? && proj.copy? && !env('REPO_STAGE', equals: '3')
147
+ next if stage == '3'
148
+ next unless proj.copy? && (proj.dev? || stage == '4')
148
149
 
149
150
  if (ws = proj.workspace).task_defined?(target = task_join(proj.name, 'copy'))
150
151
  task_invoke(target, **ws.invokeargs)
@@ -11,6 +11,26 @@ module Squared
11
11
  def hashlist
12
12
  Hash.new { |data, key| data[key] = [] }
13
13
  end
14
+
15
+ def hashdup(data, pass: [])
16
+ ret = {}
17
+ data.each do |key, val|
18
+ ret[key] = case val
19
+ when Hash
20
+ if pass.include?(val)
21
+ val
22
+ else
23
+ pass << val
24
+ hashdup(val, pass: pass)
25
+ end
26
+ when Proc, Method
27
+ val
28
+ else
29
+ val.dup
30
+ end
31
+ end
32
+ ret
33
+ end
14
34
  end
15
35
  end
16
36
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.23
4
+ version: 0.4.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-10-18 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rake
@@ -111,6 +112,7 @@ metadata:
111
112
  homepage_uri: https://github.com/anpham6/squared-ruby
112
113
  source_code_uri: https://github.com/anpham6/squared-ruby
113
114
  documentation_uri: https://squared.readthedocs.io
115
+ post_install_message:
114
116
  rdoc_options: []
115
117
  require_paths:
116
118
  - lib
@@ -125,7 +127,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
127
  - !ruby/object:Gem::Version
126
128
  version: '0'
127
129
  requirements: []
128
- rubygems_version: 3.7.2
130
+ rubygems_version: 3.2.33
131
+ signing_key:
129
132
  specification_version: 4
130
133
  summary: Rake task generator for managing multi-language workspaces.
131
134
  test_files: []