squared 0.3.6 → 0.4.1
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 +70 -2
- data/README.md +13 -2
- data/README.ruby.md +171 -88
- data/lib/squared/app.rb +1 -0
- data/lib/squared/common/base.rb +6 -1
- data/lib/squared/common/class.rb +1 -1
- data/lib/squared/common/format.rb +32 -15
- data/lib/squared/common/prompt.rb +2 -2
- data/lib/squared/common/shell.rb +52 -39
- data/lib/squared/common/utils.rb +68 -2
- data/lib/squared/config.rb +1 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +16 -13
- data/lib/squared/workspace/project/base.rb +429 -123
- data/lib/squared/workspace/project/docker.rb +622 -0
- data/lib/squared/workspace/project/git.rb +427 -164
- data/lib/squared/workspace/project/node.rb +48 -50
- data/lib/squared/workspace/project/python.rb +115 -25
- data/lib/squared/workspace/project/ruby.rb +33 -35
- data/lib/squared/workspace/project.rb +7 -1
- data/lib/squared/workspace/repo.rb +9 -4
- data/lib/squared/workspace/series.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0ee3da01c8f4091c2363f6c8b0821cbc742d7dd95a4fda4e6a26e949ce0c61f
|
4
|
+
data.tar.gz: 4642f0e308608a80077cddb81ecc3c03ff58a6baaa066b644c1ae8b922d13668
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33f08fcd47d1ac5896a5cc231e8466de17f2edbd2d987fb411c21b8db8cf734b880fefbb4454a69e610a35aa86609e94bac4dc44264e3a10a3cd69efd6429186
|
7
|
+
data.tar.gz: 5e424cb159c5a00512eca6ea9d8a0328082ecb85a30c9e769cd67bbd21d95b16a5d6f906a22a2f2c2d9fecbad5da2721ee1cc4b09722ffbdcbbcbb0a39d0c985
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.1] - 2025-03-20
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Status logger messages are written to file.
|
8
|
+
- Docker command image action push was implemented.
|
9
|
+
- Git command show action textconv was implemented.
|
10
|
+
- Docker mounts for container command run is supported.
|
11
|
+
|
12
|
+
### Removed
|
13
|
+
|
14
|
+
- Git batch commands pull+s and rebase+s were removed.
|
15
|
+
|
3
16
|
## [0.3.6] - 2025-03-12
|
4
17
|
|
5
18
|
### Added
|
@@ -12,6 +25,59 @@
|
|
12
25
|
- Project graph command does not require arguments.
|
13
26
|
- Ruby gem command exec did not add project name.
|
14
27
|
|
28
|
+
## [0.4.0] - 2025-03-06
|
29
|
+
|
30
|
+
### Added
|
31
|
+
|
32
|
+
- Git global command revbuild was created.
|
33
|
+
- Git rev command action build was implemented.
|
34
|
+
- Log messages can be hidden with ENV setting LOG_LEVEL.
|
35
|
+
- Project base command unpack was created.
|
36
|
+
- Project global task archive was created.
|
37
|
+
- Workspace style subject was created.
|
38
|
+
- Python command build was implemented.
|
39
|
+
- Python command publish was implemented.
|
40
|
+
- Project base class Docker was created.
|
41
|
+
- Docker command container action run was implemented.
|
42
|
+
- Docker command container action exec was implemented.
|
43
|
+
- Docker command container targets were implemented.
|
44
|
+
- Project build args can be constructed from a hash.
|
45
|
+
- Docker commands commit with push were implemented.
|
46
|
+
- Docker images can be built from Compose or Bake.
|
47
|
+
- Docker command compose with actions were implemented.
|
48
|
+
- Docker default files for Compose and Bake are detected.
|
49
|
+
- Docker command compose action up was implemented.
|
50
|
+
- Project base tasks can call methods in a series.
|
51
|
+
- Docker command image action list with run was implemented.
|
52
|
+
- Repo build ENV option REPO_DRYRUN was created.
|
53
|
+
- Unicode borders can be activated using enable_aixterm.
|
54
|
+
- Git program options are available to sub-commands.
|
55
|
+
- Git command mv and rm were implemented.
|
56
|
+
- Git command clean was implemented.
|
57
|
+
- Git command merge was implemented.
|
58
|
+
- Git command revert was implemented.
|
59
|
+
- Git global command branch was created.
|
60
|
+
|
61
|
+
### Changed
|
62
|
+
|
63
|
+
- Node copy method will only override when key exists.
|
64
|
+
- Base command copy and clean can accept a hash.
|
65
|
+
- ENV build options are merged with base options.
|
66
|
+
- Git log and diff uses H0 alias for HEAD~n commit.
|
67
|
+
- Project events support multiple associated routines.
|
68
|
+
- Git command restore was relocated to "git" task namespace.
|
69
|
+
|
70
|
+
### Removed
|
71
|
+
|
72
|
+
- Character methods in Shell common module were removed.
|
73
|
+
- Git command diff action cached was removed.
|
74
|
+
|
75
|
+
### Fixed
|
76
|
+
|
77
|
+
- Git base class did not check for null Logger instance.
|
78
|
+
- Banner border width extended past terminal edge.
|
79
|
+
- Task program command options used unrecognized symbol.
|
80
|
+
|
15
81
|
## [0.3.5] - 2025-03-06
|
16
82
|
|
17
83
|
### Fixed
|
@@ -37,7 +103,6 @@
|
|
37
103
|
|
38
104
|
- Project exceptions were hard coded preventing override.
|
39
105
|
- Project clean events were called twice.
|
40
|
-
- Git events were fired for internal background tasks.
|
41
106
|
- Git list display did not support single grep pattern.
|
42
107
|
- Gem outdated did not pass -C option for PWD.
|
43
108
|
|
@@ -228,6 +293,7 @@
|
|
228
293
|
- Git commit hash uses string interpolation format.
|
229
294
|
- Git options ending with "!" use conventional "no-" prefix.
|
230
295
|
- Git pull and reset commands were reduced.
|
296
|
+
- Project graph uses ASCII characters by default.
|
231
297
|
|
232
298
|
### Fixed
|
233
299
|
|
@@ -235,7 +301,7 @@
|
|
235
301
|
- Node tasks without any action are not displayed.
|
236
302
|
- Git fetch commands that do not apply to pull are rejected.
|
237
303
|
|
238
|
-
## [0.1.3] -
|
304
|
+
## [0.1.3] - 2024-01-02
|
239
305
|
|
240
306
|
### Fixed
|
241
307
|
|
@@ -314,6 +380,8 @@
|
|
314
380
|
|
315
381
|
- Changelog was created.
|
316
382
|
|
383
|
+
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
384
|
+
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
317
385
|
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
318
386
|
[0.3.5]: https://github.com/anpham6/squared/releases/tag/v0.3.5-ruby
|
319
387
|
[0.3.4]: https://github.com/anpham6/squared/releases/tag/v0.3.4-ruby
|
data/README.md
CHANGED
@@ -137,19 +137,30 @@ rake clone # node + docs
|
|
137
137
|
# DEV={0,1,local}
|
138
138
|
# DOCS=any
|
139
139
|
# PIPE_FAIL={0,1}
|
140
|
+
# PORT=3000
|
140
141
|
docker build -t squared --build-arg MANIFEST=prod --build-arg SQUARED=prod .
|
141
142
|
docker build -t node --build-arg NODE_TAG=20 --build-arg NODE_INSTALL=pnpm -f Dockerfile.slim . # no docs
|
143
|
+
docker buildx bake node
|
142
144
|
# OR
|
143
145
|
# RUBY_TAG=latest
|
144
146
|
# NODE_VERSION=22.x
|
145
|
-
docker build -t ruby --build-arg RUBY_TAG=3.0 --build-arg NODE_VERSION=20.x --build-arg PIPE_FAIL=0 -f Dockerfile.ruby .
|
147
|
+
docker build -t ruby --build-arg RUBY_TAG=3.0.0 --build-arg NODE_VERSION=20.x --build-arg PIPE_FAIL=0 -f Dockerfile.ruby .
|
148
|
+
docker buildx bake ruby
|
149
|
+
# OR
|
150
|
+
# NGINX_VERSION=1.27
|
151
|
+
# NGINX_VARIANT=bookworm
|
152
|
+
docker build -t nginx --build-arg NGINX_VERSION=1.27 --build-arg PORT=3000 --build-arg NODE_VERSION=18.x -f Dockerfile.nginx .
|
153
|
+
docker buildx bake nginx
|
146
154
|
|
147
155
|
# Express
|
148
|
-
docker run -it --name express --rm -p
|
156
|
+
docker run -it --name express --rm -p 3000:3000 \
|
149
157
|
--mount type=bind,src=${PWD},dst=/workspaces/squared/.config \
|
150
158
|
--mount type=bind,src=${PWD}/html,dst=/workspaces/squared/www \
|
151
159
|
squared
|
152
160
|
|
161
|
+
docker run -it --name express --rm -p 443:443 --build-arg PORT=443 squared \
|
162
|
+
serve --access-all --https --env=production
|
163
|
+
|
153
164
|
# Terminal
|
154
165
|
docker run -it --name debian squared /bin/bash # irb
|
155
166
|
```
|
data/README.ruby.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# squared 0.
|
1
|
+
# squared 0.4
|
2
2
|
|
3
3
|
* [source](https://github.com/anpham6/squared)
|
4
4
|
* [manifest](https://github.com/anpham6/squared-repo)
|
@@ -11,6 +11,7 @@
|
|
11
11
|
| 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 | 2.39 |
|
12
12
|
| 2025-01-07 | 0.2.0 | 2.4.0 | 3.4.0 | 2.39 |
|
13
13
|
| 2025-02-07 | 0.3.0 | 2.4.0 | 3.4.1 | 2.39 |
|
14
|
+
| 2025-03-06 | 0.4.0 | 2.4.0 | 3.4.2 | 2.39 |
|
14
15
|
|
15
16
|
The range chart indicates the latest Ruby tested against at the time of release.
|
16
17
|
|
@@ -45,18 +46,19 @@ require "squared/workspace/repo" # Optional
|
|
45
46
|
require "squared/workspace/project/node" #
|
46
47
|
require "squared/workspace/project/python" #
|
47
48
|
require "squared/workspace/project/ruby" #
|
49
|
+
require "squared/workspace/project/docker" #
|
48
50
|
# OR
|
49
51
|
require "squared/app" # All workspace related modules
|
50
52
|
|
51
53
|
# NODE_ENV = production
|
52
54
|
|
53
|
-
# REPO_ROOT = /workspaces
|
54
|
-
# REPO_HOME = /workspaces/squared
|
55
|
-
# rake = /workspaces/squared/Rakefile
|
55
|
+
# REPO_ROOT = /workspaces |
|
56
|
+
# REPO_HOME = /workspaces/squared | Dir.pwd
|
57
|
+
# rake = /workspaces/squared/Rakefile | main?
|
56
58
|
# OR
|
57
|
-
# REPO_ROOT = /workspaces
|
58
|
-
# rake = /workspaces/Rakefile
|
59
|
-
# REPO_HOME = /workspaces/squared
|
59
|
+
# REPO_ROOT = /workspaces | Dir.pwd
|
60
|
+
# rake = /workspaces/Rakefile |
|
61
|
+
# REPO_HOME = /workspaces/squared | main: "squared"
|
60
62
|
|
61
63
|
# pathname = /workspaces/pathname
|
62
64
|
# optparse = /workspaces/optparse
|
@@ -86,25 +88,37 @@ Workspace::Application
|
|
86
88
|
.add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
|
87
89
|
.add("squared", script: ["build:stage1", "build:stage2"], group: "app") do # Copy target (main)
|
88
90
|
# Repo (global)
|
89
|
-
as(:run, "build:dev", "dev")
|
91
|
+
as(:run, "build:dev", "dev") # npm run build:dev -> npm run dev
|
90
92
|
as(:run, { "build:dev": "dev", "build:prod": "prod" })
|
91
93
|
|
92
|
-
add("publish/sqd-cli", "cli", exclude: [:git])
|
93
|
-
add("publish/sqd-serve")
|
94
|
+
add("publish/sqd-cli", "cli", exclude: [:git]) # rake cli:build
|
95
|
+
add("publish/sqd-serve") # rake sqd-serve:build
|
94
96
|
add("publish/sqd-admin", group: "sqd", exclude: [:base])
|
95
97
|
# OR
|
96
|
-
with(exclude: [:base]) { add("publish/*", "packages") }
|
98
|
+
with(exclude: [:base]) { add("publish/*", "packages") } # rake packages:sqd-serve:build
|
97
99
|
# OR
|
98
|
-
add(["publish/sqd-cli", "publish/sqd-serve"
|
100
|
+
add(["publish/sqd-cli", "publish/sqd-serve"], true, exclude: [:base]) # rake squared:sqd-serve:build
|
99
101
|
end
|
100
|
-
.add("squared/sqd", exclude: :git, pass: [:node,
|
101
|
-
variable_set :script, "build:sqd"
|
102
|
+
.add("squared/sqd", exclude: :git, pass: [:node, "checkout", "bump"]) do # Skip initialize(:node) + squared:checkout:* + squared:bump:*
|
103
|
+
variable_set :script, "build:sqd" # Override detection
|
102
104
|
variable_set :depend, false
|
103
105
|
variable_set :clean, ["build/sqd/"]
|
104
106
|
end
|
107
|
+
.with(:docker, pass: ["unpack"]) do
|
108
|
+
.add("squared", "docker", file: "Dockerfile", context: ".", tag: "latest", registry: "localhost:5000", username: "squared",
|
109
|
+
args: "--ssh=default",
|
110
|
+
secrets: ["id=github,env=GITHUB_TOKEN"],
|
111
|
+
mounts: ["src=.,dst=/project,ro,bind-propagation=rshared"]) do # Docker
|
112
|
+
series(:clean) do # run | depend | doc | lint | test | copy | clean
|
113
|
+
File.read(basepath("docker-bake.hcl"))
|
114
|
+
.scan(/\btags\s+=\s+\["([^"]+)"\]/)
|
115
|
+
.each { |val| image(:rm, tag: val.first) }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
105
119
|
.pass("pull", group: "default") { test? || doc? } # pathname:pull | optparse:pull
|
106
120
|
.style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
|
107
|
-
.build(default: "build", parallel: ["pull", "fetch", "rebase", "copy", "clean", /^outdated:/], pass: [
|
121
|
+
.build(default: "build", parallel: ["pull", "fetch", "rebase", "archive", "copy", "clean", /^outdated:/], pass: ["publish"]) do |workspace|
|
108
122
|
workspace
|
109
123
|
.enable_aixterm
|
110
124
|
.style({
|
@@ -121,19 +135,19 @@ Workspace::Application
|
|
121
135
|
# chrome = /workspaces/chrome-docs
|
122
136
|
|
123
137
|
Workspace::Application
|
124
|
-
.new(ENV["SQUARED_HOME"], prefix: "rb", common: false)
|
138
|
+
.new(ENV["SQUARED_HOME"], prefix: "rb", common: false) # Local styles
|
125
139
|
.group("ruby", "default", run: "rake build", copy: "rake install", clean: "rake clean", ref: :ruby, override: {
|
126
140
|
pathname: {
|
127
|
-
run: "rake compile"
|
141
|
+
run: "rake compile" # rake rb:pathname:build
|
128
142
|
}
|
129
143
|
})
|
130
|
-
.with(:python) do
|
131
|
-
banner([:name, ": ", :version], "path")
|
132
|
-
doc("make html")
|
133
|
-
run(false)
|
134
|
-
exclude(%i[base git])
|
135
|
-
add("android-docs", "android")
|
136
|
-
add("chrome-docs", "chrome")
|
144
|
+
.with(:python) do # ref=Symbol | group=String
|
145
|
+
banner([:name, ": ", :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
|
146
|
+
doc("make html") # rake rb:doc:python
|
147
|
+
run(false) # rake rb:build:python (disabled)
|
148
|
+
exclude(%i[base git]) # Project::Git.ref (superclass)
|
149
|
+
add("android-docs", "android") # rake rb:android:doc
|
150
|
+
add("chrome-docs", "chrome") # rake rb:chrome:doc
|
137
151
|
end
|
138
152
|
.style("inline", "bold")
|
139
153
|
.build
|
@@ -141,6 +155,33 @@ Workspace::Application
|
|
141
155
|
|
142
156
|
**NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
|
143
157
|
|
158
|
+
## Archive
|
159
|
+
|
160
|
+
```ruby
|
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
|
+
|
166
|
+
Workspace::Application
|
167
|
+
.new(main: "squared")
|
168
|
+
.with(:python) do
|
169
|
+
add("android-docs", "android", archive: "https://github.com/anpham6/android-docs/archive/refs/tags/v0.3.0.zip")
|
170
|
+
add("chrome-docs", "chrome", archive: {
|
171
|
+
uri: "https://github.com/anpham6/chrome-docs/archive/refs/tags/v0.5.0.tar.gz", # URI.open (required)
|
172
|
+
digest: "e3d55d2004d4770dd663254c9272dc3baad0d57a5bd14ca767de6546cdf14680", # SHA1 | SHA256 | SHA384 | SHA512 | MD5
|
173
|
+
digest: "rmd160:47b7790a511eed675fec1a3e742845fef058799b", # RMD160
|
174
|
+
ext: "tar.gz", # zip | tar | tar.gz | tgz | tar.xz | txz
|
175
|
+
depth: 1, # nested directories (e.g. --strip-components)
|
176
|
+
headers: { # URI.open
|
177
|
+
"Authorization" => "Bearer RANDOM-TOKEN"
|
178
|
+
}
|
179
|
+
})
|
180
|
+
end
|
181
|
+
.add("squared", release: "https://github.com/anpham6/squared/archive/refs/tags/??") # squared:unpack:zip[v5.4.0,/tmp/squared]
|
182
|
+
end
|
183
|
+
```
|
184
|
+
|
144
185
|
### Clone
|
145
186
|
|
146
187
|
The task is only active when the project directory is empty or does not exist.
|
@@ -179,10 +220,14 @@ Workspace::Application
|
|
179
220
|
end
|
180
221
|
.with(:python) do # rake clone:python
|
181
222
|
add("android-docs")
|
182
|
-
add("chrome-docs")
|
223
|
+
add("chrome-docs") do
|
224
|
+
revbuild(include: "source/", exclude: ["source/conf.py"]) # Limit files being watched
|
225
|
+
end
|
183
226
|
end
|
184
|
-
.git("https://github.com/anpham6") # Uses already defined root projects
|
185
227
|
.git("https://github.com/anpham6", ["emc", "pir"]) # Targets any defined project
|
228
|
+
.git("https://github.com/anpham6", cache: true) # Uses already defined root projects + revbuild
|
229
|
+
.revbuild # Enables task revbuild (squared.revb)
|
230
|
+
.revbuild(file: "../build.json") # $ROOT/build.json
|
186
231
|
.build(parallel: ["clone"]) # rake clone + rake clone:sync
|
187
232
|
```
|
188
233
|
|
@@ -197,45 +242,75 @@ Workspace::Application
|
|
197
242
|
add("chrome-docs", "chrome", graph: "android")
|
198
243
|
end
|
199
244
|
.with(:node) do
|
200
|
-
graph(["build", "copy"], on: {
|
245
|
+
graph(["build", "copy"], on: { # Overrides "git"
|
201
246
|
first: proc { puts "1" },
|
202
247
|
last: proc { puts "2" }
|
203
248
|
})
|
204
|
-
script("build:dev")
|
249
|
+
script("build:dev") # npm run build:dev
|
205
250
|
# OR
|
206
|
-
run([nil, "build:dev", { "PATH" => "~/.bin" }, "--workspace", "--silent"])
|
251
|
+
run([nil, "build:dev", { "PATH" => "~/.bin" }, "--workspace", "--silent"]) # PATH="~/.bin" npm run build:dev --workspace -- --silent
|
252
|
+
# OR
|
253
|
+
run({ # Same
|
254
|
+
script: "build:dev", #
|
255
|
+
env: { "PATH" => "~/.bin" }, #
|
256
|
+
opts: "--workspace", #
|
257
|
+
args: "--silent" #
|
258
|
+
})
|
207
259
|
|
208
260
|
add("e-mc", "emc") do
|
209
|
-
first("build", "emc:clean", "emc:depend")
|
210
|
-
last("build", out: "123") { |out: nil| puts out }
|
211
|
-
error("build") { |err: nil| log.debug err }
|
261
|
+
first("build", "emc:clean", "emc:depend") # rake emc:clean && rake emc:depend && rake emc:build && echo "123"
|
262
|
+
last("build", out: "123") { |out: nil| puts out } #
|
263
|
+
error("build") { |err: nil| log.debug err } #
|
212
264
|
end
|
213
265
|
add("pi-r", "pir", graph: "emc", first: {
|
214
|
-
build: proc { puts self.name }
|
266
|
+
build: proc { puts self.name } # puts "pir"
|
215
267
|
})
|
216
268
|
add("squared-express", "express", graph: "pir")
|
217
269
|
add("squared", graph: ["chrome", "express"]) do
|
218
|
-
first("git:ls-files") { puts
|
219
|
-
|
270
|
+
first("git:ls-files") { puts "1" } # skipped
|
271
|
+
first("git:ls-files", override: true) { puts "2" } # puts "2"
|
272
|
+
last("git:ls-files") { puts workspace.root } # puts "/workspaces"
|
220
273
|
end
|
221
274
|
end
|
222
275
|
.with(:ruby) do
|
223
|
-
run("gem build")
|
276
|
+
run("gem build") # gem build
|
224
277
|
# OR
|
225
|
-
run(["gem build", "--force", { "RUBY_VERSION" => "3.4.0" }])
|
278
|
+
run(["gem build", "--force", { "RUBY_VERSION" => "3.4.0" }]) # RUBY_VERSION="3.4.0" gem build --force
|
279
|
+
# OR
|
280
|
+
run({ #
|
281
|
+
command: "gem build", # RUBY_VERSION="3.4.0" gem build --silent --force
|
282
|
+
opts: "--force", # composable
|
283
|
+
env: { "PATH" => "~/.bin" }, #
|
284
|
+
args: { silent: true } #
|
285
|
+
})
|
226
286
|
# OR
|
227
|
-
run(["gem pristine", ["gem build", "gem cleanup"], nil, "--debug"])
|
287
|
+
run(["gem pristine", ["gem build", "gem cleanup"], nil, "--debug"]) # gem pristine --debug && gem build --debug && gem cleanup --debug
|
288
|
+
#
|
289
|
+
# All commands are either Array or Hash
|
290
|
+
#
|
291
|
+
run([ # PATH="~/.bin" GEM_HOME="~/.gems/ruby-3.4.0" (merged)
|
292
|
+
["gem pristine", "--all", { "PATH" => "~/.bin" }, "--silent"], # gem pristine --silent --all
|
293
|
+
["gem build", { strict: true }, { "GEM_HOME" => "~/.gems/ruby-3.4.0" }] # gem build --strict
|
294
|
+
]) #
|
228
295
|
# OR
|
229
|
-
run([
|
230
|
-
|
231
|
-
|
296
|
+
run([ # Same
|
297
|
+
{ #
|
298
|
+
env: { "PATH" => "~/.bin" }, #
|
299
|
+
command: "gem pristine", #
|
300
|
+
opts: "--all", args: "--silent" #
|
301
|
+
}, #
|
302
|
+
{ #
|
303
|
+
env: { "GEM_HOME" => "~/.gems/ruby-3.4.0" }, #
|
304
|
+
command: "gem build", #
|
305
|
+
opts: { strict: true } #
|
306
|
+
} #
|
232
307
|
])
|
233
308
|
|
234
|
-
add("pathname", test: ["rake test", { jobs: ENV["RAKE_JOBS"] }])
|
309
|
+
add("pathname", test: ["rake test", { jobs: ENV["RAKE_JOBS"] }]) # rake test --jobs 4
|
235
310
|
add("fileutils", graph: "pathname")
|
236
|
-
add("optparse", run: "gem build", env: { "PATH" => "~/.bin" }, opts: "-v")
|
311
|
+
add("optparse", run: "gem build", env: { "PATH" => "~/.bin" }, opts: "-v") # PATH="~/.bin" gem build -v
|
237
312
|
add("rake", graph: ["fileutils", "optparse"])
|
238
|
-
banner(command: false)
|
313
|
+
banner(command: false) # Always hide banner
|
239
314
|
end
|
240
315
|
.build
|
241
316
|
```
|
@@ -314,6 +389,7 @@ Task:
|
|
314
389
|
* run
|
315
390
|
* script
|
316
391
|
* depend
|
392
|
+
* archive
|
317
393
|
* graph
|
318
394
|
* doc
|
319
395
|
* lint
|
@@ -332,7 +408,10 @@ Non-task:
|
|
332
408
|
* header
|
333
409
|
* active
|
334
410
|
* inline
|
411
|
+
* subject
|
412
|
+
* caution
|
335
413
|
* current
|
414
|
+
* extra
|
336
415
|
* major
|
337
416
|
* red
|
338
417
|
* yellow
|
@@ -346,12 +425,14 @@ All project executable programs can have their binary path set to a non-global a
|
|
346
425
|
|
347
426
|
```ruby
|
348
427
|
Common::PATH.merge!({
|
349
|
-
GIT:
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
428
|
+
GIT: "/usr/bin/git",
|
429
|
+
TAR: "/opt/archivers/tar",
|
430
|
+
UNZIP: "/opt/archivers/unzip",
|
431
|
+
GEM: "~/.rvm/gems/ruby-3.4.0/bin/gem",
|
432
|
+
BUNDLE: "~/.rvm/gems/ruby-3.4.0/bin/bundle",
|
433
|
+
RAKE: "~/.rvm/gems/ruby-3.4.0/bin/rake",
|
434
|
+
NPM: "/opt/node/v22.0.0/bin/npm",
|
435
|
+
PYTHON: "#{ENV["PYTHONPATH"]}/bin/python"
|
355
436
|
})
|
356
437
|
```
|
357
438
|
|
@@ -362,32 +443,32 @@ Workspace::Application
|
|
362
443
|
.new
|
363
444
|
.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
|
364
445
|
|
365
|
-
BUILD_TYPE
|
366
|
-
|
367
|
-
# :env :run :opts :type
|
368
|
-
# LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o
|
369
|
-
BUILD_${NAME}
|
370
|
-
BUILD_${NAME}_OPTS
|
371
|
-
BUILD_${NAME}_ENV
|
372
|
-
BUILD_${NAME}_TYPE
|
373
|
-
|
374
|
-
# :env :opts
|
375
|
-
# NODE_ENV="production" NO_COLOR="1" npm run --loglevel=error --workspaces=false
|
376
|
-
BUILD_${NAME}
|
377
|
-
BUILD_${NAME}_OPTS
|
378
|
-
BUILD_${NAME}_ENV
|
379
|
-
BUILD_${NAME}_DEV
|
380
|
-
BUILD_${NAME}_PROD
|
381
|
-
|
382
|
-
|
383
|
-
BUILD_${NAME}=0
|
446
|
+
BUILD_TYPE # global
|
447
|
+
|
448
|
+
# :env :run :args :opts :type
|
449
|
+
# LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -g -O2
|
450
|
+
BUILD_${NAME} # gcc a.c -o a.o
|
451
|
+
BUILD_${NAME}_OPTS # -g
|
452
|
+
BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
|
453
|
+
BUILD_${NAME}_TYPE # debug
|
454
|
+
|
455
|
+
# :env :script :opts :args
|
456
|
+
# NODE_ENV="production" NO_COLOR="1" npm run build:dev --loglevel=error --workspaces=false -- --quiet
|
457
|
+
BUILD_${NAME} # build:dev
|
458
|
+
BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
|
459
|
+
BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
|
460
|
+
BUILD_${NAME}_DEV # pattern,0,1 (:dev)
|
461
|
+
BUILD_${NAME}_PROD # pattern,0,1 (:prod)
|
462
|
+
${REF}_${NAME}_OPTS # --quiet (e.g. NODE_SQUARED_OPTS)
|
463
|
+
|
464
|
+
BUILD_${NAME}=0 # skip project
|
384
465
|
```
|
385
466
|
|
386
467
|
### Graph
|
387
468
|
|
388
469
|
```ruby
|
389
|
-
GRAPH_${NAME}
|
390
|
-
GRAPH_${NAME}_PASS
|
470
|
+
GRAPH_${NAME} # depend,build => squared:depend + squared:build
|
471
|
+
GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
391
472
|
```
|
392
473
|
|
393
474
|
### Logger
|
@@ -395,13 +476,13 @@ GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
|
395
476
|
These global options also can target the project suffix `${NAME}`. (e.g. LOG_FILE_EMC)
|
396
477
|
|
397
478
|
```ruby
|
398
|
-
LOG_FILE
|
479
|
+
LOG_FILE # %Y-%m-%d.log
|
399
480
|
# OR
|
400
|
-
LOG_AUTO
|
481
|
+
LOG_AUTO # year,y,month,m,day,d,1
|
401
482
|
# Optional
|
402
|
-
LOG_DIR
|
403
|
-
LOG_LEVEL
|
404
|
-
LOG_COLUMNS
|
483
|
+
LOG_DIR # exist?
|
484
|
+
LOG_LEVEL # See gem "logger"
|
485
|
+
LOG_COLUMNS # terminal width (default: 80)
|
405
486
|
```
|
406
487
|
|
407
488
|
### Repo
|
@@ -409,17 +490,18 @@ LOG_COLUMNS # terminal width (default: 80)
|
|
409
490
|
These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
|
410
491
|
|
411
492
|
```ruby
|
412
|
-
REPO_ROOT
|
413
|
-
REPO_HOME
|
414
|
-
REPO_BUILD
|
415
|
-
REPO_GROUP
|
416
|
-
REPO_REF
|
417
|
-
REPO_DEV
|
418
|
-
REPO_PROD
|
419
|
-
REPO_WARN
|
420
|
-
REPO_SYNC
|
421
|
-
REPO_MANIFEST
|
422
|
-
|
493
|
+
REPO_ROOT # parent dir
|
494
|
+
REPO_HOME # project dir (main)
|
495
|
+
REPO_BUILD # run,script
|
496
|
+
REPO_GROUP # string
|
497
|
+
REPO_REF # e.g. ruby,node
|
498
|
+
REPO_DEV # pattern,0,1
|
499
|
+
REPO_PROD # pattern,0,1
|
500
|
+
REPO_WARN # 0,1
|
501
|
+
REPO_SYNC # 0,1
|
502
|
+
REPO_MANIFEST # e.g. latest,nightly,prod
|
503
|
+
REPO_DRYRUN # 0,1,2
|
504
|
+
REPO_TIMEOUT # confirm dialog (seconds)
|
423
505
|
```
|
424
506
|
|
425
507
|
## Git
|
@@ -434,11 +516,12 @@ Most project classes will inherit from `Git` which enables these tasks:
|
|
434
516
|
| diff | diff | head cached branch files between contain |
|
435
517
|
| fetch | fetch | origin remote |
|
436
518
|
| files | ls-files | cached modified deleted others ignored |
|
519
|
+
| git | | clean mv restore rm |
|
520
|
+
| merge | merge | commit no-commit send |
|
437
521
|
| pull | pull | origin remote |
|
438
522
|
| rebase | rebase | branch onto send |
|
439
523
|
| refs | ls-remote --refs | heads tags remote |
|
440
524
|
| reset | reset | commit index patch mode |
|
441
|
-
| restore | restore | source worktree staged overlay |
|
442
525
|
| rev | rev | commit branch output parseopt |
|
443
526
|
| show | show | format oneline |
|
444
527
|
| stash | stash | push pop apply drop list |
|
data/lib/squared/app.rb
CHANGED
data/lib/squared/common/base.rb
CHANGED
@@ -13,8 +13,10 @@ module Squared
|
|
13
13
|
BANNER: true,
|
14
14
|
QUOTE: "'",
|
15
15
|
SPACE: ' => ',
|
16
|
-
GRAPH: ['
|
16
|
+
GRAPH: ['|', '-', '|', '\\', '-'].freeze,
|
17
|
+
BORDER: ['|', '-', '-', '-', '-', '-', '|', '|', '-', '-'].freeze,
|
17
18
|
VIEW: 'view',
|
19
|
+
LEVEL: ENV.fetch('LOG_LEVEL', 0).to_i,
|
18
20
|
COLOR: ENV.fetch('NO_COLOR', '').empty?
|
19
21
|
}
|
20
22
|
VAR = {
|
@@ -42,7 +44,10 @@ module Squared
|
|
42
44
|
header: [:bold],
|
43
45
|
active: [:bold],
|
44
46
|
inline: [:bold],
|
47
|
+
subject: [:bold],
|
48
|
+
caution: [:red],
|
45
49
|
current: nil,
|
50
|
+
extra: nil,
|
46
51
|
major: [:bold]
|
47
52
|
},
|
48
53
|
project: {},
|