squared 0.5.0 → 0.5.1
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 +81 -0
- data/README.ruby.md +1 -1
- data/lib/squared/common/base.rb +5 -2
- data/lib/squared/common/format.rb +8 -2
- data/lib/squared/common/prompt.rb +10 -2
- data/lib/squared/common/system.rb +21 -14
- data/lib/squared/common/utils.rb +7 -3
- data/lib/squared/config.rb +7 -6
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +21 -13
- data/lib/squared/workspace/project/base.rb +89 -56
- data/lib/squared/workspace/project/docker.rb +15 -13
- data/lib/squared/workspace/project/git.rb +73 -46
- data/lib/squared/workspace/project/node.rb +40 -44
- data/lib/squared/workspace/project/python.rb +244 -46
- data/lib/squared/workspace/project/ruby.rb +124 -104
- data/lib/squared/workspace/project/support/class.rb +38 -2
- data/lib/squared/workspace/repo.rb +3 -2
- data/lib/squared/workspace/support/data.rb +3 -3
- metadata +1 -1
@@ -99,7 +99,7 @@ module Squared
|
|
99
99
|
last: last,
|
100
100
|
error: error
|
101
101
|
}
|
102
|
-
@envname = @name
|
102
|
+
@envname = env_key(@name).freeze
|
103
103
|
@desc = (@name.include?(':') ? @name.split(':').join(ARG[:SPACE]) : @name).freeze
|
104
104
|
@parent = nil
|
105
105
|
@global = false
|
@@ -205,7 +205,7 @@ module Squared
|
|
205
205
|
file &&= @workspace.home.join(env('LOG_DIR', ''), file).realdirpath
|
206
206
|
rescue StandardError => e
|
207
207
|
file = nil
|
208
|
-
warn log_message(Logger::WARN, e
|
208
|
+
warn log_message(Logger::WARN, e) if warning?
|
209
209
|
end
|
210
210
|
log[:progname] ||= @name
|
211
211
|
if (val = env('LOG_LEVEL', ignore: false))
|
@@ -250,14 +250,14 @@ module Squared
|
|
250
250
|
return 1 if a.include?(other)
|
251
251
|
|
252
252
|
c, d = graph_deps other
|
253
|
-
e = b
|
254
|
-
f = d
|
253
|
+
e = b - d
|
254
|
+
f = d - b
|
255
255
|
if parent == other.parent
|
256
256
|
g = []
|
257
257
|
h = []
|
258
258
|
else
|
259
|
-
g = a
|
260
|
-
h = c
|
259
|
+
g = a - c
|
260
|
+
h = c - a
|
261
261
|
end
|
262
262
|
g << self
|
263
263
|
h << other
|
@@ -411,7 +411,7 @@ module Squared
|
|
411
411
|
|
412
412
|
out = obj.link(self, *args, **kwargs, &blk) if obj.respond_to?(:link)
|
413
413
|
if !out
|
414
|
-
warn log_message(Logger::WARN, 'link not compatible', subject: obj.to_s, hint: name
|
414
|
+
warn log_message(Logger::WARN, 'link not compatible', subject: obj.to_s, hint: name)
|
415
415
|
elsif out.respond_to?(:build)
|
416
416
|
out.build
|
417
417
|
end
|
@@ -466,9 +466,9 @@ module Squared
|
|
466
466
|
case opts
|
467
467
|
when Hash
|
468
468
|
opts = append_hash(opts, build: true)
|
469
|
-
cmd =
|
469
|
+
cmd = Array(cmd).append(flags).concat(opts).compact.join(' ')
|
470
470
|
when Enumerable
|
471
|
-
cmd =
|
471
|
+
cmd = Array(cmd).concat(opts.to_a)
|
472
472
|
cmd.map! { |val| "#{val} #{flags}" } if flags
|
473
473
|
cmd = cmd.join(' && ')
|
474
474
|
else
|
@@ -498,15 +498,13 @@ module Squared
|
|
498
498
|
begin
|
499
499
|
proj.__send__(meth, sync: sync)
|
500
500
|
rescue StandardError => e
|
501
|
-
ret = on
|
501
|
+
ret = on :error, :prereqs, e
|
502
502
|
raise unless ret == true
|
503
503
|
else
|
504
504
|
next
|
505
505
|
end
|
506
506
|
end
|
507
|
-
|
508
|
-
warn log_message(Logger::WARN, name, 'method not found', subject: 'prereqs', hint: meth, pass: true)
|
509
|
-
end
|
507
|
+
warn log_message(Logger::WARN, name, 'method not found', subject: 'prereqs', hint: meth)
|
510
508
|
end
|
511
509
|
elsif proj.build?
|
512
510
|
proj.build(sync: sync)
|
@@ -557,7 +555,7 @@ module Squared
|
|
557
555
|
@clean.each { |cmd, opts| build(cmd.to_s, opts, sync: sync) }
|
558
556
|
rescue StandardError => e
|
559
557
|
log&.error e
|
560
|
-
ret = on
|
558
|
+
ret = on :error, from, e
|
561
559
|
raise if exception && ret != true
|
562
560
|
end
|
563
561
|
else
|
@@ -607,7 +605,7 @@ module Squared
|
|
607
605
|
end
|
608
606
|
ret = graph_branch(self, data, tasks, out, sync: sync, pass: pass)
|
609
607
|
rescue StandardError => e
|
610
|
-
ret = on
|
608
|
+
ret = on :error, :graph, e
|
611
609
|
raise unless ret == true
|
612
610
|
else
|
613
611
|
if out
|
@@ -651,7 +649,7 @@ module Squared
|
|
651
649
|
headers = headers.is_a?(Hash) ? headers.merge(val) : val
|
652
650
|
end
|
653
651
|
data = nil
|
654
|
-
(uri =
|
652
|
+
(uri = Array(uri)).each_with_index do |url, index|
|
655
653
|
URI.open(url, headers) do |f|
|
656
654
|
data = f.read
|
657
655
|
if algo && algo.hexdigest(data) != digest
|
@@ -689,7 +687,7 @@ module Squared
|
|
689
687
|
file.write(data)
|
690
688
|
file.close
|
691
689
|
if create
|
692
|
-
warn log_message(Logger::WARN, 'force remove', subject: name, hint: target
|
690
|
+
warn log_message(Logger::WARN, 'force remove', subject: name, hint: target)
|
693
691
|
target.rmtree
|
694
692
|
target.mkpath
|
695
693
|
end
|
@@ -809,6 +807,8 @@ module Squared
|
|
809
807
|
exclude_set val
|
810
808
|
when :parent
|
811
809
|
parent_set val
|
810
|
+
when :archive
|
811
|
+
archive_set val
|
812
812
|
when :run
|
813
813
|
run_set(*args, **kwargs)
|
814
814
|
when :script
|
@@ -963,16 +963,28 @@ module Squared
|
|
963
963
|
puts_oe(*args, pipe: pipe)
|
964
964
|
end
|
965
965
|
|
966
|
-
def run(cmd = @session, var = nil, exception: @exception, sync: true, from: nil, banner: true, chdir: path,
|
966
|
+
def run(cmd = @session, var = nil, exception: @exception, sync: true, from: nil, banner: true, chdir: path,
|
967
|
+
interactive: nil, **)
|
967
968
|
unless cmd
|
968
|
-
|
969
|
-
|
970
|
-
warn log_message(Logger::WARN, from || 'unknown', subject: project, hint: 'no command given', pass: true)
|
971
|
-
end
|
972
|
-
return
|
969
|
+
from = from&.to_s || 'unknown'
|
970
|
+
return warn log_message(Logger::WARN, 'no command given', subject: project, hint: from, pass: true)
|
973
971
|
end
|
972
|
+
i = interactive && !(@session && option('y'))
|
974
973
|
cmd = cmd.target if cmd.is_a?(OptionPartition)
|
975
974
|
cmd = session_done cmd
|
975
|
+
if i
|
976
|
+
title, y = case interactive
|
977
|
+
when Array
|
978
|
+
interactive
|
979
|
+
when String
|
980
|
+
[interactive, 'N']
|
981
|
+
else
|
982
|
+
['Run', 'Y']
|
983
|
+
end
|
984
|
+
unless confirm("#{title}? [#{sub_style(cmd, styles: theme[:inline])}]", y)
|
985
|
+
raise_error('user cancelled', hint: from)
|
986
|
+
end
|
987
|
+
end
|
976
988
|
log&.info cmd
|
977
989
|
on :first, from
|
978
990
|
begin
|
@@ -996,7 +1008,7 @@ module Squared
|
|
996
1008
|
end
|
997
1009
|
rescue StandardError => e
|
998
1010
|
log&.error e
|
999
|
-
ret = on
|
1011
|
+
ret = on :error, from, e
|
1000
1012
|
raise unless ret == true
|
1001
1013
|
|
1002
1014
|
false
|
@@ -1011,7 +1023,7 @@ module Squared
|
|
1011
1023
|
begin
|
1012
1024
|
cmd.flatten.each { |val| run(val, env, sync: sync, banner: banner, **kwargs) }
|
1013
1025
|
rescue StandardError => e
|
1014
|
-
ret = on
|
1026
|
+
ret = on :error, from, e
|
1015
1027
|
raise unless ret == true
|
1016
1028
|
end
|
1017
1029
|
on :last, from
|
@@ -1033,7 +1045,7 @@ module Squared
|
|
1033
1045
|
elsif obj.is_a?(Array) && obj.any? { |val| !val.is_a?(String) }
|
1034
1046
|
build(*obj, **kwargs)
|
1035
1047
|
elsif obj
|
1036
|
-
run_s(obj
|
1048
|
+
run_s(*Array(obj), **kwargs)
|
1037
1049
|
end
|
1038
1050
|
end
|
1039
1051
|
end
|
@@ -1080,7 +1092,7 @@ module Squared
|
|
1080
1092
|
|
1081
1093
|
t = dedupe.call(proj.name)
|
1082
1094
|
j = if out
|
1083
|
-
if i == items.size - 1 || check.call(post = items[i + 1..-1]).empty?
|
1095
|
+
if i == items.size - 1 || check.call(post = items[(i + 1)..-1]).empty?
|
1084
1096
|
true
|
1085
1097
|
elsif !t.empty? && depth > 0
|
1086
1098
|
post.reject { |pr| t.include?(pr) }.empty?
|
@@ -1092,9 +1104,9 @@ module Squared
|
|
1092
1104
|
end
|
1093
1105
|
if !out
|
1094
1106
|
if !tasks && (script = workspace.script_get(:graph, group: proj.group, ref: proj.allref))
|
1095
|
-
|
1107
|
+
tasks = script[:graph]
|
1096
1108
|
end
|
1097
|
-
(tasks ||
|
1109
|
+
(tasks || (dev? ? ['build', 'copy'] : ['depend', 'build'])).each do |meth|
|
1098
1110
|
next if pass.include?(meth)
|
1099
1111
|
|
1100
1112
|
if workspace.task_defined?(cmd = task_join(proj.name, meth))
|
@@ -1105,7 +1117,7 @@ module Squared
|
|
1105
1117
|
end
|
1106
1118
|
run(cmd, sync: false, banner: false)
|
1107
1119
|
ENV.delete(key) if key
|
1108
|
-
elsif proj.has?(meth, tasks
|
1120
|
+
elsif proj.has?(meth, tasks ? nil : workspace.baseref)
|
1109
1121
|
proj.__send__(meth.to_sym, sync: sync)
|
1110
1122
|
end
|
1111
1123
|
end
|
@@ -1142,7 +1154,6 @@ module Squared
|
|
1142
1154
|
else
|
1143
1155
|
items = workspace.find(group: val, ref: val.to_sym)
|
1144
1156
|
end
|
1145
|
-
|
1146
1157
|
items.each do |proj|
|
1147
1158
|
next if pass.include?(proj.name)
|
1148
1159
|
|
@@ -1187,7 +1198,7 @@ module Squared
|
|
1187
1198
|
end
|
1188
1199
|
return ret == equals.to_s unless equals.nil?
|
1189
1200
|
|
1190
|
-
ret.empty? || (ignore &&
|
1201
|
+
ret.empty? || (ignore && Array(ignore).any? { |val| ret == val.to_s }) ? default : ret
|
1191
1202
|
end
|
1192
1203
|
|
1193
1204
|
def session(*cmd, prefix: cmd.first, main: true, path: true, options: true)
|
@@ -1235,10 +1246,9 @@ module Squared
|
|
1235
1246
|
def option(*args, target: @session, prefix: target&.first, **kwargs)
|
1236
1247
|
if prefix
|
1237
1248
|
args.each do |val|
|
1238
|
-
next unless (ret = env(
|
1239
|
-
return ret unless block_given?
|
1249
|
+
next unless (ret = env(env_key(stripext(prefix), val), **kwargs))
|
1240
1250
|
|
1241
|
-
return yield ret
|
1251
|
+
return block_given? ? yield(ret) : ret
|
1242
1252
|
end
|
1243
1253
|
end
|
1244
1254
|
nil
|
@@ -1296,6 +1306,18 @@ module Squared
|
|
1296
1306
|
ret.join("\n")
|
1297
1307
|
end
|
1298
1308
|
|
1309
|
+
def print_status(*args, from: nil)
|
1310
|
+
return if stdin?
|
1311
|
+
|
1312
|
+
case from
|
1313
|
+
when :outdated
|
1314
|
+
out = print_footer("major #{args[0]} / minor #{args[1]} / patch #{args[2]}", right: true).split("\n")
|
1315
|
+
out[1] = sub_style(out[1], pat: /^( +major )(\d+)(.+)$/, styles: theme[:major], index: 2)
|
1316
|
+
out[1] = sub_style(out[1], pat: /^(.+)(minor )(\d+)(.+)$/, styles: theme[:active], index: 3)
|
1317
|
+
puts out
|
1318
|
+
end
|
1319
|
+
end
|
1320
|
+
|
1299
1321
|
def format_desc(action, flag, opts = nil, **kwargs)
|
1300
1322
|
return unless TASK_METADATA
|
1301
1323
|
|
@@ -1310,7 +1332,7 @@ module Squared
|
|
1310
1332
|
|
1311
1333
|
client = true
|
1312
1334
|
else
|
1313
|
-
data =
|
1335
|
+
data = Struct::BannerData.new(true, [:path], theme[:banner], theme[:border])
|
1314
1336
|
end
|
1315
1337
|
if verbose
|
1316
1338
|
out = []
|
@@ -1356,7 +1378,7 @@ module Squared
|
|
1356
1378
|
items.each_with_index do |val, i|
|
1357
1379
|
next unless reg.empty? || reg.any? { |pat| val[0].match?(pat) }
|
1358
1380
|
|
1359
|
-
out <<
|
1381
|
+
out << ('%*d. %s' % [pad, i.succ, each ? each.call(val) : val[0]])
|
1360
1382
|
end
|
1361
1383
|
end
|
1362
1384
|
sub = [headerstyle]
|
@@ -1368,7 +1390,7 @@ module Squared
|
|
1368
1390
|
out << ''
|
1369
1391
|
end
|
1370
1392
|
if from
|
1371
|
-
out << from
|
1393
|
+
out << (from = from.to_s)
|
1372
1394
|
pat = /\A(#{Regexp.escape(from)})(.*)\z/
|
1373
1395
|
end
|
1374
1396
|
else
|
@@ -1539,7 +1561,7 @@ module Squared
|
|
1539
1561
|
raise_error("invalid JSON #{kind.name}", val, hint: hint) if kind && !ret.is_a?(kind)
|
1540
1562
|
rescue StandardError => e
|
1541
1563
|
log&.warn e
|
1542
|
-
warn log_message(Logger::WARN, e, subject: name
|
1564
|
+
warn log_message(Logger::WARN, e, subject: name) if warning?
|
1543
1565
|
else
|
1544
1566
|
ret
|
1545
1567
|
end
|
@@ -1568,9 +1590,9 @@ module Squared
|
|
1568
1590
|
'PATCH'
|
1569
1591
|
end, styles: (rev == 1 && theme[:major]) || theme[:header])
|
1570
1592
|
b = sub_style(pkg.ljust(col1), styles: theme[:inline])
|
1571
|
-
c
|
1572
|
-
|
1573
|
-
confirm "#{a}: #{b}#{
|
1593
|
+
c = lock ? sub_style((cur || 'locked').rjust(7), styles: color(:red)) : cur&.rjust(7)
|
1594
|
+
d = rev == 1 || lock ? 'N' : 'Y'
|
1595
|
+
confirm "#{a}: #{b}#{c} #{sub_style(ver.rjust(col1 > 0 ? 10 : 0), styles: theme[:inline])} ", d
|
1574
1596
|
end
|
1575
1597
|
|
1576
1598
|
def choice_index(msg, list, values: nil, accept: nil, series: false, trim: nil, column: nil,
|
@@ -1587,25 +1609,27 @@ module Squared
|
|
1587
1609
|
end
|
1588
1610
|
ret = multiple ? ret.map! { |val| val.sub(trim, '') } : ret.sub(trim, '') if trim
|
1589
1611
|
if column
|
1590
|
-
a, b =
|
1591
|
-
ret =
|
1612
|
+
a, b = Array(column)
|
1613
|
+
ret = Array(ret).map! { |val| val[a, b || 1] }
|
1592
1614
|
ret = ret.first unless multiple
|
1593
1615
|
end
|
1594
1616
|
if accept
|
1595
|
-
|
1596
|
-
accept =
|
1617
|
+
hint = Array(ret).map { |val| sub_style(val, styles: theme[:inline]) }.join(', ')
|
1618
|
+
accept = Array(accept).map { |val| Array(val) }
|
1597
1619
|
if accept.any? { |val| val[1] == true }
|
1598
1620
|
ret = [ret]
|
1599
1621
|
multiple = -1
|
1600
1622
|
end
|
1601
1623
|
loop do
|
1602
|
-
|
1603
|
-
|
1624
|
+
item = accept.first
|
1625
|
+
c = confirm("#{item[0]}#{a ? " [#{hint}]" : ''}", item[2] ? 'Y' : 'N', timeout: 60)
|
1626
|
+
if item[1] == true
|
1604
1627
|
ret << c
|
1605
1628
|
elsif !c
|
1606
1629
|
break
|
1607
1630
|
end
|
1608
|
-
|
1631
|
+
hint = nil
|
1632
|
+
accept.shift
|
1609
1633
|
break if accept.empty?
|
1610
1634
|
end
|
1611
1635
|
exit 1 unless accept.empty?
|
@@ -1636,7 +1660,7 @@ module Squared
|
|
1636
1660
|
if (ret = instance_eval(&blk)).nil?
|
1637
1661
|
val
|
1638
1662
|
else
|
1639
|
-
ret
|
1663
|
+
Array(ret)
|
1640
1664
|
end
|
1641
1665
|
end
|
1642
1666
|
|
@@ -1689,19 +1713,24 @@ module Squared
|
|
1689
1713
|
end
|
1690
1714
|
|
1691
1715
|
def indexitem(val)
|
1692
|
-
[$1.to_i, $2 && $2[1..-1]] if val =~ /\A
|
1716
|
+
[$1.to_i, $2 && $2[1..-1]] if val =~ /\A[=^#{indexchar}](\d+)(:.+)?\z/
|
1693
1717
|
end
|
1694
1718
|
|
1695
1719
|
def indexerror(val, list = nil)
|
1696
1720
|
raise_error("requested index #{val}", hint: list && "of #{list.size}")
|
1697
1721
|
end
|
1698
1722
|
|
1723
|
+
def indexchar
|
1724
|
+
workspace.windows? ? '=' : '^'
|
1725
|
+
end
|
1726
|
+
|
1699
1727
|
def printsucc
|
1700
1728
|
@@print_order += 1
|
1701
1729
|
end
|
1702
1730
|
|
1703
1731
|
def color(val)
|
1704
|
-
|
1732
|
+
ret = theme[val]
|
1733
|
+
ret && !ret.empty? ? ret : [val]
|
1705
1734
|
end
|
1706
1735
|
|
1707
1736
|
def colormap(val)
|
@@ -1744,8 +1773,9 @@ module Squared
|
|
1744
1773
|
end
|
1745
1774
|
|
1746
1775
|
def pwd_set(pass: false, from: nil)
|
1776
|
+
pass = semscan(pass).join <= RUBY_VERSION if pass.is_a?(String)
|
1747
1777
|
pwd = Dir.pwd
|
1748
|
-
if path.to_s == pwd || pass == true
|
1778
|
+
if (path.to_s == pwd || pass == true) && !workspace.jruby_win?
|
1749
1779
|
ret = yield
|
1750
1780
|
else
|
1751
1781
|
Dir.chdir(path)
|
@@ -1753,9 +1783,8 @@ module Squared
|
|
1753
1783
|
Dir.chdir(pwd)
|
1754
1784
|
end
|
1755
1785
|
rescue StandardError => e
|
1756
|
-
puts e
|
1757
1786
|
log&.error e
|
1758
|
-
ret = on
|
1787
|
+
ret = on :error, from, e
|
1759
1788
|
raise if exception && ret != true
|
1760
1789
|
else
|
1761
1790
|
ret
|
@@ -1852,7 +1881,7 @@ module Squared
|
|
1852
1881
|
|
1853
1882
|
def graph_set(val)
|
1854
1883
|
@graph = if val
|
1855
|
-
|
1884
|
+
Array(val).map { |s| workspace.prefix ? workspace.task_name(s).to_sym : s.to_sym }.freeze
|
1856
1885
|
end
|
1857
1886
|
end
|
1858
1887
|
|
@@ -1982,6 +2011,10 @@ module Squared
|
|
1982
2011
|
ARG[:BANNER] && !env('BANNER', equals: '0')
|
1983
2012
|
end
|
1984
2013
|
|
2014
|
+
def pwd?
|
2015
|
+
path == Pathname.pwd
|
2016
|
+
end
|
2017
|
+
|
1985
2018
|
def stdin?
|
1986
2019
|
pipe == 0
|
1987
2020
|
end
|
@@ -21,7 +21,8 @@ module Squared
|
|
21
21
|
compose: {
|
22
22
|
common: %w[all-resources compatibility dry-run ansi|b env-file=p f|file=p parallel=b profile=b progress=b
|
23
23
|
project-directory=p p|project-name=e].freeze,
|
24
|
-
build: %w[no-cache pull push with-dependencies q|quiet build-arg=qq builder=b m|memory=b
|
24
|
+
build: %w[check no-cache pull push with-dependencies q|quiet build-arg=qq builder=b m|memory=b
|
25
|
+
ssh=qq].freeze,
|
25
26
|
exec: %w[dry-run privileged d|detach e|env=qq index=i T|no-TTY=b? user=e w|workdir=q].freeze,
|
26
27
|
run: %w[build dry-run no-deps quiet-pull remove-orphans rm P|service-ports use-aliases cap-add=b cap-drop=b
|
27
28
|
d|detach entrypoint=q e|env=qq i|interactive=b? l|label=q name=b T|no-TTY=b? p|publish=e pull=b
|
@@ -160,7 +161,7 @@ module Squared
|
|
160
161
|
compose! flag, args.to_a
|
161
162
|
end
|
162
163
|
when :exec, :run
|
163
|
-
format_desc action, flag, "service,command#{flag == :exec ? '' : '?'}
|
164
|
+
format_desc action, flag, "service,command#{flag == :exec ? '' : '?'}|:,args*,opts*"
|
164
165
|
task flag, [:service] do |_, args|
|
165
166
|
service = param_guard(action, flag, args: args, key: :service)
|
166
167
|
compose!(flag, args.extras, service: service)
|
@@ -278,12 +279,12 @@ module Squared
|
|
278
279
|
ret << quote_option('secret', @secrets, double: true)
|
279
280
|
when Hash
|
280
281
|
append = lambda do |type|
|
281
|
-
|
282
|
+
Array(@secrets[type]).each { |arg| ret << quote_option('secret', "type=#{type},#{arg}", double: true) }
|
282
283
|
end
|
283
284
|
append.call(:file)
|
284
285
|
append.call(:env)
|
285
286
|
else
|
286
|
-
|
287
|
+
Array(@secrets).each { |arg| ret << quote_option('secret', arg) }
|
287
288
|
end
|
288
289
|
if (val = option('tag', ignore: false))
|
289
290
|
append_tag val
|
@@ -311,7 +312,7 @@ module Squared
|
|
311
312
|
when :bake
|
312
313
|
unless op.empty?
|
313
314
|
args = op.dup
|
314
|
-
op.
|
315
|
+
op.reset
|
315
316
|
if Dir.exist?(args.last)
|
316
317
|
if projectpath?(val = args.pop)
|
317
318
|
context = val
|
@@ -358,7 +359,7 @@ module Squared
|
|
358
359
|
both = run[:bind] + run[:tmpfs]
|
359
360
|
diff = run[:bind].reject { |val| run[:tmpfs].include?(val) }
|
360
361
|
delim = Regexp.new(",\\s*(?=#{both.join('|')})")
|
361
|
-
|
362
|
+
Array(@mounts).each do |val|
|
362
363
|
args = []
|
363
364
|
tmpfs = true
|
364
365
|
val.split(delim).each do |opt|
|
@@ -564,7 +565,9 @@ module Squared
|
|
564
565
|
end
|
565
566
|
|
566
567
|
def append_command(flag, val, list, target: @session, from: nil)
|
567
|
-
if (
|
568
|
+
if list.delete(':')
|
569
|
+
list << readline('Enter command [args]', force: true)
|
570
|
+
elsif (args = env('DOCKER_ARGS'))
|
568
571
|
list << args
|
569
572
|
end
|
570
573
|
case flag
|
@@ -587,7 +590,7 @@ module Squared
|
|
587
590
|
def append_file(type, target: @session)
|
588
591
|
return unless type == 2 || type == 4 || @file.is_a?(Array)
|
589
592
|
|
590
|
-
files =
|
593
|
+
files = Array(@file).map { |val| quote_option('file', path + val) }
|
591
594
|
if target.is_a?(Set)
|
592
595
|
target.merge(files)
|
593
596
|
else
|
@@ -646,7 +649,6 @@ module Squared
|
|
646
649
|
cc = bb.size + 1
|
647
650
|
a = sub_style(ee, styles: theme[:inline])
|
648
651
|
b = "Execute #{sub_style(flag, styles: theme[:active])} on #{a}#{ee == id ? '' : " (#{id})"}"
|
649
|
-
c, d = no ? ['y/N', 'N'] : ['Y/n', 'Y']
|
650
652
|
e = time_format(time_since(data['CreatedAt']), pass: ['ms'])
|
651
653
|
f = sub_style(ARG[:BORDER][0], styles: theme[:inline])
|
652
654
|
g = ' ' * (cc + 1)
|
@@ -663,13 +665,13 @@ module Squared
|
|
663
665
|
cols.each do |key|
|
664
666
|
next if (key == 'Tag' && !dd) || (key == 'Size' && data[key] == '0B')
|
665
667
|
|
666
|
-
puts "#{g + f} #{key}: #{
|
668
|
+
puts "#{g + f} #{key}: #{Array(data[key]).join(', ')}" unless data[key].to_s.empty?
|
667
669
|
end
|
668
670
|
w = 9 + flag.to_s.size + 4 + ee.size
|
669
671
|
puts g + sub_style(ARG[:BORDER][6] + (ARG[:BORDER][1] * w), styles: theme[:inline])
|
670
672
|
found = true
|
671
673
|
index += 1
|
672
|
-
next unless confirm("#{h + b}?
|
674
|
+
next unless confirm("#{h + b}?", no ? 'N' : 'Y', timeout: 60)
|
673
675
|
|
674
676
|
puts if printfirst?
|
675
677
|
end
|
@@ -679,7 +681,7 @@ module Squared
|
|
679
681
|
end
|
680
682
|
rescue StandardError => e
|
681
683
|
log.error e
|
682
|
-
ret = on
|
684
|
+
ret = on :error, from, e
|
683
685
|
raise if exception && ret != true
|
684
686
|
|
685
687
|
warn log_message(Logger::WARN, e, pass: true) if warning?
|
@@ -698,7 +700,7 @@ module Squared
|
|
698
700
|
a = t.last.capitalize
|
699
701
|
b = sub_style(target, styles: theme[:subject])
|
700
702
|
c = as && sub_style(as, styles: theme[:inline])
|
701
|
-
confirm("#{a} #{b}#{c ? " as #{c}" : ''}?
|
703
|
+
confirm("#{a} #{b}#{c ? " as #{c}" : ''}?", 'N', timeout: 60)
|
702
704
|
end
|
703
705
|
|
704
706
|
def choice_command(flag)
|