squared 0.7.9 → 0.7.10

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: f6c6ff7f1f5a649c84d9fb799e3da482e39b75823629b78fcb5fa476473cbb43
4
- data.tar.gz: 29559d83bf196111dd046905b88f1680287524589deabdc4a80b8fb23ca0de0c
3
+ metadata.gz: bf477ce6ea561419bddfea1572f95762934d01c5d5e94bd3cd65e027a96bdcc8
4
+ data.tar.gz: ffbdcaea4e1a2dc293b75fe99c8e121baa444c8784175aa6117134921fb59e46
5
5
  SHA512:
6
- metadata.gz: 1987e693d59692f782d6c6b08c75b385efd384d96be5d73757d6068964408888d61e274dcc9444342d8d12a28cfc8628e186fbc71759e76a9cee9eef197c86ac
7
- data.tar.gz: 3cca9732ab404591931ccad9b48946d15e22cf1fc6d9fd06529a3b8b9216c0e3c9b8fafca79dab97c10e6d8917c656f7c9529182140e48cb47f7cd712e7157c7
6
+ metadata.gz: e86f20679d0f906ed3ae080963014c88f2b747dd5570d3e8bf0037f7f0d4670ce257dc6720b13d94fc8f044f16e89a535f09634f7cee8bc5d7061a2f8d2b7485
7
+ data.tar.gz: 41c08e924735c9626889f6075a3eb3b5a00bf8f9e9b487ccf29f9de161a3b93702ee1658ea9a73d323bceea31671ea08ab74f58ad83151a5e5bd2929351c6c60
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.10] - 2026-08-06
4
+
5
+ ### Fixed
6
+
7
+ - See `0.6.17`.
8
+
9
+ ## [0.6.17]
10
+
11
+ ### Added
12
+
13
+ - NPM command install can bypass engines with ENV and engine-strict=false.
14
+
15
+ ### Fixed
16
+
17
+ - Ruby command gem action push interactive file selector did nothing.
18
+ - Git choice prompt did not permit optional empty values.
19
+
20
+ ## [0.4.40]
21
+
22
+ ### Changed
23
+
24
+ - Series method exclude? was made compatible with v0.8 signature.
25
+
3
26
  ## [0.7.9] - 2026-07-04
4
27
 
5
28
  ### Added
@@ -1924,6 +1947,7 @@
1924
1947
 
1925
1948
  - Changelog was created.
1926
1949
 
