squared 0.2.3 → 0.3.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 +58 -1
- data/README.ruby.md +150 -68
- data/lib/squared/common/base.rb +3 -1
- data/lib/squared/common/class.rb +27 -2
- data/lib/squared/common/format.rb +3 -3
- data/lib/squared/common/shell.rb +5 -5
- data/lib/squared/common/utils.rb +23 -12
- data/lib/squared/config.rb +4 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +52 -17
- data/lib/squared/workspace/project/base.rb +318 -117
- data/lib/squared/workspace/project/git.rb +498 -296
- data/lib/squared/workspace/project/node.rb +245 -101
- data/lib/squared/workspace/project/python.rb +89 -64
- data/lib/squared/workspace/project/ruby.rb +171 -155
- data/lib/squared/workspace/repo.rb +7 -4
- data/lib/squared/workspace/series.rb +10 -4
- metadata +2 -2
@@ -6,28 +6,36 @@ module Squared
|
|
6
6
|
class Ruby < Git
|
7
7
|
GEMFILE = %w[Gemfile Gemfile.lock gem.deps.rb Isolate].freeze
|
8
8
|
DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
OPT_BUNDLE = {
|
10
|
+
common: %w[no-color V verbose retry=i].freeze,
|
11
|
+
install: %w[frozen no-cache no-prune system path=p binstubs=p? standalone=q? target-rbconfig=p trust-policy=b
|
12
|
+
with=q without=q].freeze,
|
13
|
+
install_base: %w[full-index quiet retry gemfile=p j|jobs=i].freeze,
|
14
|
+
update: %w[conservative local pre redownload ruby strict bundler=e? g|group=q source=e].freeze,
|
15
|
+
outdated: %w[filter-major filter-minor filter-patch groups local parseable pre only-explicit strict
|
16
|
+
update-strict g|group=q source=e].freeze,
|
17
|
+
exec: %w[gemfile=p].freeze,
|
18
|
+
check: %w[dry-run gemfile=p].freeze
|
19
|
+
}.freeze
|
15
20
|
OPT_GEM = {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
platform=
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
common: %w[backtrace debug q|quiet no-verbose norc silent V|verbose config-file=p].freeze,
|
22
|
+
install: %w[version=e].freeze,
|
23
|
+
update: %w[system=e?].freeze,
|
24
|
+
outdated: %w[b|both clear-sources l|local no-http-proxy r|remote B|bulk-threshold=i p|http-proxy=q?
|
25
|
+
platform=q source=q].freeze,
|
26
|
+
push: %w[no-http-proxy attestation=p host=q key=e otp=e p|http-proxy=q?].freeze,
|
27
|
+
build: %w[force strict o|output=p platform=q].freeze,
|
28
|
+
exec: %w[conservative prerelease no-prerelease g|gem=s version=e].freeze,
|
29
|
+
pristine: %w[all env-shebang extensions no-env-shebang no-extensions only-executables only-missing-extensions
|
30
|
+
only-plugins n|bindir=p i|install-dir=p skip=e v|version=e].freeze,
|
31
|
+
shared: %w[f b|both clear-sources conservative default development development-all E|explain
|
32
|
+
ignore-dependencies l|local N|no-document r|remote w|vendor n|bindir=p build-root=p
|
33
|
+
bulk-threshold=i document=b? g|file=p? p|http-proxy=q i|install-dir=p platform=q s|source=q
|
34
|
+
target-rbconfig=p? P|trust-policy=b without=e].freeze,
|
35
|
+
shared_no: %w[env-shebang force format-executable http-proxy lock minimal-deps post-install-message
|
36
|
+
prerelease suggestions user-install wrappers].freeze
|
29
37
|
}.freeze
|
30
|
-
private_constant :GEMFILE, :DIR_RUBY, :
|
38
|
+
private_constant :GEMFILE, :DIR_RUBY, :OPT_BUNDLE, :OPT_GEM
|
31
39
|
|
32
40
|
class << self
|
33
41
|
def populate(*); end
|
@@ -52,9 +60,10 @@ module Squared
|
|
52
60
|
'install' => %i[redownload local prefer-local].freeze,
|
53
61
|
'update' => %i[patch minor major all].freeze,
|
54
62
|
'outdated' => %i[patch minor major].freeze,
|
55
|
-
'gem' => %i[install user-install update outdated
|
63
|
+
'gem' => %i[install user-install update pristine outdated push build exec].freeze,
|
56
64
|
'exec' => nil,
|
57
65
|
'config' => nil,
|
66
|
+
'check' => nil,
|
58
67
|
'rake' => nil
|
59
68
|
}.freeze
|
60
69
|
|
@@ -101,11 +110,13 @@ module Squared
|
|
101
110
|
|
102
111
|
if flags.nil?
|
103
112
|
case action
|
104
|
-
when 'exec', '
|
105
|
-
format_desc
|
113
|
+
when 'config', 'exec', 'check'
|
114
|
+
format_desc(action, nil, case action
|
115
|
+
when 'exec', 'check'
|
116
|
+
OPT_BUNDLE[action.to_sym]
|
117
|
+
end, after: action == 'check' ? nil : 'command+')
|
106
118
|
task action do |_, args|
|
107
|
-
|
108
|
-
bundle(action, *args)
|
119
|
+
bundle action, args.to_a
|
109
120
|
end
|
110
121
|
when 'rake'
|
111
122
|
next unless rakefile
|
@@ -126,7 +137,7 @@ module Squared
|
|
126
137
|
log.warn "rake task #{n} of #{list.size} (out of range)"
|
127
138
|
next
|
128
139
|
end
|
129
|
-
rake(args.extras.empty? ? cmd :
|
140
|
+
rake(args.extras.empty? ? cmd : cmd + shell_escape("[#{args.extras.join(',')}]"))
|
130
141
|
else
|
131
142
|
rake(*args.to_a)
|
132
143
|
end
|
@@ -136,33 +147,23 @@ module Squared
|
|
136
147
|
namespace action do
|
137
148
|
flags.each do |flag|
|
138
149
|
case action
|
139
|
-
when 'install'
|
140
|
-
format_desc
|
141
|
-
task flag do |_, args|
|
142
|
-
depend(flag, opts: args.to_a)
|
143
|
-
end
|
144
|
-
when 'update', 'outdated'
|
145
|
-
if @@task_desc
|
146
|
-
format_desc(action, flag, action == 'update' ? FOR_INSTALL + OPT_UPDATE : OPT_OUTDATED)
|
147
|
-
end
|
150
|
+
when 'install', 'update', 'outdated'
|
151
|
+
format_desc action, flag, 'opts*'
|
148
152
|
task flag do |_, args|
|
149
|
-
__send__
|
153
|
+
__send__ action, flag, args.to_a
|
150
154
|
end
|
151
155
|
when 'gem'
|
152
156
|
case flag
|
153
|
-
when :outdated
|
154
|
-
format_desc action, flag,
|
157
|
+
when :outdated, :build, :push, :exec
|
158
|
+
format_desc action, flag, 'opts*'
|
155
159
|
task flag do |_, args|
|
156
|
-
gemx
|
160
|
+
gemx flag, args.to_a
|
157
161
|
end
|
158
162
|
else
|
159
|
-
|
160
|
-
|
161
|
-
after: "name+#{flag == :pristine ? '|name?@version' : ''}")
|
162
|
-
end
|
163
|
-
task flag, [:name] do |_, args|
|
163
|
+
format_desc action, flag, "opts*,name+#{flag == :pristine ? '|name?@version' : ''}"
|
164
|
+
task flag do |_, args|
|
164
165
|
opts = param_guard(action, flag, args: args.to_a)
|
165
|
-
gemx
|
166
|
+
gemx flag, opts
|
166
167
|
end
|
167
168
|
end
|
168
169
|
end
|
@@ -173,22 +174,15 @@ module Squared
|
|
173
174
|
end
|
174
175
|
end
|
175
176
|
|
176
|
-
def depend(
|
177
|
-
if @depend
|
177
|
+
def depend(*, sync: invoked_sync?('depend'), **)
|
178
|
+
if @depend
|
178
179
|
super
|
179
180
|
elsif outdated?
|
180
181
|
cmd = bundle_session 'install'
|
181
|
-
if
|
182
|
-
cmd << "
|
183
|
-
append_bundle opts, FOR_INSTALL + OPT_INSTALL
|
184
|
-
from = :install
|
185
|
-
else
|
186
|
-
if (n = option('jobs')).to_i > 0
|
187
|
-
cmd << "-j#{n}"
|
188
|
-
end
|
189
|
-
from = :depend
|
182
|
+
if (n = option('jobs')).to_i > 0
|
183
|
+
cmd << "-j#{n}"
|
190
184
|
end
|
191
|
-
run_rb(from:
|
185
|
+
run_rb(from: :depend, sync: sync)
|
192
186
|
end
|
193
187
|
end
|
194
188
|
|
@@ -223,11 +217,11 @@ module Squared
|
|
223
217
|
on :last, :copy
|
224
218
|
end
|
225
219
|
|
226
|
-
def outdated(flag = nil, opts
|
220
|
+
def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
|
227
221
|
cmd = bundle_output 'outdated'
|
228
222
|
if flag
|
229
223
|
cmd << "--#{flag}"
|
230
|
-
append_bundle(opts,
|
224
|
+
append_bundle(opts, OPT_BUNDLE[:outdated] + OPT_BUNDLE[:common], target: cmd)
|
231
225
|
end
|
232
226
|
log.info cmd.to_s
|
233
227
|
on :first, :outdated
|
@@ -259,10 +253,10 @@ module Squared
|
|
259
253
|
semmajor?(cur, lat) ? major_set.() : minor_set.()
|
260
254
|
else
|
261
255
|
data.each do |val|
|
262
|
-
break unless
|
256
|
+
break unless line =~ /(>=?|=|~>|!=|<=?) (#{Regexp.escape(val.join)})/
|
263
257
|
|
264
258
|
v = semver(val).join
|
265
|
-
case
|
259
|
+
case $1
|
266
260
|
when '>', '>='
|
267
261
|
semmajor?(cur, lat) ? major_set.() : minor_set.()
|
268
262
|
when '<', '<='
|
@@ -323,8 +317,8 @@ module Squared
|
|
323
317
|
end
|
324
318
|
if found > 0
|
325
319
|
begin
|
326
|
-
if major == 0 &&
|
327
|
-
status = (
|
320
|
+
if major == 0 && dependfile.read =~ /\b(?:source\s+(["'])(.+?)\1|remote:\s+(\S+))/
|
321
|
+
status = ($2 || $3).chomp('/')
|
328
322
|
right = true
|
329
323
|
end
|
330
324
|
rescue StandardError => e
|
@@ -340,49 +334,56 @@ module Squared
|
|
340
334
|
on :last, :outdated
|
341
335
|
end
|
342
336
|
|
343
|
-
def
|
337
|
+
def install(flag, opts = [])
|
338
|
+
bundle_session 'install', "--#{flag}"
|
339
|
+
append_bundle opts, OPT_BUNDLE[:install_base] + OPT_BUNDLE[:install] + OPT_BUNDLE[:common]
|
340
|
+
run_rb(from: :install)
|
341
|
+
end
|
342
|
+
|
343
|
+
def update(flag, opts = [])
|
344
344
|
bundle_session 'update', "--#{flag}"
|
345
|
-
append_bundle opts,
|
345
|
+
append_bundle opts, OPT_BUNDLE[:install_base] + OPT_BUNDLE[:update] + OPT_BUNDLE[:common]
|
346
346
|
run_rb(from: :update)
|
347
347
|
end
|
348
348
|
|
349
|
-
def gemx(flag, opts
|
349
|
+
def gemx(flag, opts = [])
|
350
350
|
cmd = gem_session
|
351
351
|
case flag
|
352
352
|
when :outdated
|
353
|
-
cmd <<
|
353
|
+
cmd << pwd if (pwd = gempwd)
|
354
354
|
cmd << flag
|
355
|
+
when :push
|
356
|
+
cmd << flag << project
|
355
357
|
when :'user-install'
|
356
|
-
cmd << 'install' <<
|
358
|
+
cmd << 'install' << '--user-install'
|
357
359
|
else
|
358
360
|
cmd << flag
|
359
361
|
end
|
360
|
-
|
361
|
-
|
362
|
+
list = OPT_GEM[flag == :'user-install' ? :install : flag] + OPT_GEM[:common]
|
363
|
+
case flag
|
364
|
+
when :install, :'user-install', :update
|
365
|
+
list += OPT_GEM[:shared]
|
366
|
+
no = OPT_GEM[:shared_no]
|
367
|
+
end
|
368
|
+
opts, pat = option_sanitize(opts, list, no: no, first: true)
|
362
369
|
out = []
|
363
370
|
opts.each do |opt|
|
364
371
|
if opt =~ pat
|
365
372
|
case $1
|
366
|
-
when '
|
367
|
-
|
368
|
-
cmd << quote_option($1, basepath($2))
|
369
|
-
when 'p', 'http-proxy', 's', 'source'
|
370
|
-
cmd << quote_option($1, $2)
|
371
|
-
when 'bulk-threshold'
|
372
|
-
cmd << basic_option($1, $2) if $2.to_i > 0
|
373
|
-
else
|
374
|
-
cmd << shell_option($1, $2)
|
373
|
+
when 'g', 'gem'
|
374
|
+
cmd << (flag == :exec ? shell_option($1, $2) : quote_option($1, basepath($2)))
|
375
375
|
end
|
376
376
|
else
|
377
377
|
out << opt
|
378
378
|
end
|
379
379
|
end
|
380
380
|
from = :"gem:#{flag == :'user-install' ? 'install' : flag}"
|
381
|
-
|
381
|
+
case flag
|
382
|
+
when :outdated
|
382
383
|
log.info cmd.to_s
|
383
384
|
on :first, from
|
384
385
|
print_item format_banner(cmd.to_s)
|
385
|
-
pwd_set(pass:
|
386
|
+
pwd_set(pass: !pwd.nil?, from: from) do
|
386
387
|
items = [[%w[Gem Current Latest], nil]]
|
387
388
|
IO.popen(cmd.done).each do |line|
|
388
389
|
if (data = line.match(/^(\S+) \((\S+) < ([^)]+)\)$/))
|
@@ -454,36 +455,56 @@ module Squared
|
|
454
455
|
end
|
455
456
|
end
|
456
457
|
on :last, from
|
458
|
+
return
|
459
|
+
when :build, :push
|
460
|
+
if !out.empty?
|
461
|
+
if flag == :build && out.size == 1
|
462
|
+
cmd << basepath(out.first)
|
463
|
+
else
|
464
|
+
raise_error('gem', flag, out.join(', '), hint: 'unrecognized option')
|
465
|
+
end
|
466
|
+
elsif flag == :build
|
467
|
+
cmd << "#{project}.gemspec"
|
468
|
+
end
|
469
|
+
when :exec
|
470
|
+
raise_error('gem', flag, hint: 'no command given') if out.empty?
|
471
|
+
cmd << out.join(' ')
|
457
472
|
else
|
458
|
-
if out.empty? &&
|
473
|
+
if out.empty? && cmd.none? { |val| val =~ /^--system(?:=|$)/ }
|
459
474
|
raise_error('gem', flag, hint: 'no gemname given')
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
end
|
474
|
-
cmd << shell_option('version', version)
|
475
|
-
out.clear
|
475
|
+
end
|
476
|
+
if flag == :pristine
|
477
|
+
if session_arg?('all')
|
478
|
+
append_repeat 'skip', out
|
479
|
+
out.clear
|
480
|
+
elsif (n = out.first =~ /@/)
|
481
|
+
name = out.first
|
482
|
+
if n == 0
|
483
|
+
cmd << project
|
484
|
+
version = name[1..-1]
|
485
|
+
else
|
486
|
+
cmd << shell_escape(name[0, n])
|
487
|
+
version = name[n + 1..-1]
|
476
488
|
end
|
489
|
+
cmd << shell_option('version', version)
|
490
|
+
out.clear
|
477
491
|
end
|
478
|
-
append_value out
|
479
492
|
end
|
480
|
-
|
493
|
+
append_value(out, escape: true)
|
481
494
|
end
|
495
|
+
run_rb(from: from)
|
482
496
|
end
|
483
497
|
|
484
|
-
def bundle(
|
498
|
+
def bundle(flag, *args)
|
485
499
|
args = args.flatten
|
486
|
-
|
500
|
+
cmd = bundle_session flag
|
501
|
+
case flag
|
502
|
+
when 'exec', 'check'
|
503
|
+
args = option_sanitize(args, OPT_BUNDLE[flag.to_sym] + OPT_BUNDLE[:common]).first
|
504
|
+
end
|
505
|
+
raise_error('bundle', flag, hint: 'no command given') unless !args.empty? || flag == 'check'
|
506
|
+
cmd.merge!(args)
|
507
|
+
run(from: :"bundle:#{flag}")
|
487
508
|
end
|
488
509
|
|
489
510
|
def rake(*cmd)
|
@@ -509,34 +530,43 @@ module Squared
|
|
509
530
|
end
|
510
531
|
return false unless @autodetect
|
511
532
|
|
512
|
-
set = lambda do |val|
|
533
|
+
set = lambda do |val, path|
|
513
534
|
log.warn "using version #{val} (given #{@version})" if @version && @version != val
|
514
535
|
@version = val
|
536
|
+
@gemdir = Pathname.new(path.strip).join(gempath)
|
515
537
|
end
|
516
538
|
if @version
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
539
|
+
pwd = gempwd
|
540
|
+
pwd_set(pass: !pwd.nil?) do
|
541
|
+
out = `#{gem_output(pwd, 'list', '--local', '-d', project)}`
|
542
|
+
if out =~ /#{Regexp.escape(project)} \(([^)]+)\)/
|
543
|
+
ver = $1.split(/\s*,\s*/)
|
544
|
+
ver.unshift(@version).uniq!
|
545
|
+
ver.each do |val|
|
546
|
+
next unless out =~ /\(#{Regexp.escape(val)}(?:,[^)]+|\b)\):([^\n]+)/
|
547
|
+
|
548
|
+
set.(val, $1)
|
549
|
+
break
|
550
|
+
end
|
526
551
|
end
|
527
552
|
end
|
528
553
|
end
|
529
|
-
unless
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
554
|
+
unless @gemdir
|
555
|
+
parse = lambda do |path|
|
556
|
+
next unless path
|
557
|
+
|
558
|
+
lib = Regexp.new(['', 'gems', "#{project}-([^#{File::SEPARATOR}]+)", ''].join(File::SEPARATOR))
|
559
|
+
if (ver = path[lib, 1]) && (val = path[/\A(.+)#{gempath(ver[1])}/, 1])
|
560
|
+
set.(ver, val)
|
535
561
|
end
|
536
562
|
end
|
563
|
+
if RUBY_VERSION >= '2.6'
|
564
|
+
target = RUBY_VERSION.start_with?('2.6') ? RubyVM : $LOAD_PATH
|
565
|
+
parse.(target.resolve_feature_path(project)&.last)
|
566
|
+
end
|
567
|
+
pwd_set { parse.(`#{bundle_output('show', project)}`) } unless @gemdir
|
537
568
|
end
|
538
|
-
raise_error('failed to parse', hint: @version || 'path') unless
|
539
|
-
@gemdir = Pathname.new(data[1].strip).join(gempath)
|
569
|
+
raise_error('failed to parse', hint: @version || 'path') unless @gemdir
|
540
570
|
rescue StandardError => e
|
541
571
|
log.error e
|
542
572
|
@version = nil
|
@@ -557,24 +587,7 @@ module Squared
|
|
557
587
|
end
|
558
588
|
|
559
589
|
def append_bundle(opts, list, target: @session)
|
560
|
-
|
561
|
-
out = []
|
562
|
-
opts.each do |opt|
|
563
|
-
if opt =~ pat
|
564
|
-
case $1
|
565
|
-
when 'path', 'gemfile', 'binstubs', 'target-rbconfig'
|
566
|
-
target << quote_option($1, basepath($2))
|
567
|
-
when 'standalone', 'with', 'without', 'g', 'group'
|
568
|
-
target << quote_option($1, $2)
|
569
|
-
when 'retry', 'j', 'jobs'
|
570
|
-
target << basic_option($1, $2) if $2.to_i > 0
|
571
|
-
else
|
572
|
-
target << shell_option($1, $2)
|
573
|
-
end
|
574
|
-
else
|
575
|
-
out << opt
|
576
|
-
end
|
577
|
-
end
|
590
|
+
out = option_sanitize(opts, list, target: target).first
|
578
591
|
option_clear(out, target: target)
|
579
592
|
end
|
580
593
|
|
@@ -610,12 +623,12 @@ module Squared
|
|
610
623
|
return @rakelist if @rakelist
|
611
624
|
|
612
625
|
ret = []
|
613
|
-
|
614
|
-
pwd_set(pass:
|
615
|
-
IO.popen(rake_output(
|
616
|
-
next unless
|
626
|
+
pwd = rakepwd
|
627
|
+
pwd_set(pass: !pwd.nil?) do
|
628
|
+
IO.popen(rake_output(pwd, '-AT').to_s).each do |line|
|
629
|
+
next unless line =~ /^rake ((?:[^\[: ]+:?)+)(\[[^\]]+\])?/
|
617
630
|
|
618
|
-
ret << [
|
631
|
+
ret << [$1, $2]
|
619
632
|
end
|
620
633
|
end
|
621
634
|
@rakelist = ret
|
@@ -630,26 +643,29 @@ module Squared
|
|
630
643
|
end
|
631
644
|
|
632
645
|
def rakefile
|
633
|
-
file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
|
634
|
-
|
646
|
+
return unless (file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? })
|
647
|
+
|
648
|
+
basepath(file)
|
635
649
|
end
|
636
650
|
|
637
651
|
def rakeapp
|
638
652
|
quote_option 'rakefile', Rake.application.rakefile
|
639
653
|
end
|
640
654
|
|
641
|
-
def
|
642
|
-
|
655
|
+
def rakepwd
|
656
|
+
return unless Rake::VERSION >= '13.0.4'
|
657
|
+
|
658
|
+
quote_option('C', path)
|
643
659
|
end
|
644
660
|
|
645
|
-
def
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
661
|
+
def gempwd
|
662
|
+
return unless Gem::VERSION >= '3.4.2'
|
663
|
+
|
664
|
+
quote_option('C', path)
|
665
|
+
end
|
666
|
+
|
667
|
+
def gempath(val = @version)
|
668
|
+
File.join('gems', "#{project}-#{val}")
|
653
669
|
end
|
654
670
|
end
|
655
671
|
|
@@ -17,7 +17,8 @@ module Squared
|
|
17
17
|
|
18
18
|
attr_reader :manifest_url, :manifest
|
19
19
|
|
20
|
-
def repo(url, manifest = 'latest', run: nil, script: nil,
|
20
|
+
def repo(url, manifest = 'latest', run: nil, script: nil, args: nil, dev: nil, prod: nil,
|
21
|
+
ref: @ref, group: @group)
|
21
22
|
@home = if (val = env('REPO_HOME'))
|
22
23
|
path = Pathname.new(val)
|
23
24
|
if main == path.basename.to_s
|
@@ -74,6 +75,7 @@ module Squared
|
|
74
75
|
else
|
75
76
|
data[:script] = script
|
76
77
|
end
|
78
|
+
data[:args] = (val = env('REPO_SCRIPT')) ? shell_split(val, join: true) : args
|
77
79
|
elsif (val = env('REPO_BUILD'))
|
78
80
|
data[:run] = val
|
79
81
|
data[:env] = true
|
@@ -81,8 +83,8 @@ module Squared
|
|
81
83
|
data[:run] = run
|
82
84
|
end
|
83
85
|
data[:global] = true
|
84
|
-
data[:dev] = env_match('REPO_DEV', dev
|
85
|
-
data[:prod] = env_match('REPO_PROD', prod
|
86
|
+
data[:dev] = env_match('REPO_DEV', dev)
|
87
|
+
data[:prod] = env_match('REPO_PROD', prod)
|
86
88
|
if (val = env('REPO_GROUP'))
|
87
89
|
script_set(data, group: val.split(','))
|
88
90
|
found = true
|
@@ -92,11 +94,12 @@ module Squared
|
|
92
94
|
found = true
|
93
95
|
end
|
94
96
|
script_set(data, group: group, ref: ref) unless found
|
95
|
-
@warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo'])
|
97
|
+
@warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo'])) != false
|
96
98
|
@extensions << :__repo__
|
97
99
|
elsif script || run
|
98
100
|
if script
|
99
101
|
data[:script] = script
|
102
|
+
data[:args] = args
|
100
103
|
else
|
101
104
|
data[:run] = run
|
102
105
|
end
|
@@ -85,7 +85,7 @@ module Squared
|
|
85
85
|
(TASK_BASE + TASK_KEYS).each { |key| @data[key] = [] }
|
86
86
|
end
|
87
87
|
|
88
|
-
def populate(proj)
|
88
|
+
def populate(proj, **)
|
89
89
|
group, parent, id = @session.values
|
90
90
|
ws = proj.workspace
|
91
91
|
@data.each do |key, items|
|
@@ -97,7 +97,7 @@ module Squared
|
|
97
97
|
else
|
98
98
|
items.concat(tasks)
|
99
99
|
end
|
100
|
-
if tasks.size > 1 && (
|
100
|
+
if tasks.size > 1 && batch?(proj, key) && !ws.task_exclude?(key, proj)
|
101
101
|
ws.task_desc(t = ws.task_join(proj.name, key))
|
102
102
|
task t => tasks
|
103
103
|
end
|
@@ -113,9 +113,9 @@ module Squared
|
|
113
113
|
@data.merge!(@session[:parent]) if @session[:id].uniq.size > 1
|
114
114
|
@data.merge!(@session[:group])
|
115
115
|
@data.each do |key, items|
|
116
|
-
next if items.empty?
|
116
|
+
next if items.empty? || @workspace.task_exclude?(t = name_get(key))
|
117
117
|
|
118
|
-
key = task_name(t
|
118
|
+
key = task_name(t)
|
119
119
|
val = format_desc(key, out: true)
|
120
120
|
if items.size > 1
|
121
121
|
@multiple << key
|
@@ -181,6 +181,12 @@ module Squared
|
|
181
181
|
ret
|
182
182
|
end
|
183
183
|
|
184
|
+
def batch?(obj, key)
|
185
|
+
return false unless (data = batch_get(key))
|
186
|
+
|
187
|
+
data.keys.any? { |ref| obj.ref?(ref) }
|
188
|
+
end
|
189
|
+
|
184
190
|
def multiple?(val = nil)
|
185
191
|
already_invoked?(multiple, val)
|
186
192
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-02-
|
10
|
+
date: 2025-02-07 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|