squared 0.6.3 → 0.6.5
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 +48 -0
- data/README.md +3 -3
- data/lib/squared/common/format.rb +7 -4
- data/lib/squared/common/shell.rb +1 -0
- data/lib/squared/config.rb +2 -4
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +4 -4
- data/lib/squared/workspace/project/base.rb +155 -83
- data/lib/squared/workspace/project/docker.rb +18 -24
- data/lib/squared/workspace/project/git.rb +25 -31
- data/lib/squared/workspace/project/node.rb +94 -77
- data/lib/squared/workspace/project/python.rb +91 -48
- data/lib/squared/workspace/project/ruby.rb +155 -58
- data/lib/squared/workspace/project/support/class.rb +12 -8
- data/lib/squared/workspace/project/support/optionpartition.rb +1 -1
- data/lib/squared/workspace/repo.rb +23 -5
- data/lib/squared/workspace/series.rb +17 -6
- data/lib/squared/workspace.rb +5 -3
- metadata +2 -2
|
@@ -21,7 +21,21 @@ 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
|
-
rbs: %w[I=pm r=bm no-stdlib no-collection collection=p log-level=b log-output=p repo=p].freeze
|
|
24
|
+
rbs: %w[I=pm r=bm no-stdlib no-collection collection=p log-level=b log-output=p repo=p].freeze,
|
|
25
|
+
rubocop: %w[D P r=bm auto-gen-config a|autocorrect A|autocorrect-all d|debug disable-pending-cops
|
|
26
|
+
display-only-correctable display-only-fail-level-offenses display-only-failed
|
|
27
|
+
display-only-safe-correctable S|display-style-guide display-time editor-mode enable-pending-cops
|
|
28
|
+
E|extra-details F|fail-fast force-default-config force-exclusion x|fix-layout
|
|
29
|
+
ignore-disable-comments ignore-parent-exclusion ignore-unrecognized-cops init l|lint
|
|
30
|
+
L|list-target-files lsp memory no-detach only-guide-cops only-recognized-file-types
|
|
31
|
+
no-exclude-limit profile raise-cop-error regenerate-todo restart-server safe server-status
|
|
32
|
+
start-server stderr stop-server C|cache=b cache-root=p config=p exclude-limit=i fail-level=b
|
|
33
|
+
f|format=b except=q only=q o|out=p plugin=p require=p show-cops=q show-docs-url=q
|
|
34
|
+
s|stdin=p].freeze,
|
|
35
|
+
no: {
|
|
36
|
+
rubocop: %w[auto-gen-enforced-style auto-gen-only-exclude auto-gen-timestamp color display-cop-names
|
|
37
|
+
offense-counts parallel server].freeze
|
|
38
|
+
}
|
|
25
39
|
}.freeze
|
|
26
40
|
OPT_BUNDLE = {
|
|
27
41
|
common: %w[no-color V|verbose r|retry=i].freeze,
|
|
@@ -126,6 +140,7 @@ module Squared
|
|
|
126
140
|
rake: %w[I libdir r require].freeze,
|
|
127
141
|
irb: %w[I r].freeze,
|
|
128
142
|
rbs: %w[I r repo].freeze,
|
|
143
|
+
rubocop: %w[format plugin r require].freeze,
|
|
129
144
|
gem: {
|
|
130
145
|
contents: %w[s spec-dir].freeze,
|
|
131
146
|
dependency: %w[s source].freeze,
|
|
@@ -157,16 +172,18 @@ module Squared
|
|
|
157
172
|
end
|
|
158
173
|
|
|
159
174
|
subtasks({
|
|
160
|
-
'outdated' => %i[
|
|
175
|
+
'outdated' => %i[major minor patch].freeze,
|
|
161
176
|
'ruby' => %i[file script version].freeze,
|
|
162
177
|
'gem' => %i[install uninstall outdated update pristine build push exec command].freeze,
|
|
163
178
|
'bundle' => %i[install update cache exec config reinstall command].freeze,
|
|
164
|
-
'rbs' => nil,
|
|
165
179
|
'rake' => nil,
|
|
166
|
-
'irb' => nil
|
|
180
|
+
'irb' => nil,
|
|
181
|
+
'rbs' => nil,
|
|
182
|
+
'rubocop' => nil
|
|
167
183
|
})
|
|
168
184
|
|
|
169
|
-
def initialize(*, autodetect: false, gemspec: nil, steep: 'Steepfile', asdf: 'ruby',
|
|
185
|
+
def initialize(*, autodetect: false, gemspec: nil, steep: 'Steepfile', rubocop: '.rubocop.yml', asdf: 'ruby',
|
|
186
|
+
**kwargs)
|
|
170
187
|
super
|
|
171
188
|
if @pass.include?(Ruby.ref)
|
|
172
189
|
initialize_ref Ruby.ref
|
|
@@ -182,7 +199,8 @@ module Squared
|
|
|
182
199
|
elsif gemspec
|
|
183
200
|
basepath(gemspec.include?('.') ? gemspec : "#{gemspec}.gemspec")
|
|
184
201
|
end
|
|
185
|
-
@steepfile = basepath
|
|
202
|
+
@steepfile = basepath! steep
|
|
203
|
+
@rubocopfile = basepath!(rubocop) || basepath!(Dir.home, '.rubocop.yml')
|
|
186
204
|
return unless rakefile && @output[0].nil? && @copy.nil? && !version && !@autodetect
|
|
187
205
|
|
|
188
206
|
begin
|
|
@@ -300,7 +318,7 @@ module Squared
|
|
|
300
318
|
args.each do |val|
|
|
301
319
|
if val.include?('*')
|
|
302
320
|
files.concat(Dir.glob(val, base: path))
|
|
303
|
-
elsif !(file = basepath(val))
|
|
321
|
+
elsif !(file = basepath!(val))
|
|
304
322
|
print_error(val, hint: 'not found')
|
|
305
323
|
elsif file.directory?
|
|
306
324
|
files.concat(file.glob('**/*.rb'))
|
|
@@ -328,20 +346,38 @@ module Squared
|
|
|
328
346
|
end
|
|
329
347
|
end
|
|
330
348
|
end
|
|
349
|
+
when 'rubocop'
|
|
350
|
+
next unless @rubocopfile
|
|
351
|
+
|
|
352
|
+
format_desc action, nil, 'opts*,path*/:'
|
|
353
|
+
task action do |_, args|
|
|
354
|
+
opts, args = args.to_a.partition do |val|
|
|
355
|
+
next true if val.match?(/\A(?:(?:[A-Z]|[a-z-]+)=.|[a-z]+(?:-[a-z]+)*\Z)/)
|
|
356
|
+
|
|
357
|
+
!val.include?('*') && !val.end_with?('/')
|
|
358
|
+
end
|
|
359
|
+
if opts.delete(':') || !args.empty?
|
|
360
|
+
args << 'lib/' if args.empty?
|
|
361
|
+
list = args.map { |val| val.end_with?('/') ? "#{val}**/*.rb" : val }
|
|
362
|
+
.flat_map { |val| Dir.glob(val, base: path) }
|
|
363
|
+
args = choice_index('Select files', list, multiple: true)
|
|
364
|
+
end
|
|
365
|
+
rubocop(*args, opts: opts, banner: true)
|
|
366
|
+
end
|
|
331
367
|
end
|
|
332
368
|
else
|
|
333
369
|
namespace action do
|
|
334
370
|
flags.each do |flag|
|
|
335
371
|
case action
|
|
336
372
|
when 'outdated'
|
|
337
|
-
format_desc action, flag, 's
|
|
373
|
+
format_desc action, flag, "#{shortname('i', 's', 'u', 'd')},opts*"
|
|
338
374
|
task flag do |_, args|
|
|
339
|
-
|
|
375
|
+
outdated flag, args.to_a
|
|
340
376
|
end
|
|
341
377
|
when 'gem'
|
|
342
378
|
case flag
|
|
343
379
|
when :outdated
|
|
344
|
-
format_desc action, flag,
|
|
380
|
+
format_desc action, flag, "semver?=major|minor|patch,#{shortname('i', 's', 'u', 'd')},opts*"
|
|
345
381
|
task flag, [:semver] do |_, args|
|
|
346
382
|
opts = case (semver = args.semver)
|
|
347
383
|
when 'major', 'minor', 'patch'
|
|
@@ -354,13 +390,14 @@ module Squared
|
|
|
354
390
|
semver: semver,
|
|
355
391
|
update: has_value!(opts, 'u', 'update'),
|
|
356
392
|
interactive: has_value!(opts, 'i', 'interactive'),
|
|
357
|
-
select: has_value!(opts, 's', 'select')
|
|
393
|
+
select: has_value!(opts, 's', 'select'),
|
|
394
|
+
dryrun: has_value!(opts, 'd', 'dry-run')
|
|
358
395
|
})
|
|
359
396
|
end
|
|
360
397
|
when :build, :push, :exec, :update
|
|
361
398
|
format_desc(action, flag, 'opts*', after: case flag
|
|
362
399
|
when :exec then 'command,args*'
|
|
363
|
-
when :push then 'file
|
|
400
|
+
when :push then 'file/:'
|
|
364
401
|
when :update then 'name*'
|
|
365
402
|
end)
|
|
366
403
|
task flag do |_, args|
|
|
@@ -399,7 +436,7 @@ module Squared
|
|
|
399
436
|
task flag do |_, args|
|
|
400
437
|
opts = args.to_a
|
|
401
438
|
opts << 'redownload' if has_value!(opts, 'f', 'force')
|
|
402
|
-
if (lock = basepath('Gemfile.lock'))
|
|
439
|
+
if (lock = basepath!('Gemfile.lock'))
|
|
403
440
|
config = basepath '.bundle', 'config'
|
|
404
441
|
if config.exist? && config.read.match?(/\bBUNDLE_FROZEN:\s+"true"/)
|
|
405
442
|
if opts.include?('redownload')
|
|
@@ -476,9 +513,7 @@ module Squared
|
|
|
476
513
|
cmd << '--without=development'
|
|
477
514
|
end
|
|
478
515
|
end
|
|
479
|
-
|
|
480
|
-
cmd << "-j#{n}"
|
|
481
|
-
end
|
|
516
|
+
option('jobs') { |n| cmd << "-j#{n}" if n.to_i > 0 }
|
|
482
517
|
run_rb(from: :depend, sync: sync)
|
|
483
518
|
end
|
|
484
519
|
end
|
|
@@ -517,34 +552,52 @@ module Squared
|
|
|
517
552
|
def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
|
|
518
553
|
cmd = bundle_output 'outdated'
|
|
519
554
|
if flag
|
|
520
|
-
se = has_value!(opts, 's', 'select')
|
|
555
|
+
se = has_value!(opts, 's', 'select')
|
|
556
|
+
ia = has_value!(opts, 'i', 'interactive') && !se
|
|
521
557
|
up = has_value!(opts, 'u', 'update')
|
|
522
|
-
|
|
523
|
-
|
|
558
|
+
dryrun = has_value!(opts, 'd', 'dry-run')
|
|
559
|
+
if !sync || stdin?
|
|
560
|
+
se = false
|
|
561
|
+
ia = false
|
|
562
|
+
elsif se || ia || up
|
|
563
|
+
items = []
|
|
564
|
+
end
|
|
565
|
+
OptionPartition.new(opts, bundleopts(:outdated), cmd << "--#{flag}", project: self)
|
|
524
566
|
.clear
|
|
567
|
+
elsif (up = option('u', 'update'))
|
|
568
|
+
flag = case up
|
|
569
|
+
when 'major', 'minor'
|
|
570
|
+
up.to_sym
|
|
571
|
+
else
|
|
572
|
+
:patch
|
|
573
|
+
end
|
|
574
|
+
items = []
|
|
525
575
|
end
|
|
576
|
+
dryrun ||= dryrun?(prefix: 'bundle')
|
|
526
577
|
log.info cmd.to_s
|
|
527
578
|
on :first, :outdated
|
|
528
579
|
banner = format_banner cmd.to_s
|
|
529
|
-
|
|
530
|
-
print_item banner
|
|
531
|
-
[] if flag && (se || up)
|
|
532
|
-
end
|
|
580
|
+
print_item banner if sync
|
|
533
581
|
pwd_set(from: :outdated) do
|
|
534
582
|
tc = theme[:current]
|
|
535
583
|
start = 0
|
|
536
584
|
found = 0
|
|
537
585
|
major = 0
|
|
586
|
+
col = 0
|
|
538
587
|
buffer = []
|
|
539
588
|
out = ->(val) { sync ? puts(val) : buffer << val }
|
|
540
589
|
IO.popen(cmd.temp('--no-color')).each do |line|
|
|
590
|
+
line.chomp!
|
|
541
591
|
if start > 0
|
|
592
|
+
n = line.size
|
|
542
593
|
unless stdin?
|
|
594
|
+
line = line[0...col] if col > 0
|
|
543
595
|
data = line.scan(SEM_VER)
|
|
544
596
|
next unless (cur = data.shift) && (lat = data.shift)
|
|
545
597
|
|
|
546
598
|
semver cur
|
|
547
599
|
semver lat
|
|
600
|
+
type = semtype cur, lat
|
|
548
601
|
c = cur.join
|
|
549
602
|
l = lat.join
|
|
550
603
|
styles = []
|
|
@@ -552,9 +605,9 @@ module Squared
|
|
|
552
605
|
styles = %i[green bold]
|
|
553
606
|
major += 1
|
|
554
607
|
end
|
|
555
|
-
mi = -> { styles[0] =
|
|
608
|
+
mi = -> { styles[0] = type == 2 ? :yellow : :green }
|
|
556
609
|
if data.empty?
|
|
557
|
-
|
|
610
|
+
type == 1 ? ma.call : mi.call
|
|
558
611
|
else
|
|
559
612
|
data.each do |val|
|
|
560
613
|
break unless line =~ /(>=?|=|~>|!=|<=?) (#{Regexp.escape(val.join)})/
|
|
@@ -562,10 +615,10 @@ module Squared
|
|
|
562
615
|
v = semver(val).join
|
|
563
616
|
case $1
|
|
564
617
|
when '>', '>='
|
|
565
|
-
|
|
618
|
+
type == 1 ? ma.call : mi.call
|
|
566
619
|
when '<', '<='
|
|
567
620
|
if c <= v
|
|
568
|
-
if
|
|
621
|
+
if type == 1
|
|
569
622
|
ma.call
|
|
570
623
|
else
|
|
571
624
|
styles[0] = :yellow
|
|
@@ -597,17 +650,28 @@ module Squared
|
|
|
597
650
|
when :yellow
|
|
598
651
|
found += 1
|
|
599
652
|
end
|
|
600
|
-
l = Regexp.escape(l)
|
|
601
653
|
sub_style!(line, **opt_style(tc, /^(.+)(#{Regexp.escape(c)})(.+)$/, 2)) if tc
|
|
602
|
-
sub_style!(line, **opt_style(colormap(styles), /^((?:\S+\s+){2})(#{l})(.*)$/, 2))
|
|
654
|
+
sub_style!(line, **opt_style(colormap(styles), /^((?:\S+\s+){2})(#{Regexp.escape(l)})(.*)$/, 2))
|
|
655
|
+
end
|
|
656
|
+
end
|
|
657
|
+
s = '%2d. %s' % [start, line]
|
|
658
|
+
if ia
|
|
659
|
+
unless confirm_semver(s.ljust(col + 4 + line.size - n), type)
|
|
660
|
+
start += 1
|
|
661
|
+
next
|
|
603
662
|
end
|
|
663
|
+
elsif !se
|
|
664
|
+
out.call(s)
|
|
604
665
|
end
|
|
605
666
|
items&.push([line, name])
|
|
606
|
-
out.call('%2d. %s' % [start, line]) unless se
|
|
607
667
|
elsif line.start_with?('Gem')
|
|
608
668
|
unless stdin?
|
|
669
|
+
if ia
|
|
670
|
+
line.sub!(/\sGroups$/, '')
|
|
671
|
+
col = line.size
|
|
672
|
+
end
|
|
609
673
|
sub = [opt_style(theme[:header], /^(.+)(?<!\dm)(Gem|Latest)(.+)$/, 2)] * 2
|
|
610
|
-
out.call(print_footer(" # #{line
|
|
674
|
+
out.call(print_footer(" # #{line}", reverse: true, sub: sub))
|
|
611
675
|
end
|
|
612
676
|
else
|
|
613
677
|
next
|
|
@@ -619,26 +683,35 @@ module Squared
|
|
|
619
683
|
puts buffer
|
|
620
684
|
end
|
|
621
685
|
if found > 0
|
|
622
|
-
|
|
686
|
+
unless Array(items).empty?
|
|
623
687
|
gems = if se
|
|
624
688
|
choice('Select a package', items.map(&:first),
|
|
625
689
|
multiple: true, force: false, index: true, border: true).map! { |n| items[n.pred].last }
|
|
626
690
|
else
|
|
627
691
|
items.map(&:last)
|
|
628
692
|
end
|
|
629
|
-
|
|
693
|
+
if dryrun
|
|
694
|
+
print_run bundle_output("update --#{flag}", *gems.quote!), false
|
|
695
|
+
else
|
|
696
|
+
bundle(:update, *gems, opts: [flag.to_s])
|
|
697
|
+
end
|
|
630
698
|
end
|
|
631
699
|
begin
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
700
|
+
status = nil
|
|
701
|
+
if gems
|
|
702
|
+
status = "#{gems.size} packages were updated"
|
|
703
|
+
else
|
|
704
|
+
File.foreach(dependfile) do |line|
|
|
705
|
+
next unless line =~ /\b(?:source\s+(["'])((?~\1))\1|remote:\s+(\S+))/
|
|
706
|
+
|
|
707
|
+
status = ($2 || $3).chomp('/')
|
|
708
|
+
break
|
|
709
|
+
end
|
|
635
710
|
end
|
|
636
711
|
rescue StandardError => e
|
|
637
712
|
log.debug e
|
|
638
|
-
ensure
|
|
639
|
-
status ||= (items ? 'Updates were made' : 'Updates are available')
|
|
640
713
|
end
|
|
641
|
-
puts print_footer(
|
|
714
|
+
puts print_footer(status || 'Updates are available', right: status.include?('/'))
|
|
642
715
|
elsif start == 0 && banner
|
|
643
716
|
puts 'No updates were found'
|
|
644
717
|
end
|
|
@@ -832,11 +905,7 @@ module Squared
|
|
|
832
905
|
if line =~ /^(\S+) \((\S+) < ([^)]+)\)$/
|
|
833
906
|
cur = semscan $2
|
|
834
907
|
lat = semscan $3
|
|
835
|
-
rows << [$~.to_a.drop(1),
|
|
836
|
-
1
|
|
837
|
-
else
|
|
838
|
-
cur[2] == lat[2] ? 3 : 2
|
|
839
|
-
end]
|
|
908
|
+
rows << [$~.to_a.drop(1), semtype(cur, lat)]
|
|
840
909
|
else
|
|
841
910
|
out.call(line)
|
|
842
911
|
end
|
|
@@ -847,7 +916,6 @@ module Squared
|
|
|
847
916
|
e = 0
|
|
848
917
|
f = 0
|
|
849
918
|
j = 0
|
|
850
|
-
col4 = 0
|
|
851
919
|
queue = nil
|
|
852
920
|
rows.each do |row|
|
|
853
921
|
a, b, c = row.first
|
|
@@ -859,10 +927,10 @@ module Squared
|
|
|
859
927
|
next if i == 0 && stdin?
|
|
860
928
|
|
|
861
929
|
a, b, c = row.first
|
|
930
|
+
type = row.last
|
|
862
931
|
if i == 0
|
|
863
932
|
line = '%-*s %-*s %*s %*s' % [pad, ' #', d, a, e, b, f, c]
|
|
864
|
-
|
|
865
|
-
s = ARG[:BORDER][1] * col4
|
|
933
|
+
s = ARG[:BORDER][1] * line.size
|
|
866
934
|
queue = if stdin?
|
|
867
935
|
[line, s]
|
|
868
936
|
else
|
|
@@ -876,7 +944,7 @@ module Squared
|
|
|
876
944
|
pat = [/^([^.]+\.)([^.]+\..+)$/, /^([^.]+\.[^.]+\.)(.+)$/]
|
|
877
945
|
pre = b.start_with?('0.')
|
|
878
946
|
latest = [theme[:latest]]
|
|
879
|
-
case
|
|
947
|
+
case type
|
|
880
948
|
when 1
|
|
881
949
|
case semver
|
|
882
950
|
when 'major'
|
|
@@ -926,13 +994,18 @@ module Squared
|
|
|
926
994
|
out.call(queue)
|
|
927
995
|
queue = nil
|
|
928
996
|
end
|
|
929
|
-
s = '%s %s %s' % [g, b, h]
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
997
|
+
s = ('%s %s %s' % [g, b, h]).yield_self do |val|
|
|
998
|
+
items&.push([val, a])
|
|
999
|
+
'%*s %s' % [pad, "#{j}.", val]
|
|
1000
|
+
end
|
|
1001
|
+
if ia
|
|
1002
|
+
unless confirm_semver(s, type)
|
|
1003
|
+
update.delete(a)
|
|
1004
|
+
next
|
|
1005
|
+
end
|
|
1006
|
+
elsif !items
|
|
1007
|
+
out.call(s)
|
|
934
1008
|
end
|
|
935
|
-
update.delete(a) if ia && !confirm_outdated(a, c, row.last, col4: col4, timeout: 0)
|
|
936
1009
|
end
|
|
937
1010
|
end
|
|
938
1011
|
end
|
|
@@ -948,7 +1021,7 @@ module Squared
|
|
|
948
1021
|
update = choice('Select a package', items.map(&:first),
|
|
949
1022
|
multiple: true, force: false, index: true, border: true).map! { |n| items[n.pred].last }
|
|
950
1023
|
end
|
|
951
|
-
|
|
1024
|
+
unless Array(update).empty?
|
|
952
1025
|
cmd = gem_output 'update -f'
|
|
953
1026
|
option('document', prefix: 'gem', ignore: false) do |val|
|
|
954
1027
|
cmd << case val
|
|
@@ -966,8 +1039,12 @@ module Squared
|
|
|
966
1039
|
'--user-install'
|
|
967
1040
|
end
|
|
968
1041
|
end
|
|
969
|
-
cmd.merge(update)
|
|
970
|
-
|
|
1042
|
+
cmd.merge(update.quote!)
|
|
1043
|
+
if filter[:dryrun]
|
|
1044
|
+
print_run cmd, false
|
|
1045
|
+
else
|
|
1046
|
+
run(cmd, sync: sync, banner: false, from: :'gem:update')
|
|
1047
|
+
end
|
|
971
1048
|
end
|
|
972
1049
|
print_status(*major, from: :outdated)
|
|
973
1050
|
end
|
|
@@ -1289,6 +1366,26 @@ module Squared
|
|
|
1289
1366
|
end
|
|
1290
1367
|
end
|
|
1291
1368
|
|
|
1369
|
+
def rubocop(*args, sync: true, banner: verbose?, with: nil, pass: PASS_RUBY[:rubocop], **kwargs)
|
|
1370
|
+
opts = session_opts(with, args: args, kwargs: kwargs, pass: pass)
|
|
1371
|
+
op = OptionPartition.new(opts, OPT_RUBY[:rubocop], session('rubocop'), project: self,
|
|
1372
|
+
no: OPT_RUBY[:no][:rubocop])
|
|
1373
|
+
op.concat(args)
|
|
1374
|
+
op.each do |val|
|
|
1375
|
+
if basepath(val).file?
|
|
1376
|
+
op.found << val
|
|
1377
|
+
else
|
|
1378
|
+
op.errors << val
|
|
1379
|
+
end
|
|
1380
|
+
end
|
|
1381
|
+
op.swap
|
|
1382
|
+
.map! { |val| basepath(val).relative_path_from(path) }
|
|
1383
|
+
op.append(delim: true)
|
|
1384
|
+
.clear(errors: true)
|
|
1385
|
+
print_run(op, banner, **kwargs)
|
|
1386
|
+
run(sync: sync, banner: banner, from: :rubocop)
|
|
1387
|
+
end
|
|
1388
|
+
|
|
1292
1389
|
def gemspec
|
|
1293
1390
|
return @gemspec || nil unless @gemspec.nil?
|
|
1294
1391
|
|
|
@@ -1381,7 +1478,7 @@ module Squared
|
|
|
1381
1478
|
end
|
|
1382
1479
|
|
|
1383
1480
|
def outdated?
|
|
1384
|
-
dependtype > 0
|
|
1481
|
+
dependtype > 0 && !task_pass?('outdated')
|
|
1385
1482
|
end
|
|
1386
1483
|
|
|
1387
1484
|
private
|
|
@@ -49,7 +49,7 @@ module Squared
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def compact
|
|
52
|
-
to_ary
|
|
52
|
+
dump to_ary
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def last(val, pat)
|
|
@@ -79,7 +79,7 @@ module Squared
|
|
|
79
79
|
end
|
|
80
80
|
ret[items.last] = val
|
|
81
81
|
end
|
|
82
|
-
ret.concat(extras
|
|
82
|
+
ret.concat(dump(extras)) unless extras.empty?
|
|
83
83
|
return ret unless block_given?
|
|
84
84
|
|
|
85
85
|
ret.reject(&blk)
|
|
@@ -116,12 +116,12 @@ module Squared
|
|
|
116
116
|
self
|
|
117
117
|
elsif (n = enum.find_index { |val| extras?(val) })
|
|
118
118
|
data = enum.to_a
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
extras.concat(if n == 0
|
|
120
|
+
data
|
|
121
|
+
else
|
|
122
|
+
super(data[0...n])
|
|
123
|
+
data[n..-1]
|
|
124
|
+
end)
|
|
125
125
|
self
|
|
126
126
|
else
|
|
127
127
|
super
|
|
@@ -164,6 +164,10 @@ module Squared
|
|
|
164
164
|
|
|
165
165
|
private
|
|
166
166
|
|
|
167
|
+
def dump(enum)
|
|
168
|
+
enum.map(&:to_s).reject(&:empty?)
|
|
169
|
+
end
|
|
170
|
+
|
|
167
171
|
def extras?(obj)
|
|
168
172
|
obj == @partition || (include?(obj) && (!@uniq.match?(s = obj.to_s) || multiple.include?(s)))
|
|
169
173
|
end
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
module Squared
|
|
4
4
|
module Workspace
|
|
5
5
|
module Repo
|
|
6
|
+
REPO_URL = 'https://storage.googleapis.com/git-repo-downloads/repo'
|
|
7
|
+
private_constant :REPO_URL
|
|
8
|
+
|
|
6
9
|
attr_reader :manifest_url, :manifest
|
|
7
10
|
|
|
8
|
-
def repo(url, manifest = 'latest', run: nil, script: nil, args: nil, dev: nil, prod: nil,
|
|
11
|
+
def repo(url, manifest = 'latest', install: nil, run: nil, script: nil, args: nil, dev: nil, prod: nil,
|
|
9
12
|
ref: @ref, group: @group)
|
|
10
13
|
@home = if (val = env('REPO_HOME'))
|
|
11
14
|
path = Pathname.new(val)
|
|
@@ -101,6 +104,7 @@ module Squared
|
|
|
101
104
|
data[:prod] = prod
|
|
102
105
|
script_set(data, group: group, ref: ref)
|
|
103
106
|
end
|
|
107
|
+
@repo_bin = install.is_a?(String) ? @root + install : @root if install
|
|
104
108
|
self
|
|
105
109
|
end
|
|
106
110
|
|
|
@@ -154,7 +158,7 @@ module Squared
|
|
|
154
158
|
desc.call("init[manifest?=#{target},groups?,{0}]", target)
|
|
155
159
|
task 'init' do |_, args|
|
|
156
160
|
args = args.to_a
|
|
157
|
-
u = env('
|
|
161
|
+
u = env('REPO_GIT') || manifest_url
|
|
158
162
|
m = args.first && !opts.include?(args.first) ? args.shift : target
|
|
159
163
|
g = (args.shift if args.first && !opts.include?(args.first))
|
|
160
164
|
g = case (val = env('REPO_GROUPS'))
|
|
@@ -247,12 +251,26 @@ module Squared
|
|
|
247
251
|
end
|
|
248
252
|
|
|
249
253
|
def repo_run(cmd, exception: false)
|
|
250
|
-
puts log_message(
|
|
254
|
+
puts log_message(cmd, subject: main, hint: root) if verbose
|
|
251
255
|
Common::System.shell(cmd, chdir: root, exception: exception)
|
|
252
256
|
end
|
|
253
257
|
|
|
254
258
|
def repo_bin
|
|
255
|
-
Common::Shell.shell_bin('repo')
|
|
259
|
+
return Common::Shell.shell_bin('repo') unless @repo_bin
|
|
260
|
+
|
|
261
|
+
@repo_bin.join('repo').tap do |bin|
|
|
262
|
+
next if bin.file?
|
|
263
|
+
|
|
264
|
+
require 'open-uri'
|
|
265
|
+
puts log_message('Installing repo...', subject: main, hint: @repo_bin) if verbose
|
|
266
|
+
URI.open(REPO_URL) do |url|
|
|
267
|
+
@repo_bin.mkpath
|
|
268
|
+
File.open(bin, 'wb') do |f|
|
|
269
|
+
f.write(url.read)
|
|
270
|
+
f.chmod(0o755)
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
end
|
|
256
274
|
end
|
|
257
275
|
|
|
258
276
|
def repo_opts(*args)
|
|
@@ -262,7 +280,7 @@ module Squared
|
|
|
262
280
|
end
|
|
263
281
|
|
|
264
282
|
def repo?
|
|
265
|
-
return false unless manifest_url
|
|
283
|
+
return false unless manifest_url && !windows?
|
|
266
284
|
|
|
267
285
|
repo_install? || @repo_override == true
|
|
268
286
|
end
|
|
@@ -11,10 +11,11 @@ module Squared
|
|
|
11
11
|
TASK_BASE = []
|
|
12
12
|
TASK_BATCH = {}
|
|
13
13
|
TASK_EXTEND = Support.hashlist
|
|
14
|
+
TASK_METHODS = {}
|
|
14
15
|
TASK_KEYS = []
|
|
15
16
|
TASK_ALIAS = Support.hashobj
|
|
16
17
|
TASK_NAME = {}
|
|
17
|
-
private_constant :TASK_BASE, :TASK_BATCH, :TASK_EXTEND, :TASK_KEYS, :TASK_ALIAS, :TASK_NAME
|
|
18
|
+
private_constant :TASK_BASE, :TASK_BATCH, :TASK_EXTEND, :TASK_METHODS, :TASK_KEYS, :TASK_ALIAS, :TASK_NAME
|
|
18
19
|
|
|
19
20
|
class << self
|
|
20
21
|
def add(task, obj)
|
|
@@ -52,6 +53,11 @@ module Squared
|
|
|
52
53
|
TASK_BASE.concat(obj.tasks.reject { |val| TASK_KEYS.include?(val) })
|
|
53
54
|
end
|
|
54
55
|
|
|
56
|
+
def extend_set(obj)
|
|
57
|
+
obj.tasks&.each { |task| add(task, obj) }
|
|
58
|
+
TASK_METHODS[obj] = obj.instance_methods(false)
|
|
59
|
+
end
|
|
60
|
+
|
|
55
61
|
private
|
|
56
62
|
|
|
57
63
|
def key_set(val)
|
|
@@ -64,7 +70,8 @@ module Squared
|
|
|
64
70
|
|
|
65
71
|
attr_reader :sync, :multiple, :parallel
|
|
66
72
|
|
|
67
|
-
def_delegators :@data, :[], :each, :each_key, :keys, :key?, :fetch, :update, :merge!, :
|
|
73
|
+
def_delegators :@data, :[], :each, :each_key, :keys, :key?, :include?, :fetch, :update, :merge!, :any?, :none?,
|
|
74
|
+
:delete, :delete_if, :find, :find_all, :to_a, :to_s, :inspect
|
|
68
75
|
def_delegators :@workspace, :task_desc, :task_name, :task_namespace, :task_join, :format_desc
|
|
69
76
|
|
|
70
77
|
def initialize(workspace, exclude: [])
|
|
@@ -184,12 +191,14 @@ module Squared
|
|
|
184
191
|
end
|
|
185
192
|
|
|
186
193
|
def extend?(obj, key)
|
|
187
|
-
return false unless (items = TASK_EXTEND[key])
|
|
194
|
+
return false unless (items = TASK_EXTEND[key])
|
|
188
195
|
|
|
189
|
-
meth = :"#{key}?"
|
|
190
196
|
ret = false
|
|
191
197
|
items.each do |kind|
|
|
192
|
-
|
|
198
|
+
next unless obj.is_a?(kind)
|
|
199
|
+
|
|
200
|
+
meth = :"#{key}?"
|
|
201
|
+
if TASK_METHODS[kind].include?(meth)
|
|
193
202
|
out = obj.__send__(meth)
|
|
194
203
|
return true if out == 1
|
|
195
204
|
return out if obj.ref?(kind.ref)
|
|
@@ -201,7 +210,9 @@ module Squared
|
|
|
201
210
|
end
|
|
202
211
|
|
|
203
212
|
def batch?(obj, key)
|
|
204
|
-
(data = batch_get(key))
|
|
213
|
+
return false unless (data = batch_get(key))
|
|
214
|
+
|
|
215
|
+
data.keys.any? { |ref| obj.ref?(ref) }
|
|
205
216
|
end
|
|
206
217
|
|
|
207
218
|
def chain?(val)
|
data/lib/squared/workspace.rb
CHANGED
|
@@ -5,12 +5,14 @@ module Squared
|
|
|
5
5
|
class << self
|
|
6
6
|
include Common
|
|
7
7
|
|
|
8
|
-
def resolve(*args)
|
|
9
|
-
|
|
8
|
+
def resolve(*args, base: '..')
|
|
9
|
+
values = __get__(:project).values
|
|
10
|
+
ret = args.map do |id|
|
|
10
11
|
if id.is_a?(Symbol)
|
|
11
12
|
project id
|
|
12
13
|
else
|
|
13
|
-
|
|
14
|
+
values.find { |proj| proj.name == id } || values.find { |proj| proj.project == id } ||
|
|
15
|
+
values.find { |proj| proj.path.to_s == File.expand_path(id, base) }
|
|
14
16
|
end
|
|
15
17
|
end
|
|
16
18
|
ret.size == 1 ? ret.first : ret
|
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.6.
|
|
4
|
+
version: 0.6.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- An Pham
|
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
125
|
version: '0'
|
|
126
126
|
requirements: []
|
|
127
|
-
rubygems_version: 3.
|
|
127
|
+
rubygems_version: 3.6.9
|
|
128
128
|
specification_version: 4
|
|
129
129
|
summary: Rake task generator for managing multi-language workspaces.
|
|
130
130
|
test_files: []
|