squared 0.4.12 → 0.4.14
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 +100 -0
- data/README.ruby.md +6 -2
- 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/shell.rb +14 -14
- 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 +21 -12
- data/lib/squared/workspace/project/base.rb +348 -137
- data/lib/squared/workspace/project/docker.rb +95 -52
- data/lib/squared/workspace/project/git.rb +86 -52
- data/lib/squared/workspace/project/node.rb +71 -44
- data/lib/squared/workspace/project/python.rb +360 -131
- data/lib/squared/workspace/project/ruby.rb +140 -103
- data/lib/squared/workspace/project/support/class.rb +39 -3
- data/lib/squared/workspace/repo.rb +2 -1
- data/lib/squared/workspace/support/data.rb +2 -2
- 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: fafee0b2a60973f9363c71173b9de4ed4779090e2ef3c2331d3ecd9f3a2a9398
|
4
|
+
data.tar.gz: 8eb5bfef9ec19b7985866ffd1f0b55a849ff7d27a895b76d29a1cd85553e717a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 464952bd65f6c404a89ef8624549e04a7a4ec0cc2c0b211e73d0464cf1bcd8094f760449ab7e0e944fd390cf01029f14ef2b6a082ae67d1ad071d243821ee527
|
7
|
+
data.tar.gz: d36b6c580ccabb5bde29585cdb4642c7a81dadfff59b5766fa76efece506983ed0335551fdd31a41eced8c6631967573a6ad4a19f22b912e61a93f6f10e334ec
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,96 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.14] - 2025-07-05
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Python command run for project scripts was implemented.
|
8
|
+
- Python command build and publish with PDM was implemented.
|
9
|
+
- Python command run detects program tool scripts.
|
10
|
+
- Git command stash action branch was implemented.
|
11
|
+
- Docker command compose action exec and run are interactive.
|
12
|
+
- Double dash can be used to end parsing for options.
|
13
|
+
- Python command outdated tasks with semver was implemented.
|
14
|
+
|
15
|
+
### Changed
|
16
|
+
|
17
|
+
- Ruby command rake supports running multiple indexes.
|
18
|
+
- Ruby private method rakefile when nil returns empty string.
|
19
|
+
- Ruby private method gempwd and rakepwd ignores current directory.
|
20
|
+
- Ruby command gem action update parameters are optional.
|
21
|
+
- Gem command install and uninstall can parse name and version.
|
22
|
+
- Kernel method Array is used in place of common method as_a.
|
23
|
+
- Ruby public method irb parameter load was renamed args.
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Box border did not print corners on Windows.
|
28
|
+
- Index character was not captured on Windows.
|
29
|
+
- Node command publish did not prompt for package to publish.
|
30
|
+
- Python command publish did not prompt for package to publish.
|
31
|
+
- Project confirmation accept dialog did not always quit.
|
32
|
+
- Git command add did not detect when no files were changed.
|
33
|
+
|
34
|
+
## [0.3.12] - 2025-07-05
|
35
|
+
|
36
|
+
### Fixed
|
37
|
+
|
38
|
+
- Gem command exec did not include gem option flag.
|
39
|
+
- Project graph did not print first level border.
|
40
|
+
- Node command update did not use correct event name.
|
41
|
+
- Gem command push did not validate gem file to publish.
|
42
|
+
- Node command publish did not publish when silent.
|
43
|
+
|
44
|
+
## [0.2.12] - 2025-07-05
|
45
|
+
|
46
|
+
### Fixed
|
47
|
+
|
48
|
+
- See `0.1.9`.
|
49
|
+
|
50
|
+
## [0.1.9] - 2025-07-05
|
51
|
+
|
52
|
+
### Added
|
53
|
+
|
54
|
+
- Initial support for using JRuby.
|
55
|
+
- Config viewer theme color for boolean was implemented.
|
56
|
+
|
57
|
+
### Fixed
|
58
|
+
|
59
|
+
- Project output divider was not printed when not verbose.
|
60
|
+
- Directory context was not threaded using JRuby.
|
61
|
+
- Index character was not captured on Windows.
|
62
|
+
- Common method is used for Kernel shell commands.
|
63
|
+
- Git did not highlight output for single commands.
|
64
|
+
|
65
|
+
## [0.4.13] - 2025-06-16
|
66
|
+
|
67
|
+
### Added
|
68
|
+
|
69
|
+
- Docker command image action tag was implemented.
|
70
|
+
- Docker command image action save was implemented.
|
71
|
+
- Docker command container action create was implemented.
|
72
|
+
- Node command exec with NPM and PNPM were implemented.
|
73
|
+
- Ruby command exec and config are interactive.
|
74
|
+
- Python command exec using Kernel.exec was implemented.
|
75
|
+
- Theme color "latest" for semver was created.
|
76
|
+
- Project can be sorted by graph using comparison operator.
|
77
|
+
- Project base command prereqs was created.
|
78
|
+
- Project setter methods for private variables with validation.
|
79
|
+
|
80
|
+
### Changed
|
81
|
+
|
82
|
+
- Mismatched shell quoted options are fixed rather than wrapped.
|
83
|
+
- Python command venv action run was renamed exec.
|
84
|
+
- Ruby command file can accept a glob file pattern.
|
85
|
+
|
86
|
+
### Fixed
|
87
|
+
|
88
|
+
- Shell option quote detection uses Regexp conditionals.
|
89
|
+
- Docker property registry did not detect nil values.
|
90
|
+
- Gem command exec did not include gem option flag.
|
91
|
+
- Project method variable_set did not call block.
|
92
|
+
- Project output divider was not printed when not verbose.
|
93
|
+
|
3
94
|
## [0.4.12] - 2025-05-18
|
4
95
|
|
5
96
|
### Added
|
@@ -24,6 +115,8 @@
|
|
24
115
|
|
25
116
|
## [0.3.11] - 2025-05-15
|
26
117
|
|
118
|
+
### Fixed
|
119
|
+
|
27
120
|
- See `0.2.11`.
|
28
121
|
|
29
122
|
## [0.2.11] - 2025-05-15
|
@@ -286,6 +379,8 @@
|
|
286
379
|
|
287
380
|
## [0.3.7] - 2025-04-08
|
288
381
|
|
382
|
+
### Fixed
|
383
|
+
|
289
384
|
- See `0.2.7`.
|
290
385
|
|
291
386
|
## [0.2.7] - 2025-04-08
|
@@ -707,6 +802,8 @@
|
|
707
802
|
|
708
803
|
- Changelog was created.
|
709
804
|
|
805
|
+
[0.4.14]: https://github.com/anpham6/squared/releases/tag/v0.4.14-ruby
|
806
|
+
[0.4.13]: https://github.com/anpham6/squared/releases/tag/v0.4.13-ruby
|
710
807
|
[0.4.12]: https://github.com/anpham6/squared/releases/tag/v0.4.12-ruby
|
711
808
|
[0.4.11]: https://github.com/anpham6/squared/releases/tag/v0.4.11-ruby
|
712
809
|
[0.4.10]: https://github.com/anpham6/squared/releases/tag/v0.4.10-ruby
|
@@ -720,6 +817,7 @@
|
|
720
817
|
[0.4.2]: https://github.com/anpham6/squared/releases/tag/v0.4.2-ruby
|
721
818
|
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
722
819
|
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
820
|
+
[0.3.12]: https://github.com/anpham6/squared/releases/tag/v0.3.12-ruby
|
723
821
|
[0.3.11]: https://github.com/anpham6/squared/releases/tag/v0.3.11-ruby
|
724
822
|
[0.3.10]: https://github.com/anpham6/squared/releases/tag/v0.3.10-ruby
|
725
823
|
[0.3.9]: https://github.com/anpham6/squared/releases/tag/v0.3.9-ruby
|
@@ -732,6 +830,7 @@
|
|
732
830
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
733
831
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
734
832
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
833
|
+
[0.2.12]: https://github.com/anpham6/squared/releases/tag/v0.2.12-ruby
|
735
834
|
[0.2.11]: https://github.com/anpham6/squared/releases/tag/v0.2.11-ruby
|
736
835
|
[0.2.10]: https://github.com/anpham6/squared/releases/tag/v0.2.10-ruby
|
737
836
|
[0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
|
@@ -744,6 +843,7 @@
|
|
744
843
|
[0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
|
745
844
|
[0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
|
746
845
|
[0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
|
846
|
+
[0.1.9]: https://github.com/anpham6/squared/releases/tag/v0.1.9-ruby
|
747
847
|
[0.1.8]: https://github.com/anpham6/squared/releases/tag/v0.1.8-ruby
|
748
848
|
[0.1.7]: https://github.com/anpham6/squared/releases/tag/v0.1.7-ruby
|
749
849
|
[0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
|
data/README.ruby.md
CHANGED
@@ -480,6 +480,7 @@ Non-task:
|
|
480
480
|
* warn
|
481
481
|
* caution
|
482
482
|
* current
|
483
|
+
* latest
|
483
484
|
* extra
|
484
485
|
* major
|
485
486
|
* red
|
@@ -507,7 +508,7 @@ Most project classes will inherit from `Git` which enables these tasks:
|
|
507
508
|
| restore | restore | staged worktree |
|
508
509
|
| rev | rev | commit output |
|
509
510
|
| show | show | format oneline |
|
510
|
-
| stash | stash | push pop apply drop list
|
511
|
+
| stash | stash | push pop apply branch drop clear list |
|
511
512
|
| switch | switch | create detach merge |
|
512
513
|
| tag | tag | add sign delete list |
|
513
514
|
|
@@ -595,6 +596,9 @@ BANNER_${NAME}=0 #
|
|
595
596
|
|
596
597
|
REVBUILD_FORCE=1 # Rebuild all targets
|
597
598
|
REVBUILD_FORCE_${NAME}=1 # Rebuild project
|
599
|
+
|
600
|
+
PREREQS_${NAME}=build,copy # Class method name to invoke
|
601
|
+
PREREQS_${REF}=depend # e.g. Node
|
598
602
|
```
|
599
603
|
|
600
604
|
### Graph
|
@@ -637,7 +641,7 @@ GIT_AUTOSTASH_${NAME}=0 # rebase (project only)
|
|
637
641
|
| checkout | track | COUNT=n |
|
638
642
|
| checkout | global path | HEAD=s PATHSPEC=s |
|
639
643
|
| checkout | * | FORCE MERGE |
|
640
|
-
| clone | * | DEPTH=n ORIGIN=s BRANCH=s LOCAL=0,1
|
644
|
+
| clone | * | DEPTH=n ORIGIN=s BRANCH=s REVISION=s LOCAL=0,1 |
|
641
645
|
| commit | * | UPSTREAM=s DRY_RUN EDIT=0 M|MESSAGE=s |
|
642
646
|
| diff | -between -contain | MERGE_BASE |
|
643
647
|
| diff | head branch | INDEX=n |
|
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) }
|
data/lib/squared/common/shell.rb
CHANGED
@@ -9,23 +9,23 @@ module Squared
|
|
9
9
|
module_function
|
10
10
|
|
11
11
|
def shell_escape(val, quote: false, force: false, double: false, option: false, override: false)
|
12
|
-
if (r = /\A(--?)([^= ]+)((=|\s+)(["'])?(
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
r[2] = $2
|
19
|
-
override = true
|
20
|
-
end
|
21
|
-
r[1] + r[2] + r[4] + shell_quote(opt, double: double, force: force, override: override)
|
12
|
+
if (r = /\A(--?)([^= ]+)((=|\s+)(["'])?(?(5)(.*)\5|(.*)))?\z/m.match(val = val.to_s))
|
13
|
+
if (data = r[2].match(/\A(["'])(.+)\1\z/))
|
14
|
+
double = data[1] == '"'
|
15
|
+
override = true
|
16
|
+
elsif !r[3] || r[6]
|
17
|
+
return val
|
22
18
|
end
|
23
|
-
if r[
|
24
|
-
r[
|
19
|
+
if r[7].match?(/\A["']/)
|
20
|
+
opt = "#{r[7]}#{r[7][0]}"
|
21
|
+
elsif r[7].match?(/["']\z/)
|
22
|
+
opt = "#{r[7][-1]}#{r[7]}"
|
25
23
|
else
|
26
|
-
|
27
|
-
|
24
|
+
return val unless r[7].match?(/\s/)
|
25
|
+
|
26
|
+
opt = r[7]
|
28
27
|
end
|
28
|
+
r[1] + (data ? data[2] : r[2]) + r[4] + shell_quote(opt, double: double, force: force, override: override)
|
29
29
|
elsif option && val =~ /\A([^=]+)=(.+)\z/m
|
30
30
|
return val if $2.match?(/\A(["']).+\1\z/m)
|
31
31
|
|
@@ -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
|
-
|
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
@@ -94,7 +94,7 @@ module Squared
|
|
94
94
|
@project = {}
|
95
95
|
@kind = {}
|
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)
|
@@ -224,7 +224,7 @@ module Squared
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
end
|
227
|
-
data =
|
227
|
+
data = Struct::ChainData.new(action, step, ns.call(with), ns.call(before), ns.call(after), sync)
|
228
228
|
(@chain[task_name(task.to_s)] ||= []) << data
|
229
229
|
self
|
230
230
|
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
|
@@ -344,6 +344,7 @@ module Squared
|
|
344
344
|
elsif ref < Project::Base
|
345
345
|
ref
|
346
346
|
end) || @kind[name]&.last || Project::Base).new(self, path, name, **kwargs)
|
347
|
+
proj.__send__(:index_set, @project.size)
|
347
348
|
@project[name] = proj
|
348
349
|
__get__(:project)[name] = proj unless kwargs[:private]
|
349
350
|
proj.instance_eval(&blk) if block_given?
|
@@ -366,7 +367,7 @@ module Squared
|
|
366
367
|
end
|
367
368
|
|
368
369
|
def compose(name, &blk)
|
369
|
-
namespace(task_name(name), &blk)
|
370
|
+
namespace(task_name(name), &blk)
|
370
371
|
self
|
371
372
|
end
|
372
373
|
|
@@ -378,7 +379,7 @@ module Squared
|
|
378
379
|
def style(obj, *args, target: nil, empty: false)
|
379
380
|
data = nil
|
380
381
|
if target
|
381
|
-
|
382
|
+
Array(target).each_with_index do |key, i|
|
382
383
|
if i == 0
|
383
384
|
break unless (data = __get__(:theme)[key.to_sym])
|
384
385
|
else
|
@@ -484,7 +485,7 @@ module Squared
|
|
484
485
|
end
|
485
486
|
|
486
487
|
def task_namespace(val, first: false)
|
487
|
-
return
|
488
|
+
return unless (ret = val.to_s.split(':')).size > 1
|
488
489
|
|
489
490
|
first ? ret.first : task_join(*ret[0..-2])
|
490
491
|
end
|
@@ -629,6 +630,14 @@ module Squared
|
|
629
630
|
Rake::Win32.windows?
|
630
631
|
end
|
631
632
|
|
633
|
+
def jruby?
|
634
|
+
RUBY_ENGINE == 'jruby'
|
635
|
+
end
|
636
|
+
|
637
|
+
def jruby_win?
|
638
|
+
jruby? && windows?
|
639
|
+
end
|
640
|
+
|
632
641
|
def docker?
|
633
642
|
!Dir['/.dockerenv', '/docker-*.{sh,d}'].empty?
|
634
643
|
end
|
@@ -783,7 +792,7 @@ module Squared
|
|
783
792
|
task key do
|
784
793
|
unless failed.empty? && group.empty?
|
785
794
|
puts log_message(Logger::ERROR, *(failed + group.map { |val| val.action }.flatten),
|
786
|
-
subject: 'failed placement', hint: false
|
795
|
+
subject: 'failed placement', hint: false)
|
787
796
|
end
|
788
797
|
cols = level.flatten(1).map(&:size).max
|
789
798
|
level.each_with_index do |grp, n|
|
@@ -805,7 +814,7 @@ module Squared
|
|
805
814
|
|
806
815
|
def script_command(task, val, group, ref, on, &blk)
|
807
816
|
if block_given?
|
808
|
-
val =
|
817
|
+
val = Struct::RunData.new(val, blk)
|
809
818
|
elsif !val
|
810
819
|
return self
|
811
820
|
end
|
@@ -826,9 +835,9 @@ module Squared
|
|
826
835
|
def script_set(data, group: nil, ref: nil)
|
827
836
|
data.freeze
|
828
837
|
if group
|
829
|
-
|
838
|
+
Array(group).each { |val| @script[:group!][val.to_sym] = data }
|
830
839
|
elsif ref
|
831
|
-
|
840
|
+
Array(ref).each { |val| @script[:ref!][val.to_sym] = data }
|
832
841
|
else
|
833
842
|
@script[:ref!][:''] = data
|
834
843
|
end
|
@@ -868,7 +877,7 @@ module Squared
|
|
868
877
|
end
|
869
878
|
return false if state == :prod && data[:dev] == true && data[:global]
|
870
879
|
|
871
|
-
target && pat.is_a?(Regexp) ?
|
880
|
+
target && pat.is_a?(Regexp) ? Array(target).any? { |val| val.match?(pat) } : pat == true
|
872
881
|
end
|
873
882
|
|
874
883
|
def scriptobj
|