squared 0.8.1 → 0.8.3
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 +99 -0
- data/README.md +33 -30
- data/lib/squared/common/base.rb +7 -0
- data/lib/squared/common/prompt.rb +8 -4
- data/lib/squared/common/utils.rb +9 -1
- data/lib/squared/config.rb +1 -2
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +7 -1
- data/lib/squared/workspace/project/base.rb +43 -11
- data/lib/squared/workspace/project/docker.rb +85 -28
- data/lib/squared/workspace/project/git.rb +296 -122
- data/lib/squared/workspace/project/node.rb +31 -12
- data/lib/squared/workspace/project/python.rb +41 -28
- data/lib/squared/workspace/project/ruby.rb +30 -25
- data/lib/squared/workspace/project/support/optionpartition.rb +35 -4
- data/lib/squared/workspace/project/support/utils.rb +22 -6
- data/lib/squared/workspace/repo.rb +3 -8
- data/lib/squared/workspace/series.rb +2 -2
- metadata +2 -2
|
@@ -8,8 +8,8 @@ module Squared
|
|
|
8
8
|
common: %w[dry-run=!? force=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
|
|
9
9
|
common_scripts: %w[dangerously-allow-all-scripts=!? strict-allow-scripts=!? allow-scripts=q].freeze,
|
|
10
10
|
install: %w[package-lock-only=!? prefer-dedupe=!? E|save-exact=!? before=q cpu=b libc=b os=b].freeze,
|
|
11
|
-
install_a: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!?
|
|
12
|
-
package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
|
11
|
+
install_a: %w[audit=! bin-links=! engine-strict=!? foreground-scripts=!? fund=! ignore-scripts=!?
|
|
12
|
+
install-links=!? package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
|
13
13
|
install_b: %w[no-save B|save-bundle D|save-dev O|save-optional save-peer P|save-prod g|global=!?
|
|
14
14
|
S|save=!?].freeze,
|
|
15
15
|
install_c: %w[allow-directory=b? allow-file=b? allow-git=b? allow-remote=b?].freeze,
|
|
@@ -327,7 +327,7 @@ module Squared
|
|
|
327
327
|
when 'package'
|
|
328
328
|
format_desc(action, flag, 'opts*', before: case flag
|
|
329
329
|
when :dedupe, :rebuild then nil
|
|
330
|
-
when :reinstall then '
|
|
330
|
+
when :reinstall then 'f/orce?'
|
|
331
331
|
else 'name*'
|
|
332
332
|
end)
|
|
333
333
|
task flag do |_, args|
|
|
@@ -672,8 +672,7 @@ module Squared
|
|
|
672
672
|
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
673
673
|
cmd << '--dangerously-allow-all-builds' if option('approve-builds')
|
|
674
674
|
else
|
|
675
|
-
cmd = session 'npm'
|
|
676
|
-
cmd << (ci = option('ci') ? 'ci' : 'install')
|
|
675
|
+
cmd = session('npm', (ci = option('ci', prefix: 'npm')) ? 'ci' : 'install')
|
|
677
676
|
option('approve-scripts') do |val|
|
|
678
677
|
cmd = npm_output 'approve-scripts'
|
|
679
678
|
cmd << case val
|
|
@@ -687,6 +686,26 @@ module Squared
|
|
|
687
686
|
print_run cmd, silent?
|
|
688
687
|
run(cmd, banner: false)
|
|
689
688
|
end
|
|
689
|
+
option('allow-scripts', ignore: false) do |val|
|
|
690
|
+
cmd << case val
|
|
691
|
+
when '0'
|
|
692
|
+
'--ignore-scripts'
|
|
693
|
+
when 'false'
|
|
694
|
+
'--strict-allow-scripts'
|
|
695
|
+
when '1', 'true'
|
|
696
|
+
'--dangerously-allow-all-scripts'
|
|
697
|
+
else
|
|
698
|
+
quote_option 'allow-scripts', val
|
|
699
|
+
end
|
|
700
|
+
end
|
|
701
|
+
option('engine-strict', ignore: false) do |val|
|
|
702
|
+
cmd << case val
|
|
703
|
+
when '0', 'false'
|
|
704
|
+
'--engine-strict=false'
|
|
705
|
+
else
|
|
706
|
+
'--engine-strict'
|
|
707
|
+
end
|
|
708
|
+
end
|
|
690
709
|
cmd << '--workspaces=false' if ws
|
|
691
710
|
cmd << '--force' if option('force')
|
|
692
711
|
append_nocolor
|
|
@@ -1088,6 +1107,7 @@ module Squared
|
|
|
1088
1107
|
|
|
1089
1108
|
def package(flag, opts = [], packages: [], from: nil)
|
|
1090
1109
|
workspace.rev_clear(name)
|
|
1110
|
+
force = true if flag == :reinstall && has_value!(opts, 'f')
|
|
1091
1111
|
yarn = dependtype(:yarn)
|
|
1092
1112
|
if yarn > 0 && !(yarn == 1 && ((flag == :update && !packages.empty?) || %i[approve deny
|
|
1093
1113
|
rebuild].include?(flag)))
|
|
@@ -1101,8 +1121,8 @@ module Squared
|
|
|
1101
1121
|
end
|
|
1102
1122
|
when :reinstall
|
|
1103
1123
|
if yarn == 1
|
|
1104
|
-
remove_modules(prefix: 'yarn') if opts.include?('force')
|
|
1105
|
-
elsif opts.delete('force')
|
|
1124
|
+
remove_modules(prefix: 'yarn') if opts.include?('force') || force
|
|
1125
|
+
elsif opts.delete('force') || force
|
|
1106
1126
|
opts << 'check-cache'
|
|
1107
1127
|
end
|
|
1108
1128
|
opts << 'no-lockfile' if lockfile(true)
|
|
@@ -1171,7 +1191,7 @@ module Squared
|
|
|
1171
1191
|
spec = 1
|
|
1172
1192
|
flag = :install
|
|
1173
1193
|
when :reinstall
|
|
1174
|
-
remove_modules(prefix: 'npm') if opts.delete('force')
|
|
1194
|
+
remove_modules(prefix: 'npm') if opts.delete('force') || force
|
|
1175
1195
|
opts.unshift('package-lock=false') if lockfile(true)
|
|
1176
1196
|
flag = :install
|
|
1177
1197
|
end
|
|
@@ -1509,8 +1529,7 @@ module Squared
|
|
|
1509
1529
|
next if yarntype(exist: true) == 0
|
|
1510
1530
|
when /^pnpm/
|
|
1511
1531
|
next if pnpmtype(exist: true) == 0
|
|
1512
|
-
when /^npm/
|
|
1513
|
-
nil
|
|
1532
|
+
when /^npm/ then nil
|
|
1514
1533
|
else
|
|
1515
1534
|
next
|
|
1516
1535
|
end
|
|
@@ -1564,8 +1583,8 @@ module Squared
|
|
|
1564
1583
|
end
|
|
1565
1584
|
|
|
1566
1585
|
def remove_modules(prefix: dependbin)
|
|
1567
|
-
modules = basepath
|
|
1568
|
-
return false unless modules
|
|
1586
|
+
modules = basepath!('node_modules', type: 'd')
|
|
1587
|
+
return false unless modules && confirm_basic('Remove?', modules, prefix: prefix)
|
|
1569
1588
|
|
|
1570
1589
|
modules.rmtree
|
|
1571
1590
|
rescue Timeout::Error => e
|
|
@@ -36,9 +36,9 @@ module Squared
|
|
|
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
38
|
no-binary=q only-binary=q only-final=b].freeze,
|
|
39
|
-
install_b: %w[
|
|
40
|
-
|
|
41
|
-
src=p].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
43
|
install_d: %w[ignore-requires-python uploaded-prior-to=q].freeze,
|
|
44
44
|
hash: %w[a|algorithm].freeze,
|
|
@@ -181,8 +181,8 @@ module Squared
|
|
|
181
181
|
format_desc action, nil, "script+|#{indexchar}index+|#,pattern*"
|
|
182
182
|
task action, [:command] do |_, args|
|
|
183
183
|
found = 0
|
|
184
|
-
%w[tool.poetry
|
|
185
|
-
next if (list = read_pyproject(table)).empty?
|
|
184
|
+
%w[tool.poetry tool.pdm project].each_with_index do |table, i|
|
|
185
|
+
next if (list = read_pyproject("#{table}.scripts")).empty?
|
|
186
186
|
|
|
187
187
|
if args.command == '#'
|
|
188
188
|
format_list(list, "run[#{indexchar}N]", 'scripts', grep: args.extras, from: pyprojectfile)
|
|
@@ -208,7 +208,7 @@ module Squared
|
|
|
208
208
|
log.warn "run script #{n} of #{list.size}".subhint('out of range')
|
|
209
209
|
end
|
|
210
210
|
else
|
|
211
|
-
case i
|
|
211
|
+
case (i > 1 && poetry? ? 0 : i)
|
|
212
212
|
when 0
|
|
213
213
|
found |= 1
|
|
214
214
|
run(session_output('poetry', 'run', val), from: :run)
|
|
@@ -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[4]},u/
|
|
300
|
+
format_desc action, flag, "file?=#{DEP_PYTHON[4]},u/ninstall?,opts*"
|
|
301
301
|
task flag do |_, args|
|
|
302
302
|
opts = args.to_a
|
|
303
303
|
if has_value!(opts, 'u', 'uninstall')
|
|
@@ -312,7 +312,7 @@ module Squared
|
|
|
312
312
|
end
|
|
313
313
|
file = pip(flag, opts: opts, banner: requirement.nil?, requirement: requirement)
|
|
314
314
|
puts File.read(file) unless silent?
|
|
315
|
-
if requirement && confirm_basic('Uninstall?', file)
|
|
315
|
+
if requirement && confirm_basic('Uninstall?', file, prefix: 'pip')
|
|
316
316
|
pip(:uninstall, opts: ['y', "r=#{shell_quote(file)}"])
|
|
317
317
|
end
|
|
318
318
|
end
|
|
@@ -482,7 +482,7 @@ module Squared
|
|
|
482
482
|
:patch
|
|
483
483
|
end
|
|
484
484
|
end
|
|
485
|
-
'--not-required' if option('not-required', notequals: '0')
|
|
485
|
+
'--not-required' if option('not-required', notequals: '0')
|
|
486
486
|
end
|
|
487
487
|
cmd << '--local' if option('l', 'local')
|
|
488
488
|
append_global
|
|
@@ -607,18 +607,18 @@ module Squared
|
|
|
607
607
|
project: self, strict: strict?, single: singleopt(flag))
|
|
608
608
|
else
|
|
609
609
|
op = append_pip(flag, opts, pipopts(:install), target: pip_session('install'))
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
raise ArgumentError, message('no packages listed', hint: flag) if op.empty?
|
|
610
|
+
case flag
|
|
611
|
+
when :editable
|
|
612
|
+
op << quote_option('e', op.pop || editable || '.')
|
|
613
|
+
op.clear
|
|
614
|
+
when :user, :upgrade
|
|
615
|
+
op.concat(packages)
|
|
616
|
+
raise ArgumentError, message('no packages listed', hint: flag) if op.empty?
|
|
618
617
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
618
|
+
op << "--#{flag}"
|
|
619
|
+
op.append
|
|
620
|
+
python_session('-m pip', *op.to_a.drop(1)) if workspace.windows?
|
|
621
|
+
end
|
|
622
622
|
end
|
|
623
623
|
run(banner: banner, from: :install)
|
|
624
624
|
end
|
|
@@ -723,7 +723,7 @@ module Squared
|
|
|
723
723
|
op.clear(pass: false)
|
|
724
724
|
else
|
|
725
725
|
if op.empty?
|
|
726
|
-
op
|
|
726
|
+
op.add_path(dist.call, '*')
|
|
727
727
|
else
|
|
728
728
|
op.add_path
|
|
729
729
|
end
|
|
@@ -796,8 +796,7 @@ module Squared
|
|
|
796
796
|
|
|
797
797
|
op << (action = op.shift)
|
|
798
798
|
case action
|
|
799
|
-
when 'dir', 'info', 'purge'
|
|
800
|
-
nil
|
|
799
|
+
when 'dir', 'info', 'purge' then nil
|
|
801
800
|
when 'list', 'remove'
|
|
802
801
|
op.add_first(quote: true)
|
|
803
802
|
else
|
|
@@ -811,8 +810,7 @@ module Squared
|
|
|
811
810
|
action = op.shift
|
|
812
811
|
op << action
|
|
813
812
|
case action
|
|
814
|
-
when 'list', 'edit', 'debug'
|
|
815
|
-
nil
|
|
813
|
+
when 'list', 'edit', 'debug' then nil
|
|
816
814
|
when 'get', 'unset', 'set'
|
|
817
815
|
op.add_first
|
|
818
816
|
op.add_first(quote: true, expect: true) if action == 'set'
|
|
@@ -923,6 +921,7 @@ module Squared
|
|
|
923
921
|
if (target = append_nocolor('no-color', target: [], prefix: 'hatch'))
|
|
924
922
|
(opts ||= []).concat(target)
|
|
925
923
|
end
|
|
924
|
+
ENV['HATCH_ENV_TYPE_VIRTUAL_PATH'] ||= venv if venv?
|
|
926
925
|
create_session('hatch', *cmd, common: OPT_HATCH[:common], opts: opts)
|
|
927
926
|
end
|
|
928
927
|
|
|
@@ -1089,8 +1088,7 @@ module Squared
|
|
|
1089
1088
|
/\A(?:v+|q+|b+|V+|O+)\z/
|
|
1090
1089
|
when :pdm, :poetry
|
|
1091
1090
|
/\Av+\z/
|
|
1092
|
-
when :twine, :meson
|
|
1093
|
-
nil
|
|
1091
|
+
when :twine, :meson then nil
|
|
1094
1092
|
else
|
|
1095
1093
|
/\A(?:v+|q+)\z/
|
|
1096
1094
|
end
|
|
@@ -1214,7 +1212,22 @@ module Squared
|
|
|
1214
1212
|
args << 'setuptools' << 'wheel'
|
|
1215
1213
|
end
|
|
1216
1214
|
pip(:install, *args, banner: false) unless args.empty?
|
|
1217
|
-
success?(ret, banner, !status)
|
|
1215
|
+
success?(ret, banner, !status) do |out|
|
|
1216
|
+
if out && dir.directory?
|
|
1217
|
+
if poetry?
|
|
1218
|
+
dir += (workspace.windows? ? 'Scripts/python.exe' : 'bin/python')
|
|
1219
|
+
cmd = poetry_session 'env use'
|
|
1220
|
+
else
|
|
1221
|
+
puts "Success: #{dir}"
|
|
1222
|
+
return
|
|
1223
|
+
end
|
|
1224
|
+
cmd << shell_quote(dir)
|
|
1225
|
+
print_run cmd, silent?
|
|
1226
|
+
run(banner: false)
|
|
1227
|
+
else
|
|
1228
|
+
puts 'Failed'
|
|
1229
|
+
end
|
|
1230
|
+
end
|
|
1218
1231
|
end
|
|
1219
1232
|
|
|
1220
1233
|
def venv_package?(val)
|
|
@@ -26,14 +26,14 @@ module Squared
|
|
|
26
26
|
rbs: %w[I=pm r=bm no-collection no-stdlib collection=p log-level=b log-output=p repo=p].freeze,
|
|
27
27
|
rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
|
|
28
28
|
display-only-correctable display-only-fail-level-offenses display-only-failed
|
|
29
|
-
display-only-safe-correctable S|display-style-guide display-time editor-mode
|
|
30
|
-
E|extra-details F|fail-fast force-default-config force-exclusion x|fix-layout
|
|
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
31
|
ignore-disable-comments ignore-parent-exclusion ignore-unrecognized-cops init l|lint
|
|
32
|
-
L|list-target-files lsp memory no-detach only-guide-cops
|
|
33
|
-
no-exclude-limit profile raise-cop-error regenerate-todo
|
|
34
|
-
start-server stderr stop-server C|cache=b cache-root=p config=p
|
|
35
|
-
f|format=b except=q only=q o|out=p plugin=p require=p show-cops=q
|
|
36
|
-
s|stdin=p].freeze,
|
|
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,
|
|
37
37
|
pry: %w[f e=q I=pm no-color no-history no-multiline no-pager no-plugins simple-prompt c|context=q
|
|
38
38
|
d|disable-plugin=q gem=b r|require=bm s|select-plugin=q].freeze,
|
|
39
39
|
no: {
|
|
@@ -507,16 +507,22 @@ module Squared
|
|
|
507
507
|
format_desc action, flag, 'f/orce?,l/ocal?,opts*'
|
|
508
508
|
task flag do |_, args|
|
|
509
509
|
opts = args.to_a
|
|
510
|
-
opts << 'local' if has_value!(opts, 'l')
|
|
510
|
+
opts << 'local' if has_value!(opts, 'l', 'local')
|
|
511
511
|
opts << 'redownload' if has_value!(opts, 'f', 'force')
|
|
512
512
|
if (lock = basepath!('Gemfile.lock'))
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
print_error('Gemfile.lock is frozen', subject: name, hint: flag)
|
|
513
|
+
case (val = ENV['BUNDLE_FROZEN'])
|
|
514
|
+
when '0', 'false' then nil
|
|
515
|
+
else
|
|
516
|
+
if val
|
|
517
|
+
print_error("BUNDLE_FROZEN: #{val}", loglevel: Logger::INFO, subject: name, hint: flag)
|
|
519
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
|
|
520
526
|
end
|
|
521
527
|
end
|
|
522
528
|
lock&.delete
|
|
@@ -776,8 +782,7 @@ module Squared
|
|
|
776
782
|
next if val == '0' || val == 'false'
|
|
777
783
|
|
|
778
784
|
run(bundle_output('binstubs --all', case val
|
|
779
|
-
when '1', 'true'
|
|
780
|
-
nil
|
|
785
|
+
when '1', 'true' then nil
|
|
781
786
|
else
|
|
782
787
|
if val.start_with?('~')
|
|
783
788
|
val = File.join(Dir.home, val == '~' ? '.bundle' : val[1..-1])
|
|
@@ -1069,6 +1074,7 @@ module Squared
|
|
|
1069
1074
|
filter = kwargs.fetch(:filter, {})
|
|
1070
1075
|
semver = filter[:semver]
|
|
1071
1076
|
equals = filter[:equals]
|
|
1077
|
+
dryrun = filter[:dryrun] || dryrun?(prefix: 'gem')
|
|
1072
1078
|
update = if sync && filter[:select]
|
|
1073
1079
|
semver ||= 'major'
|
|
1074
1080
|
items = []
|
|
@@ -1225,7 +1231,7 @@ module Squared
|
|
|
1225
1231
|
'user-install'
|
|
1226
1232
|
end
|
|
1227
1233
|
end
|
|
1228
|
-
if
|
|
1234
|
+
if dryrun
|
|
1229
1235
|
print_run gem_output('update -f', *update.quote!(escape: true)), false
|
|
1230
1236
|
else
|
|
1231
1237
|
gem(:update, *update, opts: opts)
|
|
@@ -1268,9 +1274,9 @@ module Squared
|
|
|
1268
1274
|
.clear(pass: false)
|
|
1269
1275
|
end
|
|
1270
1276
|
when :push
|
|
1271
|
-
target =
|
|
1272
|
-
if op.empty? ||
|
|
1273
|
-
file = basepath(if !
|
|
1277
|
+
target = nil
|
|
1278
|
+
if op.empty? || ia
|
|
1279
|
+
file = basepath(if !ia && (spec = gemspec)
|
|
1274
1280
|
"#{spec.name}-#{spec.version}.gem"
|
|
1275
1281
|
else
|
|
1276
1282
|
choice_index 'Select a file', Dir.glob('*.gem', base: path)
|
|
@@ -1289,7 +1295,7 @@ module Squared
|
|
|
1289
1295
|
|
|
1290
1296
|
op.add_path(file)
|
|
1291
1297
|
end
|
|
1292
|
-
return run(from: from, interactive: ['Push', 'N', target]) unless with || !banner
|
|
1298
|
+
return run(from: from, interactive: ['Push', 'N', target || gemname]) unless with || !banner
|
|
1293
1299
|
when :exec
|
|
1294
1300
|
min = if op.arg?('g', 'gem')
|
|
1295
1301
|
1
|
|
@@ -1843,8 +1849,8 @@ module Squared
|
|
|
1843
1849
|
private
|
|
1844
1850
|
|
|
1845
1851
|
def run_repl(*args, opts:, banner:, from:, delim: true, **kwargs)
|
|
1846
|
-
op = OptionPartition.new(opts, OPT_RUBY[from], session(*bundle_args(from)),
|
|
1847
|
-
|
|
1852
|
+
op = OptionPartition.new(opts, OPT_RUBY[from], session(*bundle_args(from)),
|
|
1853
|
+
project: self, strict: strict?, first: [/\.rb$/])
|
|
1848
1854
|
r = []
|
|
1849
1855
|
r << 'bundler/setup' if !op.arg?('r') && bundle_load
|
|
1850
1856
|
r.concat(Array(kwargs[:name])) if kwargs[:name]
|
|
@@ -1932,8 +1938,7 @@ module Squared
|
|
|
1932
1938
|
val = case (val = $2)
|
|
1933
1939
|
when 'true'
|
|
1934
1940
|
true
|
|
1935
|
-
when '', '[]'
|
|
1936
|
-
nil
|
|
1941
|
+
when '', '[]' then nil
|
|
1937
1942
|
else
|
|
1938
1943
|
if val =~ /\A\[:(.+)\]\z/
|
|
1939
1944
|
$1.split(', :').map { |s| (s[/\A"(.+)"\z/, 1] || s).to_sym }
|
|
@@ -27,7 +27,15 @@ module Squared
|
|
|
27
27
|
target << '--' if delim && !target.include?('--')
|
|
28
28
|
if strip
|
|
29
29
|
pat, s = Array(strip)
|
|
30
|
-
ret.map!
|
|
30
|
+
ret.map! do |val|
|
|
31
|
+
next val unless val.is_a?(String)
|
|
32
|
+
|
|
33
|
+
if pat.is_a?(String) && pat.size == 1 && s.nil?
|
|
34
|
+
val.delete_prefix(pat)
|
|
35
|
+
else
|
|
36
|
+
val.gsub(pat, s || '')
|
|
37
|
+
end
|
|
38
|
+
end
|
|
31
39
|
end
|
|
32
40
|
if filter
|
|
33
41
|
ret, err = ret.partition { |val| filter.match?(val.to_s) }
|
|
@@ -100,7 +108,17 @@ module Squared
|
|
|
100
108
|
ret.select { |val| single ? val.size == 1 : val.size > 1 }
|
|
101
109
|
end
|
|
102
110
|
|
|
103
|
-
def
|
|
111
|
+
def union(list, other)
|
|
112
|
+
base = list.map { |val| parse_option(val).first }
|
|
113
|
+
other.each do |val|
|
|
114
|
+
next if base.include?(parse_option(val).first)
|
|
115
|
+
|
|
116
|
+
list << val
|
|
117
|
+
end
|
|
118
|
+
list
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def uniq!(list, pass: [])
|
|
104
122
|
keys = {}
|
|
105
123
|
list.each_with_index do |val, i|
|
|
106
124
|
j = val =~ OPT_VALUE ? $1 : val
|
|
@@ -152,8 +170,11 @@ module Squared
|
|
|
152
170
|
end
|
|
153
171
|
|
|
154
172
|
def pattern?(val)
|
|
173
|
+
Regexp.new(val)
|
|
155
174
|
val.start_with?('\A', '^') || val.end_with?('\z', '$') ||
|
|
156
175
|
val.match?(/[.)][*+?]|\(\?[:=!><]|\\[dsw\d]|\[.+\]|\{\d+,?\d*\}/i)
|
|
176
|
+
rescue RegexpError
|
|
177
|
+
false
|
|
157
178
|
end
|
|
158
179
|
|
|
159
180
|
private
|
|
@@ -564,11 +585,21 @@ module Squared
|
|
|
564
585
|
end
|
|
565
586
|
|
|
566
587
|
def add_first(fallback = nil, prefix: nil, path: false, escape: false, reverse: false, expect: false,
|
|
567
|
-
**kwargs)
|
|
588
|
+
strip: nil, **kwargs)
|
|
568
589
|
val = (reverse ? pop : shift) || fallback
|
|
569
590
|
if val
|
|
570
591
|
temp = val
|
|
571
|
-
|
|
592
|
+
if val.is_a?(String)
|
|
593
|
+
val = val.delete_prefix(prefix) if prefix
|
|
594
|
+
if strip
|
|
595
|
+
pat, s = Array(strip)
|
|
596
|
+
val = if pat.is_a?(String) && pat.size == 1 && s.nil?
|
|
597
|
+
val.delete_prefix(pat)
|
|
598
|
+
else
|
|
599
|
+
val.gsub(pat, s || '')
|
|
600
|
+
end
|
|
601
|
+
end
|
|
602
|
+
end
|
|
572
603
|
unless block_given? && !(val = yield val).is_a?(String)
|
|
573
604
|
if path
|
|
574
605
|
add_path(val, **kwargs)
|
|
@@ -35,13 +35,29 @@ module Squared
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def matchmap(list, prefix: nil)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
def matchmap(list, prefix: nil, negate: false)
|
|
39
|
+
ret = negate ? [[], []] : []
|
|
40
|
+
list.each do |val|
|
|
41
|
+
unless val.is_a?(Regexp)
|
|
42
|
+
val = val.dup
|
|
43
|
+
n = 1 if negate && val.delete_prefix!('!')
|
|
44
|
+
if prefix
|
|
45
|
+
a = nil
|
|
46
|
+
val.sub!(/\A(\^|\\A)/) do |s|
|
|
47
|
+
a = s
|
|
48
|
+
nil
|
|
49
|
+
end
|
|
50
|
+
val = ".*#{val}" unless a
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
pat = Regexp.new("#{a}#{prefix}#{val == '*' ? '.+' : val}")
|
|
54
|
+
if negate
|
|
55
|
+
ret[n || 0] << pat
|
|
56
|
+
else
|
|
57
|
+
ret << pat
|
|
58
|
+
end
|
|
44
59
|
end
|
|
60
|
+
ret
|
|
45
61
|
end
|
|
46
62
|
|
|
47
63
|
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)
|
|
@@ -186,8 +184,7 @@ module Squared
|
|
|
186
184
|
end
|
|
187
185
|
env('REPO_GROUPS', **envargs) do |val|
|
|
188
186
|
g = case val
|
|
189
|
-
when '0', 'false'
|
|
190
|
-
nil
|
|
187
|
+
when '0', 'false' then nil
|
|
191
188
|
else
|
|
192
189
|
val
|
|
193
190
|
end
|
|
@@ -316,9 +313,7 @@ module Squared
|
|
|
316
313
|
i = -1
|
|
317
314
|
n = repo_scriptdata(proj, name).reduce(0) do |a, b|
|
|
318
315
|
i += 1
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
a + (1 << i)
|
|
316
|
+
b ? a + (1 << i) : a
|
|
322
317
|
end
|
|
323
318
|
proj.global(n) && (pass || g.include?(proj.group) || r.any? { |val| proj.ref?(val) })
|
|
324
319
|
end
|
|
@@ -364,7 +359,7 @@ module Squared
|
|
|
364
359
|
def repo_install?(dir = root, parent: false)
|
|
365
360
|
return true if root?(dir, pass: ['.repo']) || dir.join('.repo').directory?
|
|
366
361
|
|
|
367
|
-
parent && root.children.none? { |ent| ent.directory? && ent
|
|
362
|
+
parent && root.children.none? { |ent| ent.directory? && ent != home }
|
|
368
363
|
end
|
|
369
364
|
end
|
|
370
365
|
|
|
@@ -88,7 +88,7 @@ module Squared
|
|
|
88
88
|
update @session[:parent] if @session[:id].uniq.size > 1
|
|
89
89
|
update @session[:group]
|
|
90
90
|
each do |key, items|
|
|
91
|
-
next if exclude?(key, true) || @workspace.task_exclude?(t = name_get(key))
|
|
91
|
+
next if exclude?(key, empty: true) || @workspace.task_exclude?(t = name_get(key))
|
|
92
92
|
|
|
93
93
|
key = task_name t
|
|
94
94
|
title = format_desc(key, out: true)
|
|
@@ -217,7 +217,7 @@ module Squared
|
|
|
217
217
|
already_invoked? parallel, val
|
|
218
218
|
end
|
|
219
219
|
|
|
220
|
-
def exclude?(key, empty
|
|
220
|
+
def exclude?(key, empty: false)
|
|
221
221
|
@exclude.include?(key) || (empty && (!key?(key) || self[key].empty?))
|
|
222
222
|
end
|
|
223
223
|
|
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.
|
|
4
|
+
version: 0.8.3
|
|
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.
|
|
128
|
+
rubygems_version: 4.0.18
|
|
129
129
|
specification_version: 4
|
|
130
130
|
summary: Rake task generator for managing multi-language workspaces.
|
|
131
131
|
test_files: []
|