squared 0.8.4 → 0.8.6

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.
@@ -394,7 +394,7 @@ module Squared
394
394
  elsif has_value!(args, 'p', 'public')
395
395
  'public'
396
396
  end
397
- dryrun = has_value!(args, 'd', 'dry-run')
397
+ dryrun = has_value! args, 'd', 'dry-run'
398
398
  end
399
399
  case flag
400
400
  when :stage
@@ -411,7 +411,7 @@ module Squared
411
411
  [ver, tag, item['id'], item['actor']]
412
412
  end
413
413
  if data.empty?
414
- print_error('no staged releases', loglevel: Logger::INFO, subject: npmname)
414
+ print_error(Logger::INFO, 'no staged releases', subject: npmname)
415
415
  exit 1
416
416
  end
417
417
  data.each do |item|
@@ -456,7 +456,7 @@ module Squared
456
456
  @tsfile
457
457
  end
458
458
  end
459
- watch = has_value!(args, 'w', 'watch')
459
+ watch = has_value! args, 'w', 'watch'
460
460
  tsc(*args, banner: true, project: project, build: flag == :build, watch: !watch.nil?)
461
461
  end
462
462
  end
@@ -662,7 +662,7 @@ module Squared
662
662
  end
663
663
  if nolockfile?(prefix: 'yarn')
664
664
  cmd << '--no-lockfile'
665
- elsif option('ci')
665
+ elsif option('ci') || (ci? && exist?('yarn.lock'))
666
666
  if yarn == 1
667
667
  cmd << '--frozen-lockfile'
668
668
  elsif !flag
@@ -698,13 +698,14 @@ module Squared
698
698
  '--force'
699
699
  elsif nolockfile?(prefix: 'pnpm')
700
700
  '--no-lockfile'
701
- elsif option('ci')
701
+ elsif option('ci') || (ci? && exist?('pnpm-lock.yaml'))
702
702
  '--frozen-lockfile'
703
703
  end
704
704
  cmd << '--ignore-scripts' if option('ignore-scripts')
705
705
  cmd << '--dangerously-allow-all-builds' if option('approve-builds')
706
706
  else
707
- cmd = session('npm', (ci = option('ci', prefix: 'npm')) ? 'ci' : 'install')
707
+ ci = option('ci', prefix: 'npm') || (ci? && exist?('package-lock.json'))
708
+ cmd = session('npm', ci ? 'ci' : 'install')
708
709
  option('approve-scripts') do |val|
709
710
  cmd = npm_output 'approve-scripts'
710
711
  cmd << case val
@@ -873,7 +874,7 @@ module Squared
873
874
  pending = 0
874
875
  modified = 0
875
876
  width = ->(a, i) { a.map { |aa| aa[i] }.max_by(&:size).size }
876
- pad = ->(val, ord) { val.succ.to_s.rjust([ord.size.to_s.size, 2].max) }
877
+ pad = ->(a, n) { n.succ.to_s.rjust([a.size.to_s.size, 2].max) }
877
878
  footer = lambda do |val, size|
878
879
  return unless verbose
879
880
 
@@ -889,7 +890,7 @@ module Squared
889
890
  if !found.empty?
890
891
  col1 = width.call(found, 0) + 4
891
892
  col2 = width.call(found, 1) + 4
892
- col3 = pad.call(found.size, found).size + 2 + col1 + col2 + width.call(found, 2)
893
+ col3 = pad.call(found, found.size).size + 2 + col1 + col2 + width.call(found, 2)
893
894
  packages = []
894
895
  pat = ->(a) { /("#{Regexp.escape(a[0])}"\s*:\s*)"([~^])#{'?' if a[4]}#{Regexp.escape(a[1])}"/ }
895
896
  edit = lambda do |a, pkg, mod|
@@ -911,21 +912,21 @@ module Squared
911
912
  end
912
913
  a = a.ljust(col1)
913
914
  b = b.ljust(col2)
914
- sub_style! b, theme[:current] if theme[:current] && !stdin?
915
+ b = sub_style b, theme[:current] if theme[:current] && !stdin?
915
916
  if cur == -1
916
917
  c = 'SKIP'
917
918
  elsif modified == cur
918
919
  c = 'FAIL'
919
920
  elsif !stdin?
920
921
  if d == 1
