squared 0.6.10 → 0.6.12

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: 05f58e158cd533725a7c9e6eaacead60da71dddbf311e2f63a4f69f2e51ec998
4
+ data.tar.gz: 4d400ce46ffaf7dd7c2a7a48ea28019bca1e313c46cef7dc666f64be492808e7
5
5
  SHA512:
6
- metadata.gz: 368045e7cd2f56b56e95e5d5809346d69e87c41fb3a3b8f33af001844d0d18f63fc5f72abca10d166c7b6af51443dd52ddd2fd9ee72aff1fe67f38e9d7a02526
7
- data.tar.gz: e750addd94fab922f914ffd75b771c2b5710b64f4375229dc52d7b1129637a5eccd857a7fe39ba51254793f4e3de78c041d73c644accee0a083164abf3132fa4
6
+ metadata.gz: 0dd82a720a4f3d63a8d342ee09cb582c818299d6a25922dd4a366602392afb47a89b6138a69f8d30875e617b18a0b3e929de554c0a9512a8bfe10b526569c33a
7
+ data.tar.gz: 0e99a815e0c8e769edc40171d9e3f039f82fcd366b6d66a094ef35425dc0cb44cc83eb67cad605dd8a7bf25dbf6daf15e18ee2605da866b57e2ed1f8a4011849
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.12] - 2026-04-29
4
+
5
+ ### Fixed
6
+
7
+ - Application dynamic Project loader assumed class would be found.
8
+ - Git command grep did not add patterns with "--" pathspec separator.
9
+
10
+ ## [0.5.23] - 2026-04-29
11
+
12
+ ### Fixed
13
+
14
+ - See `0.4.37`.
15
+
16
+ ## [0.4.37] - 2026-04-29
17
+
18
+ ### Changed
19
+
20
+ - Project base method dependindex replaces private instance variable.
21
+
22
+ ### Fixed
23
+
24
+ - Ruby command version did not abort asdf "Not installed" error.
25
+ - Git command pull action all did not pass option flags to branches.
26
+ - Python command exec did not activate virtual environment.
27
+ - Docker command bake did not reinsert failed check for context directory.
28
+ - Common method shell_quote argument preserve did not bypass requoting.
29
+
30
+ ## [0.6.11] - 2026-03-11
31
+
32
+ ### Changed
33
+
34
+ - Git internal data calls do not write to logs.
35
+
36
+ ## [0.5.22] - 2026-03-11
37
+
38
+ ### Fixed
39
+
40
+ - Project base run command was not covered due to lack of type checking.
41
+
42
+ ## [0.4.36] - 2026-03-11
43
+
44
+ ### Added
45
+
46
+ - Python venv initialization installs setuptools when detected.
47
+ - Node task depend adds prod option flags when NODE_ENV=production.
48
+
49
+ ### Fixed
50
+
51
+ - OptionPartition methods with escape parameter were reordered.
52
+ - OptionPartition methods with quote parameter were revised.
53
+
3
54
  ## [0.6.10] - 2025-02-23
4
55
 
5
56
  ### Added
@@ -1586,7 +1637,7 @@
1586
1637
  - Rake did not set original rakefile when calling itself.
1587
1638
  - Extended tasks were not associated to their supporting class method.
1588
1639
 
1589
- ## [0.1.0] - 2024-12-7
1640
+ ## [0.1.0] - 2024-12-07
1590
1641
 
1591
1642
  ### Added
1592
1643
 
@@ -1607,12 +1658,14 @@
1607
1658
  - Git pull did not display colors for diff bar chart.
1608
1659
  - Git commit did not fetch latest refs before submitting.
1609
1660
 
1610
- ## [0.0.12] - 2024-12-1
1661
+ ## [0.0.12] - 2024-12-01
1611
1662
 
1612
1663
  ### Added
1613
1664
 
1614
1665
  - Changelog was created.
1615
1666
 
