squared 0.4.13 → 0.4.15
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 +105 -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 +1 -1
- data/lib/squared/common/system.rb +21 -14
- data/lib/squared/common/utils.rb +7 -3
- data/lib/squared/config.rb +6 -5
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +39 -29
- data/lib/squared/workspace/project/base.rb +115 -71
- data/lib/squared/workspace/project/docker.rb +12 -10
- data/lib/squared/workspace/project/git.rb +88 -57
- data/lib/squared/workspace/project/node.rb +37 -41
- data/lib/squared/workspace/project/python.rb +248 -47
- data/lib/squared/workspace/project/ruby.rb +135 -105
- data/lib/squared/workspace/project/support/class.rb +37 -1
- data/lib/squared/workspace/repo.rb +2 -1
- data/lib/squared/workspace/series.rb +8 -8
- data/lib/squared/workspace/support/data.rb +2 -2
- data/lib/squared/workspace.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf3c1ed045970581434b5e6571a75ccb21a8ea564d83b1f85c6deca107424d5
|
4
|
+
data.tar.gz: 2300104c9cf7fcd5babbe2989c9a68af8f8b024546baf3969198df1973ab98fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5983d6fa81ba44335c2af020292f6260a02ffd4c6a8c9c9213b68d50606a14aa33fd4df032a5abfcc0677d44f5e30e69d726b3c5dcc2ac0dfbb378bdd9fa0618
|
7
|
+
data.tar.gz: dcd11eb155202c2dbbcb1d7a533516c4c0d16381caccb49a0b67612e915297242b7caa74d684afcb9db08530d68a1f0a693512189f8e6b7d9fe6579f2c5e444a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,98 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.15] - 2025-07-16
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Python command outdated option user was implemented.
|
8
|
+
- Git command commit action amend and amend-orig are interactive.
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Ruby task copy does not guess Gem directory when version is used.
|
13
|
+
- Workspace hash-based data uses global method for key creation.
|
14
|
+
|
15
|
+
## [0.3.13] - 2025-07-16
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- See `0.2.13`.
|
20
|
+
|
21
|
+
## [0.2.13] - 2025-07-16
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- Project graph did not ignore circular references.
|
26
|
+
|
27
|
+
## [0.1.10] - 2025-07-16
|
28
|
+
|
29
|
+
### Fixed
|
30
|
+
|
31
|
+
- Module namespaces were not combined in the right order.
|
32
|
+
- Workspace group tasks were not registered.
|
33
|
+
|
34
|
+
## [0.4.14] - 2025-07-05
|
35
|
+
|
36
|
+
### Added
|
37
|
+
|
38
|
+
- Python command run for project scripts was implemented.
|
39
|
+
- Python command build and publish with PDM was implemented.
|
40
|
+
- Python command run detects program tool scripts.
|
41
|
+
- Git command stash action branch was implemented.
|
42
|
+
- Docker command compose action exec and run are interactive.
|
43
|
+
- Double dash can be used to end parsing for options.
|
44
|
+
- Python command outdated tasks with semver was implemented.
|
45
|
+
|
46
|
+
### Changed
|
47
|
+
|
48
|
+
- Ruby command rake supports running multiple indexes.
|
49
|
+
- Ruby private method rakefile when nil returns empty string.
|
50
|
+
- Ruby private method gempwd and rakepwd ignores current directory.
|
51
|
+
- Ruby command gem action update parameters are optional.
|
52
|
+
- Gem command install and uninstall can parse name and version.
|
53
|
+
- Kernel method Array is used in place of common method as_a.
|
54
|
+
- Ruby public method irb parameter load was renamed args.
|
55
|
+
|
56
|
+
### Fixed
|
57
|
+
|
58
|
+
- Box border did not print corners on Windows.
|
59
|
+
- Index character was not captured on Windows.
|
60
|
+
- Node command publish did not prompt for package to publish.
|
61
|
+
- Python command publish did not prompt for package to publish.
|
62
|
+
- Project confirmation accept dialog did not always quit.
|
63
|
+
- Git command add did not detect when no files were changed.
|
64
|
+
|
65
|
+
## [0.3.12] - 2025-07-05
|
66
|
+
|
67
|
+
### Fixed
|
68
|
+
|
69
|
+
- Gem command exec did not include gem option flag.
|
70
|
+
- Project graph did not print first level border.
|
71
|
+
- Node command update did not use correct event name.
|
72
|
+
- Gem command push did not validate gem file to publish.
|
73
|
+
- Node command publish did not publish when silent.
|
74
|
+
|
75
|
+
## [0.2.12] - 2025-07-05
|
76
|
+
|
77
|
+
### Fixed
|
78
|
+
|
79
|
+
- See `0.1.9`.
|
80
|
+
|
81
|
+
## [0.1.9] - 2025-07-05
|
82
|
+
|
83
|
+
### Added
|
84
|
+
|
85
|
+
- Initial support for using JRuby.
|
86
|
+
- Config viewer theme color for boolean was implemented.
|
87
|
+
|
88
|
+
### Fixed
|
89
|
+
|
90
|
+
- Project output divider was not printed when not verbose.
|
91
|
+
- Directory context was not threaded using JRuby.
|
92
|
+
- Index character was not captured on Windows.
|
93
|
+
- Common method is used for Kernel shell commands.
|
94
|
+
- Git did not highlight output for single commands.
|
95
|
+
|
3
96
|
## [0.4.13] - 2025-06-16
|
4
97
|
|
5
98
|
### Added
|
@@ -53,6 +146,8 @@
|
|
53
146
|
|
54
147
|
## [0.3.11] - 2025-05-15
|
55
148
|
|
149
|
+
### Fixed
|
150
|
+
|
56
151
|
- See `0.2.11`.
|
57
152
|
|
58
153
|
## [0.2.11] - 2025-05-15
|
@@ -315,6 +410,8 @@
|
|
315
410
|
|
316
411
|
## [0.3.7] - 2025-04-08
|
317
412
|
|
413
|
+
### Fixed
|
414
|
+
|
318
415
|
- See `0.2.7`.
|
319
416
|
|
320
417
|
## [0.2.7] - 2025-04-08
|
@@ -736,6 +833,8 @@
|
|
736
833
|
|
737
834
|
- Changelog was created.
|
738
835
|
|
836
|
+
[0.4.15]: https://github.com/anpham6/squared/releases/tag/v0.4.15-ruby
|
837
|
+
[0.4.14]: https://github.com/anpham6/squared/releases/tag/v0.4.14-ruby
|
739
838
|
[0.4.13]: https://github.com/anpham6/squared/releases/tag/v0.4.13-ruby
|
740
839
|
[0.4.12]: https://github.com/anpham6/squared/releases/tag/v0.4.12-ruby
|
741
840
|
[0.4.11]: https://github.com/anpham6/squared/releases/tag/v0.4.11-ruby
|
@@ -750,6 +849,8 @@
|
|
750
849
|
[0.4.2]: https://github.com/anpham6/squared/releases/tag/v0.4.2-ruby
|
751
850
|
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
752
851
|
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
852
|
+
[0.3.13]: https://github.com/anpham6/squared/releases/tag/v0.3.13-ruby
|
853
|
+
[0.3.12]: https://github.com/anpham6/squared/releases/tag/v0.3.12-ruby
|
753
854
|
[0.3.11]: https://github.com/anpham6/squared/releases/tag/v0.3.11-ruby
|
754
855
|
[0.3.10]: https://github.com/anpham6/squared/releases/tag/v0.3.10-ruby
|
755
856
|
[0.3.9]: https://github.com/anpham6/squared/releases/tag/v0.3.9-ruby
|
@@ -762,6 +863,8 @@
|
|
762
863
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
763
864
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
764
865
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
866
|
+
[0.2.13]: https://github.com/anpham6/squared/releases/tag/v0.2.13-ruby
|
867
|
+
[0.2.12]: https://github.com/anpham6/squared/releases/tag/v0.2.12-ruby
|
765
868
|
[0.2.11]: https://github.com/anpham6/squared/releases/tag/v0.2.11-ruby
|
766
869
|
[0.2.10]: https://github.com/anpham6/squared/releases/tag/v0.2.10-ruby
|
767
870
|
[0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
|
@@ -774,6 +877,8 @@
|
|
774
877
|
[0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
|
775
878
|
[0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
|
776
879
|
[0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
|
880
|
+
[0.1.10]: https://github.com/anpham6/squared/releases/tag/v0.1.10-ruby
|
881
|
+
[0.1.9]: https://github.com/anpham6/squared/releases/tag/v0.1.9-ruby
|
777
882
|
[0.1.8]: https://github.com/anpham6/squared/releases/tag/v0.1.8-ruby
|
778
883
|
[0.1.7]: https://github.com/anpham6/squared/releases/tag/v0.1.7-ruby
|
779
884
|
[0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
|
data/README.ruby.md
CHANGED
@@ -508,7 +508,7 @@ Most project classes will inherit from `Git` which enables these tasks:
|
|
508
508
|
| restore | restore | staged worktree |
|
509
509
|
| rev | rev | commit output |
|
510
510
|
| show | show | format oneline |
|
511
|
-
| stash | stash | push pop apply drop list
|
511
|
+
| stash | stash | push pop apply branch drop clear list |
|
512
512
|
| switch | switch | create detach merge |
|
513
513
|
| tag | tag | add sign delete list |
|
514
514
|
|
data/lib/squared/common/base.rb
CHANGED
@@ -63,6 +63,7 @@ module Squared
|
|
63
63
|
hash: %i[green black!],
|
64
64
|
array: %i[blue black!],
|
65
65
|
number: [:magenta],
|
66
|
+
boolean: [:magenta],
|
66
67
|
undefined: %i[red italic]
|
67
68
|
},
|
68
69
|
logger: {
|
@@ -103,13 +104,15 @@ module Squared
|
|
103
104
|
return [] if obj.nil?
|
104
105
|
|
105
106
|
unless obj.is_a?(::Array)
|
106
|
-
obj = if obj.respond_to?(:
|
107
|
+
obj = if obj.respond_to?(:to_ary)
|
108
|
+
obj.to_ary
|
109
|
+
elsif obj.respond_to?(:to_a) && !obj.is_a?(::Hash) && (val = obj.to_a).is_a?(::Array)
|
107
110
|
val
|
108
111
|
else
|
109
112
|
[obj]
|
110
113
|
end
|
111
114
|
end
|
112
|
-
obj =
|
115
|
+
obj = flat.is_a?(::Numeric) ? obj.flatten(flat) : obj.flatten if flat
|
113
116
|
obj = obj.compact if compact
|
114
117
|
obj = obj.map(&meth) if meth
|
115
118
|
block_given? ? obj.select(&blk) : obj
|
@@ -29,7 +29,13 @@ module Squared
|
|
29
29
|
bright_white!: '107'
|
30
30
|
}.freeze
|
31
31
|
BOX_GRAPH = ['│', '─', '├', '└', '┬'].freeze
|
32
|
-
BOX_BORDER = ['│', '─', '
|
32
|
+
BOX_BORDER = ['│', '─', '┌', '┐', '┘', '└', '├', '┤', '┬', '┴'].tap do |val|
|
33
|
+
if ENV['TERM']&.end_with?('256color')
|
34
|
+
val.slice!(2, 4)
|
35
|
+
val.insert(2, '╭', '╮', '╯', '╰')
|
36
|
+
end
|
37
|
+
val.freeze
|
38
|
+
end
|
33
39
|
TEXT_STYLE = [:bold, :dim, :italic, :underline, :blinking, nil, :inverse, :hidden, :strikethrough].freeze
|
34
40
|
private_constant :AIX_TERM, :BOX_GRAPH, :BOX_BORDER, :TEXT_STYLE
|
35
41
|
|
@@ -61,7 +67,7 @@ module Squared
|
|
61
67
|
end
|
62
68
|
wrap = ->(s, n) { "\x1B[#{n.join(';')}m#{s}\x1B[0m" }
|
63
69
|
code = []
|
64
|
-
args.concat(
|
70
|
+
args.concat(Array(styles)).flatten.each_with_index do |type, i|
|
65
71
|
next unless type
|
66
72
|
|
67
73
|
if index == -1
|
@@ -37,7 +37,7 @@ module Squared
|
|
37
37
|
require 'readline'
|
38
38
|
require 'timeout'
|
39
39
|
if list
|
40
|
-
grep &&= (grep
|
40
|
+
grep &&= Array(grep).map { |val| Regexp.new(val) }
|
41
41
|
items = []
|
42
42
|
list.each do |val|
|
43
43
|
next if grep&.none? { |pat| pat.match?(line) }
|
@@ -1,23 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'pathname'
|
4
|
-
require '
|
4
|
+
require 'rake'
|
5
5
|
|
6
6
|
module Squared
|
7
7
|
module Common
|
8
8
|
module System
|
9
9
|
module_function
|
10
10
|
|
11
|
-
def shell(*args, **kwargs)
|
12
|
-
if
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
def shell(*args, name: :system, **kwargs)
|
12
|
+
if RUBY_ENGINE == 'jruby' && Rake::Win32.windows?
|
13
|
+
e = kwargs[:exception]
|
14
|
+
if (dir = kwargs[:chdir]) && ((pwd = Dir.pwd) != dir)
|
15
|
+
Dir.chdir(dir)
|
16
|
+
ret = Kernel.send(name, *args)
|
17
|
+
Dir.chdir(pwd)
|
18
|
+
else
|
19
|
+
ret = Kernel.send(name, *args)
|
20
|
+
end
|
21
|
+
elsif RUBY_VERSION < '2.6'
|
22
|
+
e = kwargs.delete(:exception)
|
23
|
+
ret = Kernel.send(name, *args, **kwargs)
|
18
24
|
else
|
19
|
-
Kernel.
|
25
|
+
return Kernel.send(name, *args, **kwargs)
|
20
26
|
end
|
27
|
+
return ret if ret || !e
|
28
|
+
|
29
|
+
raise $?.to_s
|
21
30
|
end
|
22
31
|
|
23
32
|
def copy_dir(src, dest, glob = ['**/*'], create: false, link: nil, force: false, pass: nil, verbose: true)
|
@@ -29,10 +38,9 @@ module Squared
|
|
29
38
|
dest.mkpath if create
|
30
39
|
if pass
|
31
40
|
exclude = []
|
32
|
-
pass
|
33
|
-
pass.each { |val| exclude.concat(Dir.glob(src + val)) }
|
41
|
+
Array(pass).each { |val| exclude.concat(Dir.glob(src + val)) }
|
34
42
|
end
|
35
|
-
(glob
|
43
|
+
Array(glob).each do |val|
|
36
44
|
Dir.glob(src + val) do |path|
|
37
45
|
next if exclude&.include?(path) || (path = Pathname.new(path)).directory?
|
38
46
|
|
@@ -79,8 +87,7 @@ module Squared
|
|
79
87
|
def copy_guard(src, dest, link: nil, force: false, verbose: true)
|
80
88
|
unless force
|
81
89
|
if (path = Pathname.new(dest)).directory?
|
82
|
-
src =
|
83
|
-
src = src.reject { |val| path.join(File.basename(val)).exist? }
|
90
|
+
src = Array(src).reject { |val| path.join(File.basename(val)).exist? }
|
84
91
|
return if src.empty?
|
85
92
|
elsif path.exist?
|
86
93
|
return
|
data/lib/squared/common/utils.rb
CHANGED
@@ -17,13 +17,13 @@ module Squared
|
|
17
17
|
val = val.strip
|
18
18
|
return [val, '', ''] unless (i = val.index('='))
|
19
19
|
|
20
|
-
last = val[i + 1..-1].strip
|
20
|
+
last = val[(i + 1)..-1].strip
|
21
21
|
quote = ''
|
22
22
|
if last =~ /\A(["'])(.+)\1\z/
|
23
23
|
last = $2
|
24
24
|
quote = $1
|
25
25
|
end
|
26
|
-
[val[0..i - 1], last, quote]
|
26
|
+
[val[0..(i - 1)], last, quote]
|
27
27
|
end
|
28
28
|
|
29
29
|
def task_invoke(*cmd, args: [], exception: true, warning: true)
|
@@ -109,7 +109,11 @@ module Squared
|
|
109
109
|
ret = env_value(key, suffix: suffix, strict: strict)
|
110
110
|
return ret == equals.to_s unless equals.nil?
|
111
111
|
|
112
|
-
ret.empty? || (ignore &&
|
112
|
+
ret.empty? || (ignore && Array(ignore).any? { |val| val.to_s == ret }) ? default : ret
|
113
|
+
end
|
114
|
+
|
115
|
+
def env_key(*val)
|
116
|
+
val.join('_').gsub(/\W+/, '_').upcase
|
113
117
|
end
|
114
118
|
|
115
119
|
def env_value(key, default = '', suffix: nil, strict: false)
|
data/lib/squared/config.rb
CHANGED
@@ -15,8 +15,7 @@ module Squared
|
|
15
15
|
def parse(gem, namespace, ext = [pkg])
|
16
16
|
require gem
|
17
17
|
obj = eval namespace
|
18
|
-
ext = [ext]
|
19
|
-
ext.each { |val| @@mime_obj[val] = [obj, ext] }
|
18
|
+
Array(ext).each { |val| @@mime_obj[val] = [obj, ext] }
|
20
19
|
rescue LoadError, NameError => e
|
21
20
|
warn e
|
22
21
|
nil
|
@@ -89,7 +88,7 @@ module Squared
|
|
89
88
|
@required = true
|
90
89
|
project ? [project, 'not found'] : ['name', 'missing']
|
91
90
|
end
|
92
|
-
warn log_message(Logger::WARN, msg, subject: self.class, hint: hint
|
91
|
+
warn log_message(Logger::WARN, msg, subject: self.class, hint: hint)
|
93
92
|
end
|
94
93
|
|
95
94
|
def build
|
@@ -129,7 +128,7 @@ module Squared
|
|
129
128
|
require(gem || type)
|
130
129
|
obj = eval namespace
|
131
130
|
else
|
132
|
-
|
131
|
+
Array(ext).each do |val|
|
133
132
|
next unless (data = @@mime_obj[val])
|
134
133
|
|
135
134
|
obj = data.first
|
@@ -137,7 +136,7 @@ module Squared
|
|
137
136
|
end
|
138
137
|
end
|
139
138
|
if obj
|
140
|
-
ext << type if (ext =
|
139
|
+
ext << type if (ext = Array(ext)).empty?
|
141
140
|
if !file && target?
|
142
141
|
ext.each do |val|
|
143
142
|
next unless (out = basepath("#{main}.#{val}")).exist?
|
@@ -249,6 +248,8 @@ module Squared
|
|
249
248
|
{ pat: /\A(.+ : ")(.+)("\s*)\z/m, styles: theme[:string], index: 2 },
|
250
249
|
{ pat: /\A(.+ : \{)(.+)(\}\s*)\z/m, styles: theme[:hash], index: 2 },
|
251
250
|
{ pat: /\A(.+ : \[)(.+)(\]\s*)\z/m, styles: theme[:array], index: 2 },
|
251
|
+
{ pat: /\A(.+ : )(true|false)(\s*)\z/m, styles: theme[:boolean],
|
252
|
+
index: 2 },
|
252
253
|
{ pat: /\A(.+ : (?!undefined))([^"\[{].*)\z/m, styles: theme[:value],
|
253
254
|
index: 2 }
|
254
255
|
]
|
data/lib/squared/version.rb
CHANGED
@@ -92,9 +92,9 @@ module Squared
|
|
92
92
|
@prefix = prefix
|
93
93
|
@series = Application.series_wrap(self)
|
94
94
|
@project = {}
|
95
|
-
@kind =
|
95
|
+
@kind = Workspace.hashlist
|
96
96
|
@extensions = []
|
97
|
-
@envname = @main
|
97
|
+
@envname = env_key(@main).freeze
|
98
98
|
@pipe = env_pipe(pipe, (ARG[:OUT] && env(ARG[:OUT])) || 1, root: @home)
|
99
99
|
@exception = env_bool exception
|
100
100
|
@verbose = env_bool(verbose, verbose.nil? || verbose.is_a?(String) ? @pipe != 0 : verbose, index: true)
|
@@ -106,20 +106,20 @@ module Squared
|
|
106
106
|
else
|
107
107
|
@theme = {}
|
108
108
|
end
|
109
|
-
@chain =
|
109
|
+
@chain = Workspace.hashlist
|
110
110
|
@script = {
|
111
|
-
group:
|
112
|
-
ref:
|
111
|
+
group: Workspace.hashobj,
|
112
|
+
ref: Workspace.hashobj,
|
113
113
|
group!: {},
|
114
114
|
ref!: {}
|
115
115
|
}.freeze
|
116
116
|
@events = {
|
117
|
-
group:
|
118
|
-
ref:
|
117
|
+
group: Workspace.hashobj,
|
118
|
+
ref: Workspace.hashobj
|
119
119
|
}.freeze
|
120
120
|
@pass = {
|
121
|
-
group:
|
122
|
-
ref:
|
121
|
+
group: Workspace.hashobj,
|
122
|
+
ref: Workspace.hashobj,
|
123
123
|
global: {},
|
124
124
|
pattern: []
|
125
125
|
}.freeze
|
@@ -224,8 +224,8 @@ module Squared
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
|
-
data =
|
228
|
-
|
227
|
+
data = Struct::ChainData.new(action, step, ns.call(with), ns.call(before), ns.call(after), sync)
|
228
|
+
@chain[task_name(task.to_s)] << data
|
229
229
|
self
|
230
230
|
end
|
231
231
|
|
@@ -267,9 +267,9 @@ module Squared
|
|
267
267
|
|
268
268
|
def pass(name, group: @group, ref: @ref, &blk)
|
269
269
|
data = if group
|
270
|
-
@pass[:group][group]
|
270
|
+
@pass[:group][group]
|
271
271
|
elsif ref
|
272
|
-
@pass[:ref][ref]
|
272
|
+
@pass[:ref][ref]
|
273
273
|
else
|
274
274
|
@pass[:global]
|
275
275
|
end
|
@@ -306,10 +306,10 @@ module Squared
|
|
306
306
|
data = {} if !command && data[:order].empty?
|
307
307
|
if group
|
308
308
|
label = :group
|
309
|
-
items =
|
309
|
+
items = Array(group)
|
310
310
|
else
|
311
311
|
label = :ref
|
312
|
-
items =
|
312
|
+
items = Array(ref || :_)
|
313
313
|
end
|
314
314
|
items.each { |val| @banner[label][val.to_sym] = data }
|
315
315
|
self
|
@@ -367,7 +367,7 @@ module Squared
|
|
367
367
|
end
|
368
368
|
|
369
369
|
def compose(name, &blk)
|
370
|
-
namespace(task_name(name), &blk)
|
370
|
+
namespace(task_name(name), &blk)
|
371
371
|
self
|
372
372
|
end
|
373
373
|
|
@@ -379,7 +379,7 @@ module Squared
|
|
379
379
|
def style(obj, *args, target: nil, empty: false)
|
380
380
|
data = nil
|
381
381
|
if target
|
382
|
-
|
382
|
+
Array(target).each_with_index do |key, i|
|
383
383
|
if i == 0
|
384
384
|
break unless (data = __get__(:theme)[key.to_sym])
|
385
385
|
else
|
@@ -485,7 +485,7 @@ module Squared
|
|
485
485
|
end
|
486
486
|
|
487
487
|
def task_namespace(val, first: false)
|
488
|
-
return
|
488
|
+
return unless (ret = val.to_s.split(':')).size > 1
|
489
489
|
|
490
490
|
first ? ret.first : task_join(*ret[0..-2])
|
491
491
|
end
|
@@ -630,6 +630,14 @@ module Squared
|
|
630
630
|
Rake::Win32.windows?
|
631
631
|
end
|
632
632
|
|
633
|
+
def jruby?
|
634
|
+
RUBY_ENGINE == 'jruby'
|
635
|
+
end
|
636
|
+
|
637
|
+
def jruby_win?
|
638
|
+
jruby? && windows?
|
639
|
+
end
|
640
|
+
|
633
641
|
def docker?
|
634
642
|
!Dir['/.dockerenv', '/docker-*.{sh,d}'].empty?
|
635
643
|
end
|
@@ -784,7 +792,7 @@ module Squared
|
|
784
792
|
task key do
|
785
793
|
unless failed.empty? && group.empty?
|
786
794
|
puts log_message(Logger::ERROR, *(failed + group.map { |val| val.action }.flatten),
|
787
|
-
subject: 'failed placement', hint: false
|
795
|
+
subject: 'failed placement', hint: false)
|
788
796
|
end
|
789
797
|
cols = level.flatten(1).map(&:size).max
|
790
798
|
level.each_with_index do |grp, n|
|
@@ -806,7 +814,7 @@ module Squared
|
|
806
814
|
|
807
815
|
def script_command(task, val, group, ref, on, &blk)
|
808
816
|
if block_given?
|
809
|
-
val =
|
817
|
+
val = Struct::RunData.new(val, blk)
|
810
818
|
elsif !val
|
811
819
|
return self
|
812
820
|
end
|
@@ -818,8 +826,8 @@ module Squared
|
|
818
826
|
items = as_a(ref, :to_sym)
|
819
827
|
end
|
820
828
|
items.each do |name|
|
821
|
-
|
822
|
-
|
829
|
+
@script[label][name][task] = val
|
830
|
+
@events[label][name][task] = on if on.is_a?(Hash)
|
823
831
|
end
|
824
832
|
self
|
825
833
|
end
|
@@ -827,24 +835,26 @@ module Squared
|
|
827
835
|
def script_set(data, group: nil, ref: nil)
|
828
836
|
data.freeze
|
829
837
|
if group
|
830
|
-
|
838
|
+
Array(group).each { |val| @script[:group!][val.to_sym] = data }
|
831
839
|
elsif ref
|
832
|
-
|
840
|
+
Array(ref).each { |val| @script[:ref!][val.to_sym] = data }
|
833
841
|
else
|
834
842
|
@script[:ref!][:''] = data
|
835
843
|
end
|
836
844
|
end
|
837
845
|
|
838
846
|
def data_get(*args, group: nil, ref: nil, target: nil)
|
839
|
-
target[:group]
|
840
|
-
|
847
|
+
if group && target[:group].key?(key = group.to_sym)
|
848
|
+
target[:group][key]
|
849
|
+
elsif ref.is_a?(Enumerable)
|
841
850
|
ref.each do |key|
|
842
|
-
next unless
|
851
|
+
next unless target[:ref].key?(key)
|
843
852
|
|
853
|
+
ret = target[:ref][key]
|
844
854
|
return ret if args.empty? || args.any? { |val| ret.key?(val) }
|
845
855
|
end
|
846
856
|
nil
|
847
|
-
elsif ref
|
857
|
+
elsif ref && target[:ref].key?(ref)
|
848
858
|
target[:ref][ref]
|
849
859
|
end
|
850
860
|
end
|
@@ -869,7 +879,7 @@ module Squared
|
|
869
879
|
end
|
870
880
|
return false if state == :prod && data[:dev] == true && data[:global]
|
871
881
|
|
872
|
-
target && pat.is_a?(Regexp) ?
|
882
|
+
target && pat.is_a?(Regexp) ? Array(target).any? { |val| val.match?(pat) } : pat == true
|
873
883
|
end
|
874
884
|
|
875
885
|
def scriptobj
|