squared 0.6.10 → 0.6.11

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: 51fbe5bab2648700b1859c3cf76d5960e1e6d02084281444e5113a02365ecfc6
4
- data.tar.gz: f3179ae97b2035233ac01856bd9f775462afb87183da51c3be34eb6357813f61
3
+ metadata.gz: e9559cf340c4a95816cc2853417bfb3c43053cf59cdd4e4b38fac0c074f41264
4
+ data.tar.gz: 60d6c5b20aa58e9606402745283948393253363ed38d5f15322be5d7cbfde7d5
5
5
  SHA512:
6
- metadata.gz: 368045e7cd2f56b56e95e5d5809346d69e87c41fb3a3b8f33af001844d0d18f63fc5f72abca10d166c7b6af51443dd52ddd2fd9ee72aff1fe67f38e9d7a02526
7
- data.tar.gz: e750addd94fab922f914ffd75b771c2b5710b64f4375229dc52d7b1129637a5eccd857a7fe39ba51254793f4e3de78c041d73c644accee0a083164abf3132fa4
6
+ metadata.gz: 0b34a0a55c607060040c027b19bc16b5ad93ba1403d753c45a75edadb3086f179b1e533b4d5058787b544012e0eda60d5e1b70ed9ff26c5fda65d55fd74b5513
7
+ data.tar.gz: 65478734cb5d093f3abb96022479ba3aec90b7b08741f0f924c348b06466dedb0a8db9d19e7d78e2d0f7cd26c874f7ff56d387323b943baa969097f2c97f37c5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.11] - 2026-03-11
4
+
5
+ ### Changed
6
+
7
+ - Git internal data calls do not write to logs.
8
+
9
+ ## [0.5.22] - 2026-03-11
10
+
11
+ - Project base run command was not covered due to lack of type checking.
12
+
13
+ ## [0.4.36] - 2026-03-11
14
+
15
+ ### Added
16
+
17
+ - Python venv initialization installs setuptools when detected.
18
+ - Node task depend adds prod option flags when NODE_ENV=production.
19
+
20
+ ### Fixed
21
+
22
+ - OptionPartition methods with escape parameter were reordered.
23
+ - OptionPartition methods with quote parameter were revised.
24
+
3
25
  ## [0.6.10] - 2025-02-23
4
26
 
5
27
  ### Added
@@ -1586,7 +1608,7 @@
1586
1608
  - Rake did not set original rakefile when calling itself.
1587
1609
  - Extended tasks were not associated to their supporting class method.
1588
1610
 
1589
- ## [0.1.0] - 2024-12-7
1611
+ ## [0.1.0] - 2024-12-07
1590
1612
 
1591
1613
  ### Added
1592
1614
 
@@ -1607,12 +1629,13 @@
1607
1629
  - Git pull did not display colors for diff bar chart.
1608
1630
  - Git commit did not fetch latest refs before submitting.
1609
1631
 
1610
- ## [0.0.12] - 2024-12-1
1632
+ ## [0.0.12] - 2024-12-01
1611
1633
 
1612
1634
  ### Added
1613
1635
 
1614
1636
  - Changelog was created.
1615
1637
 
