squared 0.2.10 → 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 +54 -101
- 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 +12 -12
- data/lib/squared/common/prompt.rb +1 -1
- data/lib/squared/common/shell.rb +11 -13
- data/lib/squared/common/utils.rb +24 -13
- data/lib/squared/config.rb +4 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +54 -19
- data/lib/squared/workspace/project/base.rb +350 -158
- data/lib/squared/workspace/project/git.rb +543 -338
- data/lib/squared/workspace/project/node.rb +248 -107
- data/lib/squared/workspace/project/python.rb +101 -78
- data/lib/squared/workspace/project/ruby.rb +179 -169
- data/lib/squared/workspace/repo.rb +9 -4
- data/lib/squared/workspace/series.rb +10 -4
- data/squared.gemspec +0 -1
- metadata +3 -17
@@ -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,34 +174,25 @@ 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
|
|
195
|
-
def copy(from: 'lib', into: @gemdir, override: false
|
196
|
-
glob = kwargs[:include]
|
197
|
-
pass = kwargs[:exclude]
|
189
|
+
def copy(from: 'lib', include: nil, exclude: nil, into: @gemdir, override: false)
|
198
190
|
if @copy && !override
|
199
191
|
return super if runnable?(@copy)
|
200
192
|
|
201
193
|
from = @copy[:from] if @copy.key?(:from)
|
202
194
|
glob = @copy[:include] if @copy.key?(:include)
|
203
|
-
|
195
|
+
exclude = @copy[:exclude] if @copy.key?(:exclude)
|
204
196
|
into = @copy[:into] if @copy.key?(:into)
|
205
197
|
end
|
206
198
|
return unless into
|
@@ -212,10 +204,10 @@ module Squared
|
|
212
204
|
as_a(from).each_with_index do |val, i|
|
213
205
|
a = basepath(val)
|
214
206
|
b = dest.join(val)
|
215
|
-
c = glob[i] || glob
|
207
|
+
c = glob[i] || glob[0]
|
216
208
|
log.info "cp #{a.join(c)} #{b}"
|
217
209
|
begin
|
218
|
-
copy_dir(a, b, c, pass:
|
210
|
+
copy_dir(a, b, c, pass: exclude, verbose: verbose)
|
219
211
|
rescue StandardError => e
|
220
212
|
log.error e
|
221
213
|
ret = on(:error, :copy, e)
|
@@ -225,11 +217,11 @@ module Squared
|
|
225
217
|
on :last, :copy
|
226
218
|
end
|
227
219
|
|
228
|
-
def outdated(flag = nil, opts
|
220
|
+
def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
|
229
221
|
cmd = bundle_output 'outdated'
|
230
222
|
if flag
|
231
223
|
cmd << "--#{flag}"
|
232
|
-
append_bundle(opts,
|
224
|
+
append_bundle(opts, OPT_BUNDLE[:outdated] + OPT_BUNDLE[:common], target: cmd)
|
233
225
|
end
|
234
226
|
log.info cmd.to_s
|
235
227
|
on :first, :outdated
|
@@ -261,10 +253,10 @@ module Squared
|
|
261
253
|
semmajor?(cur, lat) ? major_set.() : minor_set.()
|
262
254
|
else
|
263
255
|
data.each do |val|
|
264
|
-
break unless
|
256
|
+
break unless line =~ /(>=?|=|~>|!=|<=?) (#{Regexp.escape(val.join)})/
|
265
257
|
|
266
258
|
v = semver(val).join
|
267
|
-
case
|
259
|
+
case $1
|
268
260
|
when '>', '>='
|
269
261
|
semmajor?(cur, lat) ? major_set.() : minor_set.()
|
270
262
|
when '<', '<='
|
@@ -325,8 +317,8 @@ module Squared
|
|
325
317
|
end
|
326
318
|
if found > 0
|
327
319
|
begin
|
328
|
-
if major == 0 &&
|
329
|
-
status = (
|
320
|
+
if major == 0 && dependfile.read =~ /\b(?:source\s+(["'])(.+?)\1|remote:\s+(\S+))/
|
321
|
+
status = ($2 || $3).chomp('/')
|
330
322
|
right = true
|
331
323
|
end
|
332
324
|
rescue StandardError => e
|
@@ -342,49 +334,56 @@ module Squared
|
|
342
334
|
on :last, :outdated
|
343
335
|
end
|
344
336
|
|
345
|
-
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 = [])
|
346
344
|
bundle_session 'update', "--#{flag}"
|
347
|
-
append_bundle
|
345
|
+
append_bundle opts, OPT_BUNDLE[:install_base] + OPT_BUNDLE[:update] + OPT_BUNDLE[:common]
|
348
346
|
run_rb(from: :update)
|
349
347
|
end
|
350
348
|
|
351
|
-
def gemx(flag, opts
|
349
|
+
def gemx(flag, opts = [])
|
352
350
|
cmd = gem_session
|
353
351
|
case flag
|
354
352
|
when :outdated
|
355
|
-
cmd <<
|
353
|
+
cmd << pwd if (pwd = gempwd)
|
356
354
|
cmd << flag
|
355
|
+
when :push
|
356
|
+
cmd << flag << project
|
357
357
|
when :'user-install'
|
358
|
-
cmd << 'install' <<
|
358
|
+
cmd << 'install' << '--user-install'
|
359
359
|
else
|
360
360
|
cmd << flag
|
361
361
|
end
|
362
|
-
|
363
|
-
|
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)
|
364
369
|
out = []
|
365
370
|
opts.each do |opt|
|
366
371
|
if opt =~ pat
|
367
372
|
case $1
|
368
|
-
when '
|
369
|
-
|
370
|
-
cmd << quote_option($1, basepath($2))
|
371
|
-
when 'p', 'http-proxy', 's', 'source'
|
372
|
-
cmd << quote_option($1, $2)
|
373
|
-
when 'bulk-threshold'
|
374
|
-
cmd << basic_option($1, $2) if $2.to_i > 0
|
375
|
-
else
|
376
|
-
cmd << shell_option($1, $2)
|
373
|
+
when 'g', 'gem'
|
374
|
+
cmd << (flag == :exec ? shell_option($1, $2) : quote_option($1, basepath($2)))
|
377
375
|
end
|
378
376
|
else
|
379
377
|
out << opt
|
380
378
|
end
|
381
379
|
end
|
382
380
|
from = :"gem:#{flag == :'user-install' ? 'install' : flag}"
|
383
|
-
|
381
|
+
case flag
|
382
|
+
when :outdated
|
384
383
|
log.info cmd.to_s
|
385
384
|
on :first, from
|
386
385
|
print_item format_banner(cmd.to_s)
|
387
|
-
pwd_set(pass:
|
386
|
+
pwd_set(pass: !pwd.nil?, from: from) do
|
388
387
|
items = [[%w[Gem Current Latest], nil]]
|
389
388
|
IO.popen(cmd.done).each do |line|
|
390
389
|
if (data = line.match(/^(\S+) \((\S+) < ([^)]+)\)$/))
|
@@ -456,41 +455,61 @@ module Squared
|
|
456
455
|
end
|
457
456
|
end
|
458
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(' ')
|
459
472
|
else
|
460
|
-
if out.empty? &&
|
473
|
+
if out.empty? && cmd.none? { |val| val =~ /^--system(?:=|$)/ }
|
461
474
|
raise_error('gem', flag, hint: 'no gemname given')
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
end
|
476
|
-
cmd << shell_option('version', version)
|
477
|
-
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]
|
478
488
|
end
|
489
|
+
cmd << shell_option('version', version)
|
490
|
+
out.clear
|
479
491
|
end
|
480
|
-
append_value out
|
481
492
|
end
|
482
|
-
|
493
|
+
append_value(out, escape: true)
|
483
494
|
end
|
495
|
+
run_rb(from: from)
|
484
496
|
end
|
485
497
|
|
486
|
-
def bundle(
|
498
|
+
def bundle(flag, *args)
|
487
499
|
args = args.flatten
|
488
|
-
|
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}")
|
489
508
|
end
|
490
509
|
|
491
510
|
def rake(*cmd)
|
492
511
|
if cmd.empty?
|
493
|
-
run_s(rake_output(rakeapp), from: :rake, chdir: workspace.pwd
|
512
|
+
run_s(rake_output(rakeapp), from: :rake, chdir: workspace.pwd)
|
494
513
|
else
|
495
514
|
cmd = cmd.flatten.map { |val| rake_output(rakeapp, val) }
|
496
515
|
run_s(cmd, from: :rake, chdir: workspace.pwd, banner: false)
|
@@ -511,34 +530,43 @@ module Squared
|
|
511
530
|
end
|
512
531
|
return false unless @autodetect
|
513
532
|
|
514
|
-
set = lambda do |val|
|
533
|
+
set = lambda do |val, path|
|
515
534
|
log.warn "using version #{val} (given #{@version})" if @version && @version != val
|
516
535
|
@version = val
|
536
|
+
@gemdir = Pathname.new(path.strip).join(gempath)
|
517
537
|
end
|
518
538
|
if @version
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
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
|
528
551
|
end
|
529
552
|
end
|
530
553
|
end
|
531
|
-
unless
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
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)
|
537
561
|
end
|
538
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
|
539
568
|
end
|
540
|
-
raise_error('failed to parse', hint: @version || 'path') unless
|
541
|
-
@gemdir = Pathname.new(data[1].strip).join(gempath)
|
569
|
+
raise_error('failed to parse', hint: @version || 'path') unless @gemdir
|
542
570
|
rescue StandardError => e
|
543
571
|
log.error e
|
544
572
|
@version = nil
|
@@ -558,30 +586,9 @@ module Squared
|
|
558
586
|
run(banner: !@session.include?('--quiet'), **kwargs)
|
559
587
|
end
|
560
588
|
|
561
|
-
def append_bundle(opts, list, target: @session
|
562
|
-
|
563
|
-
out
|
564
|
-
opts.each do |opt|
|
565
|
-
if opt =~ pat
|
566
|
-
case $1
|
567
|
-
when 'path', 'gemfile', 'binstubs', 'target-rbconfig'
|
568
|
-
target << quote_option($1, basepath($2))
|
569
|
-
when 'standalone', 'with', 'without', 'g', 'group'
|
570
|
-
target << quote_option($1, $2)
|
571
|
-
when 'retry', 'j', 'jobs'
|
572
|
-
target << basic_option($1, $2) if $2.to_i > 0
|
573
|
-
else
|
574
|
-
target << shell_option($1, $2)
|
575
|
-
end
|
576
|
-
else
|
577
|
-
out << opt
|
578
|
-
end
|
579
|
-
end
|
580
|
-
if append
|
581
|
-
append_value(out, target: target, escape: true)
|
582
|
-
else
|
583
|
-
option_clear(out, target: target)
|
584
|
-
end
|
589
|
+
def append_bundle(opts, list, target: @session)
|
590
|
+
out = option_sanitize(opts, list, target: target).first
|
591
|
+
option_clear(out, target: target)
|
585
592
|
end
|
586
593
|
|
587
594
|
def gem_session(*cmd, **kwargs)
|
@@ -616,12 +623,12 @@ module Squared
|
|
616
623
|
return @rakelist if @rakelist
|
617
624
|
|
618
625
|
ret = []
|
619
|
-
|
620
|
-
pwd_set(pass:
|
621
|
-
IO.popen(rake_output(
|
622
|
-
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 ((?:[^\[: ]+:?)+)(\[[^\]]+\])?/
|
623
630
|
|
624
|
-
ret << [
|
631
|
+
ret << [$1, $2]
|
625
632
|
end
|
626
633
|
end
|
627
634
|
@rakelist = ret
|
@@ -636,26 +643,29 @@ module Squared
|
|
636
643
|
end
|
637
644
|
|
638
645
|
def rakefile
|
639
|
-
file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? }
|
640
|
-
|
646
|
+
return unless (file = Rake::Application::DEFAULT_RAKEFILES.find { |val| basepath(val).exist? })
|
647
|
+
|
648
|
+
basepath(file)
|
641
649
|
end
|
642
650
|
|
643
651
|
def rakeapp
|
644
|
-
quote_option '
|
652
|
+
quote_option 'rakefile', Rake.application.rakefile
|
645
653
|
end
|
646
654
|
|
647
|
-
def
|
648
|
-
|
655
|
+
def rakepwd
|
656
|
+
return unless Rake::VERSION >= '13.0.4'
|
657
|
+
|
658
|
+
quote_option('C', path)
|
649
659
|
end
|
650
660
|
|
651
|
-
def
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
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}")
|
659
669
|
end
|
660
670
|
end
|
661
671
|
|
@@ -3,6 +3,8 @@
|
|
3
3
|
module Squared
|
4
4
|
module Workspace
|
5
5
|
module Repo
|
6
|
+
include Common::Format
|
7
|
+
|
6
8
|
class << self
|
7
9
|
def read_manifest(path)
|
8
10
|
require 'rexml/document'
|
@@ -15,7 +17,8 @@ module Squared
|
|
15
17
|
|
16
18
|
attr_reader :manifest_url, :manifest
|
17
19
|
|
18
|
-
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)
|
19
22
|
@home = if (val = env('REPO_HOME'))
|
20
23
|
path = Pathname.new(val)
|
21
24
|
if main == path.basename.to_s
|
@@ -72,6 +75,7 @@ module Squared
|
|
72
75
|
else
|
73
76
|
data[:script] = script
|
74
77
|
end
|
78
|
+
data[:args] = (val = env('REPO_SCRIPT')) ? shell_split(val, join: true) : args
|
75
79
|
elsif (val = env('REPO_BUILD'))
|
76
80
|
data[:run] = val
|
77
81
|
data[:env] = true
|
@@ -79,8 +83,8 @@ module Squared
|
|
79
83
|
data[:run] = run
|
80
84
|
end
|
81
85
|
data[:global] = true
|
82
|
-
data[:dev] = env_match('REPO_DEV', dev
|
83
|
-
data[:prod] = env_match('REPO_PROD', prod
|
86
|
+
data[:dev] = env_match('REPO_DEV', dev)
|
87
|
+
data[:prod] = env_match('REPO_PROD', prod)
|
84
88
|
if (val = env('REPO_GROUP'))
|
85
89
|
script_set(data, group: val.split(','))
|
86
90
|
found = true
|
@@ -90,11 +94,12 @@ module Squared
|
|
90
94
|
found = true
|
91
95
|
end
|
92
96
|
script_set(data, group: group, ref: ref) unless found
|
93
|
-
@warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo'])
|
97
|
+
@warning = env_match('REPO_WARN', @warning && !root?(@root, pass: ['.repo'])) != false
|
94
98
|
@extensions << :__repo__
|
95
99
|
elsif script || run
|
96
100
|
if script
|
97
101
|
data[:script] = script
|
102
|
+
data[:args] = args
|
98
103
|
else
|
99
104
|
data[:run] = run
|
100
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
|