squared 0.4.3 → 0.4.5
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 +56 -0
- data/README.ruby.md +131 -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 +12 -1
- data/lib/squared/workspace/project/base.rb +121 -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 +214 -79
- data/lib/squared/workspace/project/ruby.rb +96 -40
- data/lib/squared/workspace/repo.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23d69be4457a4dfa43c961b405d27f834b915aa7c370b2733d2438dc5792b55
|
4
|
+
data.tar.gz: d070c6ee2417ce81709a5fe6ea881e152d7839b6ef4030f8ab7539b2d7552f8f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c4f6c187e2b5dd2f230e972919f48ed4badd124c7b73df86f28ec77c87027898480c3bf02044a5e3c986334214c82ec1eaeb15b52d8424eeafc720086652ee3
|
7
|
+
data.tar.gz: 1ec9ca0ff06a048e13743759b82c3e070be6a23efcc2fce8b7d5cad82e49a65597538e78780b8fe88937a07cd055f26f7c54c4a2554926d04183707c0b0e79fe
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,56 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.5] - 2025-04-09
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- Python virtual environment did not have Powershell permissions.
|
8
|
+
|
9
|
+
## [0.4.4] - 2025-04-08
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- Git command restore was implemented.
|
14
|
+
- Python command venv was implemented.
|
15
|
+
- Python command run can use separate VIRTUAL_ENV per project.
|
16
|
+
- Python command depend can manage virtual environment.
|
17
|
+
- Python command pip action freeze was implemented.
|
18
|
+
- Ruby bundle command cache was implemented.
|
19
|
+
- Python command pip action uninstall was implemented.
|
20
|
+
- Docker command network was implemented.
|
21
|
+
- Ruby program irb command was implemented.
|
22
|
+
- Docker containers can have multiple tags.
|
23
|
+
|
24
|
+
### Changed
|
25
|
+
|
26
|
+
- Base command unpack action ext accepts generic extensions.
|
27
|
+
- Docker images not matching project aliases are not listed.
|
28
|
+
- Python dependtype lists poetry.lock (2) before pyproject.toml (3).
|
29
|
+
- Rake command can be run with program options.
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
33
|
+
- Unsafe git commands are prompted before execution.
|
34
|
+
- Unrecognized options are appended selectively on context.
|
35
|
+
- Hatch root options were not applied correctly.
|
36
|
+
|
37
|
+
## [0.3.7] - 2025-04-08
|
38
|
+
|
39
|
+
- See `0.2.7`.
|
40
|
+
|
41
|
+
## [0.2.7] - 2025-04-08
|
42
|
+
|
43
|
+
### Fixed
|
44
|
+
|
45
|
+
- Paths that conflict with git options can be quoted.
|
46
|
+
- Bundle command update did not append package names.
|
47
|
+
- Git result status type was truncated.
|
48
|
+
- Log messages were concatenated without separator.
|
49
|
+
- Python pip environment options used undefined session.
|
50
|
+
- Regexp "o" modifier was not used properly.
|
51
|
+
- Rake did not run individual project Rakefile.
|
52
|
+
- Ruby commands did not delimit exec arguments.
|
53
|
+
|
3
54
|
## [0.4.3] - 2025-04-01
|
4
55
|
|
5
56
|
### Added
|
@@ -102,6 +153,7 @@
|
|
102
153
|
- Git base class did not check for null Logger instance.
|
103
154
|
- Banner border width extended past terminal edge.
|
104
155
|
- Task program command options used unrecognized symbol.
|
156
|
+
- Python pip environment options used undefined session.
|
105
157
|
|
106
158
|
## [0.3.5] - 2025-03-06
|
107
159
|
|
@@ -405,10 +457,13 @@
|
|
405
457
|
|
406
458
|
- Changelog was created.
|
407
459
|
|
460
|
+
[0.4.5]: https://github.com/anpham6/squared/releases/tag/v0.4.5-ruby
|
461
|
+
[0.4.4]: https://github.com/anpham6/squared/releases/tag/v0.4.4-ruby
|
408
462
|
[0.4.3]: https://github.com/anpham6/squared/releases/tag/v0.4.3-ruby
|
409
463
|
[0.4.2]: https://github.com/anpham6/squared/releases/tag/v0.4.2-ruby
|
410
464
|
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
411
465
|
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
466
|
+
[0.3.7]: https://github.com/anpham6/squared/releases/tag/v0.3.7-ruby
|
412
467
|
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
413
468
|
[0.3.5]: https://github.com/anpham6/squared/releases/tag/v0.3.5-ruby
|
414
469
|
[0.3.4]: https://github.com/anpham6/squared/releases/tag/v0.3.4-ruby
|
@@ -416,6 +471,7 @@
|
|
416
471
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
417
472
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
418
473
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
474
|
+
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
419
475
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
420
476
|
[0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
|
421
477
|
[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,11 @@ Workspace::Application
|
|
238
238
|
.new(main: "squared")
|
239
239
|
.graph(["depend"], ref: :git) # Optional
|
240
240
|
.with(:python) do
|
241
|
-
|
242
|
-
add("
|
241
|
+
doc(windows? ? '.\make.bat html' : 'make html')
|
242
|
+
add("android-docs", "android", venv: "/home/user/.venv") # rake android-docs:depend
|
243
|
+
add("chrome-docs", "chrome", graph: "android", venv: ".venv") do # /workspaces/chrome-docs/.venv
|
244
|
+
variable_set :dependindex, 2 # Use Poetry for dependencies (optional)
|
245
|
+
end
|
243
246
|
end
|
244
247
|
.with(:node) do
|
245
248
|
graph(["build", "copy"], on: { # Overrides "git"
|
@@ -418,6 +421,47 @@ Non-task:
|
|
418
421
|
* yellow
|
419
422
|
* green
|
420
423
|
|
424
|
+
## Git
|
425
|
+
|
426
|
+
Most project classes will inherit from `Git` which enables these tasks:
|
427
|
+
|
428
|
+
| Task | Git | Command |
|
429
|
+
| :--------- | :--------------- | :-------------------------------------------- |
|
430
|
+
| branch | branch | create set delete move copy list edit current |
|
431
|
+
| checkout | checkout | commit branch track detach path |
|
432
|
+
| commit | commit | add all amend amend-orig |
|
433
|
+
| diff | diff | head cached branch files between contain |
|
434
|
+
| fetch | fetch | origin remote |
|
435
|
+
| files | ls-files | cached modified deleted others ignored |
|
436
|
+
| git | | clean mv rm |
|
437
|
+
| merge | merge | commit no-commit send |
|
438
|
+
| pull | pull | origin remote |
|
439
|
+
| rebase | rebase | branch onto send |
|
440
|
+
| refs | ls-remote --refs | heads tags remote |
|
441
|
+
| reset | reset | commit index patch mode |
|
442
|
+
| restore | restore | staged worktree |
|
443
|
+
| rev | rev | commit branch output parseopt |
|
444
|
+
| show | show | format oneline |
|
445
|
+
| stash | stash | push pop apply drop list |
|
446
|
+
| tag | tag | add delete list |
|
447
|
+
|
448
|
+
You can disable all of them at once using the `exclude` property.
|
449
|
+
|
450
|
+
```ruby
|
451
|
+
Workspace::Application
|
452
|
+
.new
|
453
|
+
.add("squared", exclude: :git)
|
454
|
+
```
|
455
|
+
|
456
|
+
You can disable one or more of them using the `pass` property as a *string*.
|
457
|
+
|
458
|
+
```ruby
|
459
|
+
Workspace::Application
|
460
|
+
.new
|
461
|
+
.add("squared", pass: ["pull"], ref: :node)
|
462
|
+
.pass("pull", ref: :node) { read_packagemanager(:private) }
|
463
|
+
```
|
464
|
+
|
421
465
|
## Environment
|
422
466
|
|
423
467
|
### Path
|
@@ -439,7 +483,7 @@ Common::PATH.merge!({
|
|
439
483
|
|
440
484
|
### Build
|
441
485
|
|
442
|
-
```
|
486
|
+
```sh
|
443
487
|
Workspace::Application
|
444
488
|
.new
|
445
489
|
.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 +499,23 @@ BUILD_${NAME}_TYPE # debug
|
|
455
499
|
|
456
500
|
# :env :script :opts :args
|
457
501
|
# 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
|
502
|
+
BUILD_${NAME} # build:dev
|
503
|
+
BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
|
504
|
+
BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
|
505
|
+
BUILD_${NAME}_DEV # pattern,0,1 (:dev)
|
506
|
+
BUILD_${NAME}_PROD # pattern,0,1 (:prod)
|
507
|
+
${REF}_${NAME}_OPTS # --quiet (e.g. NODE_SQUARED_OPTS)
|
508
|
+
|
509
|
+
BUILD_${NAME}=0 # skip project
|
510
|
+
BUILD_${NAME}_VERSION=0.1.0 # publish + detection
|
511
|
+
|
512
|
+
BANNER=0 # hide banner
|
513
|
+
BANNER_${NAME}=0 #
|
466
514
|
```
|
467
515
|
|
468
516
|
### Graph
|
469
517
|
|
470
|
-
```
|
518
|
+
```sh
|
471
519
|
GRAPH_${NAME} # depend,build => squared:depend + squared:build
|
472
520
|
GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
473
521
|
```
|
@@ -476,7 +524,7 @@ GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
|
476
524
|
|
477
525
|
These global options also can target the project suffix `${NAME}`. (e.g. LOG_FILE_EMC)
|
478
526
|
|
479
|
-
```
|
527
|
+
```sh
|
480
528
|
LOG_FILE # %Y-%m-%d.log
|
481
529
|
# OR
|
482
530
|
LOG_AUTO # year,y,month,m,day,d,1
|
@@ -486,11 +534,72 @@ LOG_LEVEL # See gem "logger"
|
|
486
534
|
LOG_COLUMNS # terminal width (default: 80)
|
487
535
|
```
|
488
536
|
|
537
|
+
### Git
|
538
|
+
|
539
|
+
```sh
|
540
|
+
GIT_OPTIONS=q,strategy=ort # all
|
541
|
+
GIT_OPTIONS_${NAME}=v,ff-only # project only
|
542
|
+
GIT_AUTOSTASH=1 # rebase (all)
|
543
|
+
GIT_AUTOSTASH_${NAME}=0 # rebase (project only)
|
544
|
+
```
|
545
|
+
|
546
|
+
| Command | Flag | ENV |
|
547
|
+
| :--------- | :---------------- | :-------------------------------------------------------------------- |
|
548
|
+
| pull | rebase | AUTOSTASH |
|
549
|
+
| pull | remote | REFSPEC=s |
|
550
|
+
| pull | * | REBASE=0,1 FORCE RECURSE_SUBMODULES=0,1,s |
|
551
|
+
| rebase | branch | HEAD=s |
|
552
|
+
| rebase | onto | INTERACTIVE I HEAD=s |
|
553
|
+
| fetch | -remote | ALL |
|
554
|
+
| fetch | remote | REFSPEC=s |
|
555
|
+
| fetch | * | FORCE RECURSE_SUBMODULES=0,1,s |
|
556
|
+
| clone | * | DEPTH=n ORIGIN=s BRANCH=s LOCAL=0,1 |
|
557
|
+
| stash | push | PATHSPEC=s |
|
558
|
+
| stash | global | ALL=0,1 KEEP_INDEX=0,1 INCLUDE_UNTRACKED=0,1 STAGED=0,1 MESSAGE=s M=s |
|
559
|
+
| status | global | LONG IGNORE_SUBMODULES=s,0-3 PATHSPEC=s |
|
560
|
+
| revbuild | global | UNTRACKED_FILES=s IGNORE_SUBMODULES=s IGNORED=s (status) |
|
561
|
+
| reset | mode (mixed) | N REFRESH=0 |
|
562
|
+
| reset | index | PATHSPEC=s |
|
563
|
+
| reset | -commit | HEAD=s |
|
564
|
+
| checkout | branch | DETACH TRACK=s |
|
565
|
+
| checkout | global path | HEAD=s PATHSPEC=s |
|
566
|
+
| checkout | * | FORCE MERGE |
|
567
|
+
| tag | add | SIGN HEAD=s |
|
568
|
+
| log | * | PATHSPEC=s |
|
569
|
+
| diff | -between -contain | MERGE_BASE |
|
570
|
+
| diff | head branch | INDEX=n |
|
571
|
+
| diff | * | PATHSPEC=s |
|
572
|
+
| commit | * | MESSAGE=s M=s REPOSITORY=s DRY_RUN EDIT=0 |
|
573
|
+
| branch | create | TRACK=0,1,s FORCE |
|
574
|
+
| branch | move copy | FORCE |
|
575
|
+
| branch | global | SYNC |
|
576
|
+
| restore | * | PATHSPEC=s |
|
577
|
+
| show | -online | ABBREV=n |
|
578
|
+
| rev | commit branch | HEAD=s |
|
579
|
+
| git | rm | PATHSPEC=s |
|
580
|
+
|
581
|
+
### Docker
|
582
|
+
|
583
|
+
```sh
|
584
|
+
DOCKER_OPTIONS=q,no-cache # all
|
585
|
+
DOCKER_OPTIONS_${NAME}=v,no-cache=false # project only (override)
|
586
|
+
DOCKER_TAG=latest # all
|
587
|
+
DOCKER_TAG_${NAME}=v0.1.0 # project only (override)
|
588
|
+
```
|
589
|
+
|
590
|
+
| Command | Flag | ENV |
|
591
|
+
| :--------- | :---------------- | :---------------------------------------------- |
|
592
|
+
| buildx | build | TAG=s |
|
593
|
+
| buildx | bake | SERVICE=s |
|
594
|
+
| compose | build | TARGET=s |
|
595
|
+
| container | commit | REGISTRY=s PLATFORM=s DISABLE_CONTENT_TRUST=0,1 |
|
596
|
+
| image | push | TAG=s REGISTRY=s |
|
597
|
+
|
489
598
|
### Repo
|
490
599
|
|
491
600
|
These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
|
492
601
|
|
493
|
-
```
|
602
|
+
```sh
|
494
603
|
REPO_ROOT # parent dir
|
495
604
|
REPO_HOME # project dir (main)
|
496
605
|
REPO_BUILD # run,script
|
@@ -500,51 +609,12 @@ REPO_DEV # pattern,0,1
|
|
500
609
|
REPO_PROD # pattern,0,1
|
501
610
|
REPO_WARN # 0,1
|
502
611
|
REPO_SYNC # 0,1
|
612
|
+
REPO_URL # manifest repository
|
503
613
|
REPO_MANIFEST # e.g. latest,nightly,prod
|
504
614
|
REPO_DRYRUN # 0,1,2
|
505
615
|
REPO_TIMEOUT # confirm dialog (seconds)
|
506
616
|
```
|
507
617
|
|
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
618
|
## LICENSE
|
549
619
|
|
550
620
|
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,17 @@ module Squared
|
|
590
590
|
File.exist?('/.dockerenv')
|
591
591
|
end
|
592
592
|
|
593
|
+
def powershell?
|
594
|
+
return false unless windows?
|
595
|
+
|
596
|
+
case ENV['TERM_PROGRAM']
|
597
|
+
when 'powershell.exe', 'vscode'
|
598
|
+
true
|
599
|
+
else
|
600
|
+
ENV.fetch('PSModulePath', '').split(';').size > 1
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
593
604
|
def rootpath(*args)
|
594
605
|
root.join(*args)
|
595
606
|
end
|