squared 0.6.16 → 0.6.17

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: a26491045e0e9a54898e1d36dd86702354e6ae5c13fd26f81cb8a3f40a495782
4
- data.tar.gz: 945d788953e1a6fc6fbd8630d68653fd19b1e4f70fb2ffce4645661ffe4ed00e
3
+ metadata.gz: 2390f7c0bb110d16dd19ad08cd75e166953b9cccf7c57215301ae997fd05bbe2
4
+ data.tar.gz: e91ec4e023247fd9ce4faf5e4f95a8b2723f801fd2b15bccd47ba7c519c674da
5
5
  SHA512:
6
- metadata.gz: 8cd5453e7e5a42d466eaf17b56775ac19b2d7e1c2e2a04d2d4daf68bc4ca0700cbed58037c70f0bd101e9e55f0667f2cee30e014714548cf6d05dbb1390bc9bb
7
- data.tar.gz: 68bc4817d3f0ea3d99197e23dad1e21f94ad70dbc0c1afb96cbc4fab5e6bc9a7fcf85a8e6c80d90616367ea5cbe7db92cebdf95207c6a299d5ed2d68cf781edd
6
+ metadata.gz: b53882da825e403432228e0e83aa152ffb4846ae6a1f73a49b26ffc796b16c6cd78dcaafd356a39c26c96c77370c7a644bd20ca9329493dd6eeee4bc90323fd5
7
+ data.tar.gz: 2117e0d6c0bdcb1c31ad6acdf6aaa05322abe820060dd76683a93ed8d96f7c0b9183d37db5ca3df55949b852b83ea4713c9f7d99158ac44de1c1433102c0960e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.17] - 2026-08-06
4
+
5
+ ### Added
6
+
7
+ - NPM command install can bypass engines with ENV and engine-strict=false.
8
+
9
+ ### Fixed
10
+
11
+ - Ruby command gem action push interactive file selector did nothing.
12
+ - Git choice prompt did not permit optional empty values.
13
+
14
+ ## [0.4.40] - 2026-08-06
15
+
16
+ ### Changed
17
+
18
+ - Series method exclude? was made compatible with v0.8 signature.
19
+
3
20
  ## [0.6.16] - 2026-07-04
4
21
 
5
22
  ### Added
@@ -1740,6 +1757,7 @@
1740
1757
 
1741
1758
  - Changelog was created.
1742
1759
 
1760
+ [0.6.17]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.17
1743
1761
  [0.6.16]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.16
