squared 0.8.5 → 0.8.6

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: e486fab218bc18e8b6e3921184c1d4a9aeaf155e2d19f70b62062b279606714d
4
- data.tar.gz: c5d1cf6cabf110cce2befee1fc6d34dcb9f437d5c84b6dc552bd304b3f7af304
3
+ metadata.gz: d49aff6b1cd9bedf0f0057bd7f9afe30cee588a2d86224f59585f53f16003ac6
4
+ data.tar.gz: 445bcbd6ae09304dc4797404de44819600abae31b5f41f8bc61ce1951428a25c
5
5
  SHA512:
6
- metadata.gz: ba4f0d602d818ad424fc9fc940954f1c7a8d4fc138fd98e8ebb6f4b7d98baa45188a3f0476f4a7de0512c60e06d74f965da7f4a54a34cdcda76d7baec525e2d1
7
- data.tar.gz: 52f518b0aaeb168633399c34f62cf19cb14fc1ed463047cf795b527e82d9439e5c2266c3d0f0709777f6bdafdf40cd88f76bbb118e1236f4b8e8ca9a81741a16
6
+ metadata.gz: 66c420cde0388bbb2c284fc83b365014bdd770cf30d9edb4a5c5b903b9c95752a87a3c8d951acd1c9b73473d2ce5b1167c6bff63fa582d75f79418ed80e468a5
7
+ data.tar.gz: 0b89a2327e97e8f26e077134dfa228bfb1234a09cc6e499a96cd042d23d9e004aea623c63f8b34e3251b198b9f9806b6d191db9978f251c0d52608d1b4e452dd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.8.6] - 2026-10-01
4
+
5
+ ### Added
6
+
7
+ - Pip command options were updated to 26.2.
8
+ - Application method assign for appending project instance methods was created.
9
+
10
+ ### Fixed
11
+
12
+ - Bundle exec wrapper did not accept boolean values.
13
+ - RuboCop did not resolve config to project directory.
14
+
15
+ ## [0.7.13] - 2026-09-25
16
+
17
+ ### Fixed
18
+
19
+ - OptionPartition did not parse quoted option values.
20
+
21
+ ## [0.6.20] - 2026-09-25
22
+
23
+ ### Added
24
+
25
+ - Prompt choice optional selection can be bypassed with a single dash.
26
+ - OptionPartition can parse supplementary option flags for plain output.
27
+
28
+ ### Fixed
29
+
30
+ - Git interactive commit selection did not accept additional values.
31
+
3
32
  ## [0.8.5] - 2026-09-23
4
33
 
5
34
  ### Added
@@ -2124,12 +2153,14 @@
2124
2153
 
2125
2154
  - Changelog was created.
2126
2155
 
2156
+ [0.8.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.6
2127
2157
  [0.8.5]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.5
2128
2158
  [0.8.4]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.4
2129
2159
  [0.8.3]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.3
2130
2160
  [0.8.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.2
2131
2161
  [0.8.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.1
2132
2162
  [0.8.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.0
2163
+ [0.7.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.13
2133
2164
  [0.7.12]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.12
2134
2165
  [0.7.11]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.11
2135
2166
  [0.7.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.10
@@ -2143,6 +2174,7 @@
2143
2174
  [0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
2144
2175
  [0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
2145
2176
  [0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
2177
+ [0.6.20]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.20
2146
2178
  [0.6.19]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.19
2147
2179
  [0.6.18]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.18
2148
2180
  [0.6.17]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.17
data/README.md CHANGED
@@ -96,19 +96,28 @@ Workspace::Application
96
96
  apply :clean, ["build/sqd/"] # variable_set (alias)
97
97
  end
98
98
  .with(:docker, only: ["build", "compose"], hide: [:windows?]) do # When true hide entire group (formerly pass 0.6.0)
99
- .add("squared", "docker", file: "Dockerfile", context: ".", tag: "latest", registry: "localhost:5000", username: "squared", # compose publish => { oci: "oci://docker.io" }
100
- args: "--ssh=default",
101
- client: { config: '/home/user/.docker', tls: true }, # global options
102
- secrets: ["id=github,env=GITHUB_TOKEN"],
103
- mounts: ["src=.,dst=/project,ro,bind-propagation=rshared"]) do # Docker
104
- series(:clean) do # run | depend | doc | lint | test | copy | clean
99
+ add("squared", "docker", file: "Dockerfile", context: ".", tag: "latest", registry: "localhost:5000", username: "squared", # compose publish => { oci: "oci://docker.io" }
100
+ args: "--ssh=default",
101
+ client: { config: '/home/user/.docker', tls: true }, # global options
102
+ secrets: ["id=github,env=GITHUB_TOKEN"],
103
+ mounts: ["src=.,dst=/project,ro,bind-propagation=rshared"]) do # Docker
104
+ series(:clean) do # run | depend | doc | lint | test | copy | clean
105
105
  File.read(basepath("docker-bake.hcl"))
106
106
  .scan(/\btags\s+=\s+\["([^"]+)"\]/)
107
107
  .each { |val| image(:rm, tag: val.first) }
108
108
  end
109
109
  end
110
110
  end
111
- .pass("pull", group: "default") { test? || doc? } # rake pathname:pull | rake optparse:pull
111
+ .assign(:ruby) do # Add or override instance methods
112
+ def vmname(bin: false)
113
+ bin ? ['rbenv', '/usr/bin/rbenv'] : 'rbenv'
114
+ end
115
+
116
+ def copy?
117
+ false
118
+ end
119
+ end
120
+ .pass("pull", group: "default") { test? || doc? } # rake pathname:pull optparse:pull
112
121
  .style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
113
122
  .build(default: "build", parallel: ["pull", "fetch", "rebase", "archive", "clean", /^outdated:/], pass: ["publish"]) do |workspace|
114
123
  workspace
@@ -91,7 +91,9 @@ module Squared
91
91
  while (ch = Prompt.reline.readline(msg))
92
92
  ch.strip!
93
93
  unless ch.empty?
94
- if multiple
94
+ if ch == '-' && !force
95
+ break
96
+ elsif multiple
95
97
  k = if ch == '*'
96
98
  (min..max).to_a
97
99
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.6'
5
5
  end
@@ -403,7 +403,7 @@ module Squared
403
403
  end
404
404
  unless ref.is_a?(Symbol) && (proj = @base.find { |item| item.ref == ref })
405
405
  proj = if !ref.is_a?(Class)
406
- require_project(ref) || Application.find(ref: ref, path: path)
406
+ find_project(ref: ref, path: path)
407
407
  elsif Application.extends(ref)
408
408
  ref
409
409
  end || @kind[name]&.last
@@ -447,6 +447,16 @@ module Squared
447
447
  self
448
448
  end
449
449
 
450
+ def assign(ref = @ref, &blk)
451
+ proj = ref && find_project(ref: ref)
452
+ if proj
453
+ proj.class_eval(&blk)
454
+ else
455
+ warn log_message(Logger::ERROR, 'class not found', subject: main, hint: ref)
456
+ end
457
+ self
458
+ end
459
+
450
460
  def stage(val, first: false, &blk)
451
461
  data = @stage[val]
452
462
  if first == true
@@ -474,7 +484,7 @@ module Squared
474
484
  obj = begin
475
485
  JSON.parse(homepath(obj).read, { symbolize_names: true })
476
486
  rescue => e
477
- warn log_message(Logger::ERROR, e)
487
+ warn log_message(Logger::ERROR, e, subject: main)
478
488
  end
479
489
  end
480
490
  apply_style(data || theme, obj, args, empty: empty) if obj && (!target || data)
@@ -1082,6 +1092,10 @@ module Squared
1082
1092
  nil
1083
1093
  end
1084
1094
 
1095
+ def find_project(ref:, path: nil)
1096
+ require_project(ref) || Application.find(ref: ref, path: path)
1097
+ end
1098
+
1085
1099
  def root?(path, pass: [])
1086
1100
  return false unless path.directory?
1087
1101
 
@@ -1174,10 +1174,20 @@ module Squared
1174
1174
  ret = basepath(*args)
1175
1175
  return ret unless ascend && !ret.exist?
1176
1176
 
1177
+ case ascend
1178
+ when String, Pathname
1179
+ root = Pathname.new(ascend).cleanpath
1180
+ root = nil unless root.absolute? && root.directory?
1181
+ end
1177
1182
  path.parent.ascend.each do |dir|
1178
1183
  target = dir.join(*args)
1179
1184
  return target if target.exist?
1180
- break if (ascend.is_a?(String) && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
1185
+
1186
+ if root
1187
+ break if dir == root
1188
+ elsif workspace.root == dir || parent&.path == dir || (ascend.is_a?(String) && dir.join(ascend).exist?)
1189
+ break
1190
+ end
1181
1191
  end
1182
1192
  ret
1183
1193
  end
@@ -1365,7 +1375,7 @@ module Squared
1365
1375
  run(val, var, sync: sync, banner: banner, **kwargs)
1366
1376
  end
1367
1377
  rescue => e
1368
- on_error(e, exception: kwargs.fetch(:exception, exception?))
1378
+ on_error(e, exception: exception?(**kwargs))
1369
1379
  end
1370
1380
  on :last, from
1371
1381
  end
@@ -2765,7 +2775,9 @@ module Squared
2765
2775
  workspace.warning
2766
2776
  end
2767
2777
 
2768
- def exception?(*level)
2778
+ def exception?(*level, **kwargs)
2779
+ return kwargs[:exception] if kwargs.key?(:exception)
2780
+
2769
2781
  ret = exception
2770
2782
  return ret unless ret.is_a?(Numeric)
2771
2783
 
@@ -968,10 +968,13 @@ module Squared
968
968
  when :commit, :'no-commit'
969
969
  format_desc action, flag, 'branch|:,ours|theirs?,opts*'
970
970
  task flag, [:branch] do |_, args|
971
- branch = args.branch
972
- current = git_spawn('branch --show-current').chomp
971
+ branch = if args.branch == ':'
972
+ choice_refs('Choose a branch', accept: "#{action.capitalize}?")
973
+ else
974
+ args.branch
975
+ end
976
+ current = git_value 'branch --show-current'
973
977
  if branch
974
- branch = choice_refs('Choose a branch', accept: "#{action.capitalize}?") if branch == ':'
975
978
  opts = args.extras
976
979
  if has_value!(opts, 'ours')
977
980
  opts << 's=ort' << 'X=ours'
@@ -1223,7 +1226,7 @@ module Squared
1223
1226
  (heads.dup << cur).each_with_index do |branch, i|
1224
1227
  next unless (i < heads.size && cur != branch) || i == heads.size
1225
1228
 
1226
- git_spawn 'switch --quiet', force && '--force', shell_quote(branch)
1229
+ git_spawn('switch --quiet', force && '--force', shell_quote(branch))
1227
1230
  pull(nil, opts, sync: false, hint: branch) if heads.include?(branch)
1228
1231
  end
1229
1232
  return
@@ -1299,13 +1302,13 @@ module Squared
1299
1302
  if flag
1300
1303
  return unless dir && ref
1301
1304
 
1302
- url = git_spawn("config --get remote.#{remotetrack}.url")
1305
+ url = git_value "config --get remote.#{remotetrack}.url"
1303
1306
  cmd, opts = git_session('clone', worktree: false, opts: opts)
1304
1307
  op = OptionPartition.new(opts, OPT_GIT[:clone], cmd, project: self, strict: strict?,
1305
1308
  no: OPT_GIT[:no][:clone])
1306
1309
  op.add_option('b', ref)
1307
1310
  .delim
1308
- .add_quote(url.chomp)
1311
+ .add_quote(url)
1309
1312
  .add_path(dir)
1310
1313
  .clear
1311
1314
  source
@@ -1498,7 +1501,7 @@ module Squared
1498
1501
  end
1499
1502
  return
1500
1503
  end
1501
- sha = git_spawn('rev-parse --verify HEAD').chomp
1504
+ sha = git_value 'rev-parse --verify HEAD'
1502
1505
  return if sha.empty?
1503
1506
 
1504
1507
  sync = kwargs.fetch(:sync) { invoked_sync?('revbuild', flag) }
@@ -1561,7 +1564,7 @@ module Squared
1561
1564
  .clear(pass: false)
1562
1565
  when :commit
1563
1566
  exit 1 unless ref
1564
- branch ||= git_spawn('name-rev --name-only', ref).chomp
1567
+ branch ||= git_value('name-rev --name-only', ref)
1565
1568
  raise ArgumentError, message('could not resolve upstream branch', hint: ref) if branch.empty?
1566
1569
 
1567
1570
  op.append(remotetrack, "#{ref}:#{branch}")
@@ -1756,7 +1759,7 @@ module Squared
1756
1759
  end
1757
1760
  if (n = op.index('>'))
1758
1761
  patch = op.slice!(n, 2)[1]
1759
- elsif !op.exist?(op.last)
1762
+ elsif !op.last.include?('*') && !op.exist?(op.last)
1760
1763
  patch ||= op.pop
1761
1764
  end
1762
1765
  append_pathspec op.extras
@@ -1968,7 +1971,8 @@ module Squared
1968
1971
  list_result(ret, 'branches', banner: banner, from: from)
1969
1972
  return
1970
1973
  else
1971
- if (head = git_spawn('rev-parse --abbrev-ref HEAD').chomp).empty?
1974
+ head = git_value 'rev-parse --abbrev-ref HEAD'
1975
+ if head.empty?
1972
1976
  ret = 0
1973
1977
  else
1974
1978
  git_spawn 'fetch --all --prune --quiet' if option('sync')
@@ -2095,7 +2099,7 @@ module Squared
2095
2099
  else
2096
2100
  ref
2097
2101
  end)
2098
- return git_spawn(cmd, exception: false).chomp
2102
+ return git_value(cmd, exception: false)
2099
2103
  when :output
2100
2104
  if opts.delete('sq-quote')
2101
2105
  cmd << '--sq-quote'
@@ -2349,7 +2353,7 @@ module Squared
2349
2353
  ret = choice_index(msg, git_spawn(cmd, stdout: false), column: /^(\S+)/, force: force, **kwargs)
2350
2354
  case ret
2351
2355
  when Array
2352
- ret.map { |val| val&.stripstyle }
2356
+ ret.map { |val| val.is_a?(Array) ? val.map { |s| s&.stripstyle } : val&.stripstyle }
2353
2357
  when String
2354
2358
  ret.stripstyle
2355
2359
  else
@@ -2527,6 +2531,10 @@ module Squared
2527
2531
  stdout: stdout, banner: banner, **kwargs)
2528
2532
  end
2529
2533
 
2534
+ def git_value(*cmd, exception: true)
2535
+ git_spawn(*cmd, exception: exception).chomp
2536
+ end
2537
+
2530
2538
  def git_grep(cmd, *grep, equals: true, **kwargs)
2531
2539
  ret = []
2532
2540
  git_spawn(cmd, **kwargs).lines(chomp: true).each do |line|
@@ -1381,7 +1381,7 @@ module Squared
1381
1381
  print_run(cmd, banner, **kwargs)
1382
1382
  session 'npx', cmd
1383
1383
  start = time_epoch if kwargs.fetch(:verbose, verbose? && !stdin?)
1384
- ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from)
1384
+ ret = run(sync: sync, banner: banner, exception: exception?(**kwargs), from: from)
1385
1385
  print_status(name, subject: 'tsc', start: start) if success?(ret, banner, start.nil?) && start
1386
1386
  ret
1387
1387
  end
@@ -19,10 +19,10 @@ module Squared
19
19
  setuptools=b try-first-with=q].freeze
20
20
  }.freeze
21
21
  OPT_PIP = {
22
- common: %w[debug disable-pip-version-check isolated no-cache-dir no-color no-input require-virtualenv
23
- q|quiet=+ v|verbose=+ cache-dir=p cert=p client-cert=p exists-action=b keyring-provider=b log=p
24
- proxy=q python=q resume-retries=i retries=i timeout=i trusted-host=b use-deprecated=b
25
- use-feature=b].freeze,
22
+ common: %w[debug disable-pip-version-check isolated no-cache-dir no-color no-input no-proxy-env
23
+ require-virtualenv q|quiet=+ v|verbose=+ cache-dir=p cert=p client-cert=p exists-action=b
24
+ keyring-provider=b log=p proxy=q python=q resume-retries=i retries=i timeout=i trusted-host=b
25
+ use-deprecated=b use-feature=b].freeze,
26
26
  cache: %w[format=b].freeze,
27
27
  completion: %w[b|bash f|fish p|powershell z|zsh].freeze,
28
28
  config: %w[global user site editor=p].freeze,
@@ -35,12 +35,12 @@ module Squared
35
35
  no-warn-conflicts no-warn-script-location U|upgrade user prefix=p report=p root=p
36
36
  root-user-action=b t|target=p upgrade-strategy=b].freeze,
37
37
  install_a: %w[no-index pre prefer-binary all-releases=b extra-index-url=q f|find-links=q i|index-url=q
38
- no-binary=q only-binary=q only-final=b].freeze,
39
- install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps require-hashes use-pep517
40
- build-constraint=p c|constraint=p group=q progress-bar=b r|requirement=p
41
- requirements-from-script=p src=p].freeze,
38
+ no-binary=q only-binary=q only-final=b refresh-package=q uploaded-prior-to=q].freeze,
39
+ install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps no-require-hashes only-deps
40
+ require-hashes use-pep517 build-constraint=p c|constraint=p group=q progress-bar=b
41
+ r|requirement=p requirements-from-script=p src=p].freeze,
42
42
  install_c: %w[C|config-settings=q e|editable=v].freeze,
43
- install_d: %w[ignore-requires-python uploaded-prior-to=q].freeze,
43
+ install_d: %w[ignore-requires-python].freeze,
44
44
  hash: %w[a|algorithm].freeze,
45
45
  list: %w[e|editable exclude-editable include-editable l|local not-required o|outdated u|uptodate user
46
46
  exclude=b format=b path=p].freeze,
@@ -749,7 +749,7 @@ module Squared
749
749
  end
750
750
  end
751
751
  print_run(op, banner, **kwargs)
752
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: :python)
752
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: :python)
753
753
  end
754
754
 
755
755
  def pip(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -831,7 +831,7 @@ module Squared
831
831
  op.clear
832
832
  end
833
833
  print_run(op, banner, **kwargs)
834
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: symjoin('pip', flag))
834
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: symjoin('pip', flag))
835
835
  .yield_self { |val| ret || val }
836
836
  end
837
837
 
@@ -1089,12 +1089,12 @@ module Squared
1089
1089
  def singleopt(flag = nil)
1090
1090
  case flag
1091
1091
  when :python
1092
- /\A(?:v+|q+|b+|V+|O+)\z/
1092
+ /\A(v+|q+|b+|V+|O+)\z/
1093
1093
  when :pdm, :poetry
1094
1094
  /\Av+\z/
1095
1095
  when :twine, :meson then nil
1096
1096
  else
1097
- /\A(?:v+|q+)\z/
1097
+ /\A(v+|q+)\z/
1098
1098
  end
1099
1099
  end
1100
1100
 
@@ -1112,19 +1112,18 @@ module Squared
1112
1112
  def pipopts(flag)
1113
1113
  ret = OPT_PIP.fetch(flag, []) + OPT_PIP[:common]
1114
1114
  if pip_install?(flag)
1115
- ret.concat(OPT_PIP[:install_a])
1115
+ ret.concat(OPT_PIP[:install_a], OPT_PIP[:install_d])
1116
1116
  ret.concat(OPT_PIP[:install_b]) unless flag == :index
1117
- ret.concat(OPT_PIP[:install_d])
1118
1117
  case flag
1119
1118
  when :install
1120
- ret.concat(OPT_PIP[:install_c] + OPT_PIP[:debug])
1119
+ ret.concat(OPT_PIP[:install_c], OPT_PIP[:debug])
1121
1120
  when :lock, :wheel
1122
1121
  ret.concat(OPT_PIP[:install_c])
1123
1122
  when :download, :index
1124
1123
  ret.concat(OPT_PIP[:debug])
1125
1124
  end
1126
1125
  elsif flag == :list
1127
- ret.concat(OPT_PIP[:install_a])
1126
+ ret.concat(OPT_PIP[:install_a], OPT_PIP[:install_d])
1128
1127
  end
1129
1128
  ret
1130
1129
  end
@@ -21,24 +21,25 @@ module Squared
21
21
  nomultiline noprompt noscript nosingleline noverbose regexp-completor sample-book-mode script
22
22
  simple-prompt single-irb singleline tracer truncate-echo-on-assignment type-completor verbose
23
23
  back-trace-limit=i context-mode=i prompt=b prompt-mode=b].freeze,
24
- rdbg: %w[no-color no-rc no-sigint-hook c|command n|nonstop stop-at-load cookie=q e=q host=q x|init-script=p
24
+ rdbg: %w[e=q no-color no-rc no-sigint-hook c|command n|nonstop stop-at-load cookie=q host=q x|init-script=p
25
25
  O|open=q? port=i port-range=b session-name=q sock-path=q util=q].freeze,
26
26
  rbs: %w[I=pm r=bm no-collection no-stdlib collection=p log-level=b log-output=p repo=p].freeze,
27
- rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
28
- display-only-correctable display-only-fail-level-offenses display-only-failed
29
- display-only-safe-correctable S|display-style-guide display-time disable-uncorrectable editor-mode
30
- enable-pending-cops E|extra-details F|fail-fast force-default-config force-exclusion x|fix-layout
31
- ignore-disable-comments ignore-parent-exclusion ignore-unrecognized-cops init l|lint
32
- list-enabled-cops-for=p L|list-target-files lsp memory no-detach only-guide-cops
33
- only-recognized-file-types no-exclude-limit profile raise-cop-error regenerate-todo
34
- restart-server safe server-status start-server stderr stop-server C|cache=b cache-root=p config=p
35
- exclude-limit=i fail-level=b f|format=b except=q only=q o|out=p plugin=p require=p show-cops=q
36
- show-docs-url=q s|stdin=p].freeze,
27
+ rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug diff disable-all-cops
28
+ disable-pending-cops display-only-correctable display-only-fail-level-offenses display-only-failed
29
+ display-only-safe-correctable S|display-style-guide display-suppressed display-time
30
+ disable-uncorrectable editor-mode enable-pending-cops E|extra-details F|fail-fast
31
+ force-default-config force-exclusion x|fix-layout ignore-disable-comments ignore-parent-exclusion
32
+ ignore-unrecognized-cops init l|lint L|list-target-files lsp mcp memory no-detach no-exclude-limit
33
+ only-guide-cops only-recognized-file-types profile raise-cop-error regenerate-todo
34
+ report-unused-todo-entries restart-server safe server-status start-server stderr stop-server
35
+ verbose-version C|cache=b cache-root=p changed=b config=p exclude-limit=i fail-level=b f|format=b
36
+ except=q list-enabled-cops-for=p only=q o|out=p plugin=p require=p show-cops=q show-docs-url=q
37
+ s|stdin=p].freeze,
37
38
  pry: %w[f e=q I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
38
39
  d|disable-plugin=q gem=b r|require=bm s|select-plugin=q].freeze,
39
40
  no: {
40
41
  rubocop: %w[auto-gen-enforced-style auto-gen-only-exclude auto-gen-timestamp color display-cop-names
41
- offense-counts parallel server].freeze
42
+ offense-counts parallel preview server].freeze
42
43
  }
43
44
  }.freeze
44
45
  OPT_BUNDLE = {
@@ -226,9 +227,10 @@ module Squared
226
227
  serve_set kwargs[:serve]
227
228
  gemfile_set kwargs[:gemspec]
228
229
  self.autodetect = autodetect
229
- @bundle = { exec: exec.is_a?(String) ? basepath!(exec) : false }
230
+ @bundle = { exec: exec.is_a?(String) ? basepath!(exec) : exec }
230
231
  @steepfile = basepath! steep if steep
231
- @rubocopfile = Pathname.new(rubocop).realpath rescue basepath!(Dir.home, '.rubocop.yml') if rubocop
232
+ rubocop = rootpath('.rubocop.yml', ascend: Dir.home) if rubocop == true
233
+ @rubocopfile = basepath! rubocop if rubocop
232
234
  @rubygems = kwargs.fetch(:rubygems, 0)
233
235
  return unless rakefile && @output[0].nil? && @copy.nil? && !version && !self.autodetect
234
236
 
@@ -1039,7 +1041,7 @@ module Squared
1039
1041
  end
1040
1042
  end
1041
1043
  print_run(op, banner, **kwargs) unless flag
1042
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from || :ruby)
1044
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: from || :ruby)
1043
1045
  end
1044
1046
 
1045
1047
  def gem(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1416,7 +1418,7 @@ module Squared
1416
1418
  op.clear(errors: true) if gems
1417
1419
  print_run(op, banner, **kwargs)
1418
1420
  run(banner: banner && %w[q silent quiet no-verbose].none? { |s| op.include?(shell_option(s)) },
1419
- exception: kwargs.fetch(:exception, exception?), from: from)
1421
+ exception: exception?(**kwargs), from: from)
1420
1422
  end
1421
1423
 
1422
1424
  def bundle(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1553,7 +1555,7 @@ module Squared
1553
1555
  op.clear
1554
1556
  end
1555
1557
  print_run(op, banner, **kwargs)
1556
- ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?),
1558
+ ret = run(sync: sync, banner: banner, exception: exception?(**kwargs),
1557
1559
  from: symjoin('bundle', flag))
1558
1560
  success?(ret, banner, output)
1559
1561
  end
@@ -1566,7 +1568,7 @@ module Squared
1566
1568
  op.append(escape: true)
1567
1569
  print_run(op, banner, **kwargs)
1568
1570
  var = { 'BANNER' => '0' } unless banner
1569
- run(op, var, sync: sync, banner: false, exception: kwargs.fetch(:exception, exception?), from: :rake)
1571
+ run(op, var, sync: sync, banner: false, exception: exception?(**kwargs), from: :rake)
1570
1572
  end
1571
1573
 
1572
1574
  def irb(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:irb], **kwargs)
@@ -1594,7 +1596,7 @@ module Squared
1594
1596
  op.concat(args)
1595
1597
  op.append(quote: false, delim: true)
1596
1598
  print_run(op, banner, **kwargs)
1597
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: :rdbg)
1599
+ run(banner: false, exception: exception?(**kwargs), from: :rdbg)
1598
1600
  end
1599
1601
 
1600
1602
  def rbs(flag, *args, banner: verbose?, with: nil, pass: nil, **kwargs)
@@ -1643,7 +1645,7 @@ module Squared
1643
1645
  op.clear
1644
1646
  .append(*args)
1645
1647
  print_run(op, banner, **kwargs)
1646
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: symjoin('rbs', flag))
1648
+ run(banner: false, exception: exception?(**kwargs), from: symjoin('rbs', flag))
1647
1649
  end
1648
1650
  end
1649
1651
 
@@ -1666,7 +1668,7 @@ module Squared
1666
1668
  op.append(delim: true)
1667
1669
  .clear(errors: true)
1668
1670
  print_run(op, banner, **kwargs)
1669
- run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: :rubocop)
1671
+ run(sync: sync, banner: banner, exception: exception?(**kwargs), from: :rubocop)
1670
1672
  end
1671
1673
 
1672
1674
  def serve(root, *, bind: nil, port: 3000, **kwargs)
@@ -1860,7 +1862,7 @@ module Squared
1860
1862
  op.concat(args)
1861
1863
  op.append(delim: delim)
1862
1864
  print_run(op, banner, **kwargs)
1863
- run(banner: false, exception: kwargs.fetch(:exception, exception?), from: from)
1865
+ run(banner: false, exception: exception?(**kwargs), from: from)
1864
1866
  end
1865
1867
 
1866
1868
  def ruby_session(*cmd, **kwargs)
@@ -219,6 +219,7 @@ module Squared
219
219
  end
220
220
 
221
221
  attr_reader :target, :extras, :found, :errors, :values, :project, :path, :sep
222
+ attr_accessor :stdout
222
223
 
223
224
  def_delegators :@target, :+, :-, :<<, :any?, :none?, :include?, :add, :add?, :find, :find_all, :find_index,
224
225
  :merge, :compact, :delete, :delete?, :delete_if, :grep, :grep_v, :inspect, :to_a, :to_s
@@ -241,14 +242,16 @@ module Squared
241
242
  @sep = sep
242
243
  @errors = []
243
244
  @found = []
245
+ @stdout = false
244
246
  parse(list, opts, **kwargs, &blk)
245
247
  end
246
248
 
247
249
  def parse(list, opts = extras, no: nil, single: nil, args: false, multiple: nil, first: nil, underscore: nil,
248
- explicit: false, bool: %w[true false], stdin: false, &blk)
250
+ explicit: false, bool: %w[true false], auto: [], stdin: false, &blk)
249
251
  @extras = []
250
252
  @values = []
251
253
  bare = []
254
+ auto = auto.flat_map { |val| val.split('|', 2) }
252
255
  e = []
253
256
  b = []
254
257
  m = []
@@ -350,6 +353,7 @@ module Squared
350
353
  tr = ->(a) { a.map { |val| val.tr('-', '_') } }
351
354
  @values.concat(tr.call(@values))
352
355
  bare.concat(tr.call(bare))
356
+ auto.concat(tr.call(auto))
353
357
  e.concat(tr.call(e))
354
358
  b.concat(tr.call(b))
355
359
  m.concat(tr.call(m))
@@ -363,6 +367,7 @@ module Squared
363
367
  ml.concat(tr.call(ml))
364
368
  no.concat(tr.call(no))
365
369
  end
370
+ bare.concat(auto)
366
371
  if target.is_a?(JoinSet)
367
372
  target.multiple = multiple if multiple
368
373
  target.multiple = ml.map { |val| val.size == 1 ? "-#{val}" : "--#{val}" }
@@ -395,6 +400,10 @@ module Squared
395
400
  add "#{sw[opt]}#{opt}"
396
401
  else
397
402
  add(opt.size == 1 ? "-#{opt}" : "--#{opt}")
403
+ if auto.include?(opt)
404
+ @stdout = true
405
+ break
406
+ end
398
407
  end
399
408
  elsif opt.start_with?(/no[-_]/) && no.include?(s = opt[3..-1])
400
409
  add "--no-#{s}"
@@ -821,6 +830,10 @@ module Squared
821
830
  end
822
831
  end
823
832
 
833
+ def style?(*args)
834
+ !stdout && args.none?(&:!)
835
+ end
836
+
824
837
  def uniq!(list)
825
838
  list = uniq list
826
839
  return if list.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.8.5
4
+ version: 0.8.6
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.21
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: []