921
- sub_style! a, theme[:major]
922
- sub_style! c, :bold, color(:green)
922
+ a = sub_style a, theme[:major]
923
+ c = sub_style c, :bold, color(:green)
923
924
  else
924
- sub_style!(c, **opt_style(color(d == 3 ? :green : :yellow), SEM_VER, d))
925
+ c = sub_style(c, **opt_style(color(d == 3 ? :green : :yellow), SEM_VER, d))
925
926
  end
926
927
  g = item
927
928
  end
928
- s = "#{pad.call(i, found)}. #{a}#{b}#{c}"
929
+ s = "#{pad.call(found, i)}. #{a}#{b}#{c}"
929
930
  if se
930
931
  items << [s, g]
931
932
  next
@@ -994,11 +995,11 @@ module Squared
994
995
  b = sub_style b.ljust(col2), color(d ? :red : :yellow)
995
996
  c = c.ljust(col3)
996
997
  unless d
997
- sub_style! a, theme[:active]
998
- sub_style! c, color(:green)
998
+ a = sub_style a, theme[:active]
999
+ c = sub_style c, color(:green)
999
1000
  pending += 1
1000
1001
  end
1001
- puts "#{pad.call(i, avail)}. #{(a + c + b).subhint(d ? 'locked' : 'latest')}"
1002
+ puts "#{pad.call(avail, i)}. #{(a + c + b).subhint(d ? 'locked' : 'latest')}"
1002
1003
  end
1003
1004
  footer.call(0, avail.size)
1004
1005
  else
@@ -1380,7 +1381,7 @@ module Squared
1380
1381
  print_run(cmd, banner, **kwargs)
1381
1382
  session 'npx', cmd
1382
1383
  start = time_epoch if kwargs.fetch(:verbose, verbose? && !stdin?)
1383
- ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from)
1384
+ ret = run(sync: sync, banner: banner, exception: exception?(**kwargs), from: from)
1384
1385
  print_status(name, subject: 'tsc', start: start) if success?(ret, banner, start.nil?) && start
1385
1386
  ret
1386
1387
  end
@@ -1621,10 +1622,10 @@ module Squared
1621
1622
  modules.rmtree
1622
1623
  rescue Timeout::Error => e
1623
1624
  puts
1624
- print_error(e, hint: modules, pass: true)
1625
+ print_error(e, subject: name, hint: modules, pass: true)
1625
1626
  exit 1
1626
1627
  rescue => e
1627
- print_error(e, pass: true)
1628
+ print_error(e, subject: name, pass: true)
1628
1629
  false
1629
1630
  else
1630
1631
  true
@@ -19,10 +19,10 @@ module Squared
19
19
  setuptools=b try-first-with=q].freeze
20
20
  }.freeze
21
21
  OPT_PIP = {
22
- common: %w[debug disable-pip-version-check isolated no-cache-dir no-color no-input require-virtualenv
23
- q|quiet=+ v|verbose=+ cache-dir=p cert=p client-cert=p exists-action=b keyring-provider=b log=p
24
- proxy=q python=q resume-retries=i retries=i timeout=i trusted-host=b use-deprecated=b
25
- use-feature=b].freeze,
22
+ common: %w[debug disable-pip-version-check isolated no-cache-dir no-color no-input no-proxy-env
23
+ require-virtualenv q|quiet=+ v|verbose=+ cache-dir=p cert=p client-cert=p exists-action=b
24
+ keyring-provider=b log=p proxy=q python=q resume-retries=i retries=i timeout=i trusted-host=b
25
+ use-deprecated=b use-feature=b].freeze,
26
26
  cache: %w[format=b].freeze,
27
27
  completion: %w[b|bash f|fish p|powershell z|zsh].freeze,
28
28
  config: %w[global user site editor=p].freeze,
@@ -35,12 +35,12 @@ module Squared
35
35
  no-warn-conflicts no-warn-script-location U|upgrade user prefix=p report=p root=p
36
36
  root-user-action=b t|target=p upgrade-strategy=b].freeze,
37
37
  install_a: %w[no-index pre prefer-binary all-releases=b extra-index-url=q f|find-links=q i|index-url=q
38
- no-binary=q only-binary=q only-final=b].freeze,
39
- install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps require-hashes use-pep517
40
- build-constraint=p c|constraint=p group=q progress-bar=b r|requirement=p
41
- requirements-from-script=p src=p].freeze,
38
+ no-binary=q only-binary=q only-final=b refresh-package=q uploaded-prior-to=q].freeze,
39
+ install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps no-require-hashes only-deps
40
+ require-hashes use-pep517 build-constraint=p c|constraint=p group=q progress-bar=b
41
+ r|requirement=p requirements-from-script=p src=p].freeze,
42
42
  install_c: %w[C|config-settings=q e|editable=v].freeze,
43
- install_d: %w[ignore-requires-python uploaded-prior-to=q].freeze,
43
+ install_d: %w[ignore-requires-python].freeze,
44
44
  hash: %w[a|algorithm].freeze,
45
45
  list: %w[e|editable exclude-editable include-editable l|local not-required o|outdated u|uptodate user
46
46
  exclude=b format=b path=p].freeze,
@@ -749,7 +749,7 @@ module Squared
749
749
  end
750
750
  end
751
751
  print_run(op, banner, **kwargs)
752
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: :python)
752
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: :python)
753
753
  end
754
754
 
755
755
  def pip(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -831,7 +831,7 @@ module Squared
831
831
  op.clear
832
832
  end
833
833
  print_run(op, banner, **kwargs)
834
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: symjoin('pip', flag))
834
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: symjoin('pip', flag))
835
835
  .yield_self { |val| ret || val }
836
836
  end
837
837
 
@@ -1089,12 +1089,12 @@ module Squared
1089
1089
  def singleopt(flag = nil)
1090
1090
  case flag
1091
1091
  when :python
1092
- /\A(?:v+|q+|b+|V+|O+)\z/
1092
+ /\A(v+|q+|b+|V+|O+)\z/
1093
1093
  when :pdm, :poetry
1094
1094
  /\Av+\z/
1095
1095
  when :twine, :meson then nil
1096
1096
  else
1097
- /\A(?:v+|q+)\z/
1097
+ /\A(v+|q+)\z/
1098
1098
  end
1099
1099
  end
1100
1100
 
@@ -1112,19 +1112,18 @@ module Squared
1112
1112
  def pipopts(flag)
1113
1113
  ret = OPT_PIP.fetch(flag, []) + OPT_PIP[:common]
1114
1114
  if pip_install?(flag)
1115
- ret.concat(OPT_PIP[:install_a])
1115
+ ret.concat(OPT_PIP[:install_a], OPT_PIP[:install_d])
1116
1116
  ret.concat(OPT_PIP[:install_b]) unless flag == :index
1117
- ret.concat(OPT_PIP[:install_d])
1118
1117
  case flag
1119
1118
  when :install
1120
- ret.concat(OPT_PIP[:install_c] + OPT_PIP[:debug])
1119
+ ret.concat(OPT_PIP[:install_c], OPT_PIP[:debug])
1121
1120
  when :lock, :wheel
1122
1121
  ret.concat(OPT_PIP[:install_c])
1123
1122
  when :download, :index
1124
1123
  ret.concat(OPT_PIP[:debug])
1125
1124
  end
1126
1125
  elsif flag == :list
1127
- ret.concat(OPT_PIP[:install_a])
1126
+ ret.concat(OPT_PIP[:install_a], OPT_PIP[:install_d])
1128
1127
  end
1129
1128
  ret
1130
1129
  end
