squared 0.5.21 → 0.5.22

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: 422d0fe6f69fab606e4b0a218c2f4faae43fe6bb24a2e66f7e37ef2d0685019a
4
- data.tar.gz: 53761c954112ee12a3f22756a2d140b2a86db9c6a0f6113ea05a3aa32f95f52a
3
+ metadata.gz: '06381e5c59519169c2d591b16869b5d8cf241dbf5b0dc8a84ba697da432e9aa3'
4
+ data.tar.gz: 0f4f6b05caa95e9ac59540505c1eb56825817cd1bff9ff46abe3fd11b1a53918
5
5
  SHA512:
6
- metadata.gz: 46c2e2f4a935003a2a773e157760b928d23445e57a1d2c4663eae322ac02b3f3b96091a1e122457c91621b7693199cb1f15f1ebea0f5349f8f536b1ac4cc3d06
7
- data.tar.gz: 79e1beaddef54cad59db12a5ca864babe97933636f129f9797338d710bc0d928f38c1beb5882028a87670ea6aec217646ffafd6227ca7bd6b106ed77557f8f69
6
+ metadata.gz: e1f1afdae59763ad88da3466a07c8f1acbea78d3738173bc9ba13606b0977a2bddec6b31ce49eb5e2b7ce5b1e952da53573da51ba3e693b2dcefbce3f90f9f46
7
+ data.tar.gz: 8a6eef1e7cd3f666091714cdce7e171efc36d9e662e1f14e77e983bb9d017b6bfef8ae5cf4e34f4c55ea1852ef4e7fc65a7b050f1841ba8633771456e4caba7d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.22] - 2026-03-11
4
+
5
+ - Project base run command was not covered due to lack of type checking.
6
+
7
+ ## [0.4.36] - 2026-03-11
8
+
9
+ ### Added
10
+
11
+ - Python venv initialization installs setuptools when detected.
12
+ - Node task depend adds prod option flags when NODE_ENV=production.
13
+
14
+ ### Changed
15
+
16
+ - Application method with using hide and pass compatibility was implemented.
17
+
18
+ ### Fixed
19
+
20
+ - Docker task clean does not run in parallel without ENV override.
21
+ - OptionPartition methods with escape parameter were reordered.
22
+ - OptionPartition methods with quote parameter were revised.
23
+
3
24
  ## [0.5.21] - 2025-12-31
4
25
 
5
26
  ### Fixed
@@ -1324,7 +1345,7 @@
1324
1345
  - Rake did not set original rakefile when calling itself.
1325
1346
  - Extended tasks were not associated to their supporting class method.
1326
1347
 
1327
- ## [0.1.0] - 2024-12-7
1348
+ ## [0.1.0] - 2024-12-07
1328
1349
 
1329
1350
  ### Added
1330
1351
 
@@ -1345,12 +1366,13 @@
1345
1366
  - Git pull did not display colors for diff bar chart.
1346
1367
  - Git commit did not fetch latest refs before submitting.
1347
1368
 
1348
- ## [0.0.12] - 2024-12-1
1369
+ ## [0.0.12] - 2024-12-01
1349
1370
 
1350
1371
  ### Added
1351
1372
 
1352
1373
  - Changelog was created.
1353
1374
 
