squared 0.4.3 → 0.4.4
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 +49 -0
- data/README.ruby.md +130 -61
- data/lib/squared/common/format.rb +2 -6
- data/lib/squared/common/shell.rb +2 -1
- data/lib/squared/common/utils.rb +8 -5
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +10 -1
- data/lib/squared/workspace/project/base.rb +114 -46
- data/lib/squared/workspace/project/docker.rb +125 -58
- data/lib/squared/workspace/project/git.rb +59 -66
- data/lib/squared/workspace/project/node.rb +25 -27
- data/lib/squared/workspace/project/python.rb +213 -79
- data/lib/squared/workspace/project/ruby.rb +96 -40
- data/lib/squared/workspace/repo.rb +1 -1
- 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: 76e13effa08fdb2534843e9fddf53139dbed8462375670966f6cc56ad89338ed
|
4
|
+
data.tar.gz: 0b012aabda216eeb70a76cca881512d34dd9be166ef39f702b0f4b71ee31d7a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 043bc6751cbff73bc30408eecbd089691d712c47db5ebe2cca03bea20c6f500a22cc24f8b9286445bf0336efa9003c9367687c489d7bddefa808f9592e9b9e20
|
7
|
+
data.tar.gz: 927ce35b03ff2ad729ea4b900400657816c4221e7d0372c2f0e7fec69524e2c4d9059fc1d267498ba153e321017876aebe858d966f9028669010d3e924fd2adb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,50 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.4] - 2025-04-08
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Git command restore was implemented.
|
8
|
+
- Python command venv was implemented.
|
9
|
+
- Python command run can use separate VIRTUAL_ENV per project.
|
10
|
+
- Python command depend can manage virtual environment.
|
11
|
+
- Python command pip action freeze was implemented.
|
12
|
+
- Ruby bundle command cache was implemented.
|
13
|
+
- Python command pip action uninstall was implemented.
|
14
|
+
- Docker command network was implemented.
|
15
|
+
- Ruby program irb command was implemented.
|
16
|
+
- Docker containers can have multiple tags.
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
|
20
|
+
- Base command unpack action ext accepts generic extensions.
|
21
|
+
- Docker images not matching project aliases are not listed.
|
22
|
+
- Python dependtype lists poetry.lock (2) before pyproject.toml (3).
|
23
|
+
- Rake command can be run with program options.
|
24
|
+
|
25
|
+
### Fixed
|
26
|
+
|
27
|
+
- Unsafe git commands are prompted before execution.
|
28
|
+
- Unrecognized options are appended selectively on context.
|
29
|
+
- Hatch root options were not applied correctly.
|
30
|
+
|
31
|
+
## [0.3.7] - 2025-04-08
|
32
|
+
|
33
|
+
- See `0.2.7`.
|
34
|
+
|
35
|
+
## [0.2.7] - 2025-04-08
|
36
|
+
|
37
|
+
### Fixed
|
38
|
+
|
39
|
+
- Paths that conflict with git options can be quoted.
|
40
|
+
- Bundle command update did not append package names.
|
41
|
+
- Git result status type was truncated.
|
42
|
+
- Log messages were concatenated without separator.
|
43
|
+
- Python pip environment options used undefined session.
|
44
|
+
- Regexp "o" modifier was not used properly.
|
45
|
+
- Rake did not run individual project Rakefile.
|
46
|
+
- Ruby commands did not delimit exec arguments.
|
47
|
+
|
3
48
|
## [0.4.3] - 2025-04-01
|
4
49
|
|
5
50
|
### Added
|
@@ -102,6 +147,7 @@
|
|
102
147
|
- Git base class did not check for null Logger instance.
|
103
148
|
- Banner border width extended past terminal edge.
|
104
149
|
- Task program command options used unrecognized symbol.
|
150
|
+
- Python pip environment options used undefined session.
|
105
151
|
|
106
152
|
## [0.3.5] - 2025-03-06
|
107
153
|
|
@@ -405,10 +451,12 @@
|
|
405
451
|
|
406
452
|
- Changelog was created.
|
407
453
|
|
454
|
+
[0.4.4]: https://github.com/anpham6/squared/releases/tag/v0.4.4-ruby
|
408
455
|
[0.4.3]: https://github.com/anpham6/squared/releases/tag/v0.4.3-ruby
|
409
456
|
[0.4.2]: https://github.com/anpham6/squared/releases/tag/v0.4.2-ruby
|
410
457
|
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
411
458
|
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
459
|
+
[0.3.7]: https://github.com/anpham6/squared/releases/tag/v0.3.7-ruby
|
412
460
|
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
413
461
|
[0.3.5]: https://github.com/anpham6/squared/releases/tag/v0.3.5-ruby
|
414
462
|
[0.3.4]: https://github.com/anpham6/squared/releases/tag/v0.3.4-ruby
|
@@ -416,6 +464,7 @@
|
|
416
464
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
417
465
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
418
466
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
467
|
+
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
419
468
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
420
469
|
[0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
|
421
470
|
[0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
|
data/README.ruby.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# squared 0.4
|
2
2
|
|
3
3
|
* [source](https://github.com/anpham6/squared)
|
4
|
-
* [manifest](https://github.com/anpham6/squared-repo)
|
5
4
|
* [docs](https://squared.readthedocs.io)
|
6
5
|
|
7
6
|
## Version Compatibility
|
@@ -24,6 +23,7 @@ gem install squared
|
|
24
23
|
### Optional
|
25
24
|
|
26
25
|
* [Repo](https://source.android.com/docs/setup/reference/repo)
|
26
|
+
* https://github.com/anpham6/squared-repo
|
27
27
|
* Python 3.6
|
28
28
|
* Not compatible with Windows
|
29
29
|
|
@@ -155,13 +155,13 @@ Workspace::Application
|
|
155
155
|
|
156
156
|
**NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
|
157
157
|
|
158
|
-
|
158
|
+
### Archive
|
159
159
|
|
160
160
|
```ruby
|
161
|
-
# HEADERS={"Authorization":"Bearer RANDOM-TOKEN"}
|
162
|
-
# ZIP_DEPTH=0
|
163
|
-
# TAR_DEPTH=0
|
164
|
-
# UNPACK_FORCE=1
|
161
|
+
# HEADERS={"Authorization":"Bearer RANDOM-TOKEN"} | hash/json
|
162
|
+
# ZIP_DEPTH=0 | default=1
|
163
|
+
# TAR_DEPTH=0 | TAR_DEPTH_SQUARED
|
164
|
+
# UNPACK_FORCE=1 | Remove target directory
|
165
165
|
|
166
166
|
Workspace::Application
|
167
167
|
.new(main: "squared")
|
@@ -171,7 +171,7 @@ Workspace::Application
|
|
171
171
|
uri: "https://github.com/anpham6/chrome-docs/archive/refs/tags/v0.5.0.tar.gz", # URI.open (required)
|
172
172
|
digest: "e3d55d2004d4770dd663254c9272dc3baad0d57a5bd14ca767de6546cdf14680", # SHA1 | SHA256 | SHA384 | SHA512 | MD5
|
173
173
|
digest: "rmd160:47b7790a511eed675fec1a3e742845fef058799b", # RMD160
|
174
|
-
ext: "tar.gz", # zip | tar | tar.gz | tgz | tar.xz | txz
|
174
|
+
ext: "tar.gz", # zip | tar | tar.gz | tgz | tar.xz | txz | 7z
|
175
175
|
depth: 1, # nested directories (e.g. --strip-components)
|
176
176
|
headers: { # URI.open
|
177
177
|
"Authorization" => "Bearer RANDOM-TOKEN"
|
@@ -238,8 +238,10 @@ Workspace::Application
|
|
238
238
|
.new(main: "squared")
|
239
239
|
.graph(["depend"], ref: :git) # Optional
|
240
240
|
.with(:python) do
|
241
|
-
add("android-docs", "android")
|
242
|
-
add("chrome-docs", "chrome", graph: "android")
|
241
|
+
add("android-docs", "android", venv: "/home/user/.venv") # rake android-docs:depend
|
242
|
+
add("chrome-docs", "chrome", graph: "android", venv: ".venv") do # /workspaces/chrome-docs/.venv
|
243
|
+
variable_set :dependindex, 2 # Use Poetry for dependencies (optional)
|
244
|
+
end
|
243
245
|
end
|
244
246
|
.with(:node) do
|
245
247
|
graph(["build", "copy"], on: { # Overrides "git"
|
@@ -418,6 +420,47 @@ Non-task:
|
|
418
420
|
* yellow
|
419
421
|
* green
|
420
422
|
|
423
|
+
## Git
|
424
|
+
|
425
|
+
Most project classes will inherit from `Git` which enables these tasks:
|
426
|
+
|
427
|
+
| Task | Git | Command |
|
428
|
+
| :--------- | :--------------- | :-------------------------------------------- |
|
429
|
+
| branch | branch | create set delete move copy list edit current |
|
430
|
+
| checkout | checkout | commit branch track detach path |
|
431
|
+
| commit | commit | add all amend amend-orig |
|
432
|
+
| diff | diff | head cached branch files between contain |
|
433
|
+
| fetch | fetch | origin remote |
|
434
|
+
| files | ls-files | cached modified deleted others ignored |
|
435
|
+
| git | | clean mv rm |
|
436
|
+
| merge | merge | commit no-commit send |
|
437
|
+
| pull | pull | origin remote |
|
438
|
+
| rebase | rebase | branch onto send |
|
439
|
+
| refs | ls-remote --refs | heads tags remote |
|
440
|
+
| reset | reset | commit index patch mode |
|
441
|
+
| restore | restore | staged worktree |
|
442
|
+
| rev | rev | commit branch output parseopt |
|
443
|
+
| show | show | format oneline |
|
444
|
+
| stash | stash | push pop apply drop list |
|
445
|
+
| tag | tag | add delete list |
|
446
|
+
|
447
|
+
You can disable all of them at once using the `exclude` property.
|
448
|
+
|
449
|
+
```ruby
|
450
|
+
Workspace::Application
|
451
|
+
.new
|
452
|
+
.add("squared", exclude: :git)
|
453
|
+
```
|
454
|
+
|
455
|
+
You can disable one or more of them using the `pass` property as a *string*.
|
456
|
+
|
457
|
+
```ruby
|
458
|
+
Workspace::Application
|
459
|
+
.new
|
460
|
+
.add("squared", pass: ["pull"], ref: :node)
|
461
|
+
.pass("pull", ref: :node) { read_packagemanager(:private) }
|
462
|
+
```
|
463
|
+
|
421
464
|
## Environment
|
422
465
|
|
423
466
|
### Path
|
@@ -439,7 +482,7 @@ Common::PATH.merge!({
|
|
439
482
|
|
440
483
|
### Build
|
441
484
|
|
442
|
-
```
|
485
|
+
```sh
|
443
486
|
Workspace::Application
|
444
487
|
.new
|
445
488
|
.add("squared", run: "gcc a.c -o a.o", opts: { __debug__: { g: true, O2: true, c: nil }, c: true, j: 4 }) # gcc a.c -o a.o -c -j4
|
@@ -455,19 +498,23 @@ BUILD_${NAME}_TYPE # debug
|
|
455
498
|
|
456
499
|
# :env :script :opts :args
|
457
500
|
# NODE_ENV="production" NO_COLOR="1" npm run build:dev --loglevel=error --workspaces=false -- --quiet
|
458
|
-
BUILD_${NAME}
|
459
|
-
BUILD_${NAME}_OPTS
|
460
|
-
BUILD_${NAME}_ENV
|
461
|
-
BUILD_${NAME}_DEV
|
462
|
-
BUILD_${NAME}_PROD
|
463
|
-
${REF}_${NAME}_OPTS
|
464
|
-
|
465
|
-
BUILD_${NAME}=0
|
501
|
+
BUILD_${NAME} # build:dev
|
502
|
+
BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
|
503
|
+
BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
|
504
|
+
BUILD_${NAME}_DEV # pattern,0,1 (:dev)
|
505
|
+
BUILD_${NAME}_PROD # pattern,0,1 (:prod)
|
506
|
+
${REF}_${NAME}_OPTS # --quiet (e.g. NODE_SQUARED_OPTS)
|
507
|
+
|
508
|
+
BUILD_${NAME}=0 # skip project
|
509
|
+
BUILD_${NAME}_VERSION=0.1.0 # publish + detection
|
510
|
+
|
511
|
+
BANNER=0 # hide banner
|
512
|
+
BANNER_${NAME}=0 #
|
466
513
|
```
|
467
514
|
|
468
515
|
### Graph
|
469
516
|
|
470
|
-
```
|
517
|
+
```sh
|
471
518
|
GRAPH_${NAME} # depend,build => squared:depend + squared:build
|
472
519
|
GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
473
520
|
```
|
@@ -476,7 +523,7 @@ GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
|
476
523
|
|
477
524
|
These global options also can target the project suffix `${NAME}`. (e.g. LOG_FILE_EMC)
|
478
525
|
|
479
|
-
```
|
526
|
+
```sh
|
480
527
|
LOG_FILE # %Y-%m-%d.log
|
481
528
|
# OR
|
482
529
|
LOG_AUTO # year,y,month,m,day,d,1
|
@@ -486,11 +533,72 @@ LOG_LEVEL # See gem "logger"
|
|
486
533
|
LOG_COLUMNS # terminal width (default: 80)
|
487
534
|
```
|
488
535
|
|
536
|
+
### Git
|
537
|
+
|
538
|
+
```sh
|
539
|
+
GIT_OPTIONS=q,strategy=ort # all
|
540
|
+
GIT_OPTIONS_${NAME}=v,ff-only # project only
|
541
|
+
GIT_AUTOSTASH=1 # rebase (all)
|
542
|
+
GIT_AUTOSTASH_${NAME}=0 # rebase (project only)
|
543
|
+
```
|
544
|
+
|
545
|
+
| Command | Flag | ENV |
|
546
|
+
| :--------- | :---------------- | :-------------------------------------------------------------------- |
|
547
|
+
| pull | rebase | AUTOSTASH |
|
548
|
+
| pull | remote | REFSPEC=s |
|
549
|
+
| pull | * | REBASE=0,1 FORCE RECURSE_SUBMODULES=0,1,s |
|
550
|
+
| rebase | branch | HEAD=s |
|
551
|
+
| rebase | onto | INTERACTIVE I HEAD=s |
|
552
|
+
| fetch | -remote | ALL |
|
553
|
+
| fetch | remote | REFSPEC=s |
|
554
|
+
| fetch | * | FORCE RECURSE_SUBMODULES=0,1,s |
|
555
|
+
| clone | * | DEPTH=n ORIGIN=s BRANCH=s LOCAL=0,1 |
|
556
|
+
| stash | push | PATHSPEC=s |
|
557
|
+
| stash | global | ALL=0,1 KEEP_INDEX=0,1 INCLUDE_UNTRACKED=0,1 STAGED=0,1 MESSAGE=s M=s |
|
558
|
+
| status | global | LONG IGNORE_SUBMODULES=s,0-3 PATHSPEC=s |
|
559
|
+
| revbuild | global | UNTRACKED_FILES=s IGNORE_SUBMODULES=s IGNORED=s (status) |
|
560
|
+
| reset | mode (mixed) | N REFRESH=0 |
|
561
|
+
| reset | index | PATHSPEC=s |
|
562
|
+
| reset | -commit | HEAD=s |
|
563
|
+
| checkout | branch | DETACH TRACK=s |
|
564
|
+
| checkout | global path | HEAD=s PATHSPEC=s |
|
565
|
+
| checkout | * | FORCE MERGE |
|
566
|
+
| tag | add | SIGN HEAD=s |
|
567
|
+
| log | * | PATHSPEC=s |
|
568
|
+
| diff | -between -contain | MERGE_BASE |
|
569
|
+
| diff | head branch | INDEX=n |
|
570
|
+
| diff | * | PATHSPEC=s |
|
571
|
+
| commit | * | MESSAGE=s M=s REPOSITORY=s DRY_RUN EDIT=0 |
|
572
|
+
| branch | create | TRACK=0,1,s FORCE |
|
573
|
+
| branch | move copy | FORCE |
|
574
|
+
| branch | global | SYNC |
|
575
|
+
| restore | * | PATHSPEC=s |
|
576
|
+
| show | -online | ABBREV=n |
|
577
|
+
| rev | commit branch | HEAD=s |
|
578
|
+
| git | rm | PATHSPEC=s |
|
579
|
+
|
580
|
+
### Docker
|
581
|
+
|
582
|
+
```sh
|
583
|
+
DOCKER_OPTIONS=q,no-cache # all
|
584
|
+
DOCKER_OPTIONS_${NAME}=v,no-cache=false # project only (override)
|
585
|
+
DOCKER_TAG=latest # all
|
586
|
+
DOCKER_TAG_${NAME}=v0.1.0 # project only (override)
|
587
|
+
```
|
588
|
+
|
589
|
+
| Command | Flag | ENV |
|
590
|
+
| :--------- | :---------------- | :---------------------------------------------- |
|
591
|
+
| buildx | build | TAG=s |
|
592
|
+
| buildx | bake | SERVICE=s |
|
593
|
+
| compose | build | TARGET=s |
|
594
|
+
| container | commit | REGISTRY=s PLATFORM=s DISABLE_CONTENT_TRUST=0,1 |
|
595
|
+
| image | push | TAG=s REGISTRY=s |
|
596
|
+
|
489
597
|
### Repo
|
490
598
|
|
491
599
|
These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
|
492
600
|
|
493
|
-
```
|
601
|
+
```sh
|
494
602
|
REPO_ROOT # parent dir
|
495
603
|
REPO_HOME # project dir (main)
|
496
604
|
REPO_BUILD # run,script
|
@@ -500,51 +608,12 @@ REPO_DEV # pattern,0,1
|
|
500
608
|
REPO_PROD # pattern,0,1
|
501
609
|
REPO_WARN # 0,1
|
502
610
|
REPO_SYNC # 0,1
|
611
|
+
REPO_URL # manifest repository
|
503
612
|
REPO_MANIFEST # e.g. latest,nightly,prod
|
504
613
|
REPO_DRYRUN # 0,1,2
|
505
614
|
REPO_TIMEOUT # confirm dialog (seconds)
|
506
615
|
```
|
507
616
|
|
508
|
-
## Git
|
509
|
-
|
510
|
-
Most project classes will inherit from `Git` which enables these tasks:
|
511
|
-
|
512
|
-
| Task | Git | Command |
|
513
|
-
| :--------- | :--------------- | :-------------------------------------------- |
|
514
|
-
| branch | branch | create set delete move copy list edit current |
|
515
|
-
| checkout | checkout | commit branch track detach path |
|
516
|
-
| commit | commit | add all amend amend-orig |
|
517
|
-
| diff | diff | head cached branch files between contain |
|
518
|
-
| fetch | fetch | origin remote |
|
519
|
-
| files | ls-files | cached modified deleted others ignored |
|
520
|
-
| git | | clean mv restore rm |
|
521
|
-
| merge | merge | commit no-commit send |
|
522
|
-
| pull | pull | origin remote |
|
523
|
-
| rebase | rebase | branch onto send |
|
524
|
-
| refs | ls-remote --refs | heads tags remote |
|
525
|
-
| reset | reset | commit index patch mode |
|
526
|
-
| rev | rev | commit branch output parseopt |
|
527
|
-
| show | show | format oneline |
|
528
|
-
| stash | stash | push pop apply drop list |
|
529
|
-
| tag | tag | add delete list |
|
530
|
-
|
531
|
-
You can disable all of them at once using the `exclude` property.
|
532
|
-
|
533
|
-
```ruby
|
534
|
-
Workspace::Application
|
535
|
-
.new
|
536
|
-
.add("squared", exclude: :git)
|
537
|
-
```
|
538
|
-
|
539
|
-
You can disable one or more of them using the `pass` property as a *string*.
|
540
|
-
|
541
|
-
```ruby
|
542
|
-
Workspace::Application
|
543
|
-
.new
|
544
|
-
.add("squared", pass: ["pull"], ref: :node)
|
545
|
-
.pass("pull", ref: :node) { read_packagemanager(:private) }
|
546
|
-
```
|
547
|
-
|
548
617
|
## LICENSE
|
549
618
|
|
550
619
|
BSD 3-Clause
|
@@ -185,12 +185,8 @@ module Squared
|
|
185
185
|
emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub)
|
186
186
|
else
|
187
187
|
msg = [log_title(level, color: color)]
|
188
|
-
if subject
|
189
|
-
|
190
|
-
else
|
191
|
-
msg += args
|
192
|
-
args.clear
|
193
|
-
end
|
188
|
+
msg << (color ? sub_style(subject, styles: (@theme && @theme[:subject]) || :bold) : subject) if subject
|
189
|
+
msg << args.shift if msg.size == 1
|
194
190
|
message(msg.join(' '), *args, hint: hint)
|
195
191
|
end
|
196
192
|
end
|
data/lib/squared/common/shell.rb
CHANGED
@@ -35,7 +35,8 @@ module Squared
|
|
35
35
|
|
36
36
|
def shell_quote(val, option: true, force: true, double: false, override: false)
|
37
37
|
val = val.to_s
|
38
|
-
return val if
|
38
|
+
return val if !force && !val.include?(' ')
|
39
|
+
return val if option && val.match?(/(?:^|\S=|[^=]\s+|#{Rake::Win32.windows? ? '[\\\/]' : '\/'})(["']).+\1\z/m)
|
39
40
|
|
40
41
|
if double || Rake::Win32.windows? || (ARG[:QUOTE] == '"' && !override)
|
41
42
|
"\"#{val.gsub(/(?<!\\)"/, '\\"')}\""
|
data/lib/squared/common/utils.rb
CHANGED
@@ -9,7 +9,7 @@ module Squared
|
|
9
9
|
module_function
|
10
10
|
|
11
11
|
def split_escape(val, char: ',')
|
12
|
-
val.split(/\s*(?<!\\)#{char}\s*/
|
12
|
+
val.split(/\s*(?<!\\)#{char}\s*/)
|
13
13
|
end
|
14
14
|
|
15
15
|
def split_option(val)
|
@@ -105,12 +105,12 @@ module Squared
|
|
105
105
|
ret = env_value(key, suffix: suffix, strict: strict)
|
106
106
|
return ret == equals.to_s unless equals.nil?
|
107
107
|
|
108
|
-
ret.empty? || (ignore && as_a(ignore).any? { |val|
|
108
|
+
ret.empty? || (ignore && as_a(ignore).any? { |val| val.to_s == ret }) ? default : ret
|
109
109
|
end
|
110
110
|
|
111
111
|
def env_value(key, default = '', suffix: nil, strict: false)
|
112
112
|
if suffix
|
113
|
-
if (ret = ENV["#{key
|
113
|
+
if (ret = ENV["#{key + (@envname ? "_#{@envname}" : '')}_#{suffix}"])
|
114
114
|
return ret
|
115
115
|
elsif strict
|
116
116
|
return default
|
@@ -124,7 +124,10 @@ module Squared
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def env_bool(key, default = false, suffix: nil, strict: false, index: false)
|
127
|
-
|
127
|
+
case key
|
128
|
+
when nil
|
129
|
+
default
|
130
|
+
when ::String
|
128
131
|
case (val = env_value(key, suffix: suffix, strict: strict))
|
129
132
|
when ''
|
130
133
|
default
|
@@ -134,7 +137,7 @@ module Squared
|
|
134
137
|
index && val.to_i > 0 ? val.to_i : true
|
135
138
|
end
|
136
139
|
else
|
137
|
-
key
|
140
|
+
key
|
138
141
|
end
|
139
142
|
end
|
140
143
|
|
data/lib/squared/version.rb
CHANGED
@@ -404,7 +404,7 @@ module Squared
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def task_localname(val)
|
407
|
-
prefix && val.is_a?(String) ? val.sub(/\A#{Regexp.escape(prefix)}
|
407
|
+
prefix && val.is_a?(String) ? val.sub(/\A#{Regexp.escape(prefix)}:/, '') : val.to_s
|
408
408
|
end
|
409
409
|
|
410
410
|
def task_desc(*args, **kwargs)
|
@@ -590,6 +590,15 @@ module Squared
|
|
590
590
|
File.exist?('/.dockerenv')
|
591
591
|
end
|
592
592
|
|
593
|
+
def powershell?
|
594
|
+
case ENV['TERM_PROGRAM']
|
595
|
+
when 'powershell.exe', 'vscode'
|
596
|
+
true
|
597
|
+
else
|
598
|
+
!ENV['PSModulePath'].nil? || !ENV['POWERSHELL_DISTRIBUTION_CHANNEL'].nil?
|
599
|
+
end
|
600
|
+
end
|
601
|
+
|
593
602
|
def rootpath(*args)
|
594
603
|
root.join(*args)
|
595
604
|
end
|