squared 0.6.4 → 0.6.6
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 +80 -0
- data/README.md +81 -27
- data/lib/squared/common/format.rb +8 -5
- data/lib/squared/common/shell.rb +7 -2
- data/lib/squared/config.rb +14 -12
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +16 -22
- data/lib/squared/workspace/project/base.rb +131 -83
- data/lib/squared/workspace/project/docker.rb +40 -44
- data/lib/squared/workspace/project/git.rb +64 -50
- data/lib/squared/workspace/project/node.rb +123 -105
- data/lib/squared/workspace/project/python.rb +119 -86
- data/lib/squared/workspace/project/ruby.rb +225 -113
- data/lib/squared/workspace/project/support/class.rb +26 -8
- data/lib/squared/workspace/project/support/optionpartition.rb +93 -42
- data/lib/squared/workspace/series.rb +3 -1
- data/lib/squared/workspace.rb +4 -3
- 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: eef895f1332463b52f24d46188726f55878170e90ba8ed9c7dcf1a1fac3bdd41
|
|
4
|
+
data.tar.gz: d8ac6097a8ec74b0dd266558ad273e8ea23ba5994f5c79602875e6ce75d7367a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8569824e8b5cedbb189666ba9e1b67590887afa004ac43bd5c42cc854cf1a61f51ea5709f16a0c55988cfc7ad5cadab0b4b751ce4864bbb46195f3bc97181248
|
|
7
|
+
data.tar.gz: 7f3c48efd9652ee0ad67f5f35bfba87596e6c13f4bb5fb45ebd68aecfb2947e7f43c0ea7dad1bb04e365d45a001d82651e8b59f976274b07e6dda806d0e3bb4c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,79 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.6] - 2025-11-30
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Python application method with stored command options was created.
|
|
8
|
+
- Ruby task depend can install binstubs through ENV.
|
|
9
|
+
- Project application methods can throw exceptions to halt processing.
|
|
10
|
+
- Project application methods can read multiple files from STDIN.
|
|
11
|
+
- Ruby attribute setter gemdir for copy method was created.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Project base method semgte? optional argument compares with RUBY_VERSION.
|
|
16
|
+
- Project task branch in a single workspace displays all branches.
|
|
17
|
+
- Ruby application method first argument can be used as a symbol flag.
|
|
18
|
+
- Ruby task copy does not write into protected system directories.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- RuboCop did not include config file when default was not found.
|
|
23
|
+
- RuboCop path globs are not expanded except for choice selections.
|
|
24
|
+
- Ruby target application file appeared before the delimiter.
|
|
25
|
+
- JoinSet can keep arguments with a duplicate value.
|
|
26
|
+
- OptionPartition did not quarantine options added from extras.
|
|
27
|
+
- Python method pyprojectfile did not always return nil.
|
|
28
|
+
|
|
29
|
+
## [0.5.18] - 2025-11-25
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- See `0.5.18`.
|
|
34
|
+
|
|
35
|
+
## [0.4.32] - 2025-11-25
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- Git method commit did not include --dry-run with add command.
|
|
40
|
+
- JoinSet method include? did not always search to start of delimiter.
|
|
41
|
+
- Config viewer did not check for a readable package registry document.
|
|
42
|
+
- Powershell executable did not check for alternate path location.
|
|
43
|
+
|
|
44
|
+
## [0.5.17] - 2025-11-22
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
- See `0.4.31`.
|
|
49
|
+
|
|
50
|
+
## [0.4.31] - 2025-11-22
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- Ruby command flag is given precedence to a program file.
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- Project change directory context did not always restore when raised.
|
|
59
|
+
- Ruby file method attributes did not always return nil.
|
|
60
|
+
- JoinSet with a delimiter did not report correct size.
|
|
61
|
+
|
|
62
|
+
## [0.6.5] - 2025-11-18
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
- Ruby command rubocop with stored command options was created.
|
|
67
|
+
|
|
68
|
+
### Changed
|
|
69
|
+
|
|
70
|
+
- Node command outdated uses inline interactive prompts.
|
|
71
|
+
- Python task outdated no longer updates packages directly.
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
- Common format method emphasize modified frozen string in Ruby 2.5.
|
|
76
|
+
|
|
3
77
|
## [0.6.4] - 2025-11-16
|
|
4
78
|
|
|
5
79
|
### Added
|
|
@@ -1419,11 +1493,15 @@
|
|
|
1419
1493
|
|
|
1420
1494
|
- Changelog was created.
|
|
1421
1495
|
|
|
1496
|
+
[0.6.6]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.6
|
|
1497
|
+
[0.6.5]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.5
|
|
1422
1498
|
[0.6.4]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.4
|
|
1423
1499
|
[0.6.3]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.3
|
|
1424
1500
|
[0.6.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.2
|
|
1425
1501
|
[0.6.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.1
|
|
1426
1502
|
[0.6.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.6.0
|
|
1503
|
+
[0.5.18]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.18
|
|
1504
|
+
[0.5.17]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.17
|
|
1427
1505
|
[0.5.16]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.16
|
|
1428
1506
|
[0.5.15]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.15
|
|
1429
1507
|
[0.5.14]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.14
|
|
@@ -1441,6 +1519,8 @@
|
|
|
1441
1519
|
[0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
|
|
1442
1520
|
[0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
|
|
1443
1521
|
[0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
|
|
1522
|
+
[0.4.32]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.32
|
|
1523
|
+
[0.4.31]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.31
|
|
1444
1524
|
[0.4.30]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.30
|
|
1445
1525
|
[0.4.29]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.29
|
|
1446
1526
|
[0.4.28]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.28
|
data/README.md
CHANGED
|
@@ -24,23 +24,9 @@ The range chart indicates the latest Ruby tested against at the time of release.
|
|
|
24
24
|
gem install squared
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
### Optional
|
|
28
|
-
|
|
29
|
-
* [Repo](https://source.android.com/docs/setup/reference/repo)
|
|
30
|
-
* https://github.com/anpham6/squared-repo
|
|
31
|
-
* Python 3.6
|
|
32
|
-
* Not compatible with Windows
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
mkdir -p ~/.bin
|
|
36
|
-
PATH="${HOME}/.bin:${PATH}"
|
|
37
|
-
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
|
|
38
|
-
chmod a+rx ~/.bin/repo
|
|
39
|
-
```
|
|
40
|
-
|
|
41
27
|
## Example - Rakefile
|
|
42
28
|
|
|
43
|
-
Projects from any accessible folder can be added relative to the parent directory
|
|
29
|
+
Projects from any accessible folder can be added relative to the parent directory or absolutely. Missing projects will simply be excluded from the task runner.
|
|
44
30
|
|
|
45
31
|
```ruby
|
|
46
32
|
require "squared"
|
|
@@ -56,14 +42,6 @@ require "squared/app" # All workspace related mod
|
|
|
56
42
|
|
|
57
43
|
# NODE_ENV = production
|
|
58
44
|
|
|
59
|
-
# REPO_ROOT = /workspaces |
|
|
60
|
-
# REPO_HOME = /workspaces/squared | Dir.pwd
|
|
61
|
-
# rake = /workspaces/squared/Rakefile | main?
|
|
62
|
-
# OR
|
|
63
|
-
# REPO_ROOT = /workspaces | Dir.pwd
|
|
64
|
-
# rake = /workspaces/Rakefile |
|
|
65
|
-
# REPO_HOME = /workspaces/squared | main: "squared"
|
|
66
|
-
|
|
67
45
|
# pathname = /workspaces/pathname
|
|
68
46
|
# optparse = /workspaces/optparse
|
|
69
47
|
# log = /workspaces/logger
|
|
@@ -82,7 +60,6 @@ Workspace::Application.load_ref('lib/squared/workspace/project', gem: 'squared')
|
|
|
82
60
|
Workspace::Application
|
|
83
61
|
.new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
|
|
84
62
|
.banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
|
|
85
|
-
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "prod"], install: "#{ENV["HOME"]}/.bin", ref: :node) # Repo (optional)
|
|
86
63
|
.run("rake install", ref: :ruby)
|
|
87
64
|
.depend(false, group: "default")
|
|
88
65
|
.clean("rake clean", group: "default")
|
|
@@ -92,7 +69,9 @@ Workspace::Application
|
|
|
92
69
|
"CFLAGS" => "-fPIC -O1"
|
|
93
70
|
})
|
|
94
71
|
.add("optparse", doc: "rake rdoc", gemspec: "optparse.gemspec", group: "default") # Uses bundler/gem_tasks (without C extensions)
|
|
95
|
-
.add("logger", copy: { from: "lib", glob: "**/*.rb", into: "
|
|
72
|
+
.add("logger", copy: { from: "lib", glob: "**/*.rb", into: "/home/user/.local/gem/ruby/3.4.0/gems/logger-1.7.0" }, clean: ["tmp/"]) do # autodetect: true | "rvm" | "rbenv" | "asdf" | "bundler"
|
|
73
|
+
self.gemdir = "/home/user/.local/gem/ruby/3.4.0/gems/logger-1.7.0" # Default for "into"
|
|
74
|
+
end
|
|
96
75
|
.add("e-mc", "emc", copy: { from: "publish", scope: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
|
|
97
76
|
.add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
|
|
98
77
|
.add("pi-r2", "pir2", copy: { from: :npm, also: %i[squared express], files: ["LICENSE", ["README.md.ruby", "README.md"]] }) # Uses dist files from NPM package spec
|
|
@@ -154,7 +133,7 @@ Node = Workspace::Project::Node # tsc
|
|
|
154
133
|
Node.options("build:dev", "target=es2022", project: "tsconfig.json") # :node (ref)
|
|
155
134
|
Node.options("build:dev", "outDir=tmp", :squared) # squared (project name)
|
|
156
135
|
|
|
157
|
-
Ruby = Workspace::Project::Ruby # ruby | gem | rake | bundle | irb | rbs
|
|
136
|
+
Ruby = Workspace::Project::Ruby # ruby | gem | rake | bundle | irb | rbs | rubocop
|
|
158
137
|
Ruby.options("lint", "rubocop", opts: ["gemfile=Gemfile"]) # :ruby
|
|
159
138
|
Ruby.options("lint", "--parallel", :squared)
|
|
160
139
|
|
|
@@ -780,7 +759,37 @@ Workspace::Application
|
|
|
780
759
|
|
|
781
760
|
### Repo
|
|
782
761
|
|
|
783
|
-
|
|
762
|
+
* [Repo](https://source.android.com/docs/setup/reference/repo)
|
|
763
|
+
* https://github.com/anpham6/squared-repo
|
|
764
|
+
* Python 3.6
|
|
765
|
+
* Not compatible with Windows
|
|
766
|
+
|
|
767
|
+
```sh
|
|
768
|
+
mkdir -p ~/.bin
|
|
769
|
+
PATH="${HOME}/.bin:${PATH}"
|
|
770
|
+
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
|
|
771
|
+
chmod a+rx ~/.bin/repo
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
```ruby
|
|
775
|
+
# REPO_ROOT = /workspaces |
|
|
776
|
+
# REPO_HOME = /workspaces/squared | Dir.pwd
|
|
777
|
+
# rake = /workspaces/squared/Rakefile | main?
|
|
778
|
+
#
|
|
779
|
+
# OR
|
|
780
|
+
#
|
|
781
|
+
# REPO_ROOT = /workspaces | Dir.pwd
|
|
782
|
+
# rake = /workspaces/Rakefile |
|
|
783
|
+
# REPO_HOME = /workspaces/squared | main: "squared"
|
|
784
|
+
|
|
785
|
+
Workspace::Application
|
|
786
|
+
.new(main: "squared")
|
|
787
|
+
.repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "prod"], install: "#{ENV["HOME"]}/.bin", ref: :node)
|
|
788
|
+
.add("squared", script: ["build:stage1", "build:stage2"])
|
|
789
|
+
.build
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
These global options also can target the application main suffix `${NAME}`. (e.g. *REPO_ROOT_SQUARED*)
|
|
784
793
|
|
|
785
794
|
```sh
|
|
786
795
|
REPO_ROOT # parent dir
|
|
@@ -801,6 +810,51 @@ REPO_Y # 0,1
|
|
|
801
810
|
REPO_TIMEOUT # confirm dialog (seconds)
|
|
802
811
|
```
|
|
803
812
|
|
|
813
|
+
Other similarly cloned `Repo` repositories can be managed remotely by setting the `REPO_ROOT` environment variable to the location.
|
|
814
|
+
|
|
815
|
+
### Project
|
|
816
|
+
|
|
817
|
+
Features can be enabled through ENV when calling global tasks such as through *CI/CD* automation (e.g. Repo).
|
|
818
|
+
|
|
819
|
+
#### Ruby
|
|
820
|
+
|
|
821
|
+
* Prefix: BUNDLE/GEM/RBS
|
|
822
|
+
|
|
823
|
+
| Command | Flag | ENV |
|
|
824
|
+
| :--------- | :-------- | :---------------------------------------------------------------- |
|
|
825
|
+
| depend | - | BINSTUBS=s JOBS=n |
|
|
826
|
+
| outdated | - | U|UPDATE=major|minor|patch DRY_RUN |
|
|
827
|
+
| gem | outdated | DOCUMENT=0,1 USER_INSTALL=0,1 |
|
|
828
|
+
| rbs | prototype | Y=0,1 |
|
|
829
|
+
|
|
830
|
+
#### Node
|
|
831
|
+
|
|
832
|
+
* Prefix: NPM/PNPM/YARN
|
|
833
|
+
|
|
834
|
+
| Command | Flag | ENV |
|
|
835
|
+
| :------------- | :------------- | :------------------------------------------------------- |
|
|
836
|
+
| depend | - | FORCE CI IGNORE_SCRIPTS |
|
|
837
|
+
| outdated | - | U|UPDATE=major|minor|patch DIFF DRY_RUN |
|
|
838
|
+
| publish | - | OTP=s TAG=s ACCESS=0,1,s DRY_RUN |
|
|
839
|
+
| depend package | * | PACAKGE_LOCK|LOCKFILE=0 NO_LOCKFILE=1 Y |
|
|
840
|
+
| npm pnpm | depend package | CPU=s OS=s LIBC=s |
|
|
841
|
+
| npm | package | SAVE IGNORE_SCRIPTS STRICT_PEER_DEPS |
|
|
842
|
+
| pnpm | depend | ALLOW_BUILD=s PUBLIC_HOIST_PATTERN=s |
|
|
843
|
+
| yarn | depend package | IGNORE_ENGINES=0 |
|
|
844
|
+
|
|
845
|
+
#### Python
|
|
846
|
+
|
|
847
|
+
* Prefix: PIP/POETRY
|
|
848
|
+
|
|
849
|
+
| Command | Flag | ENV |
|
|
850
|
+
| :--------- | :-------- | :---------------------------------------------------------------- |
|
|
851
|
+
| global | * | CACHE_DIR=0,s PROXY=s PYTHON=s COLOR=0 |
|
|
852
|
+
| depend | - | E|EDITABLE=0,s BUILD_ISOLATION=0 |
|
|
853
|
+
| outdated | - | U|UPDATE=major|minor|patch NOT_REQUIRED=0 L|LOCAL DRY_RUN |
|
|
854
|
+
| venv | exec | INTERACTIVE=0 |
|
|
855
|
+
| poetry | * | PROJECT=s |
|
|
856
|
+
| poetry | depend | NO_ROOT |
|
|
857
|
+
|
|
804
858
|
## LICENSE
|
|
805
859
|
|
|
806
860
|
BSD 3-Clause
|
|
@@ -196,9 +196,8 @@ module Squared
|
|
|
196
196
|
args = args.map(&:to_s)
|
|
197
197
|
if level.is_a?(::Numeric)
|
|
198
198
|
if append && respond_to?(:log)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
end
|
|
199
|
+
ref = log rescue nil
|
|
200
|
+
ref.add(level, message(subject, *args, hint: hint, space: ', ')) if ref.is_a?(::Logger)
|
|
202
201
|
end
|
|
203
202
|
return false unless pass || level >= ARG[:LEVEL]
|
|
204
203
|
end
|
|
@@ -220,6 +219,10 @@ module Squared
|
|
|
220
219
|
end
|
|
221
220
|
end
|
|
222
221
|
|
|
222
|
+
def log_warn(*args, **kwargs)
|
|
223
|
+
log_message(Logger::WARN, *args, **kwargs)
|
|
224
|
+
end
|
|
225
|
+
|
|
223
226
|
def log_console(*args, pipe: 1)
|
|
224
227
|
return if args.first == false && args.size == 1
|
|
225
228
|
|
|
@@ -267,7 +270,7 @@ module Squared
|
|
|
267
270
|
out = []
|
|
268
271
|
draw = lambda do |a, b|
|
|
269
272
|
ret = a + (b1 * (n + 2)) + b
|
|
270
|
-
|
|
273
|
+
return ret unless border
|
|
271
274
|
|
|
272
275
|
sub_style ret, border
|
|
273
276
|
end
|
|
@@ -275,7 +278,7 @@ module Squared
|
|
|
275
278
|
pr = lambda do |line|
|
|
276
279
|
s = line.ljust(n)
|
|
277
280
|
sub.each { |h| sub_style!(s, **h) }
|
|
278
|
-
s = "#{b0} #{s} #{b0}"
|
|
281
|
+
s = +"#{b0} #{s} #{b0}"
|
|
279
282
|
if border
|
|
280
283
|
[[/\A(#{Regexp.escape(b0)})(.+)\z/om], [/\A(.+)(#{Regexp.escape(b0)})\z/om, 2]].each do |args|
|
|
281
284
|
sub_style!(s, **opt_style(border, *args))
|
data/lib/squared/common/shell.rb
CHANGED
|
@@ -83,7 +83,11 @@ module Squared
|
|
|
83
83
|
end
|
|
84
84
|
sep = unless flag.empty?
|
|
85
85
|
if flag[0] == '-'
|
|
86
|
-
flag[1] == '-'
|
|
86
|
+
if flag[1] == '-'
|
|
87
|
+
sep
|
|
88
|
+
else
|
|
89
|
+
merge ? '' : ' '
|
|
90
|
+
end
|
|
87
91
|
elsif flag.size == 1
|
|
88
92
|
pre = '-'
|
|
89
93
|
merge ? '' : ' '
|
|
@@ -146,7 +150,8 @@ module Squared
|
|
|
146
150
|
end
|
|
147
151
|
|
|
148
152
|
def shell_bin(name, env: true)
|
|
149
|
-
key = name.upcase
|
|
153
|
+
key = name.to_s.upcase
|
|
154
|
+
key = File.basename(key, '.*') if Rake::Win32.windows?
|
|
150
155
|
shell_quote((env && ENV["PATH_#{key}"]) || PATH[key] || PATH[key.to_sym] || name,
|
|
151
156
|
option: false, force: false, double: true)
|
|
152
157
|
end
|
data/lib/squared/config.rb
CHANGED
|
@@ -22,8 +22,8 @@ module Squared
|
|
|
22
22
|
nil
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def link(project, main = project.dependfile
|
|
26
|
-
return unless project.enabled?
|
|
25
|
+
def link(project, main = project.dependfile&.basename, name = nil, **kwargs, &blk)
|
|
26
|
+
return unless project.enabled? && main
|
|
27
27
|
|
|
28
28
|
ret = new(main, name, project: project, **kwargs)
|
|
29
29
|
ret.instance_eval(&blk) if block_given?
|
|
@@ -87,7 +87,7 @@ module Squared
|
|
|
87
87
|
@required = true
|
|
88
88
|
project ? [project, 'missing'] : %w[name missing]
|
|
89
89
|
end
|
|
90
|
-
warn
|
|
90
|
+
warn log_warn(msg, subject: self.class, hint: hint)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def build
|
|
@@ -159,7 +159,7 @@ module Squared
|
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
def also(path, type = nil, name: nil, **kwargs)
|
|
162
|
-
return self
|
|
162
|
+
return self unless (file = basepath(path)).exist? && !@mime.frozen?
|
|
163
163
|
|
|
164
164
|
ext = mimetype file
|
|
165
165
|
type ||= ext
|
|
@@ -233,10 +233,8 @@ module Squared
|
|
|
233
233
|
end
|
|
234
234
|
return unless (lines = print_keys(type, doc, keys, file: file, opts: opts))
|
|
235
235
|
|
|
236
|
-
title =
|
|
237
|
-
|
|
238
|
-
.to_s
|
|
239
|
-
.sub(/^#{Regexp.escape(File.join(Dir.pwd, ''))}/, '')
|
|
236
|
+
title = File.realpath(file)
|
|
237
|
+
.sub(/^#{Regexp.escape(File.join(Dir.pwd, ''))}/, '')
|
|
240
238
|
emphasize(lines, title: title, sub: unless stdin?
|
|
241
239
|
[
|
|
242
240
|
opt_style(theme[:banner], /\A((?:[^:]|(?<! ):(?! ))+)\z/),
|
|
@@ -244,7 +242,7 @@ module Squared
|
|
|
244
242
|
opt_style(theme[:key], /\A((?~ : ))( : (?!undefined).+)\z/m),
|
|
245
243
|
opt_style(theme[:number], /\A((?~: ): )(-?[\d.]+)(\s*)\z/m, 2),
|
|
246
244
|
opt_style(theme[:string], /\A((?~: ): ")(.+)("\s*)\z/m, 2),
|
|
247
|
-
opt_style(theme[:hash], /\A((?~: ): \{)(.+)(}\s*)\z/m, 2),
|
|
245
|
+
opt_style(theme[:hash], /\A((?~: ): \{)(.+)(\}\s*)\z/m, 2),
|
|
248
246
|
opt_style(theme[:array], /\A((?~: ): \[)(.+)(\]\s*)\z/m, 2),
|
|
249
247
|
opt_style(theme[:boolean], /\A((?~: ): )(true|false)(\s*)\z/m, 2),
|
|
250
248
|
opt_style(theme[:value], /\A((?~: ): (?!undefined))([^"\[{].*)\z/m, 2)
|
|
@@ -289,7 +287,7 @@ module Squared
|
|
|
289
287
|
if stdin?
|
|
290
288
|
puts out.map!(&:last).join("\n")
|
|
291
289
|
else
|
|
292
|
-
out.map! { |
|
|
290
|
+
out.map! { |a, b| '%-*s : %s' % [pad, a, b] }
|
|
293
291
|
end
|
|
294
292
|
end
|
|
295
293
|
|
|
@@ -318,7 +316,9 @@ module Squared
|
|
|
318
316
|
end
|
|
319
317
|
|
|
320
318
|
def warning?
|
|
321
|
-
|
|
319
|
+
return true unless project
|
|
320
|
+
|
|
321
|
+
project.workspace.warning
|
|
322
322
|
end
|
|
323
323
|
|
|
324
324
|
def stdin?
|
|
@@ -343,7 +343,9 @@ module Squared
|
|
|
343
343
|
end
|
|
344
344
|
|
|
345
345
|
def basepath(*args)
|
|
346
|
-
|
|
346
|
+
return Pathname.pwd.join(*args) unless project
|
|
347
|
+
|
|
348
|
+
project.basepath(*args)
|
|
347
349
|
end
|
|
348
350
|
end
|
|
349
351
|
end
|
data/lib/squared/version.rb
CHANGED
|
@@ -191,15 +191,11 @@ module Squared
|
|
|
191
191
|
end
|
|
192
192
|
series.populate(proj, **kwargs)
|
|
193
193
|
end
|
|
194
|
-
|
|
195
194
|
Application.kind_project.each { |obj| obj.populate(self, **kwargs) }
|
|
196
195
|
@extensions.uniq.each { |ext| __send__(ext, **kwargs) }
|
|
197
|
-
|
|
198
196
|
series.build(**kwargs)
|
|
199
197
|
__build__(**kwargs)
|
|
200
|
-
|
|
201
198
|
yield self if block_given?
|
|
202
|
-
|
|
203
199
|
__chain__(**kwargs)
|
|
204
200
|
@closed = true
|
|
205
201
|
self
|
|
@@ -240,18 +236,16 @@ module Squared
|
|
|
240
236
|
|
|
241
237
|
def chain(task, *action, project: nil, step: 0, with: nil, before: nil, after: nil, sync: false,
|
|
242
238
|
group: @group, ref: @ref)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
@project.keys unless prefix
|
|
252
|
-
end
|
|
239
|
+
if project
|
|
240
|
+
action.map! { |val| task_join(project.name, val) }
|
|
241
|
+
elsif (target = group || ref)
|
|
242
|
+
action.map! { |val| task_name(task_join(val, target)) }
|
|
243
|
+
else
|
|
244
|
+
action.map! { |val| task_name(val) }
|
|
245
|
+
keys = @project.keys unless prefix
|
|
246
|
+
end
|
|
253
247
|
ns = lambda do |val|
|
|
254
|
-
|
|
248
|
+
return if (ret = as_a(val, :to_s, flat: true)).empty?
|
|
255
249
|
|
|
256
250
|
ret.map! do |arg|
|
|
257
251
|
if arg.include?(':') || (keys && !keys.include?(arg))
|
|
@@ -433,7 +427,7 @@ module Squared
|
|
|
433
427
|
if key.start_with?(/(\\A|\^)/) || key.match?(/(\\z|\$)\z/)
|
|
434
428
|
@describe[:replace] << [Regexp.new(key), val]
|
|
435
429
|
else
|
|
436
|
-
@describe[val.is_a?(Regexp) ? :pattern : :alias][key
|
|
430
|
+
@describe[val.is_a?(Regexp) ? :pattern : :alias][key] = val
|
|
437
431
|
end
|
|
438
432
|
end
|
|
439
433
|
self
|
|
@@ -452,7 +446,7 @@ module Squared
|
|
|
452
446
|
if ret.empty? && (path || name)
|
|
453
447
|
path &&= rootpath path
|
|
454
448
|
name &&= name.to_s
|
|
455
|
-
if (proj = find { |item|
|
|
449
|
+
if (proj = find { |item| item.path == path || item.name == name })
|
|
456
450
|
ret << proj
|
|
457
451
|
end
|
|
458
452
|
end
|
|
@@ -529,7 +523,7 @@ module Squared
|
|
|
529
523
|
if (base = task_base?(key))
|
|
530
524
|
tasks << key if obj.has?(key, baseref)
|
|
531
525
|
elsif (batch = series.batch_get(key))
|
|
532
|
-
obj.allref
|
|
526
|
+
obj.allref do |ref|
|
|
533
527
|
next unless obj.has?(key, ref) && (data = batch[ref])
|
|
534
528
|
|
|
535
529
|
data.each do |val|
|
|
@@ -548,7 +542,7 @@ module Squared
|
|
|
548
542
|
if tasks.empty?
|
|
549
543
|
return [] if (base && !obj.ref?(baseref)) || !(data = series.alias_get(key))
|
|
550
544
|
|
|
551
|
-
obj.allref
|
|
545
|
+
obj.allref do |ref|
|
|
552
546
|
next unless obj.has?(key, ref) && (alt = data[ref])
|
|
553
547
|
|
|
554
548
|
ret = task_resolve obj, alt
|
|
@@ -592,9 +586,9 @@ module Squared
|
|
|
592
586
|
|
|
593
587
|
def script_find(*args)
|
|
594
588
|
args.reverse_each do |val|
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
589
|
+
if val && (ret = val.is_a?(Symbol) ? @script[:ref!][val] : @script[:group!][val.to_sym])
|
|
590
|
+
return ret
|
|
591
|
+
end
|
|
598
592
|
end
|
|
599
593
|
@script[:ref!][:''] ||= scriptobj
|
|
600
594
|
end
|