squared 0.4.17 → 0.4.19

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.
data/README.ruby.md DELETED
@@ -1,725 +0,0 @@
1
- # squared 0.4
2
-
3
- * [source](https://github.com/anpham6/squared)
4
- * [docs](https://squared.readthedocs.io)
5
-
6
- ## Version Compatibility
7
-
8
- | Date | squared | Min | Max | Git |
9
- | :--------: | ------: | -----: | -----: | -----: |
10
- | 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 | 2.39 |
11
- | 2025-01-07 | 0.2.0 | 2.4.0 | 3.4.0 | 2.39 |
12
- | 2025-02-07 | 0.3.0 | 2.4.0 | 3.4.1 | 2.39 |
13
- | 2025-03-06 | 0.4.0 | 2.4.0 | 3.4.2 | 2.39 |
14
-
15
- The range chart indicates the latest Ruby tested against at the time of release.
16
-
17
- ## Installation
18
-
19
- ```sh
20
- gem install squared
21
- ```
22
-
23
- ### Optional
24
-
25
- * [Repo](https://source.android.com/docs/setup/reference/repo)
26
- * https://github.com/anpham6/squared-repo
27
- * Python 3.6
28
- * Not compatible with Windows
29
-
30
- ```sh
31
- mkdir -p ~/.bin
32
- PATH="${HOME}/.bin:${PATH}"
33
- curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
34
- chmod a+rx ~/.bin/repo
35
- ```
36
-
37
- ## Example - Rakefile
38
-
39
- Projects from any accessible folder can be added relative to the parent directory (e.g. *REPO_ROOT*) or absolutely. The same Rakefile can also manage other similarly cloned `Repo` repositories remotely by setting the `REPO_ROOT` environment variable to the location. Missing projects will simply be excluded from the task runner.
40
-
41
- ```ruby
42
- require "squared"
43
-
44
- require "squared/workspace"
45
- require "squared/workspace/repo" # Optional
46
- require "squared/workspace/project/node" #
47
- require "squared/workspace/project/python" #
48
- require "squared/workspace/project/ruby" #
49
- require "squared/workspace/project/docker" #
50
- # OR
51
- require "squared/app" # All workspace related modules
52
-
53
- # NODE_ENV = production
54
-
55
- # REPO_ROOT = /workspaces |
56
- # REPO_HOME = /workspaces/squared | Dir.pwd
57
- # rake = /workspaces/squared/Rakefile | main?
58
- # OR
59
- # REPO_ROOT = /workspaces | Dir.pwd
60
- # rake = /workspaces/Rakefile |
61
- # REPO_HOME = /workspaces/squared | main: "squared"
62
-
63
- # pathname = /workspaces/pathname
64
- # optparse = /workspaces/optparse
65
- # log = /workspaces/logger
66
- # emc = /workspaces/e-mc
67
- # pir = /workspaces/pi-r
68
- # pir2 = /workspaces/pi-r2
69
- # squared = /workspaces/squared
70
- # cli = /workspaces/squared/publish/sqd-cli
71
- # sqd-serve = /workspaces/squared/publish/sqd-serve
72
- # sqd = /workspaces/squared/sqd
73
-
74
- Workspace::Application
75
- .new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
76
- .banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
77
- .repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
78
- .run("rake install", ref: :ruby)
79
- .depend(false, group: "default")
80
- .clean("rake clean", group: "default")
81
- .clean(["build/"], group: "app")
82
- .log({ file: "tmp/%Y-%m-%d.log", level: "debug" }, group: "app")
83
- .add("pathname", run: "rake compile", copy: "rake install", test: "rake test", group: "default", env: { # Ruby (with C extensions)
84
- "CFLAGS" => "-fPIC -O1"
85
- })
86
- .add("optparse", doc: "rake rdoc", gemspec: "optparse.gemspec", group: "default") # Uses bundler/gem_tasks (without C extensions)
87
- .add("logger", copy: { from: "lib", glob: "**/*.rb", into: "~/.rvm/gems/ruby-3.4.0/gems/logger-1.6.1" }, clean: ["tmp/"]) # autodetect: true | "rvm" | "rbenv" | "asdf" | "bundler"
88
- .add("e-mc", "emc", copy: { from: "publish", scope: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
89
- .add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
90
- .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
91
- .add("squared", init: 'pnpm', script: ["build:stage1", "build:stage2"], group: "app") do # Use pnpm/yarn/berry for depend + Copy target (main)
92
- # Repo (global)
93
- as(:run, "build:dev", "dev") # npm run build:dev -> npm run dev
94
- as(:run, { "build:dev": "dev", "build:prod": "prod" })
95
-
96
- add("publish/sqd-cli", "cli", exclude: [:git]) # rake cli:build
97
- add("publish/sqd-serve") # rake sqd-serve:build
98
- add("publish/sqd-admin", group: "sqd", exclude: [:base])
99
- # OR
100
- with(exclude: [:base]) { add("publish/*", "packages") } # rake packages:sqd-serve:build
101
- # OR
102
- add(["publish/sqd-cli", "publish/sqd-serve"], true, exclude: [:base]) # rake squared:sqd-serve:build
103
-
104
- # Git
105
- revbuild(include: %w[src/ framework/ types/]) # Synchronous is recommended
106
- end
107
- .add("squared/sqd", exclude: :git, pass: [:node, "checkout", "bump"]) do # Skip initialize(:node) + squared:checkout:* + squared:bump:*
108
- variable_set :script, "build:sqd" # Override detection
109
- variable_set :depend, false
110
- variable_set :clean, ["build/sqd/"]
111
- end
112
- .with(:docker, only: ["build", "compose"]) do
113
- .add("squared", "docker", file: "Dockerfile", context: ".", tag: "latest", registry: "localhost:5000", username: "squared",
114
- args: "--ssh=default",
115
- secrets: ["id=github,env=GITHUB_TOKEN"],
116
- mounts: ["src=.,dst=/project,ro,bind-propagation=rshared"]) do # Docker
117
- series(:clean) do # run | depend | doc | lint | test | copy | clean
118
- File.read(basepath("docker-bake.hcl"))
119
- .scan(/\btags\s+=\s+\["([^"]+)"\]/)
120
- .each { |val| image(:rm, tag: val.first) }
121
- end
122
- end
123
- end
124
- .pass("pull", group: "default") { test? || doc? } # rake pathname:pull | rake optparse:pull
125
- .style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
126
- .build(default: "build", parallel: ["pull", "fetch", "rebase", "archive", "clean", /^outdated:/], pass: ["publish"]) do |workspace|
127
- workspace
128
- .enable_aixterm
129
- .style({
130
- banner: ["bright_cyan", "bold", "bright_black!"],
131
- border: "bright_white"
132
- })
133
- end
134
-
135
- # default = /workspaces/ruby/*
136
- # pathname = /workspaces/ruby/pathname
137
- # optparse = /workspaces/ruby/optparse
138
- # logger = /workspaces/ruby/logger
139
- # android = /workspaces/android-docs
140
- # chrome = /workspaces/chrome-docs
141
-
142
- Workspace::Application
143
- .new(ENV["SQUARED_HOME"], prefix: "rb", common: false) # Local styles
144
- .group("ruby", "default", run: "rake build", copy: "rake install", clean: "rake clean", ref: :ruby, override: {
145
- pathname: {
146
- run: "rake compile" # rake rb:pathname:build
147
- }
148
- })
149
- .with(:python, editable: false) do # ref=Symbol | group=String
150
- banner([:name, ": ", :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
151
- doc("make html") # rake rb:doc:python
152
- run(false) # rake rb:build:python (disabled)
153
- exclude(%i[base git]) # Project::Git.ref (superclass)
154
- add("android-docs", "android") # rake rb:android:doc
155
- add("chrome-docs", "chrome") # rake rb:chrome:doc
156
- end
157
- .style("inline", "bold")
158
- .build
159
- ```
160
-
161
- **NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
162
-
163
- ### Archive
164
-
165
- ```ruby
166
- # HEADERS={"Authorization":"Bearer RANDOM-TOKEN"} | hash/json
167
- # ZIP_DEPTH=0 | default=1
168
- # TAR_DEPTH=0 | TAR_DEPTH_SQUARED
169
- # UNPACK_FORCE=1 | Remove target directory
170
-
171
- Workspace::Application
172
- .new(main: "squared")
173
- .with(:python) do
174
- add("android-docs", "android", archive: "https://github.com/anpham6/android-docs/archive/refs/tags/v0.3.0.zip")
175
- add("chrome-docs", "chrome", archive: {
176
- uri: "https://github.com/anpham6/chrome-docs/archive/refs/tags/v0.5.0.tar.gz", # URI.open (required)
177
- digest: "e3d55d2004d4770dd663254c9272dc3baad0d57a5bd14ca767de6546cdf14680", # SHA1 | SHA256 | SHA384 | SHA512 | MD5
178
- digest: "rmd160:47b7790a511eed675fec1a3e742845fef058799b", # RMD160
179
- ext: "tar.gz", # zip | tar | tar.gz | tgz | tar.xz | txz | 7z
180
- depth: 1, # nested directories (e.g. --strip-components)
181
- headers: { # URI.open
182
- "Authorization" => "Bearer RANDOM-TOKEN"
183
- }
184
- })
185
- end
186
- .add("squared", release: "https://github.com/anpham6/squared/archive/refs/tags/??") # squared:unpack:zip[v5.4.0,/tmp/squared]
187
- end
188
- ```
189
-
190
- ### Clone
191
-
192
- The task is only active when the project directory is empty or does not exist.
193
-
194
- ```ruby
195
- Workspace::Application
196
- .new(main: "squared")
197
- .git(
198
- "emc": "https://github.com/anpham6/e-mc", # rake emc:clone
199
- "pir": { # rake pir:clone
200
- uri: "https://github.com/anpham6/pi-r", #
201
- options: { #
202
- "origin": "github", # --origin=github
203
- "recurse-submodules": false, # --no-recurse-submodules
204
- "shallow-exclude": ["v0.0.1", "v0.0.2"] # --shallow-exclude=v0.0.1 --shallow-exclude=v0.0.2
205
- }
206
- }
207
- )
208
- .git("squared", "/path/to/squared", options: { local: true }) # Relative paths resolve from workspace root
209
- .git(
210
- {
211
- emc: { uri: "e-mc", options: { "depth": 2 } }, # https://github.com/anpham6/e-mc
212
- pir: "pi-r" # Maps task alias to repository folder
213
- },
214
- base: "https://github.com/anpham6", # Required
215
- repo: ["squared", "android-docs", "chrome-docs"], # https://github.com/anpham6/squared
216
- options: { # Only "repo"
217
- "depth": 1,
218
- "quiet": true
219
- }
220
- )
221
- .with(:node) do # rake clone:node
222
- add("e-mc", "emc") # https://github.com/anpham6/e-mc
223
- add("pi-r", "pir") # https://github.com/anpham6/pi-r
224
- add("squared") # https://github.com/anpham6/squared
225
- end
226
- .with(:python) do # rake clone:python
227
- add("android-docs")
228
- add("chrome-docs") do
229
- revbuild(include: "source/", exclude: ["source/conf.py"]) # Limit files being watched
230
- end
231
- end
232
- .git("https://github.com/anpham6", ["emc", "pir"]) # Targets any defined project
233
- .git("https://github.com/anpham6", cache: true) # Uses already defined root projects + revbuild
234
- .revbuild # Enables task revbuild (squared.revb)
235
- .revbuild(file: "../build.json") # $ROOT/build.json
236
- .build(parallel: ["clone"]) # rake clone + rake clone:sync
237
- ```
238
-
239
- ### Build
240
-
241
- #### Chain
242
-
243
- There has to be at least one project which uses the ``step`` attribute. Other placement attributes are ignored.
244
-
245
- **NOTE**: Projects can only reference non-global namespaced tasks. (e.g. with ":")
246
-
247
- ```ruby
248
- Workspace::Application
249
- .new
250
- .with(:node) do
251
- add("e-mc", "emc") do
252
- chain "all", "clean", step: 1 # Required
253
- chain "all", "build", step: 2
254
- end
255
- add("pi-r", "pir") do
256
- chain "all", "build", after: "emc:build" # step: 3
257
- end
258
- add("pi-r2", "pir2") do
259
- chain "all", "build", before: "squared" # step: 3
260
- end
261
- add("squared-express", "express") do
262
- chain "all", "clean", with: "emc" # step: 1
263
- chain "all", "build", with: "pir" # step: 3
264
- end
265
- add("squared") do
266
- revbuild(include: %w[src/ framework/ types/]) # Git revision build command (optional)
267
- chain "all", "revbuild", after: "express:build" # step: 4
268
- chain "publish", "bump:patch", "publish:latest", step: 0, sync: true # rake publish -> squared:bump:patch -> squared:publish:latest
269
- end
270
- end
271
- .with(:python) do
272
- doc("make html")
273
- add("android-docs") do
274
- chain "all", "doc", with: "squared", after: "squared" # step: 4
275
- end
276
- add("chrome-docs") do
277
- chain "all", "doc", with: "squared", before: "squared:revbuild" # Same
278
- end
279
- end
280
- .chain "all", "status", with: "squared", after: "android-docs" # Global tasks (e.g. without ":")
281
- .build
282
- ```
283
-
284
- ```sh
285
- rake all # all[1-3-4]
286
- rake all:print
287
- ```
288
-
289
- Threaded is the default when there are two or more tasks. Using ``with`` and either **before** or **after** will create a synchronous group.
290
-
291
- * Step 1: emc:clean + express:clean (thread)
292
- * Step 2: emc:build (sync)
293
- * Step 3: pir:build + express:build + pir2:build (thread)
294
- * Step 4: chrome-docs:doc + squared:revbuild + android-docs:doc + status (sync)
295
-
296
- #### Graph
297
-
298
- ```ruby
299
- Workspace::Application
300
- .new(main: "squared")
301
- .graph(["depend"], ref: :git) # Optional
302
- .with(:python) do
303
- doc(windows? ? ".\make.bat html" : "make html") # rake android-docs:doc | rake doc:python
304
- add("android-docs", "android", venv: "/home/user/.venv") # rake android-docs:depend
305
- add("chrome-docs", "chrome", graph: "android", venv: %w[.venv --clear]) do # /workspaces/chrome-docs/.venv
306
- variable_set :dependindex, 1 # Use Poetry for dependencies (optional)
307
- end
308
- end
309
- .with(:node) do
310
- graph(["build", "copy"], on: { # Overrides "git"
311
- first: proc { puts "1" },
312
- last: proc { puts "2" }
313
- })
314
- script("build:dev") # npm run build:dev
315
- # OR
316
- run([nil, "build:dev", { "PATH" => "~/.bin" }, "--workspace", "--silent"]) # PATH="~/.bin" npm run build:dev --workspace -- --silent
317
- # OR
318
- run({ # Same
319
- script: "build:dev", #
320
- env: { "PATH" => "~/.bin" }, #
321
- opts: "--workspace", #
322
- args: "--silent" #
323
- })
324
-
325
- add("e-mc", "emc") do
326
- first("build", "emc:clean", "emc:depend") # rake emc:clean && rake emc:depend && rake emc:build && echo "123"
327
- last("build", out: "123") { |out: nil| puts out } #
328
- error("build") { |err: nil| log.debug err } #
329
- end
330
- add("pi-r", "pir", graph: "emc", first: {
331
- build: proc { puts self.name } # puts "pir"
332
- })
333
- add("squared-express", "express", graph: "pir")
334
- add("squared", graph: ["chrome", "express"]) do
335
- first("git:ls-files") { puts "1" } # skipped
336
- first("git:ls-files", override: true) { puts "2" } # puts "2"
337
- last("git:ls-files") { puts workspace.root } # puts "/workspaces"
338
- end
339
- end
340
- .with(:ruby) do
341
- run("gem build") # gem build
342
- # OR
343
- run("gem build", on: { first: -> { p "2" }, last: -> { p "4" } }) do # run | depend | graph | clean | doc | lint | test
344
- p "1"
345
- end
346
- # OR
347
- run(on: { first: -> { p "pass" }, last: -> { p "pass" } }) do
348
- p "1"
349
- end
350
- # OR
351
- run(["gem build", "--force", { "RUBY_VERSION" => "3.4.0" }]) # RUBY_VERSION="3.4.0" gem build --force
352
- # OR
353
- run({ #
354
- command: "gem build", # RUBY_VERSION="3.4.0" gem build --silent --force
355
- opts: "--force", # composable
356
- env: { "PATH" => "~/.bin" }, #
357
- args: { silent: true } #
358
- })
359
- # OR
360
- run(["gem pristine", ["gem build", "gem cleanup"], nil, "--debug"]) # gem pristine --debug && gem build --debug && gem cleanup --debug
361
- #
362
- # All commands are either Array or Hash
363
- #
364
- run([ # PATH="~/.bin" GEM_HOME="~/.gems/ruby-3.4.0" (merged)
365
- ["gem pristine", "--all", { "PATH" => "~/.bin" }, "--silent"], # gem pristine --silent --all
366
- ["gem build", { strict: true }, { "GEM_HOME" => "~/.gems/ruby-3.4.0" }] # gem build --strict
367
- ]) #
368
- # OR
369
- run([ # Same
370
- { #
371
- env: { "PATH" => "~/.bin" }, #
372
- command: "gem pristine", #
373
- opts: "--all", args: "--silent" #
374
- }, #
375
- { #
376
- env: { "GEM_HOME" => "~/.gems/ruby-3.4.0" }, #
377
- command: "gem build", #
378
- opts: { strict: true } #
379
- } #
380
- ])
381
-
382
- add("pathname", test: ["rake test", { jobs: ENV["RAKE_JOBS"] }]) # rake test --jobs 4
383
- add("fileutils", graph: "pathname")
384
- add("optparse", run: "gem build", env: { "PATH" => "~/.bin" }, opts: "-v") # PATH="~/.bin" gem build -v
385
- add("rake", graph: ["fileutils", "optparse"])
386
- banner(command: false) # Always hide banner
387
- end
388
- .build
389
- ```
390
-
391
- ```sh
392
- rake pir:graph # emc + pir
393
- rake express:graph # emc + pir + express
394
- rake chrome:graph # android + chrome
395
- rake graph:python # same
396
- rake squared:graph # android + chrome + emc + pir + express + squared
397
- rake graph:node # same
398
- rake rake:graph # pathname + fileutils + optparse + rake
399
- rake graph:ruby # same
400
- rake graph # graph:node + graph:ruby
401
-
402
- rake squared:graph:run[express,pir] # emc + pir + express + squared
403
- rake squared:graph:run[node,-emc] # pir + express + squared
404
- ```
405
-
406
- ### Tasks
407
-
408
- ```ruby
409
- Workspace::Series.batch(:ruby, :node, {
410
- stage: %i[graph test],
411
- reset: %i[stash pull]
412
- })
413
-
414
- Workspace::Series.rename("depend", "install")
415
- ```
416
-
417
- ## Usage
418
-
419
- ```sh
420
- rake -T # List tasks
421
- rake # rake status (usually "build")
422
-
423
- # GIT_OPTIONS=rebase
424
- rake pull # All except "default" + "app"
425
- rake pull:ruby # pathname + optparse + logger
426
- rake pull:default # pathname + optparse
427
- rake pull:app # squared
428
- rake pull:node # emc + pir + squared
429
-
430
- rake build # All except "android"
431
- rake doc # optparse + android
432
- rake depend # All except "default"
433
-
434
- rake build:ruby # rake compile + rake install + rake install
435
-
436
- rake clean # All except "default" + "app"
437
- rake clean:ruby # rake clean + rake clean + ["tmp/"]
438
- rake clean:default # rake clean + rake clean + skip
439
- rake clean:app # none + skip + ["build/"]
440
- rake clean:node # none + ["publish/**/*.js", "tmp/"] + ["build/"]
441
-
442
- rake squared:run[#] # List scripts (node)
443
- rake squared:rake[#] # List tasks (ruby)
444
- ```
445
-
446
- ```sh
447
- rake build:app # squared + cli + sqd-serve
448
- rake squared:build:workspace # cli + sqd-serve
449
- rake pull:sqd # sqd-admin
450
- rake squared:pull:workspace # sqd-serve + sqd-admin
451
- rake squared:outdated:workspace # cli + sqd-serve + sqd-admin
452
- ```
453
-
454
- ## Methods
455
-
456
- Task:
457
-
458
- * run
459
- * script
460
- * depend
461
- * archive
462
- * graph
463
- * doc
464
- * lint
465
- * test
466
- * clean
467
-
468
- Non-task:
469
-
470
- * log
471
- * exclude
472
-
473
- ## Styles
474
-
475
- * banner
476
- * border
477
- * header
478
- * active
479
- * inline
480
- * subject
481
- * border
482
- * warn
483
- * caution
484
- * current
485
- * latest
486
- * extra
487
- * major
488
- * red
489
- * yellow
490
- * green
491
-
492
- ## Git
493
-
494
- Most project classes will inherit from `Git` which enables these tasks:
495
-
496
- | Task | Git | Command |
497
- | :--------- | :--------------- | :-------------------------------------------- |
498
- | branch | branch | create set delete move copy list edit current |
499
- | checkout | checkout | commit branch track detach path |
500
- | commit | commit | add all amend amend-orig fixup |
501
- | diff | diff | head cached branch files between contain |
502
- | fetch | fetch | origin remote all |
503
- | files | ls-files | cached modified deleted others |
504
- | git | | add blame clean mv rm revert |
505
- | merge | merge | commit no-commit send |
506
- | pull | pull | origin remote all |
507
- | rebase | rebase | branch onto send |
508
- | refs | ls-remote --refs | heads tags remote |
509
- | reset | reset | commit index patch mode |
510
- | restore | restore | staged worktree |
511
- | rev | rev | commit output |
512
- | show | show | format oneline |
513
- | stash | stash | push pop apply branch drop clear list |
514
- | switch | switch | branch create detach |
515
- | tag | tag | add sign delete list |
516
-
517
- You can disable all of them at once using the `exclude` property.
518
-
519
- ```ruby
520
- Workspace::Application.exclude('autostash', 'rebase')
521
-
522
- Workspace::Application
523
- .new
524
- .add("squared", exclude: :git)
525
- ```
526
-
527
- You can disable one or more of them using the `pass` property as a *string*.
528
-
529
- ```ruby
530
- Workspace::Application
531
- .new
532
- .add("squared", pass: ["pull"], ref: :node)
533
- .pass("pull", ref: :node) { read_packagemanager(:private) }
534
- ```
535
-
536
- ### Commit Hash
537
-
538
- Commands which use commit hashes are parsed using a ":" prefix as to not be confused for an option.
539
-
540
- ```sh
541
- rake squared:log:view[:af012345] # git log af012345
542
- rake squared:log:view[#{af012345}] # deprecated
543
- rake squared:log:view[H1,HEAD^5,all,lib,./H12345] # git log --all @~1 @^5 -- 'lib' 'H12345'
544
- ```
545
-
546
- ## Environment
547
-
548
- ### Path
549
-
550
- All project binary programs can have their executable path set to a non-global alias.
551
-
552
- ```ruby
553
- Common::PATH.update({
554
- GIT: "/usr/bin/git", # PATH_GIT=/usr/bin/git
555
- TAR: "/opt/archivers/tar", # PATH_TAR=/opt/archivers/tar
556
- UNZIP: "/opt/archivers/unzip",
557
- GEM: "~/.rvm/gems/ruby-3.4.0/bin/gem",
558
- BUNDLE: "~/.rvm/gems/ruby-3.4.0/bin/bundle",
559
- RAKE: "~/.rvm/gems/ruby-3.4.0/bin/rake",
560
- NPM: "/opt/node/v22.0.0/bin/npm",
561
- PYTHON: "#{ENV["PYTHONPATH"]}/bin/python"
562
- })
563
- ```
564
-
565
- ### Build
566
-
567
- ```ruby
568
- Workspace::Application
569
- .new
570
- .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
571
- ```
572
-
573
- ```sh
574
- BUILD_TYPE # global
575
- ${PROG}_COLOR=0 # --no-color (e.g. GIT_COLOR)
576
-
577
- # :env :run :args :opts :type
578
- # LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -g -O2
579
- BUILD_${NAME} # gcc a.c -o a.o
580
- BUILD_${NAME}_OPTS # -g
581
- BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
582
- BUILD_${NAME}_TYPE # debug
583
-
584
- # :env :script :opts :args
585
- # NODE_ENV="production" NO_COLOR="1" npm run build:dev --loglevel=error --workspaces=false -- --quiet
586
- BUILD_${NAME} # build:dev
587
- BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
588
- BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
589
- BUILD_${NAME}_DEV # pattern,0,1 (:dev)
590
- BUILD_${NAME}_PROD # pattern,0,1 (:prod)
591
- ${REF}_${NAME}_OPTS # --quiet (e.g. NODE_SQUARED_OPTS)
592
-
593
- BUILD_${NAME}=0 # skip project
594
- BUILD_${NAME}_VERSION=0.1.0 # publish + detection
595
-
596
- BANNER=0 # hide banner
597
- BANNER_${NAME}=0 #
598
-
599
- REVBUILD_FORCE=1 # Rebuild all targets
600
- REVBUILD_FORCE_${NAME}=1 # Rebuild project
601
-
602
- PREREQS_${NAME}=build,copy # Class method name to invoke
603
- PREREQS_${REF}=depend # e.g. Node
604
- ```
605
-
606
- ### Graph
607
-
608
- ```sh
609
- GRAPH_${NAME} # depend,build => squared:depend + squared:build
610
- GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
611
- ```
612
-
613
- ### Logger
614
-
615
- These global options also can target the project suffix `${NAME}`. (e.g. LOG_FILE_EMC)
616
-
617
- ```sh
618
- LOG_FILE # %Y-%m-%d.log
619
- # OR
620
- LOG_AUTO # year,y,month,m,day,d,1
621
- # Optional
622
- LOG_DIR # exist?
623
- LOG_LEVEL # See gem "logger"
624
- ```
625
-
626
- ### Git
627
-
628
- * Version: 2.50
629
-
630
- ```sh
631
- GIT_OPTIONS=q,strategy=ort # all
632
- GIT_OPTIONS_${NAME}=v,ff # project only
633
- GIT_AUTOSTASH=1 # rebase (all)
634
- GIT_AUTOSTASH_${NAME}=0 # rebase (project only)
635
- ```
636
-
637
- | Command | Flag | ENV |
638
- | :--------- | :---------------- | :-------------------------------------------------------------------- |
639
- | branch | create | TRACK=0,1,s F|FORCE |
640
- | branch | move copy | F|FORCE |
641
- | branch | set delete | COUNT=n |
642
- | branch | global | SYNC |
643
- | checkout | branch | DETACH TRACK=s COUNT=n |
644
- | checkout | detach | REFLOG=1 |
645
- | checkout | track | COUNT=n |
646
- | checkout | global path | HEAD=s PATHSPEC=s |
647
- | checkout | * | F|FORCE MERGE |
648
- | clone | * | DEPTH=n ORIGIN=s BRANCH=s REVISION=s LOCAL=0,1 |
649
- | commit | * | UPSTREAM=s DRY_RUN EDIT=0 M|MESSAGE=s |
650
- | diff | -between -contain | MERGE_BASE |
651
- | diff | head branch | INDEX=n |
652
- | diff | * | PATHSPEC=s |
653
- | fetch | -remote | ALL |
654
- | fetch | remote | REFSPEC=s |
655
- | fetch | * | F|FORCE RECURSE_SUBMODULES=0,1,s |
656
- | git | rm | PATHSPEC=s |
657
- | log | * | PATHSPEC=s |
658
- | pull | rebase | AUTOSTASH |
659
- | pull | remote | REFSPEC=s |
660
- | pull | -remote | ALL |
661
- | pull | * | REBASE=0,1 F|FORCE RECURSE_SUBMODULES=0,1,s |
662
- | rebase | branch | HEAD=s |
663
- | rebase | onto | INTERACTIVE I HEAD=s |
664
- | reset | mode (mixed) | N REFRESH=0 |
665
- | reset | index | PATHSPEC=s |
666
- | reset | commit | COUNT=n REFLOG=1 |
667
- | reset | -commit | HEAD=s |
668
- | restore | * | PATHSPEC=s |
669
- | revbuild | global | UNTRACKED_FILES=s IGNORE_SUBMODULES=s IGNORED=s (status) |
670
- | stash | push | PATHSPEC=s |
671
- | stash | global | ALL=0,1 KEEP_INDEX=0,1 INCLUDE_UNTRACKED=0,1 STAGED=0,1 M|MESSAGE=s |
672
- | status | global | BRANCH LONG IGNORE_SUBMODULES=s,0-3 PATHSPEC=s |
673
- | switch | detach | REFLOG=1 |
674
- | switch | -detach | HEAD=s |
675
- | switch | * | F|FORCE |
676
- | tag | add | SIGN FORCE HEAD=s M|MESSAGE=s |
677
- | tag | sign | F|FORCE HEAD=s M|MESSAGE=s |
678
- | tag | delete | COUNT=n |
679
- | rev | commit branch | HEAD=s |
680
-
681
- ### Docker
682
-
683
- * Version: 28.3
684
-
685
- ```sh
686
- DOCKER_OPTIONS=q,no-cache # all
687
- DOCKER_OPTIONS_${NAME}=v,no-cache=false # project only (override)
688
- DOCKER_TAG=latest # all
689
- DOCKER_TAG_${NAME}=v0.1.0 # project only (override)
690
- DOCKER_ALL=1 # list every image/container
691
- DOCKER_Y=1 # confirm all
692
- ```
693
-
694
- | Command | Flag | ENV |
695
- | :--------- | :---------------- | :---------------------------------------------- |
696
- | buildx | build | TAG=s |
697
- | buildx | bake | SERVICE=s |
698
- | compose | build | TARGET=s |
699
- | container | commit | REGISTRY=s PLATFORM=s DISABLE_CONTENT_TRUST=0,1 |
700
- | image | rm | Y=0,1 |
701
- | image | push | TAG=s REGISTRY=s |
702
-
703
- ### Repo
704
-
705
- These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
706
-
707
- ```sh
708
- REPO_ROOT # parent dir
709
- REPO_HOME # project dir (main)
710
- REPO_BUILD # run,script
711
- REPO_GROUP # string
712
- REPO_REF # e.g. ruby,node
713
- REPO_DEV # pattern,0,1
714
- REPO_PROD # pattern,0,1
715
- REPO_WARN # 0,1
716
- REPO_SYNC # 0,1
717
- REPO_URL # manifest repository
718
- REPO_MANIFEST # e.g. latest,nightly,prod
719
- REPO_STAGE # 0,1,2,3
720
- REPO_TIMEOUT # confirm dialog (seconds)
721
- ```
722
-
723
- ## LICENSE
724
-
725
- BSD 3-Clause