squared 0.8.1 → 0.8.3
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 +99 -0
- data/README.md +33 -30
- data/lib/squared/common/base.rb +7 -0
- data/lib/squared/common/prompt.rb +8 -4
- data/lib/squared/common/utils.rb +9 -1
- data/lib/squared/config.rb +1 -2
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +7 -1
- data/lib/squared/workspace/project/base.rb +43 -11
- data/lib/squared/workspace/project/docker.rb +85 -28
- data/lib/squared/workspace/project/git.rb +296 -122
- data/lib/squared/workspace/project/node.rb +31 -12
- data/lib/squared/workspace/project/python.rb +41 -28
- data/lib/squared/workspace/project/ruby.rb +30 -25
- data/lib/squared/workspace/project/support/optionpartition.rb +35 -4
- data/lib/squared/workspace/project/support/utils.rb +22 -6
- data/lib/squared/workspace/repo.rb +3 -8
- data/lib/squared/workspace/series.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 037121270d4c460552bc1b0c24580e95dc6d70c678ab2d82f3339567ab652c84
|
|
4
|
+
data.tar.gz: 7d7bdbb4164fe03ddfdc64ae0d5b0640cd6d688fa8660f0193399d816f418de1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f96c91ee8cc22e2b81159529e6037b72c07047d7b5fe86834f7fbcf4e89ad884141002d2e47bc121f04c1041a3eb8abc10514f79509e4ee83a1d561dad6d5155
|
|
7
|
+
data.tar.gz: 5984989ccad4013691a522196eaee92d047a1a2ab0636731952143fde8ac20b96ae9789fcde670586f46c474217443840bee1e22b54b8b49991cd3032717ef0d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,95 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.3] - 2026-08-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Docker command options were updated to 29.6.
|
|
8
|
+
- Git command clone was implemented.
|
|
9
|
+
- Docker command [container|compose] action logs was implemented.
|
|
10
|
+
- Git command [refs|files] action remote is interactive.
|
|
11
|
+
- Git command push was implemented.
|
|
12
|
+
- Git command commit action head was implemented.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Python virtual environment will use a detected package manager.
|
|
17
|
+
- Git command argument ref was renamed commit with interactive.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Common prompt method choice did not grep list items.
|
|
22
|
+
|
|
23
|
+
## [0.7.10] - 2026-08-06
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- See `0.6.17`.
|
|
28
|
+
|
|
29
|
+
## [0.6.17]
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- NPM command install can bypass engines with ENV and engine-strict=false.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Ruby command gem action push interactive file selector did nothing.
|
|
38
|
+
- Git choice prompt did not permit optional empty values.
|
|
39
|
+
|
|
40
|
+
## [0.4.40]
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- Series method exclude? was made compatible with v0.8 signature.
|
|
45
|
+
|
|
46
|
+
## [0.8.2] - 2026-07-05
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
|
|
50
|
+
- Docker client global options can be preconfigured for every session.
|
|
51
|
+
- Docker command image action history was implemented.
|
|
52
|
+
- NPM command install can bypass engines with ENV and engine-strict=false.
|
|
53
|
+
|
|
54
|
+
### Changed
|
|
55
|
+
|
|
56
|
+
- OptionPartition method uniq! parameter pass was converted into keyword.
|
|
57
|
+
- Project global ENV for BANNER and STRICT can accept boolean values.
|
|
58
|
+
- Series method exclude? parameter empty was converted into keyword.
|
|
59
|
+
|
|
60
|
+
## [0.7.9] - 2026-07-04
|
|
61
|
+
|
|
62
|
+
### Added
|
|
63
|
+
|
|
64
|
+
- Docker command image action inspect was implemented.
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- Project global ENV for BANNER and STRICT can accept boolean values.
|
|
69
|
+
|
|
70
|
+
## [0.6.16]
|
|
71
|
+
|
|
72
|
+
### Added
|
|
73
|
+
|
|
74
|
+
- Git command pull action all supports filter pattern negation.
|
|
75
|
+
|
|
76
|
+
## [0.5.25]
|
|
77
|
+
|
|
78
|
+
### Fixed
|
|
79
|
+
|
|
80
|
+
- See `0.4.39`.
|
|
81
|
+
|
|
82
|
+
## [0.4.39]
|
|
83
|
+
|
|
84
|
+
### Changed
|
|
85
|
+
|
|
86
|
+
- Common global argument OUT with a file separator overrides PIPE.
|
|
87
|
+
|
|
88
|
+
### Fixed
|
|
89
|
+
|
|
90
|
+
- Git output list results did not hide footer when banner was disabled.
|
|
91
|
+
- Project banners which were empty were being printed.
|
|
92
|
+
|
|
3
93
|
## [0.8.1] - 2026-06-17
|
|
4
94
|
|
|
5
95
|
### Fixed
|
|
@@ -1938,8 +2028,12 @@
|
|
|
1938
2028
|
|
|
1939
2029
|
- Changelog was created.
|
|
1940
2030
|
|
|
2031
|
+
[0.8.3]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.3
|
|
2032
|
+
[0.8.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.2
|
|
1941
2033
|
[0.8.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.1
|
|
1942
2034
|
[0.8.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.8.0
|
|
2035
|
+
[0.7.10]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.10
|
|
2036
|
+
[0.7.9]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.9
|
|
1943
2037
|
[0.7.8]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.8
|
|
1944
2038
|
[0.7.7]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.7
|
|
1945
2039
|
[0.7.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.6
|
|
@@ -1949,6 +2043,8 @@
|
|
|
1949
2043
|
[0.7.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.2
|
|
1950
2044
|
[0.7.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.1
|
|
1951
2045
|
[0.7.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.7.0
|
|
2046
|
+
[0.6.17]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.17
|
|
2047
|
+
[0.6.16]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.16
|
|
1952
2048
|
[0.6.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.15
|
|
1953
2049
|
[0.6.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.14
|
|
1954
2050
|
[0.6.13]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.13
|
|
@@ -1965,6 +2061,7 @@
|
|
|
1965
2061
|
[0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
|
|
1966
2062
|
[0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
|
|
1967
2063
|
[0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
|
|
2064
|
+
[0.5.25]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.25
|
|
1968
2065
|
[0.5.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.24
|
|
1969
2066
|
[0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
|
|
1970
2067
|
[0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
|
|
@@ -1990,6 +2087,8 @@
|
|
|
1990
2087
|
[0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
|
|
1991
2088
|
[0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
|
|
1992
2089
|
[0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
|
|
2090
|
+
[0.4.40]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.40
|
|
2091
|
+
[0.4.39]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.39
|
|
1993
2092
|
[0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
|
|
1994
2093
|
[0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
|
|
1995
2094
|
[0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
|
data/README.md
CHANGED
|
@@ -98,6 +98,7 @@ Workspace::Application
|
|
|
98
98
|
.with(:docker, only: ["build", "compose"], hide: [:windows?]) do # When true hide entire group (formerly pass 0.6.0)
|
|
99
99
|
.add("squared", "docker", file: "Dockerfile", context: ".", tag: "latest", registry: "localhost:5000", username: "squared", # compose publish => { oci: "oci://docker.io" }
|
|
100
100
|
args: "--ssh=default",
|
|
101
|
+
client: { config: '/home/user/.docker', tls: true }, # global options
|
|
101
102
|
secrets: ["id=github,env=GITHUB_TOKEN"],
|
|
102
103
|
mounts: ["src=.,dst=/project,ro,bind-propagation=rshared"]) do # Docker
|
|
103
104
|
series(:clean) do # run | depend | doc | lint | test | copy | clean
|
|
@@ -547,6 +548,7 @@ Most project classes will inherit from `Git` which enables these tasks:
|
|
|
547
548
|
| log | log | view between contain |
|
|
548
549
|
| merge | merge | commit no-commit send |
|
|
549
550
|
| pull | pull | origin remote all |
|
|
551
|
+
| push | push | origin remote commit all tags |
|
|
550
552
|
| range-diff | range-diff | view between contain |
|
|
551
553
|
| rebase | rebase | branch onto send |
|
|
552
554
|
| remote | remote | add select |
|
|
@@ -701,7 +703,7 @@ GIT_COUNT=50 # list display limit
|
|
|
701
703
|
| clone | * | DEPTH=n ORIGIN=s BRANCH=s REVISION=s BARE=1 LOCAL=0,1 |
|
|
702
704
|
| | | SINGLE_BRANCH=0,1 NO_CHECKOUT=1 NO_TAGS=1 QUIET=1 |
|
|
703
705
|
| commit | amend | F|FORCE |
|
|
704
|
-
| commit | * | UPSTREAM=s DRY_RUN EDIT=0 M|MESSAGE=s
|
|
706
|
+
| commit | * | UPSTREAM|ORIGIN=s DRY_RUN EDIT=0 M|MESSAGE=s |
|
|
705
707
|
| diff | head branch | INDEX=n |
|
|
706
708
|
| diff | * | PATHSPEC=s |
|
|
707
709
|
| fetch | -remote | ALL |
|
|
@@ -713,6 +715,7 @@ GIT_COUNT=50 # list display limit
|
|
|
713
715
|
| pull | -remote | REBASE=0,1 ALL |
|
|
714
716
|
| pull | all | FF_ONLY=0 |
|
|
715
717
|
| pull | * | AUTOSTASH F|FORCE RECURSE_SUBMODULES=0,1,s |
|
|
718
|
+
| push | all,tags | ORIGIN=s |
|
|
716
719
|
| range-diff | * | PATHSPEC=s |
|
|
717
720
|
| rebase | branch | HEAD=s |
|
|
718
721
|
| rebase | onto | INTERACTIVE I HEAD=s |
|
|
@@ -736,7 +739,7 @@ GIT_COUNT=50 # list display limit
|
|
|
736
739
|
|
|
737
740
|
### Docker
|
|
738
741
|
|
|
739
|
-
* Version: [29.
|
|
742
|
+
* Version: [29.6](https://docs.docker.com/engine/release-notes/29)
|
|
740
743
|
|
|
741
744
|
```sh
|
|
742
745
|
DOCKER_OPTIONS=q,no-cache # all
|
|
@@ -871,44 +874,44 @@ Features can be enabled through ENV when calling global tasks such as through *C
|
|
|
871
874
|
|
|
872
875
|
* Prefix: BUNDLE/GEM/RBS
|
|
873
876
|
|
|
874
|
-
| Command | Flag | ENV
|
|
875
|
-
| :--------- | :-------- |
|
|
876
|
-
| depend | - | BINSTUBS=s JOBS=n
|
|
877
|
-
| depend | update | VERSION=major|minor|patch STRICT CONSERVATIVE
|
|
878
|
-
| outdated | - | U|UPDATE=major|minor|patch ONLY_EXPLICIT DRY_RUN
|
|
879
|
-
| gem | outdated | DOCUMENT=0,1 USER_INSTALL=0,1
|
|
880
|
-
| rbs | prototype | Y=0,1
|
|
877
|
+
| Command | Flag | ENV |
|
|
878
|
+
| :--------- | :-------- | :------------------------------------------------------------------- |
|
|
879
|
+
| depend | - | BINSTUBS=s JOBS=n |
|
|
880
|
+
| depend | update | VERSION=major|minor|patch STRICT CONSERVATIVE |
|
|
881
|
+
| outdated | - | U|UPDATE=major|minor|patch ONLY_EXPLICIT DRY_RUN |
|
|
882
|
+
| gem | outdated | DOCUMENT=0,1 USER_INSTALL=0,1 |
|
|
883
|
+
| rbs | prototype | Y=0,1 |
|
|
881
884
|
|
|
882
885
|
#### Node
|
|
883
886
|
|
|
884
887
|
* Prefix: NPM/PNPM/YARN
|
|
885
888
|
|
|
886
|
-
| Command | Flag | ENV
|
|
887
|
-
| :------------- | :------------- |
|
|
888
|
-
| depend | - | FORCE CI IGNORE_SCRIPTS
|
|
889
|
-
| outdated | - | U|UPDATE=major|minor|patch SAVE_EXACT DIFF DRY_RUN
|
|
890
|
-
| publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN Y
|
|
891
|
-
| depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y
|
|
892
|
-
| npm | depend | APPROVE_SCRIPTS=s
|
|
893
|
-
| npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS
|
|
894
|
-
| pnpm | depend | PUBLIC_HOIST_PATTERN=s APPROVE_BUILDS
|
|
895
|
-
| pnpm | depend:add | ALLOW_BUILD=s
|
|
896
|
-
| yarn | depend package | IGNORE_ENGINES
|
|
897
|
-
| yarn | depend:add | W|IGNORE_WORKSPACE_ROOT_CHECK=0
|
|
898
|
-
| npm pnpm | depend package | CPU=s OS=s LIBC=s
|
|
889
|
+
| Command | Flag | ENV |
|
|
890
|
+
| :------------- | :------------- | :---------------------------------------------------------- |
|
|
891
|
+
| depend | - | FORCE CI IGNORE_SCRIPTS |
|
|
892
|
+
| outdated | - | U|UPDATE=major|minor|patch SAVE_EXACT DIFF DRY_RUN |
|
|
893
|
+
| publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN Y |
|
|
894
|
+
| depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y |
|
|
895
|
+
| npm | depend | APPROVE_SCRIPTS=0,1,s ALLOW_SCRIPTS=0,1,s ENGINE_STRICT=0,1 |
|
|
896
|
+
| npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS |
|
|
897
|
+
| pnpm | depend | PUBLIC_HOIST_PATTERN=s APPROVE_BUILDS |
|
|
898
|
+
| pnpm | depend:add | ALLOW_BUILD=s |
|
|
899
|
+
| yarn | depend package | IGNORE_ENGINES |
|
|
900
|
+
| yarn | depend:add | W|IGNORE_WORKSPACE_ROOT_CHECK=0 |
|
|
901
|
+
| npm pnpm | depend package | CPU=s OS=s LIBC=s |
|
|
899
902
|
|
|
900
903
|
#### Python
|
|
901
904
|
|
|
902
905
|
* Prefix: PIP/POETRY
|
|
903
906
|
|
|
904
|
-
| Command | Flag | ENV
|
|
905
|
-
| :--------- | :-------- |
|
|
906
|
-
| global | * | CACHE_DIR=0,s PROXY=s PYTHON=s COLOR=0
|
|
907
|
-
| depend | - | E|EDITABLE=0,s BUILD_ISOLATION=0
|
|
908
|
-
| outdated | - | U|UPDATE=major|minor|patch NOT_REQUIRED=0 L|LOCAL DRY_RUN
|
|
909
|
-
| venv | exec | INTERACTIVE=0
|
|
910
|
-
| poetry | * | PROJECT=s
|
|
911
|
-
| poetry | depend | NO_ROOT
|
|
907
|
+
| Command | Flag | ENV |
|
|
908
|
+
| :--------- | :-------- | :------------------------------------------------------------------- |
|
|
909
|
+
| global | * | CACHE_DIR=0,s PROXY=s PYTHON=s COLOR=0 |
|
|
910
|
+
| depend | - | E|EDITABLE=0,s BUILD_ISOLATION=0 |
|
|
911
|
+
| outdated | - | U|UPDATE=major|minor|patch NOT_REQUIRED=0 L|LOCAL DRY_RUN |
|
|
912
|
+
| venv | exec | INTERACTIVE=0 |
|
|
913
|
+
| poetry | * | PROJECT=s |
|
|
914
|
+
| poetry | depend | NO_ROOT |
|
|
912
915
|
|
|
913
916
|
## LICENSE
|
|
914
917
|
|
data/lib/squared/common/base.rb
CHANGED
|
@@ -91,6 +91,13 @@ module Squared
|
|
|
91
91
|
VAR[key.is_a?(::String) ? key.to_sym : key] = val
|
|
92
92
|
end
|
|
93
93
|
|
|
94
|
+
def __arg__(key, name = nil, &blk)
|
|
95
|
+
ret = ARG[key.to_sym]
|
|
96
|
+
return ret unless name && ret.is_a?(::Hash)
|
|
97
|
+
|
|
98
|
+
ret[name = name.downcase] || (block_given? ? ret.fetch(name.to_sym, &blk) : ret[name.to_sym])
|
|
99
|
+
end
|
|
100
|
+
|
|
94
101
|
def __freeze__
|
|
95
102
|
PATH.freeze
|
|
96
103
|
ARG.freeze
|
|
@@ -55,19 +55,23 @@ module Squared
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def choice(msg, list = nil, min: 1, max: 1, multiple: false, index: false, grep: nil, border: nil, auto: true,
|
|
58
|
-
force: true, attempts: 3, timeout: 0)
|
|
58
|
+
force: true, attempts: 3, timeout: 0, empty: nil)
|
|
59
59
|
require 'timeout'
|
|
60
60
|
if list
|
|
61
61
|
grep &&= Array(grep).map { |val| Regexp.new(val) }
|
|
62
62
|
items = list.each_with_object([]) do |val, out|
|
|
63
|
-
next if grep&.none? { |pat| pat.match?(
|
|
63
|
+
next if grep&.none? { |pat| pat.match?(val) }
|
|
64
64
|
|
|
65
65
|
out << val.to_s.chomp
|
|
66
66
|
puts '%2d. %s' % [out.size, val]
|
|
67
67
|
end
|
|
68
68
|
max = items.size
|
|
69
|
-
|
|
69
|
+
if max == 0
|
|
70
|
+
raise ArgumentError, 'empty selection list' unless empty
|
|
70
71
|
|
|
72
|
+
puts empty
|
|
73
|
+
exit 1
|
|
74
|
+
end
|
|
71
75
|
min = grep ? 1 : [min, max].min
|
|
72
76
|
if auto
|
|
73
77
|
auto.times { puts } if auto.is_a?(::Numeric)
|
|
@@ -81,7 +85,7 @@ module Squared
|
|
|
81
85
|
end}] "
|
|
82
86
|
end
|
|
83
87
|
end
|
|
84
|
-
between = ->(s) { s.match?(/^\d+$/) && s.to_i.between?(min, max) }
|
|
88
|
+
between = ->(s) { s.match?(/^\d+$/) && s.to_i.between?(min, max <= min ? Float::INFINITY : max) }
|
|
85
89
|
Timeout.timeout(timeout) do
|
|
86
90
|
while (ch = Prompt.reline.readline(msg))
|
|
87
91
|
ch.strip!
|
data/lib/squared/common/utils.rb
CHANGED
|
@@ -166,11 +166,19 @@ module Squared
|
|
|
166
166
|
end
|
|
167
167
|
|
|
168
168
|
def env_pipe(key, default = 1, root: nil, **kwargs)
|
|
169
|
+
out = 1
|
|
169
170
|
case key
|
|
170
171
|
when ::String
|
|
171
172
|
case (ret = env_value(key, **kwargs))
|
|
172
173
|
when '0', '1', '2'
|
|
173
174
|
return ret.to_i
|
|
175
|
+
else
|
|
176
|
+
out = default if default.is_a?(::Numeric)
|
|
177
|
+
if ret.include?(File::SEPARATOR)
|
|
178
|
+
default = ret
|
|
179
|
+
elsif key.include?(File::SEPARATOR)
|
|
180
|
+
default = key
|
|
181
|
+
end
|
|
174
182
|
end
|
|
175
183
|
when ::Numeric
|
|
176
184
|
return key if key.between?(0, 2)
|
|
@@ -181,7 +189,7 @@ module Squared
|
|
|
181
189
|
(root ? Pathname.new(root) + default : Pathname.new(default)).realdirpath
|
|
182
190
|
rescue => e
|
|
183
191
|
warn e
|
|
184
|
-
|
|
192
|
+
out
|
|
185
193
|
end
|
|
186
194
|
end
|
|
187
195
|
|
data/lib/squared/config.rb
CHANGED
data/lib/squared/version.rb
CHANGED
|
@@ -115,7 +115,13 @@ module Squared
|
|
|
115
115
|
@stage = Support.hashlist
|
|
116
116
|
self.home = home
|
|
117
117
|
self.exception = env_bool exception
|
|
118
|
-
self.pipe = $DEBUG
|
|
118
|
+
self.pipe = if $DEBUG
|
|
119
|
+
2
|
|
120
|
+
elsif (out = ARG[:OUT]) && out.include?(File::SEPARATOR)
|
|
121
|
+
env_pipe(out, pipe, root: home)
|
|
122
|
+
else
|
|
123
|
+
env_pipe(pipe, (out && env(out)) || 1, root: home)
|
|
124
|
+
end
|
|
119
125
|
self.verbose = if $VERBOSE.nil?
|
|
120
126
|
false
|
|
121
127
|
elsif verbose.nil?
|
|
@@ -1175,6 +1175,18 @@ module Squared
|
|
|
1175
1175
|
ret
|
|
1176
1176
|
end
|
|
1177
1177
|
|
|
1178
|
+
def emptypath(val, create: true)
|
|
1179
|
+
ret = basepath(val).realdirpath
|
|
1180
|
+
if ret.exist?
|
|
1181
|
+
raise Errno::EEXIST, message(val, hint: 'not empty') unless ret.directory? && ret.empty?
|
|
1182
|
+
|
|
1183
|
+
ret.rmdir unless create
|
|
1184
|
+
elsif create
|
|
1185
|
+
ret.mkpath
|
|
1186
|
+
end
|
|
1187
|
+
ret
|
|
1188
|
+
end
|
|
1189
|
+
|
|
1178
1190
|
def localname
|
|
1179
1191
|
workspace.task_localname(name)
|
|
1180
1192
|
end
|
|
@@ -1556,7 +1568,7 @@ module Squared
|
|
|
1556
1568
|
def env(key, default = nil, suffix: nil, strict: false, ignore: nil, **kwargs, &blk)
|
|
1557
1569
|
name = "#{key}_#{envname_get}"
|
|
1558
1570
|
ret = if suffix
|
|
1559
|
-
ENV
|
|
1571
|
+
ENV["#{name}_#{suffix}"] || (ignore == false && ENV["#{key}_#{suffix}"]) || ''
|
|
1560
1572
|
elsif strict
|
|
1561
1573
|
ENV[name].to_s
|
|
1562
1574
|
else
|
|
@@ -1612,7 +1624,7 @@ module Squared
|
|
|
1612
1624
|
append_keys(kwargs, b, :opts)
|
|
1613
1625
|
with.concat(c)
|
|
1614
1626
|
end
|
|
1615
|
-
OptionPartition.uniq!(args, pass) if pass
|
|
1627
|
+
OptionPartition.uniq!(args, pass: pass) if pass
|
|
1616
1628
|
[args, kwargs, with]
|
|
1617
1629
|
end
|
|
1618
1630
|
|
|
@@ -1633,7 +1645,7 @@ module Squared
|
|
|
1633
1645
|
end
|
|
1634
1646
|
if args
|
|
1635
1647
|
args.unshift(*a)
|
|
1636
|
-
OptionPartition.uniq!(args, pass) if pass
|
|
1648
|
+
OptionPartition.uniq!(args, pass: pass) if pass
|
|
1637
1649
|
end
|
|
1638
1650
|
kwargs&.update(b) { |_, obj| obj }
|
|
1639
1651
|
nil
|
|
@@ -1703,7 +1715,13 @@ module Squared
|
|
|
1703
1715
|
ret += 1
|
|
1704
1716
|
break out if first
|
|
1705
1717
|
end
|
|
1706
|
-
|
|
1718
|
+
if banner && (ret > 0 || (!pass && !first))
|
|
1719
|
+
if banner.empty?
|
|
1720
|
+
print_item(*lines)
|
|
1721
|
+
else
|
|
1722
|
+
print_item(banner, *lines)
|
|
1723
|
+
end
|
|
1724
|
+
end
|
|
1707
1725
|
ret
|
|
1708
1726
|
end
|
|
1709
1727
|
|
|
@@ -1729,7 +1747,7 @@ module Squared
|
|
|
1729
1747
|
end
|
|
1730
1748
|
|
|
1731
1749
|
def print_run(cmd, banner = true, verbose: nil, **)
|
|
1732
|
-
return if banner || !stdout? || verbose == false || env('BANNER', equals:
|
|
1750
|
+
return if banner || !stdout? || verbose == false || env('BANNER', equals: %w[0 false])
|
|
1733
1751
|
|
|
1734
1752
|
puts "\n> #{cmd}"
|
|
1735
1753
|
printsucc
|
|
@@ -1738,7 +1756,7 @@ module Squared
|
|
|
1738
1756
|
def print_item(*val, series: false)
|
|
1739
1757
|
puts unless printfirst?
|
|
1740
1758
|
printsucc unless series
|
|
1741
|
-
puts val unless val.empty? || (val.size == 1 && !val.first)
|
|
1759
|
+
puts val unless val.empty? || (val.size == 1 && (!val.first || val.first.empty?))
|
|
1742
1760
|
end
|
|
1743
1761
|
|
|
1744
1762
|
def print_banner(*lines, client: false, styles: theme[:banner], border: borderstyle)
|
|
@@ -1902,7 +1920,7 @@ module Squared
|
|
|
1902
1920
|
end
|
|
1903
1921
|
|
|
1904
1922
|
def append_hash(data, target: @session || [], build: false)
|
|
1905
|
-
if build && (type = env('BUILD', suffix: 'TYPE'
|
|
1923
|
+
if build && (type = env('BUILD', suffix: 'TYPE', ignore: false))
|
|
1906
1924
|
if (extra = data[type = "__#{type}__"] || data[type.to_sym]).is_a?(Hash)
|
|
1907
1925
|
data = data.merge(extra)
|
|
1908
1926
|
else
|
|
@@ -2086,8 +2104,8 @@ module Squared
|
|
|
2086
2104
|
args
|
|
2087
2105
|
end
|
|
2088
2106
|
|
|
2089
|
-
def confirm_basic(msg, hint, accept = 'Y', style: :inline, target: @session, prefix:
|
|
2090
|
-
return true if
|
|
2107
|
+
def confirm_basic(msg, hint, accept = 'Y', style: :inline, target: @session, prefix: target&.first, **kwargs)
|
|
2108
|
+
return true if option('y', prefix: prefix)
|
|
2091
2109
|
|
|
2092
2110
|
confirm("#{msg} [#{sub_style(hint.to_s, style.is_a?(Symbol) ? theme[style] : style)}]", accept, **kwargs)
|
|
2093
2111
|
end
|
|
@@ -2701,7 +2719,16 @@ module Squared
|
|
|
2701
2719
|
end
|
|
2702
2720
|
|
|
2703
2721
|
def banner?
|
|
2704
|
-
|
|
2722
|
+
case (val = env('BANNER', ignore: false))
|
|
2723
|
+
when '0', 'false'
|
|
2724
|
+
false
|
|
2725
|
+
else
|
|
2726
|
+
!val.nil? || ARG[:BANNER]
|
|
2727
|
+
end
|
|
2728
|
+
end
|
|
2729
|
+
|
|
2730
|
+
def dryrun?(target: @session, prefix: target&.first, **)
|
|
2731
|
+
Array(target).include?('--dry-run') || !option('dry-run', target: target, prefix: prefix).nil?
|
|
2705
2732
|
end
|
|
2706
2733
|
|
|
2707
2734
|
def pwd?
|
|
@@ -2736,7 +2763,12 @@ module Squared
|
|
|
2736
2763
|
end
|
|
2737
2764
|
|
|
2738
2765
|
def strict?
|
|
2739
|
-
|
|
2766
|
+
case (val = env('STRICT', ignore: false))
|
|
2767
|
+
when '0', 'false'
|
|
2768
|
+
false
|
|
2769
|
+
else
|
|
2770
|
+
!val.nil? || ARG[:STRICT] || exception?(Logger::FATAL)
|
|
2771
|
+
end
|
|
2740
2772
|
end
|
|
2741
2773
|
|
|
2742
2774
|
def serve?
|