@@ -21,24 +21,25 @@ 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
- rdbg: %w[no-color no-rc no-sigint-hook c|command n|nonstop stop-at-load cookie=q e=q host=q x|init-script=p
24
+ rdbg: %w[e=q no-color no-rc no-sigint-hook c|command n|nonstop stop-at-load cookie=q host=q x|init-script=p
25
25
  O|open=q? port=i port-range=b session-name=q sock-path=q util=q].freeze,
26
26
  rbs: %w[I=pm r=bm no-collection no-stdlib collection=p log-level=b log-output=p repo=p].freeze,
27
- rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
28
- display-only-correctable display-only-fail-level-offenses display-only-failed
29
- display-only-safe-correctable S|display-style-guide display-time disable-uncorrectable editor-mode
30
- enable-pending-cops E|extra-details F|fail-fast force-default-config force-exclusion x|fix-layout
31
- ignore-disable-comments ignore-parent-exclusion ignore-unrecognized-cops init l|lint
32
- list-enabled-cops-for=p L|list-target-files lsp memory no-detach only-guide-cops
33
- only-recognized-file-types no-exclude-limit profile raise-cop-error regenerate-todo
34
- restart-server safe server-status start-server stderr stop-server C|cache=b cache-root=p config=p
35
- exclude-limit=i fail-level=b f|format=b except=q only=q o|out=p plugin=p require=p show-cops=q
36
- show-docs-url=q s|stdin=p].freeze,
27
+ rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug diff disable-all-cops
28
+ disable-pending-cops display-only-correctable display-only-fail-level-offenses display-only-failed
29
+ display-only-safe-correctable S|display-style-guide display-suppressed display-time
30
+ disable-uncorrectable editor-mode enable-pending-cops E|extra-details F|fail-fast
31
+ force-default-config force-exclusion x|fix-layout ignore-disable-comments ignore-parent-exclusion
32
+ ignore-unrecognized-cops init l|lint L|list-target-files lsp mcp memory no-detach no-exclude-limit
33
+ only-guide-cops only-recognized-file-types profile raise-cop-error regenerate-todo
34
+ report-unused-todo-entries restart-server safe server-status start-server stderr stop-server
35
+ verbose-version C|cache=b cache-root=p changed=b config=p exclude-limit=i fail-level=b f|format=b
36
+ except=q list-enabled-cops-for=p only=q o|out=p plugin=p require=p show-cops=q show-docs-url=q
37
+ s|stdin=p].freeze,
37
38
  pry: %w[f e=q I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
38
39
  d|disable-plugin=q gem=b r|require=bm s|select-plugin=q].freeze,
39
40
  no: {
40
41
  rubocop: %w[auto-gen-enforced-style auto-gen-only-exclude auto-gen-timestamp color display-cop-names
41
- offense-counts parallel server].freeze
42
+ offense-counts parallel preview server].freeze
42
43
  }
43
44
  }.freeze
44
45
  OPT_BUNDLE = {
@@ -226,9 +227,10 @@ module Squared
226
227
  serve_set kwargs[:serve]
227
228
  gemfile_set kwargs[:gemspec]
228
229
  self.autodetect = autodetect
229
- @bundle = { exec: exec.is_a?(String) ? basepath!(exec) : false }
230
+ @bundle = { exec: exec.is_a?(String) ? basepath!(exec) : exec }
230
231
  @steepfile = basepath! steep if steep
231
- @rubocopfile = Pathname.new(rubocop).realpath rescue basepath!(Dir.home, '.rubocop.yml') if rubocop
232
+ rubocop = rootpath('.rubocop.yml', ascend: Dir.home) if rubocop == true
233
+ @rubocopfile = basepath! rubocop if rubocop
232
234
  @rubygems = kwargs.fetch(:rubygems, 0)
233
235
  return unless rakefile && @output[0].nil? && @copy.nil? && !version && !self.autodetect
234
236
 
@@ -565,7 +567,7 @@ module Squared
565
567
  task flag do |_, args|
566
568
  args = args.to_a
567
569
  multiline = case args.first
568
- when ';', '#'
570
+ when ';', /^#+$/
569
571
  args.shift
570
572
  else
571
573
  %w[## ;]
@@ -844,11 +846,11 @@ module Squared
844
846
  def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
845
847
  cmd = bundle_output 'outdated'
846
848
  if flag
847
- se = has_value!(opts, 's', 'select')
849
+ se = has_value! opts, 's', 'select'
848
850
  ia = has_value!(opts, 'i', 'interactive') && !se
849
- up = has_value!(opts, 'u', 'update')
851
+ up = has_value! opts, 'u', 'update'
850
852
  opts << 'only-explicit' if has_value!(opts, 'e', 'explicit')
851
- dryrun = has_value!(opts, 'd', 'dry-run')
853
+ dryrun = has_value! opts, 'd', 'dry-run'
852
854
  if !sync || stdin?
853
855
  se = false
854
856
  ia = false
@@ -1039,7 +1041,7 @@ module Squared
1039
1041
  end
1040
1042
  end
1041
1043
  print_run(op, banner, **kwargs) unless flag
1042
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from || :ruby)
1044
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: from || :ruby)
1043
1045
  end
1044
1046
 
1045
1047
  def gem(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1416,7 +1418,7 @@ module Squared
1416
1418
  op.clear(errors: true) if gems
1417
1419
  print_run(op, banner, **kwargs)
1418
1420
  run(banner: banner && %w[q silent quiet no-verbose].none? { |s| op.include?(shell_option(s)) },
1419
- exception: kwargs.fetch(:exception, exception?), from: from)
1421
+ exception: exception?(**kwargs), from: from)
1420
1422
  end