1744
1762
  [0.6.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.15
1745
1763
  [0.6.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.14
@@ -1783,6 +1801,7 @@
1783
1801
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1784
1802
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1785
1803
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1804
+ [0.4.40]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.40
1786
1805
  [0.4.39]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.39
1787
1806
  [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1788
1807
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
@@ -91,6 +91,13 @@ module Squared
91
91
  VAR[key.is_a?(::String) ? key.to_sym : key] = val
92
92
  end
93
93
 
94
+ def __arg__(key, name = nil, &blk)
95
+ ret = ARG[key.to_sym]
96
+ return ret unless name && ret.is_a?(::Hash)
97
+
98
+ ret[name = name.downcase] || (block_given? ? ret.fetch(name.to_sym, &blk) : ret[name.to_sym])
99
+ end
100
+
94
101
  def __freeze__
95
102
  PATH.freeze
96
103
  ARG.freeze
@@ -81,7 +81,7 @@ module Squared
81
81
  end}] "
82
82
  end
83
83
  end
84
- between = ->(s) { s.match?(/^\d+$/) && s.to_i.between?(min, max) }
84
+ between = ->(s) { s.match?(/^\d+$/) && s.to_i.between?(min, max <= min ? Float::INFINITY : max) }
85
85
  Timeout.timeout(timeout) do
86
86
  while (ch = Readline.readline(msg))
87
87
  unless (ch = ch.strip).empty?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.6.16'
4
+ VERSION = '0.6.17'
5
5
  end
@@ -1409,7 +1409,7 @@ module Squared
1409
1409
  def env(key, default = nil, suffix: nil, equals: nil, ignore: nil, strict: false)
1410
1410
  name = "#{key}_#{@envname}"
1411
1411
  ret = if suffix
1412
- ENV.fetch("#{name}_#{suffix}", '')
1412
+ ENV["#{name}_#{suffix}"] || (ignore == false && ENV["#{key}_#{suffix}"]) || ''
1413
1413
  elsif strict
1414
1414
  ENV[name].to_s
1415
1415
  else
@@ -1711,7 +1711,7 @@ module Squared
1711
1711
  end
1712
1712
 
1713
1713
  def append_hash(data, target: @session || [], build: false)
1714
- if build && (type = env('BUILD', suffix: 'TYPE') || ENV['BUILD_TYPE'])
1714
+ if build && (type = env('BUILD', suffix: 'TYPE', ignore: false))
1715
1715
  if (extra = data[type = "__#{type}__"] || data[type.to_sym]).is_a?(Hash)
1716
1716
  data = data.merge(extra)
1717
1717
  else
@@ -1918,8 +1918,8 @@ module Squared
1918
1918
  args
1919
1919
  end
1920
1920
 
1921
- def confirm_basic(msg, hint, default = 'Y', style: :inline, target: @session, prefix: nil, **kwargs)
1922
- return true if prefix ? option('y', prefix: prefix) : target && option('y', target: target)
1921
+ def confirm_basic(msg, hint, default = 'Y', style: :inline, target: @session, prefix: target&.first, **kwargs)
1922
+ return true if option('y', prefix: prefix)
1923
1923
 
1924
1924
  confirm("#{msg} [#{sub_style(hint.to_s, style.is_a?(Symbol) ? theme[style] : style)}]", default, **kwargs)
1925
1925
  end
@@ -2516,6 +2516,10 @@ module Squared
2516
2516
  ARG[:BANNER] && !env('BANNER', equals: '0')
2517
2517
  end
2518
2518
 
2519
+ def dryrun?(*, target: @session, prefix: target&.first)
2520
+ Array(target).include?('--dry-run') || !option('dry-run', target: target, prefix: prefix).nil?
2521
+ end
2522
+
2519
2523
  def pwd?
2520
2524
  path == Pathname.pwd
2521
2525
  end
@@ -141,7 +141,6 @@ module Squared
141
141
  end
142
142
  File.write(@revfile, JSON.pretty_generate(@revdoc))
143
143
  rescue StandardError => e
144
- log&.debug e
145
144
  warn log_warn(e, pass: true) if warning
146
145
  ensure
147
146
  @revlock = false
@@ -2021,7 +2020,7 @@ module Squared
2021
2020
  ret = choice_index('Choose a commit', git_spawn(cmd, stdout: false), column: /^(\S+)/, force: force, **kwargs)
2022
2021
  case ret
2023
2022
  when Array
2024
- ret.map!(&:stripstyle)
2023
+ ret.map { |val| val&.stripstyle }
2025
2024
  when String
2026
2025
  ret.stripstyle
2027
2026
  else
@@ -2197,10 +2196,6 @@ module Squared
2197
2196
  stdout: stdout, banner: banner, **kwargs)
2198
2197
  end
2199
2198
 
2200
- def dryrun?(*, target: @session, prefix: target&.first)
2201
- Array(target).include?('--dry-run') || !option('dry-run', target: target, prefix: prefix).nil?
2202
- end
2203
-
2204
2199
  def quiet?(*, target: @session, **)
2205
2200
  return silent? unless target
2206
2201
 
@@ -7,8 +7,8 @@ module Squared
7
7
  OPT_NPM = {
8
8
  common: %w[dry-run=!? force=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
9
9
  install: %w[package-lock-only=!? prefer-dedupe=!? E|save-exact=!? before=q cpu=b libc=b os=b].freeze,
10
- install_a: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!? install-links=!?
11
- package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
10
+ install_a: %w[audit=! bin-links=! engine-strict=!? foreground-scripts=!? fund=! ignore-scripts=!?
11
+ install-links=!? package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
12
12
  install_b: %w[no-save B|save-bundle D|save-dev O|save-optional save-peer P|save-prod g|global=!?
13
13
  S|save=!?].freeze,
14
14
  run: %w[foreground-scripts=!? if-present=!? ignore-scripts=!? script-shell=p].freeze,
@@ -586,8 +586,7 @@ module Squared
586
586
  cmd << '--ignore-scripts' if option('ignore-scripts')
587
587
  cmd << '--dangerously-allow-all-builds' if option('approve-builds')
588
588
  else
589
- cmd = session 'npm'
590
- cmd << (ci = option('ci') ? 'ci' : 'install')
589
+ cmd = session('npm', (ci = option('ci', prefix: 'npm')) ? 'ci' : 'install')
591
590
  option('approve-scripts') do |val|
592
591
  cmd = npm_output 'approve-scripts'
593
592
  cmd << case val
@@ -601,6 +600,14 @@ module Squared
601
600
  print_run cmd, silent?
602
601
  run(cmd, banner: false)
603
602
  end
603
+ option('engine-strict', ignore: false) do |val|
604
+ cmd << case val
605
+ when '0', 'false'
606
+ '--engine-strict=false'
607
+ else
608
+ '--engine-strict'
609
+ end
610
+ end
604
611
  cmd << '--workspaces=false' if ws
605
612
  cmd << '--force' if option('force')
606
613
  append_nocolor
@@ -1359,8 +1366,8 @@ module Squared
1359
1366
  end
1360
1367
 
1361
1368
  def remove_modules(prefix = dependbin)
1362
- modules = basepath 'node_modules'
1363
- return false unless modules.directory? && confirm_basic('Remove?', modules, prefix: prefix)
1369
+ modules = basepath!('node_modules', type: 'd')
1370
+ return false unless modules && confirm_basic('Remove?', modules, prefix: prefix)
1364
1371
 
1365
1372
  modules.rmtree
1366
1373
  rescue Timeout::Error => e
@@ -31,8 +31,8 @@ module Squared
31
31
  root-user-action=b t|target=p upgrade-strategy=b].freeze,
32
32
  install_a: %w[ignore-requires-python no-index pre prefer-binary all-releases=b extra-index-url=q
33
33
  f|find-links=q i|index-url=q no-binary=q only-binary=q only-final=b uploaded-prior-to=q].freeze,
34
- install_b: %w[build-constraint check-build-dependencies no-build-isolation no-clean no-deps
35
- require-hashes use-pep517 c|constraint=p group=q progress-bar=b r|requirement=p
34
+ install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps require-hashes use-pep517
35
+ build-constraint=p c|constraint=p group=q progress-bar=b r|requirement=p
36
36
  requirements-from-script=p src=p].freeze,
37
37
  install_c: %w[C|config-settings=q e|editable=v].freeze,
38
38
  hash: %w[a|algorithm].freeze,
@@ -185,7 +185,7 @@ module Squared
185
185
  log.warn "run script #{n} of #{list.size}".subhint('out of range')
186
186
  end
187
187
  else
188
- case i
188
+ case (i > 1 && poetry? ? 0 : i)
189
189
  when 0
190
190
  found |= 1
191
191
  run(session_output('poetry', 'run', val), from: :run)
@@ -936,6 +936,7 @@ module Squared
936
936
  buffer = []
937
937
  filter = kwargs.fetch(:filter, {})
938
938
  semver = filter[:semver]
939
+ dryrun = filter[:dryrun] || dryrun?(prefix: 'gem')
939
940
  update = if sync && filter[:select]
940
941
  semver ||= 'major'
941
942
  items = []
@@ -1089,7 +1090,7 @@ module Squared
1089
1090
  'user-install'
1090
1091
  end
1091
1092
  end
1092
- if filter[:dryrun]
1093
+ if dryrun
1093
1094
  print_run gem_output('update -f', *update.quote!), false
1094
1095
  else
1095
1096
  gem(:update, *update, opts: opts)
@@ -1131,8 +1132,8 @@ module Squared
1131
1132
  .clear(pass: false)
1132
1133
  end
1133
1134
  when :push
1134
- if op.empty? || (n = op.index(':'))
1135
- file = basepath(if !n && (spec = gemspec)
1135
+ if op.empty? || ia
1136
+ file = basepath(if !ia && (spec = gemspec)
1136
1137
  "#{spec.name}-#{spec.version}.gem"
1137
1138
  else
1138
1139
  choice_index 'Select a file', Dir.glob('*.gem', base: path)
@@ -246,8 +246,9 @@ module Squared
246
246
  already_invoked? parallel, val
247
247
  end
248
248
 
249
- def exclude?(key, empty = false)
250
- @exclude.include?(key) || (empty && (!key?(key) || self[key].empty?))
249
+ def exclude?(key, fallback = false, empty: nil)
250
+ fallback = empty unless empty.nil?
251
+ @exclude.include?(key) || (fallback && (!key?(key) || self[key].empty?))
251
252
  end
252
253
 
253
254
  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.6.16
4
+ version: 0.6.17
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.10
127
+ rubygems_version: 4.0.15
128
128
  specification_version: 4
129
129
  summary: Rake task generator for managing multi-language workspaces.
130
130
  test_files: []