squared 0.7.9 → 0.8.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 +44 -53
- data/README.md +38 -35
- data/lib/squared/common/base.rb +0 -1
- data/lib/squared/common/format.rb +5 -14
- data/lib/squared/common/prompt.rb +25 -24
- data/lib/squared/common/shell.rb +11 -11
- data/lib/squared/common/system.rb +9 -19
- data/lib/squared/common/utils.rb +18 -22
- data/lib/squared/config.rb +3 -11
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +99 -31
- data/lib/squared/workspace/project/base.rb +78 -81
- data/lib/squared/workspace/project/docker.rb +42 -41
- data/lib/squared/workspace/project/git.rb +164 -72
- data/lib/squared/workspace/project/node.rb +163 -121
- data/lib/squared/workspace/project/python.rb +26 -28
- data/lib/squared/workspace/project/ruby.rb +47 -41
- data/lib/squared/workspace/project/support/class.rb +2 -2
- data/lib/squared/workspace/project/support/optionpartition.rb +7 -10
- data/lib/squared/workspace/project/support/utils.rb +15 -22
- data/lib/squared/workspace/repo.rb +7 -5
- data/lib/squared/workspace/series.rb +10 -2
- metadata +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
-
require 'logger'
|
|
5
4
|
|
|
6
5
|
require_relative 'support/class'
|
|
7
6
|
require_relative 'support/utils'
|
|
@@ -10,6 +9,7 @@ module Squared
|
|
|
10
9
|
module Workspace
|
|
11
10
|
module Project
|
|
12
11
|
class Base
|
|
12
|
+
include Enumerable
|
|
13
13
|
include Comparable
|
|
14
14
|
include Common::Format
|
|
15
15
|
include System
|
|
@@ -343,7 +343,7 @@ module Squared
|
|
|
343
343
|
tag ||= if @release
|
|
344
344
|
"%s.#{ext}" % [@release.include?('??') ? @release.sub('??', tag) : @release + tag]
|
|
345
345
|
else
|
|
346
|
-
|
|
346
|
+
raise ArgumentError, message('no base uri', tag, hint: ext)
|
|
347
347
|
end
|
|
348
348
|
end
|
|
349
349
|
force = case (digest = args.digest)
|
|
@@ -471,10 +471,10 @@ module Squared
|
|
|
471
471
|
cmd = args.each_with_object([]) do |val, out|
|
|
472
472
|
case val.first
|
|
473
473
|
when Proc
|
|
474
|
-
instance_exec(*val
|
|
474
|
+
instance_exec(*val.drop(1), &val.first)
|
|
475
475
|
next
|
|
476
476
|
when Method
|
|
477
|
-
val.first.call(*val
|
|
477
|
+
val.first.call(*val.drop(1))
|
|
478
478
|
next
|
|
479
479
|
end
|
|
480
480
|
a, b, c, d, e = val
|
|
@@ -542,7 +542,7 @@ module Squared
|
|
|
542
542
|
on_error(e, exception: true)
|
|
543
543
|
end
|
|
544
544
|
else
|
|
545
|
-
print_error('prereqs',
|
|
545
|
+
print_error('prereqs', 'method', meth, subject: name, hint: 'undefined')
|
|
546
546
|
end
|
|
547
547
|
end
|
|
548
548
|
elsif proj.build?
|
|
@@ -582,10 +582,10 @@ module Squared
|
|
|
582
582
|
case @clean
|
|
583
583
|
when Struct
|
|
584
584
|
if (val = instance_eval(&@clean.block) || @clean.run)
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
585
|
+
cur = @clean
|
|
586
|
+
@clean = val
|
|
587
|
+
clean(*args, sync: sync, pass: true, **kwargs)
|
|
588
|
+
@clean = cur
|
|
589
589
|
end
|
|
590
590
|
when String
|
|
591
591
|
run_s(@clean, sync: sync)
|
|
@@ -661,9 +661,10 @@ module Squared
|
|
|
661
661
|
if !target.exist?
|
|
662
662
|
target.mkpath
|
|
663
663
|
elsif !target.directory?
|
|
664
|
-
|
|
664
|
+
raise Errno::EEXIST, message(target, hint: uri)
|
|
665
665
|
elsif !file && !target.empty?
|
|
666
|
-
|
|
666
|
+
raise Errno::EEXIST, message(target, hint: uri) unless force || env('UNPACK_FORCE')
|
|
667
|
+
|
|
667
668
|
create = true
|
|
668
669
|
end
|
|
669
670
|
if digest
|
|
@@ -683,7 +684,7 @@ module Squared
|
|
|
683
684
|
when 128, 'sha512'
|
|
684
685
|
Digest::SHA512
|
|
685
686
|
else
|
|
686
|
-
|
|
687
|
+
raise message('invalid checksum', digest, hint: uri)
|
|
687
688
|
end
|
|
688
689
|
end
|
|
689
690
|
env('HEADERS') do |val|
|
|
@@ -701,14 +702,14 @@ module Squared
|
|
|
701
702
|
data = f.read
|
|
702
703
|
if algo && algo.hexdigest(data) != digest
|
|
703
704
|
data = nil
|
|
704
|
-
|
|
705
|
+
raise message('invalid checksum', digest, hint: url) if i == uri.size.pred
|
|
705
706
|
end
|
|
706
707
|
next if ext && i == 0
|
|
707
708
|
|
|
708
709
|
case f.content_type
|
|
709
710
|
when 'application/zip'
|
|
710
711
|
ext = 'zip'
|
|
711
|
-
when %r{application/(
|
|
712
|
+
when %r{application/(x-)?gzip}
|
|
712
713
|
ext = 'tgz'
|
|
713
714
|
when 'application/x-xz'
|
|
714
715
|
ext = 'txz'
|
|
@@ -719,7 +720,7 @@ module Squared
|
|
|
719
720
|
break uri = url if data
|
|
720
721
|
end
|
|
721
722
|
unless data && (ext ||= URI.decode_www_form_component(URI.parse(uri).path[/\.([\w%]+)(?:\?|\z)/, 1]))
|
|
722
|
-
|
|
723
|
+
raise(data ? TypeError : RuntimeError, message("no content#{' type' if data}", hint: uri))
|
|
723
724
|
end
|
|
724
725
|
end
|
|
725
726
|
ext = ext.downcase
|
|
@@ -748,7 +749,7 @@ module Squared
|
|
|
748
749
|
case ext
|
|
749
750
|
when 'zip', 'aar'
|
|
750
751
|
session 'unzip', shell_quote(file), quote_option('d', target)
|
|
751
|
-
when 'tar', /\A(
|
|
752
|
+
when 'tar', /\A(t|tar\.)?[gx]z\z/
|
|
752
753
|
flags = +(silent? ? '' : 'v')
|
|
753
754
|
if ext.end_with?('gz')
|
|
754
755
|
flags += 'z'
|
|
@@ -764,7 +765,7 @@ module Squared
|
|
|
764
765
|
session 'gem', 'unpack', shell_quote(file), quote_option('target', target)
|
|
765
766
|
depth = 0 unless val
|
|
766
767
|
else
|
|
767
|
-
|
|
768
|
+
raise message('unsupported format', ext, hint: uri || file)
|
|
768
769
|
end
|
|
769
770
|
run(sync: sync, banner: verbose, from: from)
|
|
770
771
|
while depth > 0 && target.children.size == 1
|
|
@@ -1018,13 +1019,13 @@ module Squared
|
|
|
1018
1019
|
|
|
1019
1020
|
alias apply variable_set
|
|
1020
1021
|
|
|
1021
|
-
def enabled?(ref
|
|
1022
|
+
def enabled?(ref: nil, **)
|
|
1022
1023
|
return false if ref && Array(ref).none? { |val| ref?(val) }
|
|
1023
1024
|
|
|
1024
1025
|
(path.directory? && !path.empty?) || archive?
|
|
1025
1026
|
end
|
|
1026
1027
|
|
|
1027
|
-
def has?(meth, ref
|
|
1028
|
+
def has?(meth, ref: nil, all: false, missing: false)
|
|
1028
1029
|
return false if ref && !ref?(ref)
|
|
1029
1030
|
|
|
1030
1031
|
pred = :"#{meth}?"
|
|
@@ -1105,8 +1106,8 @@ module Squared
|
|
|
1105
1106
|
!@exclude.empty? && has_value?(@exclude, *refs)
|
|
1106
1107
|
end
|
|
1107
1108
|
|
|
1108
|
-
def task_include?(key, ref
|
|
1109
|
-
workspace.task_include?(self, key, ref) && !@pass.include?(key.to_s)
|
|
1109
|
+
def task_include?(key, ref: nil)
|
|
1110
|
+
workspace.task_include?(self, key, ref: ref) && !@pass.include?(key.to_s)
|
|
1110
1111
|
end
|
|
1111
1112
|
|
|
1112
1113
|
def version(*)
|
|
@@ -1189,6 +1190,20 @@ module Squared
|
|
|
1189
1190
|
keys.empty? ? ret : ret.dig(*keys)
|
|
1190
1191
|
end
|
|
1191
1192
|
|
|
1193
|
+
def each(from: :run, ref: nil, accept: nil, &blk)
|
|
1194
|
+
from = from.to_s.split(':').last if from.is_a?(Symbol)
|
|
1195
|
+
items = ref ? children.select { |proj| proj.ref?(ref) } : children
|
|
1196
|
+
if items.empty?
|
|
1197
|
+
print_error("nothing to #{from}", subject: name)
|
|
1198
|
+
elsif accept && !confirm_basic("#{from.capitalize} workspace?", items.map(&:name).join(', '), accept,
|
|
1199
|
+
prefix: 'npm')
|
|
1200
|
+
items.clear
|
|
1201
|
+
end
|
|
1202
|
+
return items.to_enum unless block_given?
|
|
1203
|
+
|
|
1204
|
+
items.each(&blk)
|
|
1205
|
+
end
|
|
1206
|
+
|
|
1192
1207
|
def inspect
|
|
1193
1208
|
"#<#{self.class}: #{name} => #{self}>"
|
|
1194
1209
|
end
|
|
@@ -1389,7 +1404,7 @@ module Squared
|
|
|
1389
1404
|
elsif ws.task_defined?(val = task_join(name, meth)) || (meth.include?(':') && ws.task_defined?(val = meth))
|
|
1390
1405
|
run(val, var, sync: sync, banner: banner, **kwargs)
|
|
1391
1406
|
elsif from
|
|
1392
|
-
print_error(from,
|
|
1407
|
+
print_error(from, 'method', meth, subject: name, hint: 'undefined')
|
|
1393
1408
|
end
|
|
1394
1409
|
end
|
|
1395
1410
|
end
|
|
@@ -1422,11 +1437,7 @@ module Squared
|
|
|
1422
1437
|
when 0
|
|
1423
1438
|
f
|
|
1424
1439
|
when 1
|
|
1425
|
-
|
|
1426
|
-
"#{d}#{b * 4} #{f}"
|
|
1427
|
-
else
|
|
1428
|
-
"#{last ? d : c}#{b * 3}#{e} #{f}"
|
|
1429
|
-
end
|
|
1440
|
+
items.empty? ? "#{d}#{b * 4} #{f}" : "#{last ? d : c}#{b * 3}#{e} #{f}"
|
|
1430
1441
|
else
|
|
1431
1442
|
"#{single ? ' ' : a}#{' ' * depth.pred}#{last ? d : c}#{b * 3}#{items.empty? ? b : e} #{f}"
|
|
1432
1443
|
end
|
|
@@ -1490,7 +1501,7 @@ module Squared
|
|
|
1490
1501
|
end
|
|
1491
1502
|
run(cmd, sync: false, banner: false)
|
|
1492
1503
|
ENV.delete(key) if key
|
|
1493
|
-
elsif proj.has?(meth, tasks || graph
|
|
1504
|
+
elsif proj.has?(meth, ref: (workspace.baseref unless tasks || graph))
|
|
1494
1505
|
proj.__send__(meth, sync: sync)
|
|
1495
1506
|
end
|
|
1496
1507
|
end
|
|
@@ -1572,7 +1583,7 @@ module Squared
|
|
|
1572
1583
|
end
|
|
1573
1584
|
cache = @timeout[:_]
|
|
1574
1585
|
cache[1] ||= workspace.timeout_get(*@ref, group: group)
|
|
1575
|
-
cache[0][ret] = if cmd
|
|
1586
|
+
cache[0][ret] = if cmd.drop(1).find { |val| val =~ /\A([A-Za-z][\w-]*)(?<![-_])(?: |\z)/ }
|
|
1576
1587
|
command = :"#{prefix}_#{$1}"
|
|
1577
1588
|
cache[1][command] || @timeout[command]
|
|
1578
1589
|
end || cache[1][prefix.to_sym] || @timeout[prefix.to_sym]
|
|
@@ -1638,8 +1649,8 @@ module Squared
|
|
|
1638
1649
|
|
|
1639
1650
|
def session_done(cmd)
|
|
1640
1651
|
return cmd.to_s unless cmd.respond_to?(:done)
|
|
1652
|
+
raise message('no command added', hint: cmd.first) unless cmd.size > 1
|
|
1641
1653
|
|
|
1642
|
-
raise_error 'no command added', hint: cmd.first unless cmd.size > 1
|
|
1643
1654
|
@session = nil if cmd.equal?(@session)
|
|
1644
1655
|
cmd.done
|
|
1645
1656
|
end
|
|
@@ -1672,7 +1683,7 @@ module Squared
|
|
|
1672
1683
|
end
|
|
1673
1684
|
|
|
1674
1685
|
def write_lines(data, grep: [], prefix: nil, sub: nil, banner: nil, loglevel: nil, pass: false, first: false)
|
|
1675
|
-
grep = (matchmap(grep, prefix) unless grep.empty?)
|
|
1686
|
+
grep = (matchmap(grep, prefix: prefix) unless grep.empty?)
|
|
1676
1687
|
sub = (as_a(sub) unless stdin?)
|
|
1677
1688
|
ret = 0
|
|
1678
1689
|
lines = data.each_with_object([]) do |line, out|
|
|
@@ -1692,13 +1703,7 @@ module Squared
|
|
|
1692
1703
|
ret += 1
|
|
1693
1704
|
break out if first
|
|
1694
1705
|
end
|
|
1695
|
-
if banner && (ret > 0 || (!pass && !first))
|
|
1696
|
-
if banner.empty?
|
|
1697
|
-
print_item(*lines)
|
|
1698
|
-
else
|
|
1699
|
-
print_item(banner, *lines)
|
|
1700
|
-
end
|
|
1701
|
-
end
|
|
1706
|
+
print_item banner, lines if banner && (ret > 0 || (!pass && !first))
|
|
1702
1707
|
ret
|
|
1703
1708
|
end
|
|
1704
1709
|
|
|
@@ -1724,7 +1729,7 @@ module Squared
|
|
|
1724
1729
|
end
|
|
1725
1730
|
|
|
1726
1731
|
def print_run(cmd, banner = true, verbose: nil, **)
|
|
1727
|
-
return if banner || !stdout? || verbose == false || env('BANNER', equals:
|
|
1732
|
+
return if banner || !stdout? || verbose == false || env('BANNER', equals: '0')
|
|
1728
1733
|
|
|
1729
1734
|
puts "\n> #{cmd}"
|
|
1730
1735
|
printsucc
|
|
@@ -1733,7 +1738,7 @@ module Squared
|
|
|
1733
1738
|
def print_item(*val, series: false)
|
|
1734
1739
|
puts unless printfirst?
|
|
1735
1740
|
printsucc unless series
|
|
1736
|
-
puts val unless val.empty? || (val.size == 1 &&
|
|
1741
|
+
puts val unless val.empty? || (val.size == 1 && !val.first)
|
|
1737
1742
|
end
|
|
1738
1743
|
|
|
1739
1744
|
def print_banner(*lines, client: false, styles: theme[:banner], border: borderstyle)
|
|
@@ -1814,13 +1819,13 @@ module Squared
|
|
|
1814
1819
|
out = []
|
|
1815
1820
|
if data.command
|
|
1816
1821
|
if command
|
|
1817
|
-
if cmd =~ /\A(?:"((?:[^"]|(?<=\\)")+)"|'((?:[^']|(?<=\\)')+)'|(\S+))( |\z)/
|
|
1822
|
+
if cmd =~ /\A(?:"((?:[^"]|(?<=\\)")+)"|'((?:[^']|(?<=\\)')+)'|(\S+))(?: |\z)/
|
|
1818
1823
|
arg = $3 || $2 || $1
|
|
1819
1824
|
cmd = cmd.sub(arg, data.command == 0 ? arg.stripext : arg.stripext.upcase)
|
|
1820
1825
|
end
|
|
1821
1826
|
if strip || (strip.nil? && data.order.include?(:path))
|
|
1822
|
-
|
|
1823
|
-
|
|
1827
|
+
s = Regexp.escape(File.join(path, ''))
|
|
1828
|
+
cmd = cmd.gsub(/(#{s}?(?=["'])|#{s})/, '').gsub(/( -[^ ])? (""|'')/, '')
|
|
1824
1829
|
end
|
|
1825
1830
|
cmd = cmd.gsub(/(?<= )(["'])([\w.-]+)\1(?= |\z)/, '\2') unless quote
|
|
1826
1831
|
end
|
|
@@ -2044,11 +2049,6 @@ module Squared
|
|
|
2044
2049
|
end
|
|
2045
2050
|
end
|
|
2046
2051
|
|
|
2047
|
-
def collect_hash(data, pass: [])
|
|
2048
|
-
data = data.reject { |key,| pass.include?(key) } unless pass.empty?
|
|
2049
|
-
data.values.flatten
|
|
2050
|
-
end
|
|
2051
|
-
|
|
2052
2052
|
def replace_bin(val)
|
|
2053
2053
|
a, b = val.split(' ', 2)
|
|
2054
2054
|
return val if val.start_with?(/["']/) || a.include?(File::Separator)
|
|
@@ -2058,7 +2058,7 @@ module Squared
|
|
|
2058
2058
|
|
|
2059
2059
|
def parse_json(val, kind: Hash, key: nil, hint: nil, &blk)
|
|
2060
2060
|
ret = JSON.parse(val)
|
|
2061
|
-
|
|
2061
|
+
raise message('invalid JSON', kind.name, hint: hint) if kind && !ret.is_a?(kind)
|
|
2062
2062
|
return ret unless key
|
|
2063
2063
|
|
|
2064
2064
|
block_given? ? ret.fetch(key, &blk) : ret[key]
|
|
@@ -2078,18 +2078,18 @@ module Squared
|
|
|
2078
2078
|
return val unless val.nil? || (pat && !val.match?(pat)) || (values && !values.include?(val))
|
|
2079
2079
|
|
|
2080
2080
|
@session = nil
|
|
2081
|
-
|
|
2081
|
+
raise message(action, "#{flag}[#{key}]", hint: val.nil? ? 'missing' : 'invalid')
|
|
2082
2082
|
elsif args.is_a?(Array) && args.empty?
|
|
2083
2083
|
@session = nil
|
|
2084
|
-
|
|
2084
|
+
raise message(action, "#{flag}+", hint: 'empty')
|
|
2085
2085
|
end
|
|
2086
2086
|
args
|
|
2087
2087
|
end
|
|
2088
2088
|
|
|
2089
|
-
def confirm_basic(msg, hint,
|
|
2089
|
+
def confirm_basic(msg, hint, accept = 'Y', style: :inline, target: @session, prefix: nil, **kwargs)
|
|
2090
2090
|
return true if prefix ? option('y', prefix: prefix) : target && option('y', target: target)
|
|
2091
2091
|
|
|
2092
|
-
confirm("#{msg} [#{sub_style(hint.to_s, style.is_a?(Symbol) ? theme[style] : style)}]",
|
|
2092
|
+
confirm("#{msg} [#{sub_style(hint.to_s, style.is_a?(Symbol) ? theme[style] : style)}]", accept, **kwargs)
|
|
2093
2093
|
end
|
|
2094
2094
|
|
|
2095
2095
|
def confirm_semver(msg, type, style: (type == 1 && theme[:major]) || :inline, timeout: 0, **kwargs)
|
|
@@ -2149,12 +2149,8 @@ module Squared
|
|
|
2149
2149
|
ret
|
|
2150
2150
|
end
|
|
2151
2151
|
|
|
2152
|
-
def accept_b(val, yes
|
|
2153
|
-
[val,
|
|
2154
|
-
end
|
|
2155
|
-
|
|
2156
|
-
def accept_y(val, bool = false)
|
|
2157
|
-
[val, bool, true]
|
|
2152
|
+
def accept_b(val, ret: true, yes: false)
|
|
2153
|
+
[val, ret, yes]
|
|
2158
2154
|
end
|
|
2159
2155
|
|
|
2160
2156
|
def command_args(args, min: 0, force: false, **kwargs)
|
|
@@ -2215,10 +2211,6 @@ module Squared
|
|
|
2215
2211
|
end
|
|
2216
2212
|
end
|
|
2217
2213
|
|
|
2218
|
-
def symjoin(*args, char: ':')
|
|
2219
|
-
args.join(char).to_sym
|
|
2220
|
-
end
|
|
2221
|
-
|
|
2222
2214
|
def semver(val)
|
|
2223
2215
|
return val if val[3]
|
|
2224
2216
|
|
|
@@ -2260,7 +2252,7 @@ module Squared
|
|
|
2260
2252
|
def sembump(val, flag = :patch, join: true)
|
|
2261
2253
|
ret = semscan(val, fill: false)
|
|
2262
2254
|
case flag
|
|
2263
|
-
when :major
|
|
2255
|
+
when :major, :premajor
|
|
2264
2256
|
ret[2] = if ret[0] != '0' || ret[2].nil?
|
|
2265
2257
|
ret[0] = ret[0].succ
|
|
2266
2258
|
'0'
|
|
@@ -2268,16 +2260,29 @@ module Squared
|
|
|
2268
2260
|
ret[2].succ
|
|
2269
2261
|
end
|
|
2270
2262
|
ret[4] = '0'
|
|
2271
|
-
when :minor
|
|
2263
|
+
when :minor, :preminor
|
|
2272
2264
|
if ret[0] == '0'
|
|
2273
2265
|
ret[4] &&= ret[4].succ
|
|
2274
2266
|
else
|
|
2275
2267
|
ret[2] = ret[2].succ
|
|
2276
2268
|
ret[4] &&= '0'
|
|
2277
2269
|
end
|
|
2278
|
-
when :patch
|
|
2270
|
+
when :patch, :prepatch
|
|
2279
2271
|
ret[4] &&= ret[4].succ
|
|
2280
2272
|
end
|
|
2273
|
+
case flag
|
|
2274
|
+
when :premajor, :preminor, :prepatch
|
|
2275
|
+
ret[5] ||= '-'
|
|
2276
|
+
ret[6] = '0'
|
|
2277
|
+
when :prerelease
|
|
2278
|
+
if !ret[6]
|
|
2279
|
+
ret[5] = '-'
|
|
2280
|
+
ret[6] = '0'
|
|
2281
|
+
elsif ret[6].match?(/^\d+$/)
|
|
2282
|
+
ret[5] ||= '-'
|
|
2283
|
+
ret[6] = ret[6].succ
|
|
2284
|
+
end
|
|
2285
|
+
end
|
|
2281
2286
|
join ? ret.join : ret
|
|
2282
2287
|
end
|
|
2283
2288
|
|
|
@@ -2304,7 +2309,7 @@ module Squared
|
|
|
2304
2309
|
end
|
|
2305
2310
|
|
|
2306
2311
|
def indexerror(val, list = nil)
|
|
2307
|
-
|
|
2312
|
+
raise IndexError, message("requested index #{val}", hint: ("of #{list.size}" if list))
|
|
2308
2313
|
end
|
|
2309
2314
|
|
|
2310
2315
|
def indexchar
|
|
@@ -2692,12 +2697,7 @@ module Squared
|
|
|
2692
2697
|
end
|
|
2693
2698
|
|
|
2694
2699
|
def banner?
|
|
2695
|
-
|
|
2696
|
-
when '0', 'false'
|
|
2697
|
-
false
|
|
2698
|
-
else
|
|
2699
|
-
!val.nil? || ARG[:BANNER]
|
|
2700
|
-
end
|
|
2700
|
+
ARG[:BANNER] && env('BANNER', notequals: '0')
|
|
2701
2701
|
end
|
|
2702
2702
|
|
|
2703
2703
|
def pwd?
|
|
@@ -2725,17 +2725,14 @@ module Squared
|
|
|
2725
2725
|
end
|
|
2726
2726
|
|
|
2727
2727
|
def exception?(*level)
|
|
2728
|
-
|
|
2729
|
-
|
|
2728
|
+
ret = exception
|
|
2729
|
+
return ret unless ret.is_a?(Numeric)
|
|
2730
|
+
|
|
2731
|
+
level.empty? ? ret != Logger::INFO : level.include?(ret)
|
|
2730
2732
|
end
|
|
2731
2733
|
|
|
2732
2734
|
def strict?
|
|
2733
|
-
|
|
2734
|
-
when '0', 'false'
|
|
2735
|
-
false
|
|
2736
|
-
else
|
|
2737
|
-
!val.nil? || ARG[:STRICT] || exception?(Logger::FATAL)
|
|
2738
|
-
end
|
|
2735
|
+
(ARG[:STRICT] || exception?(Logger::FATAL)) && env('STRICT', notequals: '0')
|
|
2739
2736
|
end
|
|
2740
2737
|
|
|
2741
2738
|
def serve?
|