1667
+ [0.6.12]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.12
1668
+ [0.6.11]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.11
1616
1669
  [0.6.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.10
1617
1670
  [0.6.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.9
1618
1671
  [0.6.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.8
@@ -1624,6 +1677,8 @@
1624
1677
  [0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
1625
1678
  [0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
1626
1679
  [0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
1680
+ [0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
1681
+ [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
1627
1682
  [0.5.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.21
1628
1683
  [0.5.20]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.20
1629
1684
  [0.5.19]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.19
@@ -1646,6 +1701,8 @@
1646
1701
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1647
1702
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1648
1703
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1704
+ [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1705
+ [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
1649
1706
  [0.4.35]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.35
1650
1707
  [0.4.34]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.34
1651
1708
  [0.4.33]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.33
@@ -51,7 +51,7 @@ module Squared
51
51
  end
52
52
  end
53
53
 
54
- def shell_quote(val, option: true, force: true, double: false, preserve: true, override: false)
54
+ def shell_quote(val, option: true, force: true, double: false, preserve: true, pass: false, override: false)
55
55
  val = val.to_s
56
56
  return val if (!force && !val.include?(' ')) || val.empty?
57
57
 
@@ -59,16 +59,16 @@ module Squared
59
59
  pat = /\A(?:-[^=\s-](?:=|\s+)?|(--)?[^=\s-][^=\s]*(?(1)(?:=|\s+)|=))(["']).+\2\z/m
60
60
  return val if val.match?(pat)
61
61
  end
62
- q = ->(s) { s.gsub("'\\\\''", "'") }
63
62
  if val =~ QUOTE_VALUE
64
- return val if $1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o)
63
+ return val if pass || ($1 == '"' && Rake::Win32.windows? && val.match?(/(?:[#{File::SEPARATOR} ]|\\")/o))
65
64
 
66
65
  base = $2 unless preserve
67
66
  end
67
+ q = -> { (base || val).gsub("'\\\\''", "'") }
68
68
  if double || Rake::Win32.windows? || (ARG[:QUOTE] == '"' && !override)
69
- "\"#{q.call(base || val).gsub(/(?<!\\)"/, '\\"')}\""
69
+ "\"#{q.call.gsub(/(?<!\\)"/, '\\"')}\""
70
70
  else
71
- base ? val : "'#{q.call(val).gsub("'", "'\\\\''")}'"
71
+ "'#{q.call.gsub("'", "'\\\\''")}'"
72
72
  end
73
73
  end
74
74
 
@@ -28,6 +28,7 @@ module Squared
28
28
  module_function
29
29
 
30
30
  def shell(*args, name: :system, **kwargs)
31
+ kwargs.delete(:exception) unless name == :system
31
32
  if RUBY_ENGINE == 'jruby' && Rake::Win32.windows?
32
33
  e = kwargs[:exception]
33
34
  if (dir = kwargs[:chdir]) && ((pwd = Dir.pwd) != dir)
@@ -43,7 +44,7 @@ module Squared
43
44
  else
44
45
  return Kernel.send(name, *args, **kwargs)
45
46
  end
46
- return ret unless e && !ret && name == :system
47
+ return ret unless e && !ret
47
48
 
48
49
  raise $?.to_s
49
50
  end
@@ -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.12'
5
5
  end
@@ -923,6 +923,7 @@ module Squared
923
923
  require_relative rb
924
924
  break
925
925
  end
926
+ nil
926
927
  end
927
928
 
928
929
  def root?(path, pass: [])
@@ -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
@@ -918,7 +918,7 @@ module Squared
918
918
  end
919
919
 
920
920
  def run(cmd = @session, var = nil, exception: self.exception, sync: true, banner: true, from: nil, chdir: path,
921
- interactive: nil, hint: nil, series: false, **)
921
+ interactive: nil, hint: nil, series: false, send: :system, **)
922
922
  unless cmd
923
923
  print_error('no command session started', subject: project, hint: from, pass: true)
924
924
  return
@@ -956,7 +956,7 @@ module Squared
956
956
  end
957
957
  end
958
958
  args = var.is_a?(Hash) ? [var, cmd] : [cmd]
959
- ret = shell(*args, chdir: chdir, exception: exception)
959
+ ret = shell(*args, name: send, chdir: chdir, exception: exception)
960
960
  end
961
961
  rescue StandardError => e
962
962
  on_error(e, from, exception: true)
@@ -1008,7 +1008,7 @@ module Squared
1008
1008
  run_set(output[0], *args, **kwargs)
1009
1009
  when :dependfile
1010
1010
  @dependindex = nil
1011
- @dependfile = val.nil? ? nil : basepath(*args)
1011
+ @dependfile = (basepath(*args) if val)
1012
1012
  else
1013
1013
  instance_variable_set(:"@#{key}", val)
1014
1014
  end
@@ -1116,7 +1116,7 @@ module Squared
1116
1116
  end
1117
1117
 
1118
1118
  def dependtype(*)
1119
- @dependindex ? @dependindex.succ : 0
1119
+ dependindex&.succ || 0
1120
1120
  end
1121
1121
 
1122
1122
  def dependname
@@ -1249,7 +1249,7 @@ module Squared
1249
1249
  else
1250
1250
  if series?(obj)
1251
1251
  obj.each(&:call)
1252
- elsif obj.is_a?(Array) && obj.any? { |val| !val.is_a?(String) }
1252
+ elsif obj.is_a?(Array) && obj.none?(String)
1253
1253
  build(*obj, **kwargs)
1254
1254
  elsif obj
1255
1255
  run_s(*Array(obj), **kwargs)
@@ -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) }
@@ -2369,13 +2369,19 @@ module Squared
2369
2369
  end
2370
2370
  end
2371
2371
 
2372
- def dependfile_set(list)
2372
+ def dependfile_set(list, default: 0)
2373
2373
  @dependindex = if @dependname
2374
2374
  @dependfile = basepath @dependname
2375
2375
  list.index(@dependname)
2376
2376
  else
2377
- list.index { |file| exist?(file) }.tap { |i: 0| @dependfile = basepath(list[i]) }
2378
- end
2377
+ list.index { |file| exist?(file) }.tap { |i| @dependfile = basepath(list[i || default]) }
2378
+ end || (list unless enabled?)
2379
+ end
2380
+
2381
+ def dependindex
2382
+ dependfile_set @dependindex if @dependindex.is_a?(Array)
2383
+
2384
+ @dependindex unless @dependindex.is_a?(Array)
2379
2385
  end
2380
2386
 
2381
2387
  def as_get(val, from)
@@ -20,7 +20,7 @@ module Squared
20
20
  sbom=q].freeze
21
21
  }.freeze,
22
22
  compose: {
23
- common: %w[all-resources ansi|b compatibility dry-run env-file=p f|file=p parallel=n profile=b progress=b
23
+ common: %w[all-resources ansi=b compatibility dry-run env-file=p f|file=p parallel=n profile=b progress=b
24
24
  project-directory=p p|project-name=e].freeze,
25
25
  build: %w[check no-cache print pull push with-dependencies q|quiet build-arg=qq builder=b m|memory=b
26
26
  provenance=q sbom=q ssh=qq].freeze,
@@ -400,7 +400,7 @@ module Squared
400
400
  if projectpath?(val = args.pop)
401
401
  context = val
402
402
  else
403
- op.push(val)
403
+ args << val
404
404
  end
405
405
  end
406
406
  op.append(args, escape: true, strip: /^:/)
@@ -875,11 +875,11 @@ module Squared
875
875
  when :service
876
876
  ['Choose a service',
877
877
  'compose ps -a ' \
878
- "--format='table {{.Service}}\t{{.Name}}\t{{.Image}}\t{{.Command}}\t{{.Status}}\t{{.Ports}}'"]
878
+ '--format="table {{.Service}}\t{{.Name}}\t{{.Image}}\t{{.Command}}\t{{.Status}}\t{{.Ports}}"']
879
879
  else
880
880
  ['Choose an image',
881
881
  'images -a ' \
882
- "--format='table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}\t{{.Size}}'"]
882
+ '--format="table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}\t{{.Size}}"']
883
883
  end
884
884
  lines = `#{docker_output(cmd)}`.lines
885
885
  if lines.size <= 1
@@ -169,22 +169,22 @@ module Squared
169
169
  }.freeze,
170
170
  fetch: {
171
171
  base: %w[multiple porcelain progress P|prune-tags refetch stdin u|update-head-ok
172
- recurse-submodules-default=b].freeze,
172
+ recurse-submodules-default=b?].freeze,
173
173
  pull: %w[4 6 n t a|append atomic dry-run f|force k|keep negotiate-only prefetch p|prune q|quiet set-upstream
174
174
  unshallow update-shallow v|verbose deepen=i depth=i j|jobs=i negotiation-tip=q recurse-submodules=v
175
175
  refmap=q o|server-option=q shallow-exclude=b shallow-since=v upload-pack=q].freeze
176
176
  }.freeze,
177
177
  git: {
178
- add: %w[N|intent-to-add refresh].freeze,
178
+ add: %w[N|intent-to-add].freeze,
179
179
  blame: %w[b c l s t w C=im? L=q M=im? S=p color-by-age color-lines first-parent incremental line-porcelain
180
180
  p|porcelain root score-debug f|show-name e|show-email n|show-number show-stats abbrev=i contents=p
181
- date=q encoding=b ignore-rev=b ignore-revs-file=p reverse=q].freeze,
181
+ date=q diff-algorithm=b encoding=b ignore-rev=b ignore-revs-file=p reverse=q].freeze,
182
182
  clean: %w[d x X f|force n|dry-run i|interactive q|quiet e|exclude=q].freeze,
183
183
  grep: %w[e f=p h H I O=bm r all-match and G|basic-regexp break cached column c|count E|extended-regexp
184
184
  l|files-with-matches L|files-without-match F|fixed-strings full-name W|function-context heading
185
185
  i|ignore-case v|invert-match n|line-number name-only no-index not z|null o|only-matching or
186
186
  P|perl-regexp q|quiet recurse-submodules p|show-function a|text untracked w|word-regexp
187
- A|after-context=i B|before-context=i color=b C|context=i m|max-count=n max-depth=i
187
+ A|after-context=i B|before-context=i color=b C|context=i m|max-count=n max-depth=n
188
188
  open-files-in-pager=b threads=n].freeze,
189
189
  mv: %w[k f|force n|dry-run v|verbose].freeze,
190
190
  revert: %w[e S=bm? n|no-commit reference cleanup=b gpg-sign=b? m|mainline=i s|signoff strategy=b
@@ -254,7 +254,7 @@ module Squared
254
254
  submodule: {
255
255
  status: %w[cached recursive].freeze,
256
256
  update: %w[checkout f|force init merge N|no-fetch no-recommend-shallow no-single-branch recommend-shallow
257
- rebase recursive remote single-branch depth=i filter=q jobs=i reference=b ref-format=q].freeze,
257
+ rebase recursive remote single-branch depth=i filter=q jobs=i reference=q ref-format=q].freeze,
258
258
  branch: %w[b|branch d|default].freeze,
259
259
  sync: %w[recursive].freeze
260
260
  }.freeze,
@@ -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
@@ -1009,12 +1009,8 @@ module Squared
1009
1009
  printsucc
1010
1010
  end
1011
1011
  op = OptionPartition.new(opts, OPT_GIT[:pull], cmd, project: self, no: OPT_GIT[:no][:pull])
1012
- reg = if op.empty?
1013
- []
1014
- else
1015
- opts = op.uniq(opts)
1016
- matchmap op
1017
- end
1012
+ opts -= op.extras
1013
+ reg = matchmap op
1018
1014
  session_done op.target
1019
1015
  heads = []
1020
1016
  cur = nil
@@ -1849,10 +1845,15 @@ module Squared
1849
1845
  when :rm, :clean
1850
1846
  append_pathspec(op.extras, expect: flag == :rm)
1851
1847
  when :grep
1848
+ delim = false
1852
1849
  op.each do |val|
1853
- if op.include?('--')
1850
+ if val == '--'
1851
+ delim = true
1852
+ op.delim
1853
+ elsif delim
1854
1854
  op.add_path(val)
1855
1855
  elsif op.exist?(val, glob: true)
1856
+ delim = true
1856
1857
  op.delim
1857
1858
  .add_path(val)
1858
1859
  else
@@ -1888,22 +1889,22 @@ module Squared
1888
1889
  if io && banner == false
1889
1890
  from = nil
1890
1891
  banner = nil
1892
+ args = false
1891
1893
  else
1892
- if banner
1893
- banner = nil unless banner? && !multiple
1894
- args = true
1895
- end
1896
1894
  if from == false
1897
1895
  from = nil
1898
1896
  elsif !from && cmd.respond_to?(:drop)
1899
1897
  from = cmd.drop(1).find { |val| val.match?(/\A[a-z]{1,2}[a-z-]*\z/) }
1900
1898
  from &&= :"git:#{from}"
1901
1899
  end
1902
- banner &&= cmd.temp { |val| val.start_with?(/--(?:work-tree|git-dir)/) } if cmd.respond_to?(:temp)
1900
+ if banner
1901
+ banner = cmd.temp { |val| val.start_with?(/--(work-tree|git-dir)/) } if cmd.respond_to?(:temp)
1902
+ args = true
1903
+ end
1903
1904
  end
1904
1905
  cmd = session_done cmd
1905
- log&.info cmd
1906
- banner = if banner
1906
+ log&.info cmd unless args == false
1907
+ banner = if banner && banner? && !multiple
1907
1908
  format_banner(banner.is_a?(String) ? banner : cmd, hint: hint, strip: true)
1908
1909
  end
1909
1910
  on :first, from
@@ -2122,9 +2123,7 @@ module Squared
2122
2123
 
2123
2124
  def append_message(val = nil, target: @session)
2124
2125
  val = messageopt if val.to_s.empty?
2125
- return unless val
2126
-
2127
- target << quote_option('message', val)
2126
+ target << quote_option('message', val) if val
2128
2127
  end
2129
2128
 
2130
2129
  def append_head(val = nil, target: @session)
@@ -508,6 +508,7 @@ module Squared
508
508
  end
509
509
  save, exact, omit = save if save.is_a?(Array)
510
510
  ws = env('NODE_WORKSPACES', equals: '0')
511
+ ci = option('ci')
511
512
  om = lambda do |cmd|
512
513
  if omit
513
514
  save = case save
@@ -529,31 +530,36 @@ module Squared
529
530
  run(target.temp(*remove).sub!(/ (?:add|install) /, ' remove '), from: :remove, sync: sync)
530
531
  end
531
532
  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')
533
+ if !flag && yarn > 1 && prod?
534
+ cmd = session 'yarn', 'workspaces focus --all --production'
538
535
  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')
536
+ cmd = session('yarn', flag || 'install')
545
537
  if yarn == 1
546
- cmd << '--frozen-lockfile'
547
- elsif !flag
548
- cmd << '--immutable' << '--refresh-lockfile'
538
+ cmd << '--production' if prod?
539
+ cmd << '--ignore-engines' unless option('ignore-engines', equals: '0')
540
+ cmd << '--ignore-scripts' if option('ignore-scripts')
541
+ cmd << '--force' if option('force')
542
+ else
543
+ cmd << '--mode=skip-build' if option('ignore-scripts')
544
+ cmd << '--check-cache' if !flag && option('force')
545
+ end
546
+ if nolockfile?('yarn')
547
+ cmd << '--no-lockfile'
548
+ elsif ci
549
+ if yarn == 1
550
+ cmd << '--frozen-lockfile'
551
+ elsif !flag
552
+ cmd << '--immutable' << '--refresh-lockfile'
553
+ end
554
+ end
555
+ if add
556
+ cmd << '-W' if yarn == 1 && !option('w', 'ignore-workspace-root-check', equals: '0')
557
+ rm.call(cmd)
558
+ om.call(cmd)
559
+ cmd << '--exact' if exact
549
560
  end
550
561
  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
562
+ append_loglevel
557
563
  elsif pnpm?
558
564
  cmd = session('pnpm', flag || 'install')
559
565
  append_nocolor
@@ -564,6 +570,7 @@ module Squared
564
570
  cmd << '--save-exact' if exact
565
571
  option('allow-build') { |val| cmd << quote_option('allow-build', val) }
566
572
  else
573
+ cmd << '--prod' if prod?
567
574
  append_platform
568
575
  end
569
576
  option('public-hoist-pattern') do |val|
@@ -574,20 +581,22 @@ module Squared
574
581
  '--force'
575
582
  elsif nolockfile?('pnpm')
576
583
  '--no-lockfile'
577
- elsif option('ci')
584
+ elsif ci
578
585
  '--frozen-lockfile'
579
586
  end
580
587
  cmd << '--ignore-scripts' if option('ignore-scripts')
581
588
  cmd << '--dangerously-allow-all-builds' if option('approve-builds')
582
589
  else
583
- cmd = session 'npm'
584
- cmd << (ci = option('ci') ? 'ci' : 'install')
590
+ cmd = session('npm', ci ? 'ci' : 'install')
585
591
  cmd << '--workspaces=false' if ws
592
+ cmd << '--force' if option('force')
586
593
  append_nocolor
587
594
  append_loglevel
588
595
  if omit
589
596
  cmd << "--omit=#{save || omit}"
590
597
  save = nil
598
+ elsif !add && prod?
599
+ cmd << '--include=prod'
591
600
  end
592
601
  unless ci
593
602
  if add
@@ -113,7 +113,7 @@ module Squared
113
113
  initialize_build(Python.ref, **kwargs)
114
114
  initialize_env(**kwargs)
115
115
  end
116
- dependfile_set DEP_PYTHON
116
+ dependfile_set(DEP_PYTHON, default: 2)
117
117
  editable_set editable
118
118
  venv_set kwargs[:venv]
119
119
  end
@@ -209,7 +209,7 @@ module Squared
209
209
  subject: name, hint: pyprojectfile)
210
210
  end
211
211
  when 'exec'
212
- format_desc action, nil, ':|command,args*'
212
+ format_desc action, nil, 'command|:,args*'
213
213
  task action do |_, args|
214
214
  args = args.to_a
215
215
  cmd = if (i = args.delete(':')) && !workspace.windows?
@@ -219,7 +219,7 @@ module Squared
219
219
  else
220
220
  (args << command_args(args, min: 1, prefix: 'python')).compact.join(' ')
221
221
  end
222
- shell(cmd, name: :exec, chdir: path)
222
+ run(cmd, send: :exec, banner: false)
223
223
  end
224
224
  end
225
225
  else
@@ -710,7 +710,9 @@ module Squared
710
710
  when :freeze
711
711
  venv_init
712
712
  op << '>'
713
- op.add_quote(ret = basepath(op.detect { |val| op.exist?(val) } || DEP_PYTHON[4]))
713
+ file = op.detect { |val| op.exist?(val) }
714
+ op.remove(file) if file
715
+ op.add_quote(ret = basepath(file || DEP_PYTHON[4]))
714
716
  .clear
715
717
  when :cache
716
718
  op.concat(args)
@@ -1074,7 +1076,11 @@ module Squared
1074
1076
  .clear(pass: false)
1075
1077
  .arg?(/\A-v+\z/)
1076
1078
  ret = run(op, env, exception: true, banner: banner)
1077
- pip(:install, 'poetry', banner: false) if poetry?
1079
+ if poetry?
1080
+ pip(:install, 'poetry', banner: false)
1081
+ elsif setuptools?
1082
+ pip(:install, 'setuptools', 'wheel', banner: false)
1083
+ end
1078
1084
  success?(ret, banner, !status) { |out| puts(out && dir.directory? ? "Success: #{dir}" : 'Failed') }
1079
1085
  end
1080
1086
 
@@ -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')}`
@@ -822,7 +822,8 @@ module Squared
822
822
  ver = '.tool-versions'
823
823
  opt = [@asdf.first]
824
824
  opt.unshift('--no-header') unless @@asdf.version == 15
825
- `asdf current #{opt.join(' ')}`[/^\S+\s+\S+/, 0].sub(/\s+/, ' ')
825
+ exit 1 unless (cur = `asdf current #{opt.join(' ')}`[/^\S+\s+\S+/, 0])
826
+ cur.sub(/\s+/, ' ')
826
827
  else
827
828
  ver = nil
828
829
  `ruby --version`
@@ -1654,7 +1655,7 @@ module Squared
1654
1655
  def unpack_get(tag, ext)
1655
1656
  return super unless ext == 'gem'
1656
1657
 
1657
- "https://rubygems.org/downloads/#{File.basename(tag, '.gem')}.gem"
1658
+ "https://rubygems.org/downloads/#{tag.sub_ext('.gem')}"
1658
1659
  end
1659
1660
 
1660
1661
  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
@@ -9,7 +9,7 @@ module Squared
9
9
  attr_reader :manifest_url, :manifest
10
10
 
11
11
  def repo(url, manifest = 'latest', install: nil, run: nil, script: nil, args: nil, dev: nil, prod: nil,
12
- ref: @ref, group: @group)
12
+ ref: @ref, group: @group, **)
13
13
  @home = if (val = env('REPO_HOME'))
14
14
  path = Pathname.new(val)
15
15
  if main == path.basename.to_s
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.12
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.3
127
+ rubygems_version: 4.0.6
128
128
  specification_version: 4
129
129
  summary: Rake task generator for managing multi-language workspaces.
130
130
  test_files: []