1950
+ [0.7.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.10
1927
1951
  [0.7.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.9
1928
1952
  [0.7.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.8
1929
1953
  [0.7.7]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.7
@@ -1934,6 +1958,7 @@
1934
1958
  [0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
1935
1959
  [0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
1936
1960
  [0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
1961
+ [0.6.17]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.17
1937
1962
  [0.6.16]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.16
1938
1963
  [0.6.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.15
1939
1964
  [0.6.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.14
@@ -1977,6 +2002,7 @@
1977
2002
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1978
2003
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1979
2004
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
2005
+ [0.4.40]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.40
1980
2006
  [0.4.39]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.39
1981
2007
  [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1982
2008
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
@@ -92,6 +92,13 @@ module Squared
92
92
  VAR[key.is_a?(::String) ? key.to_sym : key] = val
93
93
  end
94
94
 
95
+ def __arg__(key, name = nil, &blk)
96
+ ret = ARG[key.to_sym]
97
+ return ret unless name && ret.is_a?(::Hash)
98
+
99
+ ret[name = name.downcase] || (block_given? ? ret.fetch(name.to_sym, &blk) : ret[name.to_sym])
100
+ end
101
+
95
102
  def __freeze__
96
103
  PATH.freeze
97
104
  ARG.freeze
@@ -80,7 +80,7 @@ module Squared
80
80
  end}] "
81
81
  end
82
82
  end
83
- between = ->(s) { s.match?(/^\d+$/) && s.to_i.between?(min, max) }
83
+ between = ->(s) { s.match?(/^\d+$/) && s.to_i.between?(min, max <= min ? Float::INFINITY : max) }
84
84
  Timeout.timeout(timeout) do
85
85
  while (ch = Readline.readline(msg))
86
86
  ch.strip!
@@ -332,8 +332,7 @@ module Squared
332
332
  'yaml'
333
333
  when 'js'
334
334
  'json'
335
- when ''
336
- nil
335
+ when '' then nil
337
336
  else
338
337
  ret
339
338
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.7.9'
4
+ VERSION = '0.7.10'
5
5
  end
@@ -1545,7 +1545,7 @@ module Squared
1545
1545
  def env(key, default = nil, suffix: nil, strict: false, ignore: nil, **kwargs, &blk)
1546
1546
  name = "#{key}_#{envname_get}"
1547
1547
  ret = if suffix
1548
- ENV.fetch("#{name}_#{suffix}", '')
1548
+ ENV["#{name}_#{suffix}"] || (ignore == false && ENV["#{key}_#{suffix}"]) || ''
1549
1549
  elsif strict
1550
1550
  ENV[name].to_s
1551
1551
  else
@@ -1897,7 +1897,7 @@ module Squared
1897
1897
  end
1898
1898
 
1899
1899
  def append_hash(data, target: @session || [], build: false)
1900
- if build && (type = env('BUILD', suffix: 'TYPE') || ENV['BUILD_TYPE'])
1900
+ if build && (type = env('BUILD', suffix: 'TYPE', ignore: false))
1901
1901
  if (extra = data[type = "__#{type}__"] || data[type.to_sym]).is_a?(Hash)
1902
1902
  data = data.merge(extra)
1903
1903
  else
@@ -2086,8 +2086,8 @@ module Squared
2086
2086
  args
2087
2087
  end
2088
2088
 
2089
- def confirm_basic(msg, hint, default = 'Y', style: :inline, target: @session, prefix: nil, **kwargs)
2090
- return true if prefix ? option('y', prefix: prefix) : target && option('y', target: target)
2089
+ def confirm_basic(msg, hint, default = 'Y', style: :inline, target: @session, prefix: target&.first, **kwargs)
2090
+ return true if option('y', prefix: prefix)
2091
2091
 
2092
2092
  confirm("#{msg} [#{sub_style(hint.to_s, style.is_a?(Symbol) ? theme[style] : style)}]", default, **kwargs)
2093
2093
  end
@@ -2700,6 +2700,10 @@ module Squared
2700
2700
  end
2701
2701
  end
2702
2702
 
2703
+ def dryrun?(*, target: @session, prefix: target&.first)
2704
+ Array(target).include?('--dry-run') || !option('dry-run', target: target, prefix: prefix).nil?
2705
+ end
2706
+
2703
2707
  def pwd?
2704
2708
  path == Pathname.pwd
2705
2709
  end
@@ -141,7 +141,6 @@ module Squared
141
141
  end
142
142
  File.write(@revfile, JSON.pretty_generate(@revdoc))
143
143
  rescue => e
144
- log&.debug e
145
144
  warn log_warn(e, pass: true) if warning
146
145
  ensure
147
146
  @revlock = false
@@ -2101,7 +2100,7 @@ module Squared
2101
2100
  ret = choice_index('Choose a commit', git_spawn(cmd, stdout: false), column: /^(\S+)/, force: force, **kwargs)
2102
2101
  case ret
2103
2102
  when Array
2104
- ret.map(&:stripstyle)
2103
+ ret.map { |val| val&.stripstyle }
2105
2104
  when String
2106
2105
  ret.stripstyle
2107
2106
  else
@@ -2279,10 +2278,6 @@ module Squared
2279
2278
  stdout: stdout, banner: banner, **kwargs)
2280
2279
  end
2281
2280
 
2282
- def dryrun?(*, target: @session, prefix: target&.first)
2283
- Array(target).include?('--dry-run') || !option('dry-run', target: target, prefix: prefix).nil?
2284
- end
2285
-
2286
2281
  def quiet?(*, target: @session, **)
2287
2282
  return silent? unless target
2288
2283
 
@@ -8,8 +8,8 @@ module Squared
8
8
  common: %w[dry-run=!? force=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
9
9
  common_scripts: %w[dangerously-allow-all-scripts=!? strict-allow-scripts=!? allow-scripts=q].freeze,
10
10
  install: %w[package-lock-only=!? prefer-dedupe=!? E|save-exact=!? before=q cpu=b libc=b os=b].freeze,
11
- install_a: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!? install-links=!?
12
- package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
11
+ install_a: %w[audit=! bin-links=! engine-strict=!? foreground-scripts=!? fund=! ignore-scripts=!?
12
+ install-links=!? package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
13
13
  install_b: %w[no-save B|save-bundle D|save-dev O|save-optional save-peer P|save-prod g|global=!?
14
14
  S|save=!?].freeze,
15
15
  install_c: %w[allow-directory=b? allow-file=b? allow-git=b? allow-remote=b?].freeze,
@@ -627,8 +627,7 @@ module Squared
627
627
  cmd << '--ignore-scripts' if option('ignore-scripts')
628
628
  cmd << '--dangerously-allow-all-builds' if option('approve-builds')
629
629
  else
630
- cmd = session 'npm'
631
- cmd << (ci = option('ci') ? 'ci' : 'install')
630
+ cmd = session('npm', (ci = option('ci', prefix: 'npm')) ? 'ci' : 'install')
632
631
  option('approve-scripts') do |val|
633
632
  cmd = npm_output 'approve-scripts'
634
633
  cmd << case val
@@ -654,6 +653,14 @@ module Squared
654
653
  quote_option 'allow-scripts', val
655
654
  end
656
655
  end
656
+ option('engine-strict', ignore: false) do |val|
657
+ cmd << case val
658
+ when '0', 'false'
659
+ '--engine-strict=false'
660
+ else
661
+ '--engine-strict'
662
+ end
663
+ end
657
664
  cmd << '--workspaces=false' if ws
658
665
  cmd << '--force' if option('force')
659
666
  append_nocolor
@@ -1463,8 +1470,7 @@ module Squared
1463
1470
  next if yarntype(exist: true) == 0
1464
1471
  when /^pnpm/
1465
1472
  next if pnpmtype(exist: true) == 0
1466
- when /^npm/
1467
- nil
1473
+ when /^npm/ then nil
1468
1474
  else
1469
1475
  next
1470
1476
  end
@@ -1518,8 +1524,8 @@ module Squared
1518
1524
  end
1519
1525
 
1520
1526
  def remove_modules(prefix = dependbin)
1521
- modules = basepath 'node_modules'
1522
- return false unless modules.directory? && confirm_basic('Remove?', modules, prefix: prefix)
1527
+ modules = basepath!('node_modules', type: 'd')
1528
+ return false unless modules && confirm_basic('Remove?', modules, prefix: prefix)
1523
1529
 
1524
1530
  modules.rmtree
1525
1531
  rescue Timeout::Error => e
@@ -36,9 +36,9 @@ module Squared
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
38
  no-binary=q only-binary=q only-final=b].freeze,
39
- install_b: %w[build-constraint check-build-dependencies no-build-isolation no-clean no-deps require-hashes
40
- use-pep517 c|constraint=p group=q progress-bar=b r|requirement=p requirements-from-script=p
41
- src=p].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,
42
42
  install_c: %w[C|config-settings=q e|editable=v].freeze,
43
43
  install_d: %w[ignore-requires-python uploaded-prior-to=q].freeze,
44
44
  hash: %w[a|algorithm].freeze,
@@ -181,8 +181,8 @@ module Squared
181
181
  format_desc action, nil, "script+|#{indexchar}index+|#,pattern*"
182
182
  task action, [:command] do |_, args|
183
183
  found = 0
184
- %w[tool.poetry.scripts tool.pdm.scripts project.scripts].each_with_index do |table, i|
185
- next if (list = read_pyproject(table)).empty?
184
+ %w[tool.poetry tool.pdm project].each_with_index do |table, i|
185
+ next if (list = read_pyproject("#{table}.scripts")).empty?
186
186
 
187
187
  if args.command == '#'
188
188
  format_list(list, "run[#{indexchar}N]", 'scripts', grep: args.extras, from: pyprojectfile)
@@ -208,7 +208,7 @@ module Squared
208
208
  log.warn "run script #{n} of #{list.size}".subhint('out of range')
209
209
  end
210
210
  else
211
- case i
211
+ case (i > 1 && poetry? ? 0 : i)
212
212
  when 0
213
213
  found |= 1
214
214
  run(session_output('poetry', 'run', val), from: :run)
@@ -297,7 +297,7 @@ module Squared
297
297
  install flag, ['upgrade', *args.to_a, 'pip']
298
298
  end
299
299
  when :freeze
300
- format_desc action, flag, "file?=#{DEP_PYTHON[4]},u/uninstall,opts*"
300
+ format_desc action, flag, "file?=#{DEP_PYTHON[4]},u/ninstall?,opts*"
301
301
  task flag do |_, args|
302
302
  opts = args.to_a
303
303
  if has_value!(opts, 'u', 'uninstall')
@@ -312,7 +312,7 @@ module Squared
312
312
  end
313
313
  file = pip(flag, opts: opts, banner: requirement.nil?, requirement: requirement)
314
314
  puts File.read(file) unless silent?
315
- if requirement && confirm_basic('Uninstall?', file)
315
+ if requirement && confirm_basic('Uninstall?', file, prefix: 'pip')
316
316
  pip(:uninstall, opts: ['y', "r=#{shell_quote(file)}"])
317
317
  end
318
318
  end
@@ -482,7 +482,7 @@ module Squared
482
482
  :patch
483
483
  end
484
484
  end
485
- '--not-required' if option('not-required', notequals: '0') && !env('PYTHON_DEFAULT')
485
+ '--not-required' if option('not-required', notequals: '0')
486
486
  end
487
487
  cmd << '--local' if option('l', 'local')
488
488
  append_global
@@ -607,17 +607,17 @@ module Squared
607
607
  project: self, strict: strict?, single: singleopt(flag))
608
608
  else
609
609
  op = append_pip(flag, opts, pipopts(:install), target: pip_session('install'))
610
- end
611
- case flag
612
- when :editable
613
- op << quote_option('e', op.pop || editable || '.')
614
- op.clear
615
- when :user, :upgrade
616
- op.concat(packages)
617
- raise_error ArgumentError, 'no packages listed', hint: flag if op.empty?
618
- op << "--#{flag}"
619
- op.append
620
- python_session('-m pip', *op.to_a.drop(1)) if workspace.windows?
610
+ case flag
611
+ when :editable
612
+ op << quote_option('e', op.pop || editable || '.')
613
+ op.clear
614
+ when :user, :upgrade
615
+ op.concat(packages)
616
+ raise_error ArgumentError, 'no packages listed', hint: flag if op.empty?
617
+ op << "--#{flag}"
618
+ op.append
619
+ python_session('-m pip', *op.to_a.drop(1)) if workspace.windows?
620
+ end
621
621
  end
622
622
  run(banner: banner, from: :install)
623
623
  end
@@ -798,8 +798,7 @@ module Squared
798
798
  raise_error 'no subcommand', hint: flag if op.empty?
799
799
  op << (action = op.shift)
800
800
  case action
801
- when 'dir', 'info', 'purge'
802
- nil
801
+ when 'dir', 'info', 'purge' then nil
803
802
  when 'list', 'remove'
804
803
  op.add_first(quote: true)
805
804
  else
@@ -811,8 +810,7 @@ module Squared
811
810
  raise_error 'no subcommand', hint: flag if op.empty?
812
811
  op << (action = op.shift)
813
812
  case action
814
- when 'list', 'edit', 'debug'
815
- nil
813
+ when 'list', 'edit', 'debug' then nil
816
814
  when 'get', 'unset', 'set'
817
815
  op.add_first
818
816
  op.add_first(quote: true, expect: true) if action == 'set'
@@ -1091,8 +1089,7 @@ module Squared
1091
1089
  /\A(?:v+|q+|b+|V+|O+)\z/
1092
1090
  when :pdm, :poetry
1093
1091
  /\Av+\z/
1094
- when :twine, :meson
1095
- nil
1092
+ when :twine, :meson then nil
1096
1093
  else
1097
1094
  /\A(?:v+|q+)\z/
1098
1095
  end
@@ -510,8 +510,7 @@ module Squared
510
510
  opts << 'redownload' if has_value!(opts, 'f', 'force')
511
511
  if (lock = basepath!('Gemfile.lock'))
512
512
  case (val = ENV['BUNDLE_FROZEN'])
513
- when '0', 'false'
514
- nil
513
+ when '0', 'false' then nil
515
514
  else
516
515
  if val
517
516
  print_error("BUNDLE_FROZEN: #{val}", loglevel: Logger::INFO, subject: name, hint: flag)
@@ -782,8 +781,7 @@ module Squared
782
781
  next if val == '0' || val == 'false'
783
782
 
784
783
  run(bundle_output('binstubs --all', case val
785
- when '1', 'true'
786
- nil
784
+ when '1', 'true' then nil
787
785
  else
788
786
  if val.start_with?('~')
789
787
  val = File.join(Dir.home, val == '~' ? '.bundle' : val[1..-1])
@@ -1074,6 +1072,7 @@ module Squared
1074
1072
  buffer = []
1075
1073
  filter = kwargs.fetch(:filter, {})
1076
1074
  semver = filter[:semver]
1075
+ dryrun = filter[:dryrun] || dryrun?(prefix: 'gem')
1077
1076
  update = if sync && filter[:select]
1078
1077
  semver ||= 'major'
1079
1078
  items = []
@@ -1226,7 +1225,7 @@ module Squared
1226
1225
  'user-install'
1227
1226
  end
1228
1227
  end
1229
- if filter[:dryrun]
1228
+ if dryrun
1230
1229
  print_run gem_output('update -f', *update.quote!(escape: true)), false
1231
1230
  else
1232
1231
  gem(:update, *update, opts: opts)
@@ -1268,8 +1267,8 @@ module Squared
1268
1267
  .clear(pass: false)
1269
1268
  end
1270
1269
  when :push
1271
- if op.empty? || (n = op.index(':'))
1272
- file = basepath(if !n && (spec = gemspec)
1270
+ if op.empty? || ia
1271
+ file = basepath(if !ia && (spec = gemspec)
1273
1272
  "#{spec.name}-#{spec.version}.gem"
1274
1273
  else
1275
1274
  choice_index 'Select a file', Dir.glob('*.gem', base: path)
@@ -1922,8 +1921,7 @@ module Squared
1922
1921
  val = case (val = $2)
1923
1922
  when 'true'
1924
1923
  true
1925
- when '', '[]'
1926
- nil
1924
+ when '', '[]' then nil
1927
1925
  else
1928
1926
  if val =~ /\A\[:(.+)\]\z/
1929
1927
  $1.split(', :').map { |s| (s[/\A"(.+)"\z/, 1] || s).to_sym }
@@ -184,8 +184,7 @@ module Squared
184
184
  end
185
185
  env('REPO_GROUPS', **envargs) do |val|
186
186
  g = case val
187
- when '0', 'false'
188
- nil
187
+ when '0', 'false' then nil
189
188
  else
190
189
  val
191
190
  end
@@ -209,8 +209,9 @@ module Squared
209
209
  already_invoked? parallel, val
210
210
  end
211
211
 
212
- def exclude?(key, empty = false)
213
- @exclude.include?(key) || (empty && (!key?(key) || self[key].empty?))
212
+ def exclude?(key, fallback = false, empty: nil)
213
+ fallback = empty unless empty.nil?
214
+ @exclude.include?(key) || (fallback && (!key?(key) || self[key].empty?))
214
215
  end
215
216
 
216
217
  private
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.7.9
4
+ version: 0.7.10
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.10
128
+ rubygems_version: 4.0.15
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []