squared 0.4.14 → 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 +37 -0
- data/README.md +4 -4
- data/README.ruby.md +14 -11
- data/lib/squared/common/base.rb +5 -3
- data/lib/squared/common/format.rb +1 -1
- data/lib/squared/common/prompt.rb +44 -40
- data/lib/squared/common/shell.rb +13 -8
- data/lib/squared/common/system.rb +33 -29
- data/lib/squared/common/utils.rb +0 -12
- data/lib/squared/common.rb +2 -1
- data/lib/squared/config.rb +14 -13
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +16 -21
- data/lib/squared/workspace/project/base.rb +97 -132
- data/lib/squared/workspace/project/docker.rb +31 -30
- data/lib/squared/workspace/project/git.rb +74 -73
- data/lib/squared/workspace/project/node.rb +31 -20
- data/lib/squared/workspace/project/python.rb +11 -7
- data/lib/squared/workspace/project/ruby.rb +31 -31
- data/lib/squared/workspace/project/support/class.rb +80 -5
- data/lib/squared/workspace/project.rb +0 -10
- data/lib/squared/workspace/repo.rb +6 -6
- data/lib/squared/workspace/series.rb +8 -8
- data/lib/squared/workspace/support/data.rb +1 -0
- data/lib/squared/workspace.rb +1 -1
- data/squared.gemspec +1 -1
- metadata +2 -3
- data/lib/squared/common/class.rb +0 -110
@@ -29,7 +29,7 @@ module Squared
|
|
29
29
|
@impl_project = obj
|
30
30
|
impl_series.base_set(obj)
|
31
31
|
else
|
32
|
-
kind_project.
|
32
|
+
kind_project.prepend(obj)
|
33
33
|
obj.tasks&.each { |task| impl_series.add(task, obj) }
|
34
34
|
end
|
35
35
|
if (args = obj.batchargs)
|
@@ -73,7 +73,7 @@ module Squared
|
|
73
73
|
end
|
74
74
|
|
75
75
|
@kind_project = []
|
76
|
-
@task_exclude =
|
76
|
+
@task_exclude = Set.new
|
77
77
|
|
78
78
|
attr_reader :root, :home, :main, :prefix, :exception, :warning, :pipe, :verbose, :theme, :series, :closed
|
79
79
|
|
@@ -220,7 +220,7 @@ module Squared
|
|
220
220
|
if arg.include?(':') || (keys && !keys.include?(arg))
|
221
221
|
task_name(arg)
|
222
222
|
else
|
223
|
-
|
223
|
+
/#{Regexp.escape(arg)}:/
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
@@ -278,7 +278,7 @@ module Squared
|
|
278
278
|
end
|
279
279
|
|
280
280
|
def banner(*args, command: true, styles: nil, border: nil, group: @group, ref: @ref)
|
281
|
-
data =
|
281
|
+
data = Struct::BannerData.new(command, [], check_style(styles, empty: false), check_style(border))
|
282
282
|
args.each do |meth|
|
283
283
|
if meth.is_a?(Array)
|
284
284
|
found = false
|
@@ -301,9 +301,8 @@ module Squared
|
|
301
301
|
elsif !Application.attr_banner.include?(meth = meth.to_sym)
|
302
302
|
next
|
303
303
|
end
|
304
|
-
data
|
304
|
+
data.order << meth
|
305
305
|
end
|
306
|
-
data = {} if !command && data[:order].empty?
|
307
306
|
if group
|
308
307
|
label = :group
|
309
308
|
items = Array(group)
|
@@ -316,11 +315,7 @@ module Squared
|
|
316
315
|
end
|
317
316
|
|
318
317
|
def add(path, project = nil, **kwargs, &blk)
|
319
|
-
if @withargs
|
320
|
-
data = @withargs.dup
|
321
|
-
data.merge!(kwargs)
|
322
|
-
kwargs = data
|
323
|
-
end
|
318
|
+
kwargs = @withargs.yield_self { |data| data.dup.update(kwargs) } if @withargs
|
324
319
|
ref = if kwargs.key?(:ref)
|
325
320
|
kwargs = kwargs.dup unless @withargs
|
326
321
|
kwargs.delete(:ref)
|
@@ -360,7 +355,7 @@ module Squared
|
|
360
355
|
end
|
361
356
|
.each do |dir, basename, opts|
|
362
357
|
args = kwargs.dup
|
363
|
-
args.
|
358
|
+
args.update(opts) if opts
|
364
359
|
add(dir, basename, group: val, **args, &blk)
|
365
360
|
end
|
366
361
|
self
|
@@ -399,7 +394,7 @@ module Squared
|
|
399
394
|
}
|
400
395
|
data.each do |key, val|
|
401
396
|
key = key.to_s
|
402
|
-
if key.
|
397
|
+
if key.start_with?(/(\\A|\^)/) || key.match?(/(\\z|\$)\z/)
|
403
398
|
@describe[:replace] << [Regexp.new(key), val]
|
404
399
|
else
|
405
400
|
@describe[val.is_a?(Regexp) ? :pattern : :alias][key.to_s] = val
|
@@ -417,7 +412,7 @@ module Squared
|
|
417
412
|
if ret.empty?
|
418
413
|
ret = @project.select { |_, item| item.ref?(ref) }.map(&:last) if ref
|
419
414
|
if ret.empty? && (path || name)
|
420
|
-
path &&= rootpath
|
415
|
+
path &&= rootpath path
|
421
416
|
name &&= name.to_s
|
422
417
|
proj = @project.find { |_, item| (path && item.path == path) || (name && item.name == name) }&.last
|
423
418
|
ret << proj if proj
|
@@ -517,7 +512,7 @@ module Squared
|
|
517
512
|
obj.allref.each do |ref|
|
518
513
|
next unless obj.has?(key, ref) && (alt = data[ref])
|
519
514
|
|
520
|
-
ret = task_resolve
|
515
|
+
ret = task_resolve obj, alt
|
521
516
|
break unless ret.empty?
|
522
517
|
end
|
523
518
|
else
|
@@ -537,7 +532,7 @@ module Squared
|
|
537
532
|
end
|
538
533
|
|
539
534
|
def format_desc(val, opts = nil, arg: 'opts*', before: nil, after: nil, out: false)
|
540
|
-
return unless TASK_METADATA
|
535
|
+
return unless TASK_METADATA
|
541
536
|
|
542
537
|
val = val.split(':') if val.is_a?(String)
|
543
538
|
if before || after || opts
|
@@ -711,7 +706,7 @@ module Squared
|
|
711
706
|
else
|
712
707
|
step = 0
|
713
708
|
catch :found do
|
714
|
-
has = ->(c, d) { c.any? { |e| e.is_a?(Regexp) ? d.
|
709
|
+
has = ->(c, d) { c.any? { |e| e.is_a?(Regexp) ? d.start_with?(e) : d == e } }
|
715
710
|
w = data.with
|
716
711
|
a = data.after
|
717
712
|
b = data.before
|
@@ -770,7 +765,7 @@ module Squared
|
|
770
765
|
end
|
771
766
|
end
|
772
767
|
if step == -1
|
773
|
-
level.
|
768
|
+
level.prepend(data.action)
|
774
769
|
step = 0
|
775
770
|
elsif step > 0
|
776
771
|
(level[step -= 1] ||= []).concat(data.action)
|
@@ -860,7 +855,7 @@ module Squared
|
|
860
855
|
def root?(path, pass: [])
|
861
856
|
return false unless path.directory?
|
862
857
|
|
863
|
-
path.
|
858
|
+
path.each_child do |c|
|
864
859
|
name = c.basename.to_s
|
865
860
|
next if c.to_s == __FILE__ || (@main == name && c.directory? && c.empty?) || pass.any? { |val| val == name }
|
866
861
|
|
@@ -870,14 +865,14 @@ module Squared
|
|
870
865
|
end
|
871
866
|
|
872
867
|
def script?(state, target: nil, pat: nil, group: nil, ref: baseref, global: false)
|
873
|
-
data = script_find
|
868
|
+
data = script_find ref, group
|
874
869
|
if global
|
875
870
|
target = data[:script] || data[:run] if target.nil?
|
876
871
|
pat = data[state] if pat.nil?
|
877
872
|
end
|
878
873
|
return false if state == :prod && data[:dev] == true && data[:global]
|
879
874
|
|
880
|
-
target && pat.is_a?(Regexp) ? Array(target).any?
|
875
|
+
target && pat.is_a?(Regexp) ? Array(target).any?(pat) : pat == true
|
881
876
|
end
|
882
877
|
|
883
878
|
def scriptobj
|