squared 0.8.7 → 0.8.8

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: 671df38fde0cf8e19a5edf52d76aedba0d3eb294e7eaeed1bc32e63ca50b5e37
4
- data.tar.gz: 1f87dfbe1fb9881d0d5a2ae023a4e4f14e353bd30368afcc0b45e6cd7e5c3beb
3
+ metadata.gz: dabd702e6d76fec691fb926ac596d794146c3eaa6688d2c65c8506525ef18d56
4
+ data.tar.gz: 0fa0f20be1f5b9fba992764320d07336b827f46178920a0ff7070efff269d997
5
5
  SHA512:
6
- metadata.gz: ea1eda6ca2addd9593a414c453eaa7450e31309f91ce56077732e0bc24297d23901a177ec8fd3740ccbdf92e19ec0c4473720e344508ba365fb44a745deda65f
7
- data.tar.gz: bf9ac431a644fa2fd532bf33aff3bba1a1b9a52a0e8e2ec7b724df2bcfec41760aa00378034a099e0da60a47b21778581bae5a31700c9a5c9d7e0a816d715a6d
6
+ metadata.gz: 2c5afc38add70c38951a8b30f92d6d205c354a6d8b1e59ea8d7bc47f789b7c180ec4e71b90ecec91ca69e5126f8570f6e34cbce0bca3ffc3d8191a705be85f6a
7
+ data.tar.gz: 5db957c61a34ea75e1ed09e8d2c0fb4b6a7832bf08c9e10254013645408598b59dd75eeb3c49cba40f5f51dd6ac7ca22f64108a71fea44a1ede192e4e74250bb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.8] - 2026-11-04
4
+
5
+ - See `0.7.15`.
6
+
7
+ ## [0.7.15]
8
+
9
+ ### Added
10
+
11
+ - Git command commit action pathspec was implemented.
12
+ - Common base argument TAB for column alignment was created.
13
+ - Node command package action deny can modify currently approved scripts.
14
+
15
+ ### Changed
16
+
17
+ - Node command package action [approve|deny] uses install-scripts ls.
18
+
19
+ ### Fixed
20
+
21
+ - Bundle exec wrapper as a Hash did not support using alternate Gemfile.
22
+ - Common base ARG data objects were not frozen with __freeze__.
23
+
3
24
  ## [0.8.7] - 2026-10-22
4
25
 
5
26
  ### Added
@@ -2181,6 +2202,7 @@
2181
2202
 
2182
2203
  - Changelog was created.
2183
2204
 
2205
+ [0.8.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.8
2184
2206
  [0.8.7]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.7
2185
2207
  [0.8.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.6
2186
2208
  [0.8.5]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.5
@@ -2189,6 +2211,7 @@
2189
2211
  [0.8.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.2
2190
2212
  [0.8.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.1
2191
2213
  [0.8.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.0
2214
+ [0.7.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.15
2192
2215
  [0.7.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.14
2193
2216
  [0.7.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.13
2194
2217
  [0.7.12]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.12
data/README.md CHANGED
@@ -10,11 +10,11 @@
10
10
  | 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 | |
11
11
  | 2025-01-07 | 0.2.0 | | 3.4.0 | |
12
12
  | 2025-02-07 | 0.3.0 | | 3.4.1 | |
13
- | 2025-03-06 | 0.4.0 | | 3.4.2 | * |
13
+ | 2025-03-06 | 0.4.0 | | 3.4.2 | |
14
14
  | 2025-06-16 | 0.5.0 | 2.5.0 | 3.4.4 | |
15
15
  | ---------- | ----- | ----- | ----- | --- |
16
16
  | 2025-08-23 | 0.5.5 | | 3.4.5 | |
17
- | 2025-10-31 | 0.6.0 | | 3.4.7 | * |
17
+ | 2025-10-31 | 0.6.0 | | 3.4.7 | |
18
18
  | 2026-01-07 | 0.7.0 | 2.5.0 | 4.0.0 | * |
19
19
  | 2026-06-16 | 0.8.0 | | 4.0.5 | * |
20
20
 
@@ -13,6 +13,7 @@ module Squared
13
13
  STRICT: false,
14
14
  BANNER: true,
15
15
  CHOICE: 25,
16
+ TAB: 4,
16
17
  QUOTE: "'",
17
18
  SPACE: ' => ',
18
19
  SUCCESS: 'Success',
@@ -101,6 +102,7 @@ module Squared
101
102
 
102
103
  def __freeze__
103
104
  PATH.freeze
105
+ ARG.each_value { |val| val.freeze if val.is_a?(::Hash) || val.is_a?(::Array) }
104
106
  ARG.freeze
105
107
  VAR.each_value(&:freeze)
106
108
  VAR[:theme].each_value { |val| val.freeze.each_value(&:freeze) }
@@ -296,7 +296,7 @@ module Squared
296
296
  if footer
297
297
  unless sub.empty? && !right
298
298
  footer.map! do |s|
299
- s = s.rjust(n + 4) if right
299
+ s = s.rjust(n + ARG[:TAB]) if right
300
300
  sub.each { |h| sub_style!(s, **h) }
301
301
  s
302
302
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.8.7'
4
+ VERSION = '0.8.8'
5
5
  end
@@ -974,7 +974,7 @@ module Squared
974
974
  end
975
975
  pad = cols.map(&:size).max
976
976
  cols.each { |key| puts "#{g + f} #{key.rjust(pad)}: #{Array(data[key]).join(', ')}" }
977
- w = 9 + flag.to_s.size + 4 + ee.size
977
+ w = 9 + flag.to_s.size + ARG[:TAB] + ee.size
978
978
  puts g + sub_style(ARG[:BORDER][6] + (ARG[:BORDER][1] * w), theme[:inline])
979
979
  index += 1
980
980
  next unless confirm("#{h + b}?", no ? 'N' : 'Y')
@@ -364,7 +364,7 @@ module Squared
364
364
  subtasks({
365
365
  'branch' => %i[create track delete move copy list all current].freeze,
366
366
  'checkout' => %i[commit branch track detach path].freeze,
367
- 'commit' => %i[head add all amend amend-orig fixup].freeze,
367
+ 'commit' => %i[head add all pathspec amend amend-orig fixup].freeze,
368
368
  'clone' => %i[branch tag].freeze,
369
369
  'diff' => %i[head branch files view between contain].freeze,
370
370
  'range-diff' => %i[view between contain].freeze,
@@ -533,7 +533,7 @@ module Squared
533
533
  if flag == :add
534
534
  opts = param_guard(action, flag, args: args.to_a)
535
535
  elsif (refs = args.to_a).empty?
536
- refs = readline('Enter file patterns', force: true).shellsplit
536
+ refs = readline('Enter glob patterns', force: true).shellsplit
537
537
  end
538
538
  end
539
539
  commit(flag, opts, refs: refs, ref: ref, squash: squash, pick: pick)
@@ -1798,7 +1798,7 @@ module Squared
1798
1798
  pathspec = false if pick == 'reword'
1799
1799
  end
1800
1800
  if pathspec.nil?
1801
- pathspec = if (flag == :fixup || amend) && refs.size == 1 && refs.first == '*'
1801
+ pathspec = if (flag == :pathspec || flag == :fixup || amend) && refs.size == 1 && refs.first == '*'
1802
1802
  '--all'
1803
1803
  elsif (refs = projectmap(refs)).empty?
1804
1804
  raise 'no qualified pathspec'
@@ -11,7 +11,7 @@ module Squared
11
11
  install_a: %w[audit=! bin-links=! engine-strict=!? foreground-scripts=!? fund=! ignore-scripts=!?
12
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
- S|save=!?].freeze,
14
+ min-release-age=i min-release-age-exclude=q S|save=!?].freeze,
15
15
  install_c: %w[allow-directory=b? allow-file=b? allow-git=b? allow-remote=b?].freeze,
16
16
  run: %w[foreground-scripts=!? if-present=!? ignore-scripts=!? script-shell=p].freeze,
17
17
  exec: %w[c|call=q package=b].freeze,
@@ -329,26 +329,39 @@ module Squared
329
329
  when 'package'
330
330
  case flag
331
331
  when :approve, :deny
332
- format_desc action, flag, 'name*|:,opts*'
332
+ format_desc(action, flag, 'opts*', before: flag == :approve ? 'name*|:' : 'name*|:|::')
333
333
  task flag do |_, args|
334
334
  args = args.to_a
335
- if choice!(args)
335
+ if choice!(args) || (flag == :deny && (all = choice!(args, char: '::')))
336
+ list = []
337
+ pad = 0
338
+ size = ->(s) { pad = [pad, s.size].max }
336
339
  pwd_set do
337
- pad = 0
338
- list = IO.popen(npm_output('approve-scripts --allow-scripts-pending').to_s)
339
- .each_with_object([]) do |line, out|
340
- next unless line =~ /^\s+([a-z\d@][^@]*)@(\S+)/
341
-
342
- pad = [pad, $1.size].max
343
- out << [$1, $2]
344
- end
345
- .map { |name, ver| name.ljust(pad + 4) + ver }
346
- if list.empty?
347
- puts log_message('no packages to review', subject: name, hint: "#{flag}-scripts")
348
- exit 0
340
+ json = JSON.parse(`#{npm_output('install-scripts ls --json')}`)
341
+ json&.fetch('allowScripts', [])&.each do |data|
342
+ line = data['changes']&.find { |item| item['change'] == 'pending' }
343
+ next unless line && line['key'] =~ /^(.+)@([^@]+)$/
344
+
345
+ size.call($1)
346
+ list << [$1, $2]
347
+ end
348
+ if all
349
+ current = read_package 'allowScripts'
350
+ current&.each_pair do |key, val|
351
+ next unless val
352
+
353
+ md = key.match(/^(.+?)(?:@([^@]+))?$/)
354
+ size.call(md[1])
355
+ list << [md[1], sub_style(md[2] || 'any', theme[:inline])]
356
+ end
349
357
  end
350
- args.concat(choice_index('Select packages', list, multiple: true, column: /^(\S+)/))
351
358
  end
359
+ if list.empty?
360
+ puts log_message('no packages to review', subject: name, hint: "#{flag}-scripts")
361
+ exit 0
362
+ end
363
+ list.map! { |name, ver| name.ljust(pad + ARG[:TAB]) + ver }
364
+ args.concat(choice_index('Select packages', list, multiple: true, column: /^(\S+)/))
352
365
  end
353
366
  package flag, args
354
367
  end
@@ -886,9 +899,9 @@ module Squared
886
899
  end
887
900
  print_item banner unless sync
888
901
  if !found.empty?
889
- col1 = width.call(found, 0) + 4
890
- col2 = width.call(found, 1) + 4
891
- col3 = pad.call(found, found.size).size + 2 + col1 + col2 + width.call(found, 2)
902
+ col1 = width.call(found, 0) + ARG[:TAB]
903
+ col2 = width.call(found, 1) + ARG[:TAB]
904
+ col3 = pad.call(found, found.size).size + (ARG[:TAB] / 2) + col1 + col2 + width.call(found, 2)
892
905
  packages = []
893
906
  pat = ->(a) { /("#{Regexp.escape(a[0])}"\s*:\s*)"([~^])#{'?' if a[4]}#{Regexp.escape(a[1])}"/ }
894
907
  edit = lambda do |a, pkg, mod|
@@ -984,9 +997,9 @@ module Squared
984
997
  end
985
998
  end
986
999
  elsif !avail.empty?
987
- col1 = width.call(avail, 0) + 4
1000
+ col1 = width.call(avail, 0) + ARG[:TAB]
988
1001
  col2 = width.call(avail, 1)
989
- col3 = width.call(avail, 2) + 4
1002
+ col3 = width.call(avail, 2) + ARG[:TAB]
990
1003
  avail.each_with_index do |item, i|
991
1004
  a, b, c, d = item
992
1005
  a = a.ljust(col1)
@@ -752,7 +752,7 @@ module Squared
752
752
  op.clear
753
753
  else
754
754
  op.exist?(add: true, first: true) unless op.arg?('m')
755
- op.append(escape: kwargs.fetch(:escape, false), quote: kwargs.fetch(:quote, false))
755
+ op.append(context: kwargs)
756
756
  end
757
757
  end
758
758
  print_run(op, banner, **kwargs)
@@ -949,7 +949,7 @@ module Squared
949
949
  end
950
950
  s = '%2d. %s' % [start, line]
951
951
  if ia
952
- unless confirm_semver(s.ljust(col + 4 + line.size - n), type)
952
+ unless confirm_semver(s.ljust(col + ARG[:TAB] + line.size - n), type)
953
953
  start += 1
954
954
  next
955
955
  end
@@ -1037,7 +1037,7 @@ module Squared
1037
1037
  if op.arg?('e')
1038
1038
  op.clear
1039
1039
  else
1040
- op.append(delim: true, escape: kwargs.fetch(:escape, false), quote: kwargs.fetch(:quote, false))
1040
+ op.append(delim: true, context: kwargs)
1041
1041
  end
1042
1042
  end
1043
1043
  print_run(op, banner, **kwargs) unless flag
@@ -1376,10 +1376,10 @@ module Squared
1376
1376
  end
1377
1377
  if flag == :install
1378
1378
  op.append_any(escape: true)
1379
+ op.delim << post if post
1379
1380
  else
1380
1381
  op.append(escape: true)
1381
1382
  end
1382
- op.delim << post if post
1383
1383
  when :check, :cleanup, :contents, :fetch, :list, :lock, :rdoc
1384
1384
  op.append
1385
1385
  when :dependency, :info, :search
@@ -1907,24 +1907,20 @@ module Squared
1907
1907
  end
1908
1908
 
1909
1909
  def bundle_args(*args)
1910
- if (val = @bundle[:exec])
1911
- app = args.first
1912
- if val.is_a?(Hash)
1913
- env = val[app.to_s] || val[app.to_sym]
1914
- return args unless env
1915
-
1916
- val = env.is_a?(String) ? basepath!(env) : true
1917
- elsif app == 'ruby'
1918
- return args
1919
- end
1920
- if val.is_a?(String)
1921
- return args unless (val = basepath!(val))
1910
+ return args unless (val = @bundle[:exec])
1922
1911
 
1923
- args.unshift("--gemfile=#{shell_escape(val.relative_path_from(path), quote: true)}")
1924
- end
1925
- args.unshift('bundle', 'exec')
1912
+ app = args.first
1913
+ if val.is_a?(Hash)
1914
+ val = val[app.to_s] || val[app.to_sym]
1915
+ elsif app == 'ruby'
1916
+ return args
1917
+ end
1918
+ case val
1919
+ when String, Pathname
1920
+ val = basepath!(val, type: 'f')
1921
+ args.unshift("--gemfile=#{shell_escape(val.relative_path_from(path), quote: true)}") if val
1926
1922
  end
1927
- args
1923
+ val ? args.unshift('bundle', 'exec') : args
1928
1924
  end
1929
1925
 
1930
1926
  def bundle_load
@@ -59,10 +59,10 @@ module Squared
59
59
  ret.map! do |val|
60
60
  next val if opt?(val)
61
61
 
62
- if !(pa = val.is_a?(Pathname)) && escape
63
- shell_escape(val, quote: quote, double: double)
64
- elsif quote || pa
62
+ if (quote && !escape) || val.is_a?(Pathname)
65
63
  shell_quote(val, double: double, **kwargs)
64
+ elsif escape
65
+ shell_escape(val, quote: quote, double: double)
66
66
  else
67
67
  val
68
68
  end
@@ -486,7 +486,11 @@ module Squared
486
486
  self
487
487
  end
488
488
 
489
- def append(*args, clear: false, preserve: '"', **kwargs, &blk)
489
+ def append(*args, clear: false, preserve: '"', context: nil, **kwargs, &blk)
490
+ if context
491
+ kwargs[:escape] = context.fetch(:escape, false) unless kwargs.key?(:escape)
492
+ kwargs[:quote] = context.fetch(:quote, false) unless kwargs.key?(:quote)
493
+ end
490
494
  args = clear ? extras.dup.tap { extras.clear } : extras if args.empty?
491
495
  pass = kwargs[:pass] ||= []
492
496
  OptionPartition.append(target, *args, preserve: preserve, **kwargs, &blk)
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.7
4
+ version: 0.8.8
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.23
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: []