1421
1423
 
1422
1424
  def bundle(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1553,7 +1555,7 @@ module Squared
1553
1555
  op.clear
1554
1556
  end
1555
1557
  print_run(op, banner, **kwargs)
1556
- ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?),
1558
+ ret = run(sync: sync, banner: banner, exception: exception?(**kwargs),
1557
1559
  from: symjoin('bundle', flag))
1558
1560
  success?(ret, banner, output)
1559
1561
  end
@@ -1566,7 +1568,7 @@ module Squared
1566
1568
  op.append(escape: true)
1567
1569
  print_run(op, banner, **kwargs)
1568
1570
  var = { 'BANNER' => '0' } unless banner
1569
- run(op, var, sync: sync, banner: false, exception: kwargs.fetch(:exception, exception?), from: :rake)
1571
+ run(op, var, sync: sync, banner: false, exception: exception?(**kwargs), from: :rake)
1570
1572
  end
1571
1573
 
1572
1574
  def irb(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:irb], **kwargs)
@@ -1594,7 +1596,7 @@ module Squared
1594
1596
  op.concat(args)
1595
1597
  op.append(quote: false, delim: true)
1596
1598
  print_run(op, banner, **kwargs)
1597
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: :rdbg)
1599
+ run(banner: false, exception: exception?(**kwargs), from: :rdbg)
1598
1600
  end
1599
1601
 
1600
1602
  def rbs(flag, *args, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1643,7 +1645,7 @@ module Squared
1643
1645
  op.clear
1644
1646
  .append(*args)
1645
1647
  print_run(op, banner, **kwargs)
1646
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: symjoin('rbs', flag))
1648
+ run(banner: false, exception: exception?(**kwargs), from: symjoin('rbs', flag))
1647
1649
  end
1648
1650
  end
1649
1651
 
@@ -1666,13 +1668,13 @@ module Squared
1666
1668
  op.append(delim: true)
1667
1669
  .clear(errors: true)
1668
1670
  print_run(op, banner, **kwargs)
1669
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: :rubocop)
1671
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: :rubocop)
1670
1672
  end
1671
1673
 
1672
1674
  def serve(root, *, bind: nil, port: 3000, **kwargs)
1673
1675
  require 'webrick'
1674
1676
  rescue LoadError => e
1675
- print_error(e, pass: true)
1677
+ print_error(e, subject: name, hint: 'webrick', pass: true)
1676
1678
  else
1677
1679
  config = kwargs.merge({ DocumentRoot: root })
1678
1680
  config[:BindAddress] = bind if bind
@@ -1860,7 +1862,7 @@ module Squared
1860
1862
  op.concat(args)
1861
1863
  op.append(delim: delim)
1862
1864
  print_run(op, banner, **kwargs)
1863
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: from)
1865
+ run(banner: false, exception: exception?(**kwargs), from: from)
1864
1866
  end
1865
1867
 
1866
1868
  def ruby_session(*cmd, **kwargs)
@@ -219,6 +219,7 @@ module Squared
219
219
  end
220
220
 
221
221
  attr_reader :target, :extras, :found, :errors, :values, :project, :path, :sep
222
+ attr_accessor :stdout
222
223
 
223
224
  def_delegators :@target, :+, :-, :<<, :any?, :none?, :include?, :add, :add?, :find, :find_all, :find_index,
224
225
  :merge, :compact, :delete, :delete?, :delete_if, :grep, :grep_v, :inspect, :to_a, :to_s
@@ -241,14 +242,16 @@ module Squared
241
242
  @sep = sep
242
243
  @errors = []
243
244
  @found = []
245
+ @stdout = false
244
246
  parse(list, opts, **kwargs, &blk)
245
247
  end
246
248
 
247
249
  def parse(list, opts = extras, no: nil, single: nil, args: false, multiple: nil, first: nil, underscore: nil,
248
- explicit: false, bool: %w[true false], stdin: false, &blk)
250
+ explicit: false, bool: %w[true false], auto: [], stdin: false, &blk)
249
251
  @extras = []
250
252
  @values = []
251
253
  bare = []
254
+ auto = auto.flat_map { |val| val.split('|', 2) }
252
255
  e = []
253
256
  b = []
254
257
  m = []
@@ -350,6 +353,7 @@ module Squared
350
353
  tr = ->(a) { a.map { |val| val.tr('-', '_') } }
351
354
  @values.concat(tr.call(@values))
352
355
  bare.concat(tr.call(bare))
356
+ auto.concat(tr.call(auto))
353
357
  e.concat(tr.call(e))
354
358
  b.concat(tr.call(b))
355
359
  m.concat(tr.call(m))
@@ -363,6 +367,7 @@ module Squared
363
367
  ml.concat(tr.call(ml))
364
368
  no.concat(tr.call(no))
365
369
  end
370
+ bare.concat(auto)
366
371
  if target.is_a?(JoinSet)
367
372
  target.multiple = multiple if multiple
368
373
  target.multiple = ml.map { |val| val.size == 1 ? "-#{val}" : "--#{val}" }
@@ -395,6 +400,10 @@ module Squared
395
400
  add "#{sw[opt]}#{opt}"
396
401
  else
397
402
  add(opt.size == 1 ? "-#{opt}" : "--#{opt}")
403
+ if auto.include?(opt)
404
+ @stdout = true
405
+ break
406
+ end
398
407
  end
399
408
  elsif opt.start_with?(/no[-_]/) && no.include?(s = opt[3..-1])
400
409
  add "--no-#{s}"
@@ -408,17 +417,23 @@ module Squared
408
417
  if opt =~ OPT_VALUE
409
418
  key = $1
410
419
  val = $2
420
+ if val =~ QUOTE_VALUE
421
+ val = $2
422
+ double = $1 == '"'
423
+ end
411
424
  get = ->(h) { h[key] || h.find { |k,| k.end_with?(':*') }.last }
412
425
  kwargs = { sep: se[key] || sep, merge: has.call(m, key), switch: sw[key] }
426
+ kwargs[:double] = double unless double.nil?
413
427
  if has.call(e, key) || (has.call(bl, key) && bool.include?(val))
414
428
  add shell_option(key, val, **kwargs)
415
429
  elsif has.call(ex, key) && bool.include?(val)
416
430
  add shell_option(key, val, explicit: explicit, **kwargs)
417
431
  elsif has.call(q, key)
418
- add quote_option(key, val, double: has.call(qq, key), **kwargs)
432
+ kwargs[:double] = true if has.call(qq, key)
433
+ add quote_option(key, val, **kwargs)
419
434
  elsif has.call(p, key)
420
- if val =~ QUOTE_VALUE
421
- add shell_option(key, val, double: $1 == '"', escape: false, **kwargs)
435
+ if !double.nil?
436
+ add shell_option(key, val, escape: false, **kwargs)
422
437
  elsif path
423
438
  add quote_option(key, path + val, **kwargs)
424
439
  else
@@ -449,7 +464,7 @@ module Squared
449
464
  end
450
465
  opt = key unless opt == last
451
466
  elsif has.call(m, key = opt[0]) && opt[1..-1] =~ QUOTE_VALUE
452
- add basic_option(key, $2, double: $1 == '"', **kwargs, merge: true)
467
+ add basic_option(key, $2, double: $1 == '"' || has.call(qq, key), **kwargs, merge: true)
453
468
  opt = key
454
469
  else
455
470
  push opt
@@ -815,6 +830,10 @@ module Squared
815
830
  end
816
831
  end
817
832
 
833
+ def style?(*args)
834
+ !stdout && args.none?(&:!)
835
+ end
836
+
818
837
  def uniq!(list)
819
838
  list = uniq list
820
839
  return if list.empty?
@@ -281,7 +281,7 @@ module Squared
281
281
  env('REPO_OPTIONS', **kwargs) { |val| cmd << val } if options
282
282
  cmd = cmd.join(' ')
283
283
  puts log_message(cmd, subject: main, hint: root) if verbose
284
- Common::System.shell(cmd, chdir: root, exception: exception)
284
+ Common::System.shell(cmd, chdir: root, exception: exception || env('REPO_FAIL', equals: %w[1 true]))
285
285
  end
286
286
 
287
287
  def repo_bin
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.8.4
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 4.0.19
129
+ rubygems_version: 4.0.20
130
130
  specification_version: 4
131
131
  summary: Rake task generator for managing multi-language workspaces.
132
132
  test_files: []