squared 0.8.6 → 0.9.0.pre1
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 +35 -25
- data/README.md +158 -126
- data/exe/sqd +224 -0
- data/lib/squared/common/base.rb +7 -3
- data/lib/squared/common/format.rb +8 -3
- data/lib/squared/common/prompt.rb +65 -33
- data/lib/squared/common/shell.rb +3 -1
- data/lib/squared/common/system.rb +2 -9
- data/lib/squared/config.rb +3 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +26 -29
- data/lib/squared/workspace/project/base.rb +104 -61
- data/lib/squared/workspace/project/docker.rb +93 -44
- data/lib/squared/workspace/project/git.rb +65 -96
- data/lib/squared/workspace/project/node.rb +14 -12
- data/lib/squared/workspace/project/python.rb +75 -35
- data/lib/squared/workspace/project/ruby.rb +61 -52
- data/lib/squared/workspace/project/support/class.rb +1 -1
- data/lib/squared/workspace/project/support/optionpartition.rb +16 -28
- data/lib/squared/workspace/repo.rb +5 -5
- data/lib/squared/workspace/series.rb +4 -2
- data/squared.gemspec +7 -5
- metadata +21 -5
|
@@ -4,7 +4,7 @@ module Squared
|
|
|
4
4
|
module Workspace
|
|
5
5
|
module Project
|
|
6
6
|
class Python < Git
|
|
7
|
-
DEP_PYTHON = %w[poetry.lock setup.cfg pyproject.toml setup.py requirements.txt].freeze
|
|
7
|
+
DEP_PYTHON = %w[poetry.lock pdm.lock pylock.toml setup.cfg pyproject.toml setup.py requirements.txt].freeze
|
|
8
8
|
DIR_PYTHON = (DEP_PYTHON + %w[meson.build README.rst]).freeze
|
|
9
9
|
OPT_PYTHON = {
|
|
10
10
|
common: %w[b=+ B d E h i I O P q=+ s S u v=+ V=+ x c=q m=b W=b X=q check-hash-based-pycs=b].freeze,
|
|
@@ -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
|
-
|
|
24
|
-
|
|
25
|
-
use-
|
|
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,
|
|
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
|
|
39
|
-
install_b: %w[check-build-dependencies no-build-isolation no-clean no-deps
|
|
40
|
-
|
|
41
|
-
|
|
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,
|
|
42
42
|
install_c: %w[C|config-settings=q e|editable=v].freeze,
|
|
43
|
-
install_d: %w[ignore-requires-python].freeze,
|
|
43
|
+
install_d: %w[ignore-requires-python uploaded-prior-to=q].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,
|
|
@@ -58,8 +58,8 @@ module Squared
|
|
|
58
58
|
u|username=qq].freeze
|
|
59
59
|
}.freeze
|
|
60
60
|
OPT_PDM = {
|
|
61
|
-
common: %w[I|ignore-python no-cache n|non-interactive].freeze,
|
|
62
|
-
build: %w[C=bm no-clean no-isolation no-sdist no-wheel q|quiet v|verbose=+ config-setting=
|
|
61
|
+
common: %w[c|config I|ignore-python no-cache n|non-interactive].freeze,
|
|
62
|
+
build: %w[C=bm no-clean no-isolation no-sdist no-wheel q|quiet v|verbose=+ config-setting=qq d|dest=p
|
|
63
63
|
p|project=p k|skip=b].freeze,
|
|
64
64
|
publish: %w[no-build no-very-ssl q|quiet S|sign skip-existing v|verbose=+ ca-certs=p c|comment=q d|dest=p
|
|
65
65
|
i|identity=b P|password=q p|project=p r|repository=q k|skip=b u|username=qq].freeze
|
|
@@ -131,7 +131,7 @@ module Squared
|
|
|
131
131
|
initialize_build(Python.ref, **kwargs)
|
|
132
132
|
initialize_env(**kwargs)
|
|
133
133
|
end
|
|
134
|
-
dependfile_set(DEP_PYTHON, default:
|
|
134
|
+
dependfile_set(DEP_PYTHON, default: 4)
|
|
135
135
|
serve_set kwargs[:serve]
|
|
136
136
|
editable_set editable
|
|
137
137
|
venv_set kwargs[:venv]
|
|
@@ -297,7 +297,7 @@ module Squared
|
|
|
297
297
|
install flag, ['upgrade', *args.to_a, 'pip']
|
|
298
298
|
end
|
|
299
299
|
when :freeze
|
|
300
|
-
format_desc action, flag, "file?=#{DEP_PYTHON[
|
|
300
|
+
format_desc action, flag, "file?=#{DEP_PYTHON[6]},u/ninstall?,opts*"
|
|
301
301
|
task flag do |_, args|
|
|
302
302
|
opts = args.to_a
|
|
303
303
|
if has_value!(opts, 'u', 'uninstall')
|
|
@@ -351,7 +351,7 @@ module Squared
|
|
|
351
351
|
'eager'
|
|
352
352
|
when /^only-if|needed$/
|
|
353
353
|
'only-if-needed'
|
|
354
|
-
end.
|
|
354
|
+
end.then do |val|
|
|
355
355
|
if val
|
|
356
356
|
args.extras << "upgrade-strategy=#{val}"
|
|
357
357
|
else
|
|
@@ -430,7 +430,17 @@ module Squared
|
|
|
430
430
|
workspace.rev_clear(name, sync: sync)
|
|
431
431
|
if !flag && poetry?
|
|
432
432
|
cmd = poetry_session 'install -n'
|
|
433
|
+
if prod?
|
|
434
|
+
cmd << '--only=main'
|
|
435
|
+
else
|
|
436
|
+
option('with') { |val| cmd << basic_option('with', val) }
|
|
437
|
+
option('without') { |val| cmd << basic_option('without', val) }
|
|
438
|
+
end
|
|
433
439
|
cmd << '--no-root' if option('no-root')
|
|
440
|
+
elsif !flag && pdm?
|
|
441
|
+
cmd = pdm_session 'install'
|
|
442
|
+
cmd << '--prod' if prod?
|
|
443
|
+
option('G', 'group') { |val| cmd << basic_option('G', val) }
|
|
434
444
|
else
|
|
435
445
|
cmd = pip_session 'install'
|
|
436
446
|
cmd << '--upgrade-strategy=eager' if env('UPDATE') || env('PYTHON_UPDATE')
|
|
@@ -447,9 +457,13 @@ module Squared
|
|
|
447
457
|
else
|
|
448
458
|
append_global
|
|
449
459
|
end
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
460
|
+
unless session_arg?('r', 'requirement')
|
|
461
|
+
if exist?(DEP_PYTHON[2])
|
|
462
|
+
cmd << basic_option('r', DEP_PYTHON[2])
|
|
463
|
+
elsif exist?(DEP_PYTHON[6])
|
|
464
|
+
cmd << basic_option('r', DEP_PYTHON[6])
|
|
465
|
+
cmd << basic_option('c', 'constraints.txt') if exist?('constraints.txt')
|
|
466
|
+
end
|
|
453
467
|
end
|
|
454
468
|
append_editable
|
|
455
469
|
end
|
|
@@ -569,8 +583,9 @@ module Squared
|
|
|
569
583
|
end
|
|
570
584
|
if found > 0
|
|
571
585
|
items = if se
|
|
572
|
-
choice('Select a package', items.map(&:first),
|
|
573
|
-
|
|
586
|
+
choice('Select a package', items.map(&:first), multiple: true, force: false, index: true,
|
|
587
|
+
border: true, **parse_select)
|
|
588
|
+
.map { |n| items[n.pred].last }
|
|
574
589
|
elsif ia
|
|
575
590
|
items.map(&:last)
|
|
576
591
|
else
|
|
@@ -749,7 +764,7 @@ module Squared
|
|
|
749
764
|
end
|
|
750
765
|
end
|
|
751
766
|
print_run(op, banner, **kwargs)
|
|
752
|
-
run(sync: sync, banner: banner, exception: exception?
|
|
767
|
+
run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: :python)
|
|
753
768
|
end
|
|
754
769
|
|
|
755
770
|
def pip(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -786,7 +801,7 @@ module Squared
|
|
|
786
801
|
ret = kwargs[:requirement] || begin
|
|
787
802
|
file = op.detect { |val| op.exist?(val) }
|
|
788
803
|
op.remove(file) if file
|
|
789
|
-
basepath(file || DEP_PYTHON[
|
|
804
|
+
basepath(file || DEP_PYTHON[6])
|
|
790
805
|
end
|
|
791
806
|
op.add_quote(ret)
|
|
792
807
|
.clear
|
|
@@ -831,8 +846,8 @@ module Squared
|
|
|
831
846
|
op.clear
|
|
832
847
|
end
|
|
833
848
|
print_run(op, banner, **kwargs)
|
|
834
|
-
run(sync: sync, banner: banner, exception: exception?
|
|
835
|
-
.
|
|
849
|
+
run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: symjoin('pip', flag))
|
|
850
|
+
.then { |val| ret || val }
|
|
836
851
|
end
|
|
837
852
|
|
|
838
853
|
def serve(root, opts = [], bind: 'localhost', port: nil, **)
|
|
@@ -1039,7 +1054,15 @@ module Squared
|
|
|
1039
1054
|
end
|
|
1040
1055
|
end
|
|
1041
1056
|
ret.last[1] += val
|
|
1042
|
-
elsif line.strip =~ /^(\S+)\s*=\s*
|
|
1057
|
+
elsif line.strip =~ /^(\S+)\s*=\s*
|
|
1058
|
+
(
|
|
1059
|
+
[+-]?(?:[\d._]+(?:[eE].+)?|0x[\dA-Fa-f]+|0[ob]\d+|nan|inf)
|
|
1060
|
+
|true|false
|
|
1061
|
+
|\d{4}-\d{2}-\d{2}.*
|
|
1062
|
+
|\d{2}:\d{2}.*
|
|
1063
|
+
|("""|'''|["'\[{])(.*)
|
|
1064
|
+
)$/x
|
|
1065
|
+
name = $1
|
|
1043
1066
|
if (val = $4)
|
|
1044
1067
|
case (ch = $3)
|
|
1045
1068
|
when '{', '['
|
|
@@ -1059,11 +1082,21 @@ module Squared
|
|
|
1059
1082
|
true
|
|
1060
1083
|
when 'false'
|
|
1061
1084
|
false
|
|
1085
|
+
when /^\d{4}-/
|
|
1086
|
+
Time.parse(ch)
|
|
1087
|
+
when /^\d{2}:/
|
|
1088
|
+
Time.strptime(ch, '%T')
|
|
1089
|
+
when /nan$/
|
|
1090
|
+
Float::NAN
|
|
1091
|
+
when /inf$/
|
|
1092
|
+
Float::INFINITY * (ch[0] == '-' ? -1 : 1)
|
|
1093
|
+
when /^[+-]?0[xob]/
|
|
1094
|
+
eval ch
|
|
1062
1095
|
else
|
|
1063
1096
|
ch.include?('.') ? ch.to_f : ch.to_i
|
|
1064
1097
|
end
|
|
1065
1098
|
end
|
|
1066
|
-
ret << [
|
|
1099
|
+
ret << [name, val]
|
|
1067
1100
|
end
|
|
1068
1101
|
if !ch && (val = ret.last[1]).is_a?(String) && (val.match?(/\A\{.+\}\z/m) || val.match?(/\A\[.+\]\z/m))
|
|
1069
1102
|
ret.last[1] = JSON.parse(val) rescue nil
|
|
@@ -1082,19 +1115,19 @@ module Squared
|
|
|
1082
1115
|
end
|
|
1083
1116
|
|
|
1084
1117
|
def pyprojectfile
|
|
1085
|
-
@pyprojectfile = basepath!(DEP_PYTHON[
|
|
1118
|
+
@pyprojectfile = basepath!(DEP_PYTHON[4]) || false if @pyprojectfile.nil?
|
|
1086
1119
|
@pyprojectfile || nil
|
|
1087
1120
|
end
|
|
1088
1121
|
|
|
1089
1122
|
def singleopt(flag = nil)
|
|
1090
1123
|
case flag
|
|
1091
1124
|
when :python
|
|
1092
|
-
/\A(v+|q+|b+|V+|O+)\z/
|
|
1125
|
+
/\A(?:v+|q+|b+|V+|O+)\z/
|
|
1093
1126
|
when :pdm, :poetry
|
|
1094
1127
|
/\Av+\z/
|
|
1095
1128
|
when :twine, :meson then nil
|
|
1096
1129
|
else
|
|
1097
|
-
/\A(v+|q+)\z/
|
|
1130
|
+
/\A(?:v+|q+)\z/
|
|
1098
1131
|
end
|
|
1099
1132
|
end
|
|
1100
1133
|
|
|
@@ -1112,18 +1145,19 @@ module Squared
|
|
|
1112
1145
|
def pipopts(flag)
|
|
1113
1146
|
ret = OPT_PIP.fetch(flag, []) + OPT_PIP[:common]
|
|
1114
1147
|
if pip_install?(flag)
|
|
1115
|
-
ret.concat(OPT_PIP[:install_a]
|
|
1148
|
+
ret.concat(OPT_PIP[:install_a])
|
|
1116
1149
|
ret.concat(OPT_PIP[:install_b]) unless flag == :index
|
|
1150
|
+
ret.concat(OPT_PIP[:install_d])
|
|
1117
1151
|
case flag
|
|
1118
1152
|
when :install
|
|
1119
|
-
ret.concat(OPT_PIP[:install_c]
|
|
1153
|
+
ret.concat(OPT_PIP[:install_c] + OPT_PIP[:debug])
|
|
1120
1154
|
when :lock, :wheel
|
|
1121
1155
|
ret.concat(OPT_PIP[:install_c])
|
|
1122
1156
|
when :download, :index
|
|
1123
1157
|
ret.concat(OPT_PIP[:debug])
|
|
1124
1158
|
end
|
|
1125
1159
|
elsif flag == :list
|
|
1126
|
-
ret.concat(OPT_PIP[:install_a]
|
|
1160
|
+
ret.concat(OPT_PIP[:install_a])
|
|
1127
1161
|
end
|
|
1128
1162
|
ret
|
|
1129
1163
|
end
|
|
@@ -1138,7 +1172,7 @@ module Squared
|
|
|
1138
1172
|
if windows?
|
|
1139
1173
|
shell_quote(venvbin.join(powershell? ? 'Activate.ps1' : 'activate.bat'), option: false)
|
|
1140
1174
|
else
|
|
1141
|
-
{ 'VIRTUAL_ENV' => venv.to_s, 'PATH' =>
|
|
1175
|
+
{ 'VIRTUAL_ENV' => venv.to_s, 'PATH' => task_join(venvbin, ENV['PATH']) }
|
|
1142
1176
|
end
|
|
1143
1177
|
end
|
|
1144
1178
|
|
|
@@ -1220,6 +1254,8 @@ module Squared
|
|
|
1220
1254
|
if poetry?
|
|
1221
1255
|
dir += (windows? ? 'Scripts/python.exe' : 'bin/python')
|
|
1222
1256
|
cmd = poetry_session 'env use'
|
|
1257
|
+
elsif pdm?
|
|
1258
|
+
cmd = pdm_session 'use -f'
|
|
1223
1259
|
else
|
|
1224
1260
|
puts "Success: #{dir}"
|
|
1225
1261
|
return
|
|
@@ -1263,13 +1299,17 @@ module Squared
|
|
|
1263
1299
|
end
|
|
1264
1300
|
|
|
1265
1301
|
def setuptools?
|
|
1266
|
-
dependtype ==
|
|
1302
|
+
dependtype == 4 || dependtype == 6
|
|
1267
1303
|
end
|
|
1268
1304
|
|
|
1269
1305
|
def poetry?
|
|
1270
1306
|
dependtype == 1
|
|
1271
1307
|
end
|
|
1272
1308
|
|
|
1309
|
+
def pdm?
|
|
1310
|
+
dependtype == 2
|
|
1311
|
+
end
|
|
1312
|
+
|
|
1273
1313
|
def twine?
|
|
1274
1314
|
venv_package?('twine')
|
|
1275
1315
|
end
|
|
@@ -1279,7 +1319,7 @@ module Squared
|
|
|
1279
1319
|
end
|
|
1280
1320
|
|
|
1281
1321
|
def requirements?
|
|
1282
|
-
dependtype ==
|
|
1322
|
+
dependtype == 7
|
|
1283
1323
|
end
|
|
1284
1324
|
end
|
|
1285
1325
|
|
|
@@ -21,25 +21,24 @@ 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[
|
|
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
|
|
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
|
|
28
|
-
|
|
29
|
-
display-only-safe-correctable S|display-style-guide display-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
only-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
s|stdin=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,
|
|
38
37
|
pry: %w[f e=q I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
|
|
39
38
|
d|disable-plugin=q gem=b r|require=bm s|select-plugin=q].freeze,
|
|
40
39
|
no: {
|
|
41
40
|
rubocop: %w[auto-gen-enforced-style auto-gen-only-exclude auto-gen-timestamp color display-cop-names
|
|
42
|
-
offense-counts parallel
|
|
41
|
+
offense-counts parallel server].freeze
|
|
43
42
|
}
|
|
44
43
|
}.freeze
|
|
45
44
|
OPT_BUNDLE = {
|
|
@@ -227,10 +226,9 @@ module Squared
|
|
|
227
226
|
serve_set kwargs[:serve]
|
|
228
227
|
gemfile_set kwargs[:gemspec]
|
|
229
228
|
self.autodetect = autodetect
|
|
230
|
-
@bundle = { exec: exec.is_a?(String) ? basepath!(exec) :
|
|
229
|
+
@bundle = { exec: exec.is_a?(String) ? basepath!(exec) : false }
|
|
231
230
|
@steepfile = basepath! steep if steep
|
|
232
|
-
|
|
233
|
-
@rubocopfile = basepath! rubocop if rubocop
|
|
231
|
+
@rubocopfile = Pathname.new(rubocop).realpath rescue basepath!(Dir.home, '.rubocop.yml') if rubocop
|
|
234
232
|
@rubygems = kwargs.fetch(:rubygems, 0)
|
|
235
233
|
return unless rakefile && @output[0].nil? && @copy.nil? && !version && !self.autodetect
|
|
236
234
|
|
|
@@ -238,10 +236,10 @@ module Squared
|
|
|
238
236
|
File.foreach(rakefile) do |line|
|
|
239
237
|
next unless line.match?(%r{\brequire\s+(["'])bundler/gem_tasks\1})
|
|
240
238
|
|
|
241
|
-
cmd = bundle_output('exec rake')
|
|
242
|
-
@output[0] =
|
|
243
|
-
@copy =
|
|
244
|
-
@clean =
|
|
239
|
+
cmd = "#{bundle_output('exec rake')} %s"
|
|
240
|
+
@output[0] = cmd % 'build'
|
|
241
|
+
@copy = cmd % 'install'
|
|
242
|
+
@clean = cmd % 'clean' if @clean.nil?
|
|
245
243
|
break
|
|
246
244
|
end
|
|
247
245
|
rescue => e
|
|
@@ -331,7 +329,7 @@ module Squared
|
|
|
331
329
|
opts = args.to_a
|
|
332
330
|
cmd = opts.delete('::')
|
|
333
331
|
if (n = opts.index('c'))
|
|
334
|
-
args = opts.slice!(n.succ
|
|
332
|
+
args = opts.slice!(n.succ..)
|
|
335
333
|
else
|
|
336
334
|
file = opts.shift
|
|
337
335
|
args = []
|
|
@@ -461,11 +459,13 @@ module Squared
|
|
|
461
459
|
when :build, :push, :exec, :update
|
|
462
460
|
format_desc(action, flag, 'opts*', after: case flag
|
|
463
461
|
when :exec then 'command,args*'
|
|
464
|
-
when :push then 'file
|
|
462
|
+
when :push then 'file/:,d/dry-run?'
|
|
465
463
|
when :update then 'name*'
|
|
466
464
|
end)
|
|
467
465
|
task flag do |_, args|
|
|
468
|
-
|
|
466
|
+
opts = args.to_a
|
|
467
|
+
filter = { dryrun: true } if flag == :push && has_value!(opts, 'd', 'dry-run')
|
|
468
|
+
gem(flag, opts: opts, banner: true, filter: filter)
|
|
469
469
|
end
|
|
470
470
|
when :install, :uninstall, :pristine
|
|
471
471
|
format_desc(action, flag, 'opts*', after: flag == :pristine ? 'name*|name?@version' : 'name*')
|
|
@@ -572,13 +572,18 @@ module Squared
|
|
|
572
572
|
else
|
|
573
573
|
%w[## ;]
|
|
574
574
|
end
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
575
|
+
unless (command = ENV['RUBY_E'])
|
|
576
|
+
command = if Prompt.reline.respond_to?(:readmultiline)
|
|
577
|
+
require 'ripper'
|
|
578
|
+
readline('ruby>', force: true, multiline: multiline) do |code|
|
|
579
|
+
next if code.strip.empty? || !Ripper.sexp(code)
|
|
580
|
+
|
|
581
|
+
Array(multiline).any? { |s| code.split.last.match?(/(?<!#{s[-1]})#{s}$/) }
|
|
582
|
+
end
|
|
583
|
+
else
|
|
584
|
+
readline('Enter script', force: true, multiline: Array(multiline))
|
|
585
|
+
end
|
|
586
|
+
end
|
|
582
587
|
ruby(flag, opts: args.to_a, command: command)
|
|
583
588
|
end
|
|
584
589
|
when :version
|
|
@@ -701,7 +706,7 @@ module Squared
|
|
|
701
706
|
.lines
|
|
702
707
|
.map { |line| line.sub(/#.*$/, '').strip }
|
|
703
708
|
.reject(&:empty?)
|
|
704
|
-
.
|
|
709
|
+
.then do |lines|
|
|
705
710
|
target = lines.find { |line| line.include?(tool) }
|
|
706
711
|
target ? [target] : lines
|
|
707
712
|
end
|
|
@@ -788,7 +793,7 @@ module Squared
|
|
|
788
793
|
when '1', 'true' then nil
|
|
789
794
|
else
|
|
790
795
|
if val.start_with?('~')
|
|
791
|
-
val = File.join(Dir.home, val == '~' ? '.bundle' : val[1
|
|
796
|
+
val = File.join(Dir.home, val == '~' ? '.bundle' : val[1..])
|
|
792
797
|
if prod?
|
|
793
798
|
config_set('binstubs', shell_quote(val), global: true)
|
|
794
799
|
val = nil
|
|
@@ -978,8 +983,9 @@ module Squared
|
|
|
978
983
|
if found > 0
|
|
979
984
|
unless Array(items).empty?
|
|
980
985
|
gems = if se
|
|
981
|
-
choice('Select a package', items.map(&:first),
|
|
982
|
-
|
|
986
|
+
choice('Select a package', items.map(&:first), multiple: true, force: false, index: true,
|
|
987
|
+
border: true, **parse_select)
|
|
988
|
+
.map { |n| items[n.pred].last }
|
|
983
989
|
else
|
|
984
990
|
items.map(&:last)
|
|
985
991
|
end
|
|
@@ -1041,7 +1047,7 @@ module Squared
|
|
|
1041
1047
|
end
|
|
1042
1048
|
end
|
|
1043
1049
|
print_run(op, banner, **kwargs) unless flag
|
|
1044
|
-
run(sync: sync, banner: banner, exception: exception?
|
|
1050
|
+
run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: from || :ruby)
|
|
1045
1051
|
end
|
|
1046
1052
|
|
|
1047
1053
|
def gem(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -1213,8 +1219,9 @@ module Squared
|
|
|
1213
1219
|
puts 'No updates were found'
|
|
1214
1220
|
else
|
|
1215
1221
|
if items
|
|
1216
|
-
update = choice('Select a package', items.map(&:first),
|
|
1217
|
-
|
|
1222
|
+
update = choice('Select a package', items.map(&:first), multiple: true, force: false, index: true,
|
|
1223
|
+
border: true, **parse_select)
|
|
1224
|
+
.map { |n| items[n.pred].last }
|
|
1218
1225
|
end
|
|
1219
1226
|
unless Array(update).empty?
|
|
1220
1227
|
opts = ['f']
|
|
@@ -1298,7 +1305,12 @@ module Squared
|
|
|
1298
1305
|
|
|
1299
1306
|
op.add_path(file)
|
|
1300
1307
|
end
|
|
1301
|
-
|
|
1308
|
+
if dryrun? || kwargs[:filter]&.fetch(:dryrun, nil)
|
|
1309
|
+
print_item "> #{op}"
|
|
1310
|
+
exit 0
|
|
1311
|
+
elsif !with && banner
|
|
1312
|
+
return run(from: from, interactive: ['Push', 'N', target || gemname])
|
|
1313
|
+
end
|
|
1302
1314
|
when :exec
|
|
1303
1315
|
min = if op.arg?('g', 'gem')
|
|
1304
1316
|
1
|
|
@@ -1367,9 +1379,9 @@ module Squared
|
|
|
1367
1379
|
name = op.remove_at(n)
|
|
1368
1380
|
n = name.index('@')
|
|
1369
1381
|
pre, ver = if n == 0
|
|
1370
|
-
[gemname, name[1
|
|
1382
|
+
[gemname, name[1..]]
|
|
1371
1383
|
else
|
|
1372
|
-
[name[0, n], name[n.succ
|
|
1384
|
+
[name[0, n], name[n.succ..]]
|
|
1373
1385
|
end
|
|
1374
1386
|
op.adjoin(pre, quote_option('version', ver))
|
|
1375
1387
|
.clear
|
|
@@ -1418,7 +1430,7 @@ module Squared
|
|
|
1418
1430
|
op.clear(errors: true) if gems
|
|
1419
1431
|
print_run(op, banner, **kwargs)
|
|
1420
1432
|
run(banner: banner && %w[q silent quiet no-verbose].none? { |s| op.include?(shell_option(s)) },
|
|
1421
|
-
exception: exception?
|
|
1433
|
+
exception: kwargs.fetch(:exception, exception?), from: from)
|
|
1422
1434
|
end
|
|
1423
1435
|
|
|
1424
1436
|
def bundle(flag, *args, sync: true, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -1555,7 +1567,7 @@ module Squared
|
|
|
1555
1567
|
op.clear
|
|
1556
1568
|
end
|
|
1557
1569
|
print_run(op, banner, **kwargs)
|
|
1558
|
-
ret = run(sync: sync, banner: banner, exception: exception?
|
|
1570
|
+
ret = run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?),
|
|
1559
1571
|
from: symjoin('bundle', flag))
|
|
1560
1572
|
success?(ret, banner, output)
|
|
1561
1573
|
end
|
|
@@ -1568,7 +1580,7 @@ module Squared
|
|
|
1568
1580
|
op.append(escape: true)
|
|
1569
1581
|
print_run(op, banner, **kwargs)
|
|
1570
1582
|
var = { 'BANNER' => '0' } unless banner
|
|
1571
|
-
run(op, var, sync: sync, banner: false, exception: exception?
|
|
1583
|
+
run(op, var, sync: sync, banner: false, exception: kwargs.fetch(:exception, exception?), from: :rake)
|
|
1572
1584
|
end
|
|
1573
1585
|
|
|
1574
1586
|
def irb(*args, banner: verbose?, with: nil, pass: PASS_RUBY[:irb], **kwargs)
|
|
@@ -1596,7 +1608,7 @@ module Squared
|
|
|
1596
1608
|
op.concat(args)
|
|
1597
1609
|
op.append(quote: false, delim: true)
|
|
1598
1610
|
print_run(op, banner, **kwargs)
|
|
1599
|
-
run(banner: false, exception: exception?
|
|
1611
|
+
run(banner: false, exception: kwargs.fetch(:exception, exception?), from: :rdbg)
|
|
1600
1612
|
end
|
|
1601
1613
|
|
|
1602
1614
|
def rbs(flag, *args, banner: verbose?, with: nil, pass: nil, **kwargs)
|
|
@@ -1645,7 +1657,7 @@ module Squared
|
|
|
1645
1657
|
op.clear
|
|
1646
1658
|
.append(*args)
|
|
1647
1659
|
print_run(op, banner, **kwargs)
|
|
1648
|
-
run(banner: false, exception: exception?
|
|
1660
|
+
run(banner: false, exception: kwargs.fetch(:exception, exception?), from: symjoin('rbs', flag))
|
|
1649
1661
|
end
|
|
1650
1662
|
end
|
|
1651
1663
|
|
|
@@ -1668,7 +1680,7 @@ module Squared
|
|
|
1668
1680
|
op.append(delim: true)
|
|
1669
1681
|
.clear(errors: true)
|
|
1670
1682
|
print_run(op, banner, **kwargs)
|
|
1671
|
-
run(sync: sync, banner: banner, exception: exception?
|
|
1683
|
+
run(sync: sync, banner: banner, exception: kwargs.fetch(:exception, exception?), from: :rubocop)
|
|
1672
1684
|
end
|
|
1673
1685
|
|
|
1674
1686
|
def serve(root, *, bind: nil, port: 3000, **kwargs)
|
|
@@ -1828,10 +1840,7 @@ module Squared
|
|
|
1828
1840
|
set.call(ver, val)
|
|
1829
1841
|
end
|
|
1830
1842
|
end
|
|
1831
|
-
|
|
1832
|
-
target = RUBY_VERSION.start_with?('2.6') ? RubyVM : $LOAD_PATH
|
|
1833
|
-
parse.call(target.resolve_feature_path(gemname)&.last)
|
|
1834
|
-
end
|
|
1843
|
+
parse.call($LOAD_PATH.resolve_feature_path(gemname)&.last)
|
|
1835
1844
|
unless gemdir || pwd_set { parse.call(`#{bundle_output('show', gemname)}`) }
|
|
1836
1845
|
raise Errno::ENOENT, 'gems home'
|
|
1837
1846
|
end
|
|
@@ -1862,7 +1871,7 @@ module Squared
|
|
|
1862
1871
|
op.concat(args)
|
|
1863
1872
|
op.append(delim: delim)
|
|
1864
1873
|
print_run(op, banner, **kwargs)
|
|
1865
|
-
run(banner: false, exception: exception?
|
|
1874
|
+
run(banner: false, exception: kwargs.fetch(:exception, exception?), from: from)
|
|
1866
1875
|
end
|
|
1867
1876
|
|
|
1868
1877
|
def ruby_session(*cmd, **kwargs)
|
|
@@ -2059,7 +2068,7 @@ module Squared
|
|
|
2059
2068
|
end
|
|
2060
2069
|
|
|
2061
2070
|
def gemlib
|
|
2062
|
-
@gemlib ||= Set.new(['lib']).
|
|
2071
|
+
@gemlib ||= Set.new(['lib']).then do |lib|
|
|
2063
2072
|
if (spec = gemspec)
|
|
2064
2073
|
lib.merge(spec.require_paths || [])
|
|
2065
2074
|
end
|