squared 0.7.8 → 0.7.9

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: 4c4eb1673e7842e505bf21625b8452292591fa243e04d7481f44b889f0e4c22b
4
- data.tar.gz: a44d3b23a26deba7d5cec9559a82d1d53545f9c6e78d55108f90f3221013d4df
3
+ metadata.gz: f6c6ff7f1f5a649c84d9fb799e3da482e39b75823629b78fcb5fa476473cbb43
4
+ data.tar.gz: 29559d83bf196111dd046905b88f1680287524589deabdc4a80b8fb23ca0de0c
5
5
  SHA512:
6
- metadata.gz: b2413955e422ad4b3d7d7a90d155848bd6a359bb42f212cbb67f20ed1eac8a8a7bd895e90decf99bfdfcc05ddf90d0363a9e48111bf4843de97b23930e81e7a3
7
- data.tar.gz: b85dfd373270eb1cc285156902cc06f1a14591270dc94e8a0f4cbc1951f8cd39b0475ef92cd0f0629f84fb55a149eb4cf17a549105eb5813072127eb67a6affa
6
+ metadata.gz: 1987e693d59692f782d6c6b08c75b385efd384d96be5d73757d6068964408888d61e274dcc9444342d8d12a28cfc8628e186fbc71759e76a9cee9eef197c86ac
7
+ data.tar.gz: 3cca9732ab404591931ccad9b48946d15e22cf1fc6d9fd06529a3b8b9216c0e3c9b8fafca79dab97c10e6d8917c656f7c9529182140e48cb47f7cd712e7157c7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.9] - 2026-07-04
4
+
5
+ ### Added
6
+
7
+ - Docker command image action inspect was implemented.
8
+
9
+ ### Changed
10
+
11
+ - Project global ENV for BANNER and STRICT can accept boolean values.
12
+
13
+ ## [0.6.16]
14
+
15
+ ### Added
16
+
17
+ - Git command pull action all supports filter pattern negation.
18
+
19
+ ## [0.5.25]
20
+
21
+ ### Fixed
22
+
23
+ - See `0.4.39`.
24
+
25
+ ## [0.4.39]
26
+
27
+ ### Changed
28
+
29
+ - Common global argument OUT with a file separator overrides PIPE.
30
+
31
+ ### Fixed
32
+
33
+ - Git output list results did not hide footer when banner was disabled.
34
+ - Project banners which were empty were being printed.
35
+
3
36
  ## [0.7.8] - 2026-06-17
4
37
 
5
38
  ### Fixed
@@ -1891,6 +1924,7 @@
1891
1924
 
1892
1925
  - Changelog was created.
1893
1926
 
1927
+ [0.7.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.9
1894
1928
  [0.7.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.8
1895
1929
  [0.7.7]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.7
1896
1930
  [0.7.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.6
@@ -1900,6 +1934,7 @@
1900
1934
  [0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
1901
1935
  [0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
1902
1936
  [0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
1937
+ [0.6.16]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.16
1903
1938
  [0.6.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.15
1904
1939
  [0.6.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.14
1905
1940
  [0.6.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.13
@@ -1916,6 +1951,7 @@
1916
1951
  [0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
1917
1952
  [0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
1918
1953
  [0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
1954
+ [0.5.25]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.25
1919
1955
  [0.5.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.24
1920
1956
  [0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
1921
1957
  [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
@@ -1941,6 +1977,7 @@
1941
1977
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1942
1978
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1943
1979
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1980
+ [0.4.39]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.39
1944
1981
  [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1945
1982
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1946
1983
  [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
data/README.md CHANGED
@@ -886,7 +886,7 @@ Features can be enabled through ENV when calling global tasks such as through *C
886
886
  | outdated | - | U|UPDATE=major|minor|patch DIFF DRY_RUN |
887
887
  | publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN Y |
888
888
  | depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y |
889
- | npm | depend | APPROVE_SCRIPTS=s |
889
+ | npm | depend | APPROVE_SCRIPTS=0,1,s ALLOW_SCRIPTS=0,1,s |
890
890
  | npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS |
891
891
  | pnpm | depend | PUBLIC_HOIST_PATTERN=s APPROVE_BUILDS |
892
892
  | pnpm | depend:add | ALLOW_BUILD=s |
@@ -162,11 +162,19 @@ module Squared
162
162
  end
163
163
 
164
164
  def env_pipe(key, default = 1, root: nil, **kwargs)
165
+ out = 1
165
166
  case key
166
167
  when ::String
167
168
  case (ret = env_value(key, **kwargs))
168
169
  when '0', '1', '2'
169
170
  return ret.to_i
171
+ else
172
+ out = default if default.is_a?(::Numeric)
173
+ if ret.include?(File::SEPARATOR)
174
+ default = ret
175
+ elsif key.include?(File::SEPARATOR)
176
+ default = key
177
+ end
170
178
  end
171
179
  when ::Numeric
172
180
  return key if key.between?(0, 2)
@@ -177,7 +185,7 @@ module Squared
177
185
  (root ? Pathname.new(root) + default : Pathname.new(default)).realdirpath
178
186
  rescue => e
179
187
  warn e
180
- 1
188
+ out
181
189
  end
182
190
  end
183
191
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.7.8'
4
+ VERSION = '0.7.9'
5
5
  end
@@ -115,7 +115,13 @@ module Squared
115
115
  @stage = Support.hashlist
116
116
  self.home = home
117
117
  self.exception = env_bool exception
118
- self.pipe = $DEBUG ? 2 : env_pipe(pipe, (ARG[:OUT] && env(ARG[:OUT])) || 1, root: home)
118
+ self.pipe = if $DEBUG
119
+ 2
120
+ elsif (out = ARG[:OUT]) && out.include?(File::SEPARATOR)
121
+ env_pipe(out, pipe, root: home)
122
+ else
123
+ env_pipe(pipe, (out && env(out)) || 1, root: home)
124
+ end
119
125
  self.verbose = if $VERBOSE.nil?
120
126
  false
121
127
  elsif verbose.nil?
@@ -1692,7 +1692,13 @@ module Squared
1692
1692
  ret += 1
1693
1693
  break out if first
1694
1694
  end
1695
- print_item banner, lines if banner && (ret > 0 || (!pass && !first))
1695
+ if banner && (ret > 0 || (!pass && !first))
1696
+ if banner.empty?
1697
+ print_item(*lines)
1698
+ else
1699
+ print_item(banner, *lines)
1700
+ end
1701
+ end
1696
1702
  ret
1697
1703
  end
1698
1704
 
@@ -1718,7 +1724,7 @@ module Squared
1718
1724
  end
1719
1725
 
1720
1726
  def print_run(cmd, banner = true, verbose: nil, **)
1721
- return if banner || !stdout? || verbose == false || env('BANNER', equals: '0')
1727
+ return if banner || !stdout? || verbose == false || env('BANNER', equals: %w[0 false])
1722
1728
 
1723
1729
  puts "\n> #{cmd}"
1724
1730
  printsucc
@@ -1727,7 +1733,7 @@ module Squared
1727
1733
  def print_item(*val, series: false)
1728
1734
  puts unless printfirst?
1729
1735
  printsucc unless series
1730
- puts val unless val.empty? || (val.size == 1 && !val.first)
1736
+ puts val unless val.empty? || (val.size == 1 && (!val.first || val.first.empty?))
1731
1737
  end
1732
1738
 
1733
1739
  def print_banner(*lines, client: false, styles: theme[:banner], border: borderstyle)
@@ -2686,7 +2692,12 @@ module Squared
2686
2692
  end
2687
2693
 
2688
2694
  def banner?
2689
- ARG[:BANNER] && env('BANNER', notequals: '0')
2695
+ case (val = env('BANNER', ignore: false))
2696
+ when '0', 'false'
2697
+ false
2698
+ else
2699
+ !val.nil? || ARG[:BANNER]
2700
+ end
2690
2701
  end
2691
2702
 
2692
2703
  def pwd?
@@ -2719,7 +2730,12 @@ module Squared
2719
2730
  end
2720
2731
 
2721
2732
  def strict?
2722
- (ARG[:STRICT] || exception?(Logger::FATAL)) && env('STRICT', notequals: '0')
2733
+ case (val = env('STRICT', ignore: false))
2734
+ when '0', 'false'
2735
+ false
2736
+ else
2737
+ !val.nil? || ARG[:STRICT] || exception?(Logger::FATAL)
2738
+ end
2723
2739
  end
2724
2740
 
2725
2741
  def serve?
@@ -56,7 +56,7 @@ module Squared
56
56
  exec: %w[d|detach i|interactive privileged t|tty detach-keys=q e|env=qq env-file=p u|user=e
57
57
  w|workdir=q].freeze,
58
58
  commit: %w[no-pause a|author=q c|change=q m|message=q pause=b?].freeze,
59
- inspect: %w[s|size f|format=q type=b].freeze,
59
+ inspect: %w[s|size f|format=q].freeze,
60
60
  start: %w[a|attach i|interactive detach-keys=q].freeze,
61
61
  stop: %w[s|signal=b t|timeout=i].freeze,
62
62
  restart: %w[s|signal=b t|timeout=i].freeze,
@@ -64,6 +64,7 @@ module Squared
64
64
  stats: %w[a|all no-stream no-trunc format|q].freeze
65
65
  }.freeze,
66
66
  image: {
67
+ inspect: %w[f|format platform=q].freeze,
67
68
  ls: %w[a|all digests no-trunc q|quiet tree f|filter=q format=q].freeze,
68
69
  pull: %w[a|all-tags platform=q q|quiet].freeze,
69
70
  push: %w[a|all-tags platform=q q|quiet].freeze,
@@ -113,7 +114,7 @@ module Squared
113
114
  'build' => %i[tag context].freeze,
114
115
  'compose' => %i[build create publish run exec up down service].freeze,
115
116
  'bake' => %i[build compose check].freeze,
116
- 'image' => %i[ls rm pull push tag save].freeze,
117
+ 'image' => %i[ls rm pull push tag save inspect].freeze,
117
118
  'container' => %i[run create exec update commit inspect diff start stop restart pause unpause top stats kill
118
119
  rm].freeze,
119
120
  'network' => %i[connect disconnect create].freeze,
@@ -276,7 +277,7 @@ module Squared
276
277
  end
277
278
  end
278
279
  else
279
- format_desc action, flag, "opts*,id/name#{flag == :update ? '+' : '*'}"
280
+ format_desc action, flag, "opts*,id/name#{flag == :update || flag == :inspect ? '+' : '*'}"
280
281
  task flag do |_, args|
281
282
  container flag, args.to_a
282
283
  end
@@ -287,7 +288,7 @@ module Squared
287
288
  next unless @registry
288
289
 
289
290
  format_desc action, flag, 'tag?,registry/username?,opts*'
290
- task flag, [:tag] do |_, args|
291
+ task flag do |_, args|
291
292
  image flag, args.to_a
292
293
  end
293
294
  when :pull
@@ -296,6 +297,11 @@ module Squared
296
297
  id = param_guard(action, flag, args: args, key: :tag)
297
298
  image(flag, args.extras, id: id)
298
299
  end
300
+ when :inspect
301
+ format_desc action, flag, 'opts*,id+'
302
+ task flag do |_, args|
303
+ image flag, args.to_a
304
+ end
299
305
  else
300
306
  format_desc(action, flag, case flag
301
307
  when :rm, :save then 'id,opts*'
@@ -646,6 +652,9 @@ module Squared
646
652
  sync = false
647
653
  exception ||= true
648
654
  banner = false
655
+ when :inspect
656
+ raise_error ArgumentError, 'missing image', hint: flag if op.empty?
657
+ op.append(escape: true, strip: /^:/)
649
658
  end
650
659
  success?(run(sync: sync, exception: exception, banner: banner, from: from), flag == :tag || flag == :save)
651
660
  end
@@ -1048,13 +1048,13 @@ module Squared
1048
1048
  op = OptionPartition.new(opts, OPT_GIT[:pull], cmd, project: self, strict: strict?,
1049
1049
  no: OPT_GIT[:no][:pull])
1050
1050
  opts -= op.extras
1051
- reg = matchmap op
1051
+ reg, neg = matchmap(op, negate: true)
1052
1052
  session_done op.target
1053
1053
  heads = []
1054
1054
  cur = nil
1055
1055
  foreachref('heads', format: '%(if)%(HEAD)%(then)* %(end)%(refname:short)').each do |line|
1056
1056
  cur ||= line.delete_prefix!('* ')
1057
- heads << line if matchany?(reg, line)
1057
+ heads << line if matchany?(reg, line) && !matchany?(neg, line, empty: false)
1058
1058
  end
1059
1059
  raise_error 'head not found', hint: 'for-each-ref' unless cur
1060
1060
  opts << 'ff-only' if opts.empty? && option('ff-only', notequals: '0')
@@ -1234,7 +1234,7 @@ module Squared
1234
1234
  op.clear
1235
1235
  out, banner, from = source(io: true)
1236
1236
  print_item banner
1237
- list_result(write_lines(out), 'objects', from: from)
1237
+ list_result(write_lines(out), 'objects', banner: banner, from: from)
1238
1238
  return
1239
1239
  end
1240
1240
  else
@@ -1286,7 +1286,7 @@ module Squared
1286
1286
  end
1287
1287
  out, banner, from = source(io: true)
1288
1288
  ret = write_lines(out, banner: banner, sub: sub)
1289
- list_result(ret, 'files', action: 'modified', from: from)
1289
+ list_result(ret, 'files', action: 'modified', banner: banner, from: from)
1290
1290
  end
1291
1291
 
1292
1292
  def revbuild(flag = nil, opts = [], **kwargs)
@@ -1454,7 +1454,7 @@ module Squared
1454
1454
  out, banner, from = source(io: true)
1455
1455
  print_item banner
1456
1456
  ret = write_lines(out, grep: op.extras)
1457
- list_result(ret, 'tags', grep: op.extras, from: from)
1457
+ list_result(ret, 'tags', grep: op.extras, banner: banner, from: from)
1458
1458
  return
1459
1459
  end
1460
1460
  if (ret = source) && (remote ||= option('remote'))
@@ -1465,9 +1465,9 @@ module Squared
1465
1465
 
1466
1466
  def log!(flag, opts = [], range: [], index: [], grep: [])
1467
1467
  cmd, opts = git_session('log', opts: opts)
1468
- op = OptionPartition.new(opts, collect_hash(OPT_GIT[:log]), cmd, project: self, strict: strict?,
1469
- no: collect_hash(OPT_GIT[:no][:log]),
1470
- first: matchpathspec)
1468
+ op = OptionPartition.new(opts, collect_hash(OPT_GIT[:log]), cmd,
1469
+ project: self, strict: strict?, no: collect_hash(OPT_GIT[:no][:log]),
1470
+ first: matchpathspec)
1471
1471
  case flag
1472
1472
  when :between, :contain
1473
1473
  op.add_quote(range.join(flag == :between ? '..' : '...'))
@@ -1722,7 +1722,7 @@ module Squared
1722
1722
  opt_style(color(:green), /^(\*\s+)(\S+)(.*)$/, 2),
1723
1723
  opt_style(color(:red), %r{^(\s*)(remotes/\S+)(.*)$}, 2)
1724
1724
  ])
1725
- list_result(ret, 'branches', from: from)
1725
+ list_result(ret, 'branches', banner: banner, from: from)
1726
1726
  return
1727
1727
  else
1728
1728
  if (head = git_spawn('rev-parse --abbrev-ref HEAD').chomp).empty?
@@ -1731,7 +1731,7 @@ module Squared
1731
1731
  git_spawn 'fetch --all --prune --quiet' if option('sync')
1732
1732
  cmd << '-vv --no-abbrev --list'
1733
1733
  out, banner, from = source(io: true)
1734
- first = workspace.size > 1
1734
+ first = from_base?('branch')
1735
1735
  grep = first ? [/^\*\s+#{Regexp.escape(head)}\s/] : []
1736
1736
  ret = write_lines(out, grep: grep, banner: banner, first: first) do |line, index|
1737
1737
  next line if stdin?
@@ -1804,9 +1804,7 @@ module Squared
1804
1804
 
1805
1805
  def restore(flag, opts = [], commit: nil, files: nil)
1806
1806
  cmd, opts = git_session('restore', shell_option(flag, commit, escape: false, force: false), opts: opts)
1807
- op = OptionPartition.new(opts,
1808
- OPT_GIT[:restore] + OPT_GIT[:log][:diff_context],
1809
- cmd,
1807
+ op = OptionPartition.new(opts, OPT_GIT[:restore] + OPT_GIT[:log][:diff_context], cmd,
1810
1808
  project: self, strict: strict?, no: OPT_GIT[:no][:restore], first: matchpathspec)
1811
1809
  append_pathspec(op.extras + (files || []), pass: false)
1812
1810
  source(sync: false, stderr: true)
@@ -1835,8 +1833,7 @@ module Squared
1835
1833
  end
1836
1834
  list = OPT_GIT[:show] + OPT_GIT[:diff][:show] + OPT_GIT[:log][:diff] + OPT_GIT[:log][:diff_context]
1837
1835
  op = OptionPartition.new(opts, list, cmd,
1838
- project: self,
1839
- strict: strict?,
1836
+ project: self, strict: strict?,
1840
1837
  no: OPT_GIT[:no][:show] + collect_hash(OPT_GIT[:no][:log], pass: [:base]))
1841
1838
  op.append(delim: true)
1842
1839
  source(exception: false, banner: flag != :oneline)
@@ -1861,8 +1858,8 @@ module Squared
1861
1858
  cmd << '--sq-quote'
1862
1859
  args = true
1863
1860
  end
1864
- OptionPartition.new(opts, OPT_GIT[:rev_parse], cmd,
1865
- project: self, strict: strict?, no: OPT_GIT[:no][:rev_parse], args: args)
1861
+ OptionPartition.new(opts, OPT_GIT[:rev_parse], cmd, project: self, strict: strict?, args: args,
1862
+ no: OPT_GIT[:no][:rev_parse])
1866
1863
  .append(escape: args)
1867
1864
  end
1868
1865
  source(banner: verbose?)
@@ -1890,7 +1887,7 @@ module Squared
1890
1887
  out, banner, from = source(io: true)
1891
1888
  print_item banner
1892
1889
  ret = write_lines(out, grep: op.extras, prefix: "refs/#{flag}/")
1893
- list_result(ret, flag.to_s, grep: op.extras, from: from)
1890
+ list_result(ret, flag.to_s, grep: op.extras, banner: banner, from: from)
1894
1891
  end
1895
1892
 
1896
1893
  def ls_files(flag, opts = [])
@@ -1900,7 +1897,7 @@ module Squared
1900
1897
  out, banner, from = source(io: true)
1901
1898
  print_item banner
1902
1899
  ret = write_lines(out, grep: op.extras)
1903
- list_result(ret, 'files', grep: op.extras, from: from)
1900
+ list_result(ret, 'files', grep: op.extras, banner: banner, from: from)
1904
1901
  end
1905
1902
 
1906
1903
  def git(flag, opts = [])
@@ -2069,10 +2066,10 @@ module Squared
2069
2066
  end
2070
2067
  end
2071
2068
 
2072
- def list_result(size, type, action: 'found', grep: [], from: nil)
2069
+ def list_result(size, type, action: 'found', grep: [], banner: nil, from: nil)
2073
2070
  if size == 0
2074
2071
  puts empty_status("No #{type} were #{action}", 'grep', grep.join(', '))
2075
- elsif stdout?
2072
+ elsif stdout? && (banner.nil? || (banner.is_a?(String) && !banner.empty?))
2076
2073
  styles = theme.fetch(:banner, []).reject { |val| val.to_s.end_with?('!') }
2077
2074
  styles << :bold if styles.size <= 1
2078
2075
  puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
@@ -2141,8 +2138,8 @@ module Squared
2141
2138
  append_submodules(target: target, from: from)
2142
2139
  return if !remote && opts.empty?
2143
2140
 
2144
- op = OptionPartition.new(opts, remote ? list + ['refspec=v'] : list, target, project: self, strict: strict?,
2145
- no: no)
2141
+ op = OptionPartition.new(opts, remote ? list + ['refspec=v'] : list, target,
2142
+ project: self, strict: strict?, no: no)
2146
2143
  refspec = op.each_with_object([]) do |opt, out|
2147
2144
  if opt =~ op.values
2148
2145
  case $1
@@ -315,7 +315,7 @@ module Squared
315
315
  when 'package'
316
316
  format_desc(action, flag, 'opts*', before: case flag
317
317
  when :dedupe, :rebuild then nil
318
- when :reinstall then 'force?'
318
+ when :reinstall then 'f/orce?'
319
319
  else 'name*'
320
320
  end)
321
321
  task flag do |_, args|
@@ -642,6 +642,18 @@ module Squared
642
642
  print_run cmd, silent?
643
643
  run(cmd, banner: false)
644
644
  end
645
+ option('allow-scripts', ignore: false) do |val|
646
+ cmd << case val
647
+ when '0'
648
+ '--ignore-scripts'
649
+ when 'false'
650
+ '--strict-allow-scripts'
651
+ when '1', 'true'
652
+ '--dangerously-allow-all-scripts'
653
+ else
654
+ quote_option 'allow-scripts', val
655
+ end
656
+ end
645
657
  cmd << '--workspaces=false' if ws
646
658
  cmd << '--force' if option('force')
647
659
  append_nocolor
@@ -1032,6 +1044,7 @@ module Squared
1032
1044
 
1033
1045
  def package(flag, opts = [], packages: [], from: nil)
1034
1046
  workspace.rev_clear(name)
1047
+ force = true if flag == :reinstall && has_value!(opts, 'f')
1035
1048
  yarn = dependtype(:yarn)
1036
1049
  if yarn > 0 && !(yarn == 1 && ((flag == :update && !packages.empty?) || %i[approve deny
1037
1050
  rebuild].include?(flag)))
@@ -1045,8 +1058,8 @@ module Squared
1045
1058
  end
1046
1059
  when :reinstall
1047
1060
  if yarn == 1
1048
- remove_modules 'yarn' if opts.include?('force')
1049
- elsif opts.delete('force')
1061
+ remove_modules 'yarn' if opts.include?('force') || force
1062
+ elsif opts.delete('force') || force
1050
1063
  opts << 'check-cache'
1051
1064
  end
1052
1065
  opts << 'no-lockfile' if lockfile(true)
@@ -1115,7 +1128,7 @@ module Squared
1115
1128
  spec = 1
1116
1129
  flag = :install
1117
1130
  when :reinstall
1118
- remove_modules 'npm' if opts.delete('force')
1131
+ remove_modules 'npm' if opts.delete('force') || force
1119
1132
  opts.unshift('package-lock=false') if lockfile(true)
1120
1133
  flag = :install
1121
1134
  end
@@ -506,16 +506,23 @@ module Squared
506
506
  format_desc action, flag, 'f/orce?,l/ocal?,opts*'
507
507
  task flag do |_, args|
508
508
  opts = args.to_a
509
- opts << 'local' if has_value!(opts, 'l')
509
+ opts << 'local' if has_value!(opts, 'l', 'local')
510
510
  opts << 'redownload' if has_value!(opts, 'f', 'force')
511
511
  if (lock = basepath!('Gemfile.lock'))
512
- config = basepath '.bundle', 'config'
513
- if config.exist? && config.read.match?(/\bBUNDLE_FROZEN:\s+"true"/)
514
- if opts.include?('redownload')
515
- run(bundle_output('config unset frozen'), banner: false)
516
- else
517
- print_error('Gemfile.lock is frozen', subject: name, hint: flag)
512
+ case (val = ENV['BUNDLE_FROZEN'])
513
+ when '0', 'false'
514
+ nil
515
+ else
516
+ if val
517
+ print_error("BUNDLE_FROZEN: #{val}", loglevel: Logger::INFO, subject: name, hint: flag)
518
518
  lock = nil
519
+ elsif basepath!('.bundle', 'config')&.read&.match?(/\bBUNDLE_FROZEN:\s+"true"/)
520
+ if opts.include?('redownload')
521
+ run(bundle_output('config unset frozen'), banner: false)
522
+ else
523
+ print_error('Gemfile.lock is frozen', subject: name, hint: flag)
524
+ lock = nil
525
+ end
519
526
  end
520
527
  end
521
528
  lock&.delete
@@ -1826,8 +1833,8 @@ module Squared
1826
1833
  private
1827
1834
 
1828
1835
  def run_repl(*args, opts:, banner:, from:, delim: true, **kwargs)
1829
- op = OptionPartition.new(opts, OPT_RUBY[from], session(*bundle_args(from)), project: self, strict: strict?,
1830
- first: [/\.rb$/])
1836
+ op = OptionPartition.new(opts, OPT_RUBY[from], session(*bundle_args(from)),
1837
+ project: self, strict: strict?, first: [/\.rb$/])
1831
1838
  r = []
1832
1839
  r << 'bundler/setup' if !op.arg?('r') && bundle_load
1833
1840
  r.concat(Array(kwargs[:name])) if kwargs[:name]
@@ -26,13 +26,29 @@ module Squared
26
26
  end
27
27
  end
28
28
 
29
- def matchmap(list, prefix = nil)
30
- list.map do |val|
31
- next val if val.is_a?(Regexp)
32
-
33
- val = ".*#{val}" if prefix && !val.sub!(/\A(\^|\\A)/, '')
34
- Regexp.new("#{prefix}#{val == '*' ? '.+' : val}")
29
+ def matchmap(list, prefix = nil, negate: false)
30
+ ret = negate ? [[], []] : []
31
+ list.each do |val|
32
+ unless val.is_a?(Regexp)
33
+ val = val.dup
34
+ n = 1 if negate && val.delete_prefix!('!')
35
+ if prefix
36
+ a = nil
37
+ val.sub!(/\A(\^|\\A)/) do |s|
38
+ a = s
39
+ nil
40
+ end
41
+ val = ".*#{val}" unless a
42
+ end
43
+ end
44
+ pat = Regexp.new("#{a}#{prefix}#{val == '*' ? '.+' : val}")
45
+ if negate
46
+ ret[n || 0] << pat
47
+ else
48
+ ret << pat
49
+ end
35
50
  end
51
+ ret
36
52
  end
37
53
 
38
54
  def matchany?(list, *args, empty: true)
@@ -157,8 +157,6 @@ module Squared
157
157
  [proj, proj.build? && (script || run), doc && proj.doc?, lint && proj.lint?, test && proj.test?]
158
158
  end
159
159
  .select do |proj, run, doc, lint, test|
160
- next unless proj
161
-
162
160
  proj.doc(sync: true) if doc
163
161
  proj.build(sync: true) if run
164
162
  next if n.anybits?(4)
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.7.8
4
+ version: 0.7.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 4.0.12
128
+ rubygems_version: 4.0.10
129
129
  specification_version: 4
130
130
  summary: Rake task generator for managing multi-language workspaces.
131
131
  test_files: []