1638
+ [0.6.11]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.11
1616
1639
  [0.6.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.10
1617
1640
  [0.6.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.9
1618
1641
  [0.6.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.8
@@ -1624,6 +1647,7 @@
1624
1647
  [0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
1625
1648
  [0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
1626
1649
  [0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
1650
+ [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
1627
1651
  [0.5.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.21
1628
1652
  [0.5.20]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.20
1629
1653
  [0.5.19]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.19
@@ -1646,6 +1670,7 @@
1646
1670
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1647
1671
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1648
1672
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1673
+ [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1649
1674
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
1650
1675
  [0.4.34]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.34
1651
1676
  [0.4.33]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.33
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.6.10'
4
+ VERSION = '0.6.11'
5
5
  end
@@ -251,7 +251,7 @@ module Squared
251
251
  print_error e
252
252
  end
253
253
  log[:progname] ||= @name
254
- env('LOG_LEVEL', ignore: false) { |val| log[:level] = val.start_with?(/\d/) ? log_sym(val.to_i) : val }
254
+ env('LOG_LEVEL', ignore: false) { |s| log[:level] = s.start_with?(/\d/) ? log_sym(s.to_i) : s }
255
255
  log.delete(:file)
256
256
  @log = [file, log]
257
257
  end
@@ -521,7 +521,7 @@ module Squared
521
521
  args[0] = instance_eval(&blk) || f
522
522
  return unless args.first
523
523
  end
524
- if args.all? { |val| val.is_a?(Array) }
524
+ if args.all?(Array)
525
525
  cmd = []
526
526
  var = {}
527
527
  args.each do |val|
@@ -841,7 +841,7 @@ module Squared
841
841
  ensure
842
842
  if dir
843
843
  remove_entry dir
844
- elsif delete && file&.exist?
844
+ elsif delete && file.exist?
845
845
  file.unlink
846
846
  end
847
847
  end
@@ -1323,17 +1323,17 @@ module Squared
1323
1323
  s += "#{indent || (last && data[final].last == context) ? ' ' : a} "
1324
1324
  k += 1
1325
1325
  end
1326
- s += "#{j ? d : c}#{b * 3} #{tag.call(proj)}"
1326
+ s + "#{j ? d : c}#{b * 3} #{tag.call(proj)}"
1327
1327
  end
1328
1328
  end
1329
1329
  if order
1330
1330
  n = order.size
1331
1331
  order[name] ||= if proj.parent
1332
- if order[s = proj.parent.name]
1333
- order[s] += 1
1332
+ if order[key = proj.parent.name]
1333
+ order[key] += 1
1334
1334
  n.pred
1335
1335
  else
1336
- order[s] = n.succ
1336
+ order[key] = n.succ
1337
1337
  n
1338
1338
  end
1339
1339
  else
@@ -2260,7 +2260,7 @@ module Squared
2260
2260
  ret = []
2261
2261
  if data[:command]
2262
2262
  ret[0] = data[:command]
2263
- ret[1] = data[:opts] unless diso
2263
+ ret[1] = data[:opts] unless noopt
2264
2264
  ret[3] = data[:args]
2265
2265
  elsif data[:script]
2266
2266
  ret[1] = data[:script]
@@ -2269,7 +2269,7 @@ module Squared
2269
2269
  else
2270
2270
  ret[0] = false
2271
2271
  end
2272
- ret[2] = data[:env] unless dise
2272
+ ret[2] = data[:env] unless noenv
2273
2273
  ret
2274
2274
  end
2275
2275
  self.global = global
@@ -2277,7 +2277,7 @@ module Squared
2277
2277
  when Hash
2278
2278
  @output = parse.call(data)
2279
2279
  when Enumerable
2280
- @output = if cmd.all? { |data| data.is_a?(Hash) }
2280
+ @output = if cmd.all?(Hash)
2281
2281
  noopt = false
2282
2282
  noenv = false
2283
2283
  cmd.map { |data| parse.call(data) }
@@ -426,7 +426,7 @@ module Squared
426
426
  end
427
427
  if squash
428
428
  found = false
429
- git_spawn(git_output('log --format=%h'), stdout: false).each do |val|
429
+ git_spawn('log --format=%h', stdout: false).each do |val|
430
430
  if found
431
431
  squash = val.chomp
432
432
  break
@@ -1888,22 +1888,22 @@ module Squared
1888
1888
  if io && banner == false
1889
1889
  from = nil
1890
1890
  banner = nil
1891
+ args = false
1891
1892
  else
1892
- if banner
1893
- banner = nil unless banner? && !multiple
1894
- args = true
1895
- end
1896
1893
  if from == false
1897
1894
  from = nil
1898
1895
  elsif !from && cmd.respond_to?(:drop)
1899
1896
  from = cmd.drop(1).find { |val| val.match?(/\A[a-z]{1,2}[a-z-]*\z/) }
1900
1897
  from &&= :"git:#{from}"
1901
1898
  end
1902
- banner &&= cmd.temp { |val| val.start_with?(/--(?:work-tree|git-dir)/) } if cmd.respond_to?(:temp)
1899
+ if banner
1900
+ banner = cmd.temp { |val| val.start_with?(/--(work-tree|git-dir)/) } if cmd.respond_to?(:temp)
1901
+ args = true
1902
+ end
1903
1903
  end
1904
1904
  cmd = session_done cmd
1905
- log&.info cmd
1906
- banner = if banner
1905
+ log&.info cmd unless args == false
1906
+ banner = if banner && banner? && !multiple
1907
1907
  format_banner(banner.is_a?(String) ? banner : cmd, hint: hint, strip: true)
1908
1908
  end
1909
1909
  on :first, from
@@ -2122,9 +2122,7 @@ module Squared
2122
2122
 
2123
2123
  def append_message(val = nil, target: @session)
2124
2124
  val = messageopt if val.to_s.empty?
2125
- return unless val
2126
-
2127
- target << quote_option('message', val)
2125
+ target << quote_option('message', val) if val
2128
2126
  end
2129
2127
 
2130
2128
  def append_head(val = nil, target: @session)
@@ -529,31 +529,36 @@ module Squared
529
529
  run(target.temp(*remove).sub!(/ (?:add|install) /, ' remove '), from: :remove, sync: sync)
530
530
  end
531
531
  if (yarn = dependtype(:yarn)) > 0
532
- cmd = session('yarn', flag || 'install')
533
- append_loglevel
534
- if yarn == 1
535
- cmd << '--ignore-engines' unless option('ignore-engines', equals: '0')
536
- cmd << '--ignore-scripts' if option('ignore-scripts')
537
- cmd << '--force' if option('force')
532
+ if !flag && yarn > 1 && prod?
533
+ cmd = session 'yarn', 'workspaces focus --all --production'
538
534
  else
539
- cmd << '--mode=skip-build' if option('ignore-scripts')
540
- cmd << '--check-cache' if !flag && option('force')
541
- end
542
- if nolockfile?('yarn')
543
- cmd << '--no-lockfile'
544
- elsif option('ci')
535
+ cmd = session('yarn', flag || 'install')
545
536
  if yarn == 1
546
- cmd << '--frozen-lockfile'
547
- elsif !flag
548
- cmd << '--immutable' << '--refresh-lockfile'
537
+ cmd << '--production' if prod?
538
+ cmd << '--ignore-engines' unless option('ignore-engines', equals: '0')
539
+ cmd << '--ignore-scripts' if option('ignore-scripts')
540
+ cmd << '--force' if option('force')
541
+ else
542
+ cmd << '--mode=skip-build' if option('ignore-scripts')
543
+ cmd << '--check-cache' if !flag && option('force')
544
+ end
545
+ if nolockfile?('yarn')
546
+ cmd << '--no-lockfile'
547
+ elsif option('ci')
548
+ if yarn == 1
549
+ cmd << '--frozen-lockfile'
550
+ elsif !flag
551
+ cmd << '--immutable' << '--refresh-lockfile'
552
+ end
553
+ end
554
+ if add
555
+ cmd << '-W' if yarn == 1 && !option('w', 'ignore-workspace-root-check', equals: '0')
556
+ rm.call(cmd)
557
+ om.call(cmd)
558
+ cmd << '--exact' if exact
549
559
  end
550
560
  end
551
- if add
552
- cmd << '-W' if yarn == 1 && !option('w', 'ignore-workspace-root-check', equals: '0')
553
- rm.call(cmd)
554
- om.call(cmd)
555
- cmd << '--exact' if exact
556
- end
561
+ append_loglevel
557
562
  elsif pnpm?
558
563
  cmd = session('pnpm', flag || 'install')
559
564
  append_nocolor
@@ -564,6 +569,7 @@ module Squared
564
569
  cmd << '--save-exact' if exact
565
570
  option('allow-build') { |val| cmd << quote_option('allow-build', val) }
566
571
  else
572
+ cmd << '--prod' if prod?
567
573
  append_platform
568
574
  end
569
575
  option('public-hoist-pattern') do |val|
@@ -588,6 +594,8 @@ module Squared
588
594
  if omit
589
595
  cmd << "--omit=#{save || omit}"
590
596
  save = nil
597
+ elsif !add && prod?
598
+ cmd << '--include=prod'
591
599
  end
592
600
  unless ci
593
601
  if add
@@ -1074,7 +1074,11 @@ module Squared
1074
1074
  .clear(pass: false)
1075
1075
  .arg?(/\A-v+\z/)
1076
1076
  ret = run(op, env, exception: true, banner: banner)
1077
- pip(:install, 'poetry', banner: false) if poetry?
1077
+ if poetry?
1078
+ pip(:install, 'poetry', banner: false)
1079
+ elsif setuptools?
1080
+ pip(:install, 'setuptools', 'wheel', banner: false)
1081
+ end
1078
1082
  success?(ret, banner, !status) { |out| puts(out && dir.directory? ? "Success: #{dir}" : 'Failed') }
1079
1083
  end
1080
1084
 
@@ -812,7 +812,7 @@ module Squared
812
812
  `rvm current`[/^\S+/, 0]
813
813
  when 'rbenv'
814
814
  name = `rbenv version-name`
815
- name.match?(SEM_VER) ? "ruby #{name}" : name
815
+ (name =~ SEM_VER) == 0 ? "ruby #{name}" : name
816
816
  when 'chruby.sh'
817
817
  chruby = session_output 'source', val
818
818
  `#{chruby.with('ruby --version')}`
@@ -1654,7 +1654,7 @@ module Squared
1654
1654
  def unpack_get(tag, ext)
1655
1655
  return super unless ext == 'gem'
1656
1656
 
1657
- "https://rubygems.org/downloads/#{File.basename(tag, '.gem')}.gem"
1657
+ "https://rubygems.org/downloads/#{tag.sub_ext('.gem')}"
1658
1658
  end
1659
1659
 
1660
1660
  def preopts
@@ -27,7 +27,7 @@ module Squared
27
27
  def multiple=(val)
28
28
  case val
29
29
  when Enumerable
30
- @multiple.concat(val.to_a.map { |val| val.is_a?(Regexp) ? val : val.to_s })
30
+ @multiple.concat(val.to_a.map { |pat| pat.is_a?(Regexp) ? pat : pat.to_s })
31
31
  when String, Symbol, Pathname
32
32
  @multiple << val.to_s
33
33
  when Regexp
@@ -48,10 +48,10 @@ module Squared
48
48
  ret.map! do |val|
49
49
  next val if opt?(val)
50
50
 
51
- if quote || val.is_a?(Pathname)
52
- shell_quote(val, force: force, double: double)
53
- elsif escape
51
+ if !(pa = val.is_a?(Pathname)) && escape
54
52
  shell_escape(val, quote: quote, double: double)
53
+ elsif quote || pa
54
+ shell_quote(val, force: force, double: double)
55
55
  else
56
56
  val
57
57
  end
@@ -336,7 +336,7 @@ module Squared
336
336
  push opt
337
337
  skip = true if args
338
338
  end
339
- skip = true if first&.any? { |s| s.is_a?(Regexp) ? opt.match?(s) : !opt.include?(s) }
339
+ skip = true if first&.any? { |pat| pat.is_a?(Regexp) ? opt.match?(pat) : !opt.include?(pat) }
340
340
  end
341
341
  end
342
342
  @values = @values.empty? ? /\A\s+\z/ : /\A(#{@values.join('|')})#{sep}(.+)\z/m
@@ -361,7 +361,8 @@ module Squared
361
361
  self
362
362
  end
363
363
 
364
- def append_any(*args, escape: false, quote: true, **kwargs)
364
+ def append_any(*args, escape: false, **kwargs)
365
+ quote = kwargs.fetch(:quote, true)
365
366
  (args.empty? ? extras : args.flatten).each do |val|
366
367
  if block_given?
367
368
  temp = val
@@ -369,7 +370,7 @@ module Squared
369
370
  if val.is_a?(Array)
370
371
  found << temp
371
372
  k, v, q = val
372
- add_option(k, v, escape: escape, quote: quote, double: q == '"', merge: q == true, **kwargs)
373
+ add_option(k, v, escape: escape, double: q == '"', merge: q == true, **kwargs)
373
374
  next
374
375
  end
375
376
  end
@@ -377,10 +378,10 @@ module Squared
377
378
 
378
379
  if exist?(val)
379
380
  add_path(val, **kwargs)
380
- elsif quote
381
- add_quote(val, **kwargs)
382
381
  elsif escape
383
382
  add shell_escape(val, **kwargs)
383
+ elsif quote
384
+ add_quote(val, **kwargs)
384
385
  else
385
386
  add val
386
387
  end
@@ -494,7 +495,7 @@ module Squared
494
495
 
495
496
  def add_path(*args, option: nil, force: true, double: false, **kwargs)
496
497
  if args.empty?
497
- args = select { |val| val.is_a?(String) }
498
+ args = grep(String)
498
499
  found.concat(args)
499
500
  args.map! { |val| path + val } if path
500
501
  append(args, force: force, **kwargs)
@@ -510,6 +511,7 @@ module Squared
510
511
  end
511
512
 
512
513
  def add_quote(*args, **kwargs)
514
+ kwargs.delete(:quote)
513
515
  merge(args.compact
514
516
  .map! { |val| val == '--' || OptionPartition.opt?(val) ? val : shell_quote(val, **kwargs) })
515
517
  self
@@ -520,8 +522,8 @@ module Squared
520
522
  self
521
523
  end
522
524
 
523
- def add_first(fallback = nil, prefix: nil, path: false, escape: false, quote: false, reverse: false,
524
- expect: false, **kwargs)
525
+ def add_first(fallback = nil, prefix: nil, path: false, escape: false, reverse: false, expect: false,
526
+ **kwargs)
525
527
  val = (reverse ? pop : shift) || fallback
526
528
  if val
527
529
  temp = val
@@ -529,10 +531,10 @@ module Squared
529
531
  unless block_given? && !(val = yield val).is_a?(String)
530
532
  if path
531
533
  add_path(val, **kwargs)
532
- elsif quote
533
- add_quote(val, **kwargs)
534
534
  elsif escape
535
535
  add shell_escape(val, **kwargs)
536
+ elsif kwargs[:quote]
537
+ add_quote(val, **kwargs)
536
538
  else
537
539
  add val
538
540
  end
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.10
4
+ version: 0.6.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham