squared 0.9.0.pre1 → 0.9.0
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 +4 -4
- data/CHANGELOG.md +37 -1
- data/README.md +22 -12
- data/exe/sqd +22 -11
- data/lib/squared/common/prompt.rb +5 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +43 -20
- data/lib/squared/workspace/project/base.rb +21 -5
- data/lib/squared/workspace/project/docker.rb +1 -1
- data/lib/squared/workspace/project/git.rb +29 -24
- data/lib/squared/workspace/project/node.rb +80 -64
- data/lib/squared/workspace/project/python.rb +41 -37
- data/lib/squared/workspace/project/ruby.rb +37 -31
- data/lib/squared/workspace/project/support/class.rb +10 -10
- data/lib/squared/workspace/project/support/optionpartition.rb +14 -1
- metadata +1 -1
|
@@ -69,7 +69,7 @@ module Squared
|
|
|
69
69
|
install: %w[check-cache check-resolutions immutable immutable-cache inline-builds json refresh-lockfile
|
|
70
70
|
mode=b].freeze,
|
|
71
71
|
add: %w[cached D|dev json O|optional P|peer prefer-dev].freeze,
|
|
72
|
-
add_a: %w[C|caret E|exact F|fixed interactive T|tilde mode=b].freeze,
|
|
72
|
+
add_a: %w[C|caret E|exact F|fixed i|interactive no-time-gate T|tilde mode=b].freeze,
|
|
73
73
|
update: %w[R|recursive].freeze,
|
|
74
74
|
dedupe: %w[check json mode=b strategy=b].freeze,
|
|
75
75
|
run: %w[B|binaries-only inspect inspect-brk T|top-level require=q].freeze,
|
|
@@ -77,39 +77,37 @@ module Squared
|
|
|
77
77
|
}.freeze
|
|
78
78
|
OPT_TSC = {
|
|
79
79
|
base: %w[all b|build init listFilesOnly locale=b p|project=p showConfig w|watch].freeze,
|
|
80
|
-
compiler: %w[allowArbitraryExtensions
|
|
81
|
-
allowUnreachableCode
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
build: %w[clean=!? dry=!? force=!? v|verbose=!?].freeze,
|
|
105
|
-
watch: %w[excludeDirectories=p excludeFiles=p fallbackPolling=b synchronousWatchDirectory=!? watchDirectory=b
|
|
80
|
+
compiler: %w[allowArbitraryExtensions allowImportingTsExtensions allowJs allowUmdGlobalAccess
|
|
81
|
+
allowUnreachableCode allowUnusedLabels assumeChangesOnlyAffectDirectDependencies charset=b
|
|
82
|
+
checkJs composite customConditions=q d|declaration declarationDir=p declarationMap diagnostics
|
|
83
|
+
disableReferencedProjectLoad disableSizeLimit disableSolutionSearching emitBOM
|
|
84
|
+
emitDeclarationOnly emitDecoratorMetadata erasableSyntaxOnly exactOptionalPropertyTypes
|
|
85
|
+
experimentalDecorators explainFiles extendedDiagnostics forceConsistentCasingInFileNames
|
|
86
|
+
generateCpuProfile=b ignoreConfig importHelpers importsNotUsedAsValues=b incremental
|
|
87
|
+
inlineSourceMap inlineSources isolatedDeclarations isolatedModules jsx=b jsxFactory=q
|
|
88
|
+
jsxFragmentFactory=q jsxImportSource=q keyofStringsOnly lib=q libReplacement listEmittedFiles
|
|
89
|
+
listFiles mapRoot=p maxNodeModuleJsDepth=i m|module=b moduleDetection=b moduleResolution=b
|
|
90
|
+
moduleSuffixes=b newLine=b noCheck noEmit noEmitHelpers noEmitOnError noErrorTruncation
|
|
91
|
+
noFallthroughCasesInSwitch noImplicitAny noImplicitOverride noImplicitReturns noImplicitThis
|
|
92
|
+
noImplicitUseStrict noLib noPropertyAccessFromIndexSignature noResolve noStrictGenericChecks
|
|
93
|
+
noUncheckedIndexedAccess noUncheckedSideEffectImports noUnusedLocals noUnusedParameters outDir=p
|
|
94
|
+
paths=q plugins=b preserveConstEnums preserveSymlinks preserveValueImports preserveWatchOutput
|
|
95
|
+
pretty reactNamespace=b removeComments resolveJsonModule resolvePackageJsonExports
|
|
96
|
+
resolvePackageJsonImports rewriteRelativeImportExtensions rootDir=p rootDirs=p
|
|
97
|
+
skipDefaultLibCheck skipLibCheck sourceMap sourceRoot=p stableTypeOrdering stopBuildOnErrors
|
|
98
|
+
strict strictBindCallApply strictBuiltinIteratorReturn strictFunctionTypes strictNullChecks
|
|
99
|
+
strictPropertyInitialization stripInternal suppressExcessPropertyErrors
|
|
100
|
+
suppressImplicitAnyIndexErrors t|target=b traceResolution tsBuildInfoFile=p typeRoots=p types=b
|
|
101
|
+
useDefineForClassFields useUnknownInCatchVariables verbatimModuleSyntax].freeze,
|
|
102
|
+
build: %w[clean dry force v|verbose].freeze,
|
|
103
|
+
watch: %w[excludeDirectories=p excludeFiles=p fallbackPolling=b synchronousWatchDirectory watchDirectory=b
|
|
106
104
|
watchFile=b].freeze,
|
|
107
105
|
v7: {
|
|
108
106
|
compiler: %w[builders=i checkers=i singleThreaded=!?]
|
|
109
107
|
},
|
|
110
108
|
v5: {
|
|
111
|
-
compiler: %w[allowSyntheticDefaultImports
|
|
112
|
-
|
|
109
|
+
compiler: %w[allowSyntheticDefaultImports alwaysStrict baseUrl=p downlevelIteration esModuleInterop
|
|
110
|
+
outFile=p].freeze
|
|
113
111
|
}.freeze
|
|
114
112
|
}.freeze
|
|
115
113
|
PASS_NODE = {
|
|
@@ -308,13 +306,11 @@ module Squared
|
|
|
308
306
|
format_desc action, nil, 'version|pre?{major,minor,patch}|prerelease'
|
|
309
307
|
task action, [:version] do |_, args|
|
|
310
308
|
version = param_guard(action, 'to', args: args, key: :version)
|
|
311
|
-
if version.match?(/^(
|
|
312
|
-
|
|
313
|
-
version = nil
|
|
309
|
+
if version.match?(/^(pre)?(major|minor|patch)|prerelease$/)
|
|
310
|
+
bump version.to_sym
|
|
314
311
|
else
|
|
315
|
-
|
|
312
|
+
bump :version, version
|
|
316
313
|
end
|
|
317
|
-
bump flag, version
|
|
318
314
|
end
|
|
319
315
|
when 'pack'
|
|
320
316
|
format_desc action, nil, 'opts*'
|
|
@@ -350,7 +346,7 @@ module Squared
|
|
|
350
346
|
.map { |name, ver| name.ljust(pad + 4) + ver }
|
|
351
347
|
if list.empty?
|
|
352
348
|
puts log_message('no packages to review', subject: name, hint: "#{flag}-scripts")
|
|
353
|
-
exit
|
|
349
|
+
exit
|
|
354
350
|
end
|
|
355
351
|
args.concat(choice_index('Select packages', list, multiple: true, column: /^(\S+)/))
|
|
356
352
|
end
|
|
@@ -664,7 +660,7 @@ module Squared
|
|
|
664
660
|
end
|
|
665
661
|
if nolockfile?(prefix: 'yarn')
|
|
666
662
|
cmd << '--no-lockfile'
|
|
667
|
-
elsif ci? && exist?(
|
|
663
|
+
elsif ci? && exist?(yarnlock)
|
|
668
664
|
if yarn == 1
|
|
669
665
|
cmd << '--frozen-lockfile'
|
|
670
666
|
elsif !flag
|
|
@@ -700,13 +696,13 @@ module Squared
|
|
|
700
696
|
'--force'
|
|
701
697
|
elsif nolockfile?(prefix: 'pnpm')
|
|
702
698
|
'--no-lockfile'
|
|
703
|
-
elsif ci? && exist?(
|
|
699
|
+
elsif ci? && exist?(pnpmlock)
|
|
704
700
|
'--frozen-lockfile'
|
|
705
701
|
end
|
|
706
702
|
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
707
703
|
cmd << '--dangerously-allow-all-builds' if option('approve-builds')
|
|
708
704
|
else
|
|
709
|
-
cmd = session('npm', ci = ci? && exist?(
|
|
705
|
+
cmd = session('npm', ci = ci? && exist?(npmlock) ? 'ci' : 'install')
|
|
710
706
|
option('approve-scripts') do |val|
|
|
711
707
|
cmd = npm_output 'approve-scripts'
|
|
712
708
|
cmd << case val
|
|
@@ -759,7 +755,7 @@ module Squared
|
|
|
759
755
|
append_platform
|
|
760
756
|
end
|
|
761
757
|
end
|
|
762
|
-
cmd << '--package-lock=false' << 'save=false' if nolockfile?(prefix: 'npm')
|
|
758
|
+
cmd << '--package-lock=false' << '--save=false' if nolockfile?(prefix: 'npm')
|
|
763
759
|
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
764
760
|
end
|
|
765
761
|
if add
|
|
@@ -772,7 +768,7 @@ module Squared
|
|
|
772
768
|
end
|
|
773
769
|
|
|
774
770
|
def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
|
|
775
|
-
cmd = session(pnpm? && exist?(
|
|
771
|
+
cmd = session(pnpm? && exist?(pnpmlock) ? 'pnpm' : 'npm', 'outdated')
|
|
776
772
|
dryrun = has_value?(opts, 'd', 'dry-run') || dryrun?
|
|
777
773
|
unless dryrun
|
|
778
774
|
log.info cmd.to_s
|
|
@@ -1351,39 +1347,47 @@ module Squared
|
|
|
1351
1347
|
end
|
|
1352
1348
|
|
|
1353
1349
|
def tsc(*args, with: nil, pass: PASS_NODE[:tsc], sync: true, banner: verbose?, from: :tsc, **kwargs)
|
|
1354
|
-
|
|
1350
|
+
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1355
1351
|
p = kwargs[:project]
|
|
1356
1352
|
b = kwargs[:build]
|
|
1357
1353
|
w = kwargs[:watch]
|
|
1358
1354
|
list = OPT_TSC[:base] + OPT_TSC[:compiler]
|
|
1359
1355
|
kwargs[:legacy] = semapp('npx', 'tsc', '--version', minor: false) if kwargs[:detect]
|
|
1360
1356
|
list.concat(Array(kwargs[:legacy]).flat_map { |n| OPT_TSC.fetch(:"v#{n}", {}).fetch(:compiler, []) })
|
|
1357
|
+
auto = %w[h|help v|version]
|
|
1361
1358
|
cmd = session 'tsc', if p
|
|
1362
1359
|
quote_option 'p', basepath(p)
|
|
1363
1360
|
elsif b
|
|
1364
1361
|
list.concat(OPT_TSC[:build])
|
|
1362
|
+
auto[1] = 'version'
|
|
1365
1363
|
'-b'
|
|
1366
1364
|
end
|
|
1367
1365
|
if w
|
|
1368
1366
|
list.concat(OPT_TSC[:watch])
|
|
1369
1367
|
cmd << '-w'
|
|
1370
1368
|
end
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1369
|
+
flags, args = args.partition { |val| val.start_with?('-') }
|
|
1370
|
+
op = OptionPartition.new(opts + args, list, cmd, project: self, strict: strict?, auto: auto, explicit: true,
|
|
1371
|
+
sep: ' ')
|
|
1372
|
+
if op.stdout
|
|
1373
|
+
banner = false
|
|
1374
|
+
else
|
|
1375
|
+
unless p
|
|
1376
|
+
if b.is_a?(String)
|
|
1377
|
+
op.add_path(b)
|
|
1378
|
+
elsif w.is_a?(String)
|
|
1379
|
+
op.add_path(w)
|
|
1380
|
+
else
|
|
1381
|
+
op.exist?(add: true)
|
|
1382
|
+
end
|
|
1379
1383
|
end
|
|
1384
|
+
op.append(flags, escape: kwargs.fetch(:escape, false), quote: kwargs.fetch(:quote, false))
|
|
1385
|
+
.clear
|
|
1386
|
+
print_run(op, banner, **kwargs)
|
|
1387
|
+
start = time_epoch if kwargs.fetch(:verbose, verbose? && !stdin?)
|
|
1380
1388
|
end
|
|
1381
|
-
op.
|
|
1382
|
-
|
|
1383
|
-
print_run(cmd, banner, **kwargs)
|
|
1384
|
-
session 'npx', cmd
|
|
1385
|
-
start = time_epoch if kwargs.fetch(:verbose, verbose? && !stdin?)
|
|
1386
|
-
ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from)
|
|
1389
|
+
session 'npx', session_done(op.target)
|
|
1390
|
+
ret = run(sync: sync, banner: banner, exception: exception?(**kwargs), from: from)
|
|
1387
1391
|
print_status(name, subject: 'tsc', start: start) if success?(ret, banner, start.nil?) && start
|
|
1388
1392
|
ret
|
|
1389
1393
|
end
|
|
@@ -1454,7 +1458,7 @@ module Squared
|
|
|
1454
1458
|
end
|
|
1455
1459
|
|
|
1456
1460
|
def yarn?
|
|
1457
|
-
(@pm[:yarn] ||= if rootpath(
|
|
1461
|
+
(@pm[:yarn] ||= if rootpath(yarnlock, ascend: dependroot).exist?
|
|
1458
1462
|
yarntype
|
|
1459
1463
|
elsif (ver = read_package || read_install)
|
|
1460
1464
|
if ver =~ /^yarn(?:@(\d)|$)/
|
|
@@ -1475,7 +1479,7 @@ module Squared
|
|
|
1475
1479
|
end
|
|
1476
1480
|
|
|
1477
1481
|
def pnpm?
|
|
1478
|
-
(@pm[:pnpm] ||= if rootpath(
|
|
1482
|
+
(@pm[:pnpm] ||= if rootpath(pnpmlock, ascend: dependroot).exist?
|
|
1479
1483
|
pnpmtype
|
|
1480
1484
|
elsif (ver = read_package || read_install)
|
|
1481
1485
|
ver.start_with?('pnpm') ? pnpmtype : 0
|
|
@@ -1584,7 +1588,7 @@ module Squared
|
|
|
1584
1588
|
require 'yaml'
|
|
1585
1589
|
doc = YAML.load_file(rc)
|
|
1586
1590
|
doc.nodeLinker == 'node-modules' ? 2 : 3
|
|
1587
|
-
elsif exist && !exist?(
|
|
1591
|
+
elsif exist && !exist?(yarnlock)
|
|
1588
1592
|
0
|
|
1589
1593
|
else
|
|
1590
1594
|
1
|
|
@@ -1596,6 +1600,10 @@ module Squared
|
|
|
1596
1600
|
3
|
|
1597
1601
|
end
|
|
1598
1602
|
|
|
1603
|
+
def yarnlock
|
|
1604
|
+
'yarn.lock'
|
|
1605
|
+
end
|
|
1606
|
+
|
|
1599
1607
|
def pnpmtype(exist: false)
|
|
1600
1608
|
require 'yaml'
|
|
1601
1609
|
doc = YAML.load_file(basepath('node_modules/.modules.yaml', ascend: dependroot))
|
|
@@ -1610,13 +1618,21 @@ module Squared
|
|
|
1610
1618
|
end
|
|
1611
1619
|
rescue => e
|
|
1612
1620
|
if exist
|
|
1613
|
-
%
|
|
1621
|
+
%W[#{pnpmlock} pnpm-workspace.yaml].any? { |val| exist?(val) } ? 4 : 0
|
|
1614
1622
|
else
|
|
1615
1623
|
log.debug e
|
|
1616
1624
|
4
|
|
1617
1625
|
end
|
|
1618
1626
|
end
|
|
1619
1627
|
|
|
1628
|
+
def pnpmlock
|
|
1629
|
+
'pnpm-lock.yaml'
|
|
1630
|
+
end
|
|
1631
|
+
|
|
1632
|
+
def pnpmopts(*args)
|
|
1633
|
+
OPT_PNPM[:common] + args.flat_map { |name| OPT_PNPM.fetch(name, []) }
|
|
1634
|
+
end
|
|
1635
|
+
|
|
1620
1636
|
def remove_modules(prefix: dependbin)
|
|
1621
1637
|
modules = basepath!('node_modules', type: 'd')
|
|
1622
1638
|
return false unless modules && confirm_basic('Remove?', modules, prefix: prefix)
|
|
@@ -1698,16 +1714,16 @@ module Squared
|
|
|
1698
1714
|
].concat(args)
|
|
1699
1715
|
end
|
|
1700
1716
|
|
|
1701
|
-
def
|
|
1702
|
-
|
|
1717
|
+
def npmlock
|
|
1718
|
+
'package-lock.json'
|
|
1703
1719
|
end
|
|
1704
1720
|
|
|
1705
|
-
def
|
|
1706
|
-
|
|
1721
|
+
def npmopts(*args)
|
|
1722
|
+
OPT_NPM[:common] + args.flat_map { |name| OPT_NPM.fetch(name, []) }
|
|
1707
1723
|
end
|
|
1708
1724
|
|
|
1709
1725
|
def lockfile(delete = false)
|
|
1710
|
-
ret = basepath(yarn? ?
|
|
1726
|
+
ret = basepath(yarn? ? yarnlock : pnpm? ? pnpmlock : npmlock)
|
|
1711
1727
|
if ret.exist?
|
|
1712
1728
|
if delete
|
|
1713
1729
|
ret.delete
|
|
@@ -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
|
|
23
|
-
q|quiet=+ v|verbose=+ cache-dir=p cert=p client-cert=p exists-action=b
|
|
24
|
-
proxy=q python=q resume-retries=i retries=i timeout=i trusted-host=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
|
|
40
|
-
build-constraint=p c|constraint=p group=q progress-bar=b
|
|
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
|
|
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,
|
|
@@ -53,23 +53,23 @@ module Squared
|
|
|
53
53
|
common: %w[ansi no-ansi no-cache n|no-interaction no-plugins q|quiet v|verbose=+ P|project=p].freeze,
|
|
54
54
|
install: %w[all-extras all-groups compile dry-run no-directory no-root only-root E|extras=q only=q with=q
|
|
55
55
|
without=q].freeze,
|
|
56
|
-
build: %w[clean config-settings=qq f|format=b o|output=p].freeze,
|
|
56
|
+
build: %w[clean c|config-settings=qq f|format=b o|output=p].freeze,
|
|
57
57
|
publish: %w[build dry-run skip-existing cert=p client-cert=p dist-dir=p p|password=q r|repository=q
|
|
58
58
|
u|username=qq].freeze
|
|
59
59
|
}.freeze
|
|
60
60
|
OPT_PDM = {
|
|
61
|
-
common: %w[c|config I|ignore-python no-cache n|non-interactive
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
publish: %w[no-build no-very-ssl
|
|
65
|
-
i|identity=b P|password=q
|
|
61
|
+
common: %w[c|config I|ignore-python no-cache n|non-interactive q|quiet v|verbose=+ p|project=p
|
|
62
|
+
k|skip=b].freeze,
|
|
63
|
+
build: %w[C=bm no-clean no-isolation no-sdist no-wheel config-setting=qq d|dest=p].freeze,
|
|
64
|
+
publish: %w[no-build no-verify-ssl no-very-ssl S|sign skip-existing ca-certs=p c|comment=q d|dest=p
|
|
65
|
+
i|identity=b P|password=q r|repository=q u|username=qq].freeze
|
|
66
66
|
}.freeze
|
|
67
67
|
OPT_HATCH = {
|
|
68
68
|
common: %w[color interactive no-color no-interactive cache-dir=p config=p data-dir=p e|env=b p|project=b
|
|
69
69
|
q|quiet=+ v|verbose=+].freeze,
|
|
70
|
-
build: %w[clean-hooks-after ext hooks-only no-hooks c|clean t|target=b].freeze,
|
|
70
|
+
build: %w[a|all clean-hooks-after ext hooks-only no-hooks c|clean t|target=b].freeze,
|
|
71
71
|
publish: %w[initialize-auth n|no-prompt y|yes a|auth=q ca-cert=p client-cert=p client-key=p o|option=q
|
|
72
|
-
p|publisher=b r|repo=q u|user=
|
|
72
|
+
p|publisher=b r|repo=q u|user=qq].freeze
|
|
73
73
|
}.freeze
|
|
74
74
|
OPT_TWINE = {
|
|
75
75
|
publish: %w[attestations disable-progress-bar non-interactive s|sign skip-existing verbose cert=p
|
|
@@ -77,15 +77,20 @@ module Squared
|
|
|
77
77
|
sign-with=b u|username=qq].freeze
|
|
78
78
|
}.freeze
|
|
79
79
|
OPT_MESON = {
|
|
80
|
-
build: %w[D=q clearcache debug errorlogs fatal-meson-warnings pkgconfig.relocatable prefer-static
|
|
81
|
-
python.allow-limited-api reconfigure stdsplit strip vsenv werror wipe auto-features=b
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
80
|
+
build: %w[D=q clearcache debug errorlogs fatal-meson-warnings os2-emxomf pkgconfig.relocatable prefer-static
|
|
81
|
+
python.allow-limited-api reconfigure stdsplit strip vsenv werror wipe auto-features=b
|
|
82
|
+
backend={ninja,vs,vs2010,vs2012,vs2013,vs2015,vs2017,vs2019,vs2022,vs2026,xcode,none}
|
|
83
|
+
bindir=q build.cmake-prefix-path=p build.pkg-config-path=p
|
|
84
|
+
buildtype={plain,debug,debugoptimized,release,minsize,custom} cmake-prefix-path=p cross-file=p
|
|
85
|
+
datadir=q default-library={shared,static,both} default-both-libraries={shared,static,auto}
|
|
86
|
+
force-fallback-for=q genvslite={vs2022,vs2026} includedir=q infodir=q install-umask=b
|
|
87
|
+
layout={mirror,flat} libdir=q libexecdir=q licensedir=q localedir=q localstatedir=q mandir=q
|
|
88
|
+
namingscheme={platform,classic} native-file=p optimization={plain,0,g,1,2,3,s} pkg-config-path=p
|
|
89
|
+
prefix=p python.build-config=p python.bytecompile=b python.platlibdir=p python.purelibdir=p
|
|
90
|
+
python.install-env={auto,prefix,system,venv} sbindir=q sharedstatedir=q sysconfdir=q
|
|
91
|
+
unity={on,off,subprojects} unity-size=i warnlevel={0,1,2,3,everything}
|
|
92
|
+
wrap-mode={default,nofallback,nodownload,forcefallback,nopromote}].freeze,
|
|
93
|
+
compile: %w[C=p clean v|verbose j|jobs=i l|load-average=b ninja-args=q vs-args=q xcode-args=q].freeze
|
|
89
94
|
}.freeze
|
|
90
95
|
PASS_PYTHON = {
|
|
91
96
|
python: %w[c v V].freeze,
|
|
@@ -749,8 +754,8 @@ module Squared
|
|
|
749
754
|
def python(*args, sync: true, banner: verbose?, with: nil, pass: PASS_PYTHON[:python], **kwargs)
|
|
750
755
|
op = OptionPartition.new(session_opts(with, args: args, kwargs: kwargs, pass: pass), OPT_PYTHON[:common],
|
|
751
756
|
session('python', path: !venv?),
|
|
752
|
-
project: self, strict: strict?,
|
|
753
|
-
args: true, stdin: true)
|
|
757
|
+
project: self, strict: strict?, auto: %w[help V|version],
|
|
758
|
+
multiple: [/^-c/], single: singleopt(:python), args: true, stdin: true)
|
|
754
759
|
op.concat(args)
|
|
755
760
|
if op.include?('-')
|
|
756
761
|
op.exist?(add: true)
|
|
@@ -763,8 +768,8 @@ module Squared
|
|
|
763
768
|
op.append(escape: kwargs.fetch(:escape, false), quote: kwargs.fetch(:quote, false))
|
|
764
769
|
end
|
|
765
770
|
end
|
|
766
|
-
print_run(op, banner, **kwargs)
|
|
767
|
-
run(sync: sync, banner: banner, exception:
|
|
771
|
+
print_run(op, banner, **kwargs) unless op.stdout
|
|
772
|
+
run(sync: sync, banner: op.style?(banner), exception: exception?(**kwargs), from: :python)
|
|
768
773
|
end
|
|
769
774
|
|
|
770
775
|
def pip(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -846,7 +851,7 @@ module Squared
|
|
|
846
851
|
op.clear
|
|
847
852
|
end
|
|
848
853
|
print_run(op, banner, **kwargs)
|
|
849
|
-
run(sync: sync, banner: banner, exception:
|
|
854
|
+
run(sync: sync, banner: banner, exception: exception?(**kwargs), from: symjoin('pip', flag))
|
|
850
855
|
.then { |val| ret || val }
|
|
851
856
|
end
|
|
852
857
|
|
|
@@ -1122,12 +1127,12 @@ module Squared
|
|
|
1122
1127
|
def singleopt(flag = nil)
|
|
1123
1128
|
case flag
|
|
1124
1129
|
when :python
|
|
1125
|
-
/\A(
|
|
1130
|
+
/\A(v+|q+|b+|V+|O+)\z/
|
|
1126
1131
|
when :pdm, :poetry
|
|
1127
1132
|
/\Av+\z/
|
|
1128
1133
|
when :twine, :meson then nil
|
|
1129
1134
|
else
|
|
1130
|
-
/\A(
|
|
1135
|
+
/\A(v+|q+)\z/
|
|
1131
1136
|
end
|
|
1132
1137
|
end
|
|
1133
1138
|
|
|
@@ -1145,19 +1150,18 @@ module Squared
|
|
|
1145
1150
|
def pipopts(flag)
|
|
1146
1151
|
ret = OPT_PIP.fetch(flag, []) + OPT_PIP[:common]
|
|
1147
1152
|
if pip_install?(flag)
|
|
1148
|
-
ret.concat(OPT_PIP[:install_a])
|
|
1153
|
+
ret.concat(OPT_PIP[:install_a], OPT_PIP[:install_d])
|
|
1149
1154
|
ret.concat(OPT_PIP[:install_b]) unless flag == :index
|
|
1150
|
-
ret.concat(OPT_PIP[:install_d])
|
|
1151
1155
|
case flag
|
|
1152
1156
|
when :install
|
|
1153
|
-
ret.concat(OPT_PIP[:install_c]
|
|
1157
|
+
ret.concat(OPT_PIP[:install_c], OPT_PIP[:debug])
|
|
1154
1158
|
when :lock, :wheel
|
|
1155
1159
|
ret.concat(OPT_PIP[:install_c])
|
|
1156
1160
|
when :download, :index
|
|
1157
1161
|
ret.concat(OPT_PIP[:debug])
|
|
1158
1162
|
end
|
|
1159
1163
|
elsif flag == :list
|
|
1160
|
-
ret.concat(OPT_PIP[:install_a])
|
|
1164
|
+
ret.concat(OPT_PIP[:install_a], OPT_PIP[:install_d])
|
|
1161
1165
|
end
|
|
1162
1166
|
ret
|
|
1163
1167
|
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
|
|
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-
|
|
28
|
-
display-only-correctable display-only-fail-level-offenses display-only-failed
|
|
29
|
-
display-only-safe-correctable S|display-style-guide display-
|
|
30
|
-
enable-pending-cops E|extra-details F|fail-fast
|
|
31
|
-
ignore-disable-comments ignore-parent-exclusion
|
|
32
|
-
|
|
33
|
-
only-recognized-file-types
|
|
34
|
-
restart-server safe server-status start-server stderr stop-server
|
|
35
|
-
|
|
36
|
-
|
|
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) :
|
|
230
|
+
@bundle = { exec: exec.is_a?(String) ? basepath!(exec) : exec }
|
|
230
231
|
@steepfile = basepath! steep if steep
|
|
231
|
-
|
|
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
|
|
|
@@ -1019,13 +1021,17 @@ module Squared
|
|
|
1019
1021
|
end
|
|
1020
1022
|
|
|
1021
1023
|
def ruby(*args, sync: true, banner: verbose?, with: nil, pass: PASS_RUBY[:ruby], **kwargs)
|
|
1022
|
-
if args.first.is_a?(Symbol)
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1024
|
+
from = if args.first.is_a?(Symbol)
|
|
1025
|
+
flag = args.shift
|
|
1026
|
+
symjoin 'ruby', flag
|
|
1027
|
+
else
|
|
1028
|
+
:ruby
|
|
1029
|
+
end
|
|
1030
|
+
op = OptionPartition.new(session_opts(with, args: args, kwargs: kwargs, pass: pass),
|
|
1031
|
+
OPT_RUBY[:ruby],
|
|
1032
|
+
ruby_session,
|
|
1033
|
+
project: self, strict: strict?, auto: %w[help version],
|
|
1034
|
+
multiple: [/^-e/], args: true, stdin: true)
|
|
1029
1035
|
if kwargs[:command]
|
|
1030
1036
|
op << quote_option('e', kwargs[:command])
|
|
1031
1037
|
elsif kwargs[:file]
|
|
@@ -1046,8 +1052,8 @@ module Squared
|
|
|
1046
1052
|
op.append(delim: true, escape: kwargs.fetch(:escape, false), quote: kwargs.fetch(:quote, false))
|
|
1047
1053
|
end
|
|
1048
1054
|
end
|
|
1049
|
-
print_run(op, banner, **kwargs) unless flag
|
|
1050
|
-
run(sync: sync, banner: banner, exception:
|
|
1055
|
+
print_run(op, banner, **kwargs) unless flag || op.stdout
|
|
1056
|
+
run(sync: sync, banner: op.style?(banner), exception: exception?(**kwargs), from: from)
|
|
1051
1057
|
end
|
|
1052
1058
|
|
|
1053
1059
|
def gem(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -1307,7 +1313,7 @@ module Squared
|
|
|
1307
1313
|
end
|
|
1308
1314
|
if dryrun? || kwargs[:filter]&.fetch(:dryrun, nil)
|
|
1309
1315
|
print_item "> #{op}"
|
|
1310
|
-
exit
|
|
1316
|
+
exit
|
|
1311
1317
|
elsif !with && banner
|
|
1312
1318
|
return run(from: from, interactive: ['Push', 'N', target || gemname])
|
|
1313
1319
|
end
|
|
@@ -1430,7 +1436,7 @@ module Squared
|
|
|
1430
1436
|
op.clear(errors: true) if gems
|
|
1431
1437
|
print_run(op, banner, **kwargs)
|
|
1432
1438
|
run(banner: banner && %w[q silent quiet no-verbose].none? { |s| op.include?(shell_option(s)) },
|
|
1433
|
-
exception:
|
|
1439
|
+
exception: exception?(**kwargs), from: from)
|
|
1434
1440
|
end
|
|
1435
1441
|
|
|
1436
1442
|
def bundle(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -1567,7 +1573,7 @@ module Squared
|
|
|
1567
1573
|
op.clear
|
|
1568
1574
|
end
|
|
1569
1575
|
print_run(op, banner, **kwargs)
|
|
1570
|
-
ret = run(sync: sync, banner: banner, exception:
|
|
1576
|
+
ret = run(sync: sync, banner: banner, exception: exception?(**kwargs),
|
|
1571
1577
|
from: symjoin('bundle', flag))
|
|
1572
1578
|
success?(ret, banner, output)
|
|
1573
1579
|
end
|
|
@@ -1580,7 +1586,7 @@ module Squared
|
|
|
1580
1586
|
op.append(escape: true)
|
|
1581
1587
|
print_run(op, banner, **kwargs)
|
|
1582
1588
|
var = { 'BANNER' => '0' } unless banner
|
|
1583
|
-
run(op, var, sync: sync, banner: false, exception:
|
|
1589
|
+
run(op, var, sync: sync, banner: false, exception: exception?(**kwargs), from: :rake)
|
|
1584
1590
|
end
|
|
1585
1591
|
|
|
1586
1592
|
def irb(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:irb], **kwargs)
|
|
@@ -1608,7 +1614,7 @@ module Squared
|
|
|
1608
1614
|
op.concat(args)
|
|
1609
1615
|
op.append(quote: false, delim: true)
|
|
1610
1616
|
print_run(op, banner, **kwargs)
|
|
1611
|
-
run(banner: false, exception:
|
|
1617
|
+
run(banner: false, exception: exception?(**kwargs), from: :rdbg)
|
|
1612
1618
|
end
|
|
1613
1619
|
|
|
1614
1620
|
def rbs(flag, *args, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -1657,7 +1663,7 @@ module Squared
|
|
|
1657
1663
|
op.clear
|
|
1658
1664
|
.append(*args)
|
|
1659
1665
|
print_run(op, banner, **kwargs)
|
|
1660
|
-
run(banner: false, exception:
|
|
1666
|
+
run(banner: false, exception: exception?(**kwargs), from: symjoin('rbs', flag))
|
|
1661
1667
|
end
|
|
1662
1668
|
end
|
|
1663
1669
|
|
|
@@ -1680,7 +1686,7 @@ module Squared
|
|
|
1680
1686
|
op.append(delim: true)
|
|
1681
1687
|
.clear(errors: true)
|
|
1682
1688
|
print_run(op, banner, **kwargs)
|
|
1683
|
-
run(sync: sync, banner: banner, exception:
|
|
1689
|
+
run(sync: sync, banner: banner, exception: exception?(**kwargs), from: :rubocop)
|
|
1684
1690
|
end
|
|
1685
1691
|
|
|
1686
1692
|
def serve(root, *, bind: nil, port: 3000, **kwargs)
|
|
@@ -1871,7 +1877,7 @@ module Squared
|
|
|
1871
1877
|
op.concat(args)
|
|
1872
1878
|
op.append(delim: delim)
|
|
1873
1879
|
print_run(op, banner, **kwargs)
|
|
1874
|
-
run(banner: false, exception:
|
|
1880
|
+
run(banner: false, exception: exception?(**kwargs), from: from)
|
|
1875
1881
|
end
|
|
1876
1882
|
|
|
1877
1883
|
def ruby_session(*cmd, **kwargs)
|