1375
+ [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
1354
1376
  [0.5.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.21
1355
1377
  [0.5.20]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.20
1356
1378
  [0.5.19]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.19
@@ -1373,6 +1395,7 @@
1373
1395
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1374
1396
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1375
1397
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1398
+ [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1376
1399
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
1377
1400
  [0.4.34]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.34
1378
1401
  [0.4.33]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.33
@@ -188,7 +188,9 @@ module Squared
188
188
  end
189
189
  if hint.nil? ? args.size > 1 : !hint
190
190
  title = log_title(level, color: false)
191
- sub = [pat: /\A(#{Regexp.escape(title)})(.*)\z/m, styles: __get__(:theme)[:logger][log_sym(level)]] if color
191
+ if color
192
+ sub = [{ pat: /\A(#{Regexp.escape(title)})(.*)\z/m, styles: __get__(:theme)[:logger][log_sym(level)] }]
193
+ end
192
194
  emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub, pipe: -1)
193
195
  else
194
196
  msg = [log_title(level, color: color)]
@@ -239,6 +241,8 @@ module Squared
239
241
  lines = val.to_s.lines(chomp: true)
240
242
  lines[0] = "#{val.class}: #{lines.first}" if (err = val.is_a?(::StandardError))
241
243
  end
244
+ return if lines.empty?
245
+
242
246
  n = cols || max.call(lines)
243
247
  if $stdout.tty?
244
248
  require 'io/console'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.5.21'
4
+ VERSION = '0.5.22'
5
5
  end
@@ -178,8 +178,25 @@ module Squared
178
178
  self
179
179
  end
180
180
 
181
- def with(*val, pass: false, group: nil, **kwargs, &blk)
182
- return self if pass == true || (pass && as_a(pass, :to_s).any? { |s| respond_to?(s) && __send__(s) rescue nil })
181
+ def with(*val, hide: nil, group: nil, **kwargs, &blk)
182
+ if hide.nil? && kwargs.key?(:pass)
183
+ pass = kwargs[:pass]
184
+ case pass
185
+ when true, false
186
+ hide = pass
187
+ kwargs.delete(:pass)
188
+ else
189
+ hide, pass = Array(pass).partition { |s| respond_to?(s) || s.to_s.end_with?('?') }
190
+ if pass.empty?
191
+ kwargs.delete(:pass)
192
+ elsif hide.empty?
193
+ hide = nil
194
+ else
195
+ kwargs[:pass] = pass
196
+ end
197
+ end
198
+ end
199
+ return self if hide == true || (hide && Array(hide).any? { |s| respond_to?(s) && __send__(s) rescue nil })
183
200
 
184
201
  @group = nil
185
202
  @ref = nil
@@ -817,7 +834,7 @@ module Squared
817
834
  ' (sync)'
818
835
  end}"
819
836
  emphasize(grp, title: title, cols: [cols, title.size].max, border: theme[:border],
820
- sub: [pat: /\A(Step \d+)(.*)\z/, styles: theme[:header]])
837
+ sub: [{ pat: /\A(Step \d+)(.*)\z/, styles: theme[:header] }])
821
838
  end
822
839
  end
823
840
  end
@@ -499,7 +499,7 @@ module Squared
499
499
  args[0] = instance_eval(&blk) || f
500
500
  return unless args.first
501
501
  end
502
- if args.all? { |val| val.is_a?(Array) }
502
+ if args.all?(Array)
503
503
  cmd = []
504
504
  var = {}
505
505
  args.each do |val|
@@ -1184,6 +1184,8 @@ module Squared
1184
1184
  else
1185
1185
  items = check.call(data[start])
1186
1186
  end
1187
+ return done if items.empty?
1188
+
1187
1189
  if out
1188
1190
  a, b, c, d, e = ARG[:GRAPH]
1189
1191
  f = tag.call(target)
@@ -1950,7 +1952,7 @@ module Squared
1950
1952
  ret = []
1951
1953
  if data[:command]
1952
1954
  ret[0] = data[:command]
1953
- ret[1] = data[:opts] unless diso
1955
+ ret[1] = data[:opts] unless noopt
1954
1956
  ret[3] = data[:args]
1955
1957
  elsif data[:script]
1956
1958
  ret[1] = data[:script]
@@ -1959,12 +1961,12 @@ module Squared
1959
1961
  else
1960
1962
  ret[0] = false
1961
1963
  end
1962
- ret[2] = data[:env] unless dise
1964
+ ret[2] = data[:env] unless noenv
1963
1965
  ret
1964
1966
  end
1965
1967
  case cmd
1966
1968
  when Array
1967
- @output = if cmd.all? { |data| data.is_a?(Hash) }
1969
+ @output = if cmd.all?(Hash)
1968
1970
  noopt = false
1969
1971
  noenv = false
1970
1972
  cmd.map { |data| parse.call(data) }
@@ -254,8 +254,8 @@ module Squared
254
254
  def clean(*, sync: invoked_sync?('clean'), **)
255
255
  if runnable?(@clean)
256
256
  super
257
- else
258
- image(:rm, sync: sync)
257
+ elsif sync || option('y', prefix: 'docker')
258
+ image :rm
259
259
  end
260
260
  end
261
261
 
@@ -1187,7 +1187,7 @@ module Squared
1187
1187
  { pat: /^(## )((?~\.{3}))(\.{3})(.+)$/, styles: [nil, g, nil, r], index: -1 }
1188
1188
  ]
1189
1189
  else
1190
- [pat: /^(\t+)([a-z]+: +.+)$/, styles: r, index: 2]
1190
+ [{ pat: /^(\t+)([a-z]+: +.+)$/, styles: r, index: 2 }]
1191
1191
  end
1192
1192
  end
1193
1193
  out, banner, from = source(io: true)
@@ -1910,7 +1910,7 @@ module Squared
1910
1910
  styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
1911
1911
  styles << :bold if styles.size <= 1
1912
1912
  puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
1913
- sub: [pat: /^(\d+)(.+)$/, styles: styles])
1913
+ sub: [{ pat: /^(\d+)(.+)$/, styles: styles }])
1914
1914
  end
1915
1915
  on :last, from
1916
1916
  end
@@ -5,7 +5,7 @@ module Squared
5
5
  module Project
6
6
  class Node < Git
7
7
  OPT_NPM = {
8
- common: %w[dry-run=!? include-workspace-root=!? loglevel=b workspaces=!? w|workspace=v].freeze,
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
10
  install_base: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!? install-links=!?
11
11
  package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
@@ -435,13 +435,18 @@ module Squared
435
435
 
436
436
  if (yarn = dependtype(:yarn)) > 0
437
437
  cmd = session 'yarn'
438
- if flag == :add
438
+ if !flag && yarn > 1 && prod?
439
+ cmd << 'workspaces focus --all --production'
440
+ elsif flag == :add
439
441
  cmd << 'add'
440
442
  cmd << "--#{save}" unless save == 'prod'
441
443
  cmd << '--exact' if exact
442
444
  else
443
445
  cmd << 'install'
444
- cmd << '--ignore-engines' if yarn == 1 && !option('ignore-engines', equals: '0')
446
+ if yarn == 1
447
+ cmd << '--production' if prod?
448
+ cmd << '--ignore-engines' unless option('ignore-engines', equals: '0')
449
+ end
445
450
  end
446
451
  elsif pnpm?
447
452
  cmd = session 'pnpm'
@@ -451,6 +456,7 @@ module Squared
451
456
  option('allow-build') { |val| cmd << quote_option('allow-build', val) }
452
457
  else
453
458
  cmd << 'install'
459
+ cmd << '--prod' if prod?
454
460
  append_platform
455
461
  end
456
462
  option('public-hoist-pattern') do |val|
@@ -465,6 +471,7 @@ module Squared
465
471
  cmd << "--save-#{save}"
466
472
  cmd << '--save-exact' if exact
467
473
  else
474
+ cmd << '--include=prod' if prod?
468
475
  append_platform
469
476
  end
470
477
  cmd << '--workspaces=false' if env('NODE_WORKSPACES', equals: '0')
@@ -693,8 +700,9 @@ module Squared
693
700
  pwd_set(from: from, dryrun: dryrun) do
694
701
  cmd = session_done cmd
695
702
  Open3.popen2e(cmd) do |_, out|
696
- write_lines(out, banner: format_banner(cmd),
697
- sub: npmnotice + [pat: /^(.+)(Tarball .+)$/, styles: color(:bright_blue), index: 2])
703
+ write_lines(out,
704
+ banner: format_banner(cmd),
705
+ sub: npmnotice + [{ pat: /^(.+)(Tarball .+)$/, styles: color(:bright_blue), index: 2 }])
698
706
  end
699
707
  end
700
708
  on :last, from
@@ -228,7 +228,7 @@ module Squared
228
228
  if args.empty?
229
229
  args = readline('Enter command', force: true).split(' ', 2)
230
230
  elsif args.size == 1 && !option('interactive', prefix: 'venv', equals: '0')
231
- args << readline('Enter arguments', force: false)
231
+ args << readline('Enter arguments', force: false) unless args.first.include?(' ')
232
232
  end
233
233
  venv_init
234
234
  run args.join(' ')
@@ -896,7 +896,11 @@ module Squared
896
896
  .clear(pass: false)
897
897
  .arg?(/\A-v+\z/)
898
898
  run(op, env, exception: true, banner: banner)
899
- install(:upgrade, ['poetry']) if poetry?
899
+ if poetry?
900
+ install(:upgrade, ['poetry'])
901
+ elsif setuptools?
902
+ install(:upgrade, ['setuptools', 'wheel'])
903
+ end
900
904
  puts(dir.directory? ? "Success: #{dir}" : 'Failed') if banner && !status
901
905
  end
902
906
 
@@ -537,7 +537,7 @@ module Squared
537
537
  `rvm current`[/^\S+/, 0]
538
538
  when 'rbenv'
539
539
  `rbenv version-name`.yield_self do |name|
540
- name.match?(SEM_VER) ? "ruby #{name}" : name
540
+ (name =~ SEM_VER) == 0 ? "ruby #{name}" : name
541
541
  end
542
542
  when 'chruby.sh'
543
543
  chruby = session_output 'source', val
@@ -806,7 +806,7 @@ module Squared
806
806
  else
807
807
  op.clear
808
808
  end
809
- elsif (n = op.index { |val| val.match?(/(\A|[a-z])@\d/) })
809
+ elsif (n = op.index { |val| val.match?(/(\A|[\w.-])@\d/) })
810
810
  name = op.delete_at(n)
811
811
  pre, ver = if (n = name.index('@')) == 0
812
812
  [gemname, name[1..-1]]
@@ -32,10 +32,10 @@ module Squared
32
32
  ret.map! do |val|
33
33
  next val if opt?(val)
34
34
 
35
- if quote || val.is_a?(Pathname)
36
- shell_quote(val, force: force, double: double)
37
- elsif escape
35
+ if !(pa = val.is_a?(Pathname)) && escape
38
36
  shell_escape(val, quote: quote, double: double)
37
+ elsif quote || pa
38
+ shell_quote(val, force: force, double: double)
39
39
  else
40
40
  val
41
41
  end
@@ -300,10 +300,13 @@ module Squared
300
300
  self
301
301
  end
302
302
 
303
- def append_any(*args, quote: true, **kwargs)
303
+ def append_any(*args, escape: false, **kwargs)
304
+ quote = kwargs.fetch(:quote, true)
304
305
  (args.empty? ? extras : args.flatten).each do |val|
305
306
  if exist?(val)
306
307
  add_path(val, **kwargs)
308
+ elsif escape
309
+ add shell_escape(val, **kwargs)
307
310
  elsif quote
308
311
  add_quote(val, **kwargs)
309
312
  else
@@ -427,6 +430,7 @@ module Squared
427
430
  end
428
431
 
429
432
  def add_quote(*args, **kwargs)
433
+ kwargs.delete(:quote)
430
434
  args.compact!
431
435
  merge(args.map! { |val| val == '--' || OptionPartition.opt?(val) ? val : shell_quote(val, **kwargs) })
432
436
  self
@@ -443,10 +447,12 @@ module Squared
443
447
  elsif exclude.first.is_a?(Symbol)
444
448
  partition(&exclude.first)
445
449
  else
450
+ exclude.map! { |pat| Regexp.new(pat) }
446
451
  partition do |val|
447
- next false if pattern && OptionPartition.pattern?(val)
452
+ val = val.to_s
453
+ next if pattern && OptionPartition.pattern?(val)
448
454
 
449
- exclude.none? { |pat| val.match?(Regexp.new(pat)) }
455
+ exclude.none? { |pat| val.match?(pat) }
450
456
  end
451
457
  end
452
458
  unless temp.empty?
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.5.21
4
+ version: 0.5.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham