squared 0.5.4 → 0.5.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.
data/README.ruby.md DELETED
@@ -1,728 +0,0 @@
1
- # squared 0.5
2
-
3
- * [source](https://github.com/anpham6/squared)
4
- * [docs](https://squared.readthedocs.io)
5
-
6
- ## Version Compatibility
7
-
8
- | Date | squared | Min | Max |
9
- | :--------: | ------: | -----: | -----: |
10
- | 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 |
11
- | 2025-01-07 | 0.2.0 | | 3.4.0 |
12
- | 2025-02-07 | 0.3.0 | | 3.4.1 |
13
- | 2025-03-06 | 0.4.0 | | 3.4.2 |
14
- | 2025-06-16 | 0.5.0 | 2.5.0 | 3.4.3 |
15
-
16
- The range chart indicates the latest Ruby tested against at the time of release.
17
-
18
- ## Installation
19
-
20
- ```sh
21
- gem install squared
22
- ```
23
-
24
- ### Optional
25
-
26
- * [Repo](https://source.android.com/docs/setup/reference/repo)
27
- * https://github.com/anpham6/squared-repo
28
- * Python 3.6
29
- * Not compatible with Windows
30
-
31
- ```sh
32
- mkdir -p ~/.bin
33
- PATH="${HOME}/.bin:${PATH}"
34
- curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
35
- chmod a+rx ~/.bin/repo
36
- ```
37
-
38
- ## Example - Rakefile
39
-
40
- 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.
41
-
42
- ```ruby
43
- require "squared"
44
-
45
- require "squared/workspace"
46
- require "squared/workspace/repo" # Optional
47
- require "squared/workspace/project/node" #
48
- require "squared/workspace/project/python" #
49
- require "squared/workspace/project/ruby" #
50
- require "squared/workspace/project/docker" #
51
- # OR
52
- require "squared/app" # All workspace related modules
53
-
54
- # NODE_ENV = production
55
-
56
- # REPO_ROOT = /workspaces |
57
- # REPO_HOME = /workspaces/squared | Dir.pwd
58
- # rake = /workspaces/squared/Rakefile | main?
59
- # OR
60
- # REPO_ROOT = /workspaces | Dir.pwd
61
- # rake = /workspaces/Rakefile |
62
- # REPO_HOME = /workspaces/squared | main: "squared"
63
-
64
- # pathname = /workspaces/pathname
65
- # optparse = /workspaces/optparse
66
- # log = /workspaces/logger
67
- # emc = /workspaces/e-mc
68
- # pir = /workspaces/pi-r
69
- # pir2 = /workspaces/pi-r2
70
- # squared = /workspaces/squared
71
- # cli = /workspaces/squared/publish/sqd-cli
72
- # sqd-serve = /workspaces/squared/publish/sqd-serve
73
- # sqd = /workspaces/squared/sqd
74
-
75
- Workspace::Application
76
- .new(Dir.pwd, main: "squared") # Dir.pwd? (main? is implicitly basename)
77
- .banner("group", "project", styles: ["yellow", "black"], border: "bold") # name | project | path | ref | group? | parent? | version?
78
- .repo("https://github.com/anpham6/squared-repo", "nightly", script: ["build:dev", "build:prod"], ref: :node) # Repo (optional)
79
- .run("rake install", ref: :ruby)
80
- .depend(false, group: "default")
81
- .clean("rake clean", group: "default")
82
- .clean(["build/"], group: "app")
83
- .log({ file: "tmp/%Y-%m-%d.log", level: "debug" }, group: "app")
84
- .add("pathname", run: "rake compile", copy: "rake install", test: "rake test", group: "default", env: { # Ruby (with C extensions)
85
- "CFLAGS" => "-fPIC -O1"
86
- })
87
- .add("optparse", doc: "rake rdoc", gemspec: "optparse.gemspec", group: "default") # Uses bundler/gem_tasks (without C extensions)
88
- .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"
89
- .add("e-mc", "emc", copy: { from: "publish", scope: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
90
- .add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
91
- .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
92
- .add("squared", init: 'pnpm', script: ["build:stage1", "build:stage2"], group: "app") do # Use pnpm/yarn/berry for depend + Copy target (main)
93
- # Repo (global)
94
- as(:run, "build:dev", "dev") # npm run build:dev -> npm run dev
95
- as(:run, { "build:dev": "dev", "build:prod": "prod" })
96
-
97
- add("publish/sqd-cli", "cli", exclude: [:git]) # rake cli:build
98
- add("publish/sqd-serve") # rake sqd-serve:build
99
- add("publish/sqd-admin", group: "sqd", exclude: [:base])
100
- # OR
101
- with(exclude: [:base]) { add("publish/*", "packages") } # rake packages:sqd-serve:build
102
- # OR
103
- add(["publish/sqd-cli", "publish/sqd-serve"], true, exclude: [:base]) # rake squared:sqd-serve:build
104
-
105
- # Git
106
- revbuild(include: %w[src/ framework/ types/]) # Synchronous is recommended
107
- end
108
- .add("squared/sqd", exclude: :git, pass: [:node, "checkout", "bump"]) do # Skip initialize(:node) + squared:checkout:* + squared:bump:*
109
- variable_set :script, "build:sqd" # Override detection
110
- variable_set :depend, false
111
- variable_set :clean, ["build/sqd/"]
112
- end
113
- .with(:docker, only: ["build", "compose"]) do
114
- .add("squared", "docker", file: "Dockerfile", context: ".", tag: "latest", registry: "localhost:5000", username: "squared",
115
- args: "--ssh=default",
116
- secrets: ["id=github,env=GITHUB_TOKEN"],
117
- mounts: ["src=.,dst=/project,ro,bind-propagation=rshared"]) do # Docker
118
- series(:clean) do # run | depend | doc | lint | test | copy | clean
119
- File.read(basepath("docker-bake.hcl"))
120
- .scan(/\btags\s+=\s+\["([^"]+)"\]/)
121
- .each { |val| image(:rm, tag: val.first) }
122
- end
123
- end
124
- end
125
- .pass("pull", group: "default") { test? || doc? } # rake pathname:pull | rake optparse:pull
126
- .style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
127
- .build(default: "build", parallel: ["pull", "fetch", "rebase", "archive", "clean", /^outdated:/], pass: ["publish"]) do |workspace|
128
- workspace
129
- .enable_aixterm
130
- .style({
131
- banner: ["bright_cyan", "bold", "bright_black!"],
132
- border: "bright_white"
133
- })
134
- end
135
-
136
- # default = /workspaces/ruby/*
137
- # pathname = /workspaces/ruby/pathname
138
- # optparse = /workspaces/ruby/optparse
139
- # logger = /workspaces/ruby/logger
140
- # android = /workspaces/android-docs
141
- # chrome = /workspaces/chrome-docs
142
-
143
- Workspace::Application
144
- .new(ENV["SQUARED_HOME"], prefix: "rb", common: false) # Local styles
145
- .group("ruby", "default", run: "rake build", copy: "rake install", clean: "rake clean", ref: :ruby, override: {
146
- pathname: {
147
- run: "rake compile" # rake rb:pathname:build
148
- }
149
- })
150
- .with(:python, editable: false) do # ref=Symbol | group=String
151
- banner([:name, ": ", :version], "path") # chrome-docs: 0.1.0 | /workspaces/chrome-docs
152
- doc("make html") # rake rb:doc:python
153
- run(false) # rake rb:build:python (disabled)
154
- exclude(%i[base git]) # Project::Git.ref (superclass)
155
- add("android-docs", "android") # rake rb:android:doc
156
- add("chrome-docs", "chrome") # rake rb:chrome:doc
157
- end
158
- .style("inline", "bold")
159
- .build
160
- ```
161
-
162
- **NOTE**: The use of "**ref**" (class name) is only necessary when initializing an empty directory (e.g. *rake repo:init*).
163
-
164
- ### Archive
165
-
166
- ```ruby
167
- # HEADERS={"Authorization":"Bearer RANDOM-TOKEN"} | hash/json
168
- # ZIP_DEPTH=0 | default=1
169
- # TAR_DEPTH=0 | TAR_DEPTH_SQUARED
170
- # UNPACK_FORCE=1 | Remove target directory
171
-
172
- Workspace::Application
173
- .new(main: "squared")
174
- .with(:python) do
175
- add("android-docs", "android", archive: "https://github.com/anpham6/android-docs/archive/refs/tags/v0.3.0.zip")
176
- add("chrome-docs", "chrome", archive: {
177
- uri: "https://github.com/anpham6/chrome-docs/archive/refs/tags/v0.5.0.tar.gz", # URI.open (required)
178
- digest: "e3d55d2004d4770dd663254c9272dc3baad0d57a5bd14ca767de6546cdf14680", # SHA1 | SHA256 | SHA384 | SHA512 | MD5
179
- digest: "rmd160:47b7790a511eed675fec1a3e742845fef058799b", # RMD160
180
- ext: "tar.gz", # zip | tar | tar.gz | tgz | tar.xz | txz | 7z
181
- depth: 1, # nested directories (e.g. --strip-components)
182
- headers: { # URI.open
183
- "Authorization" => "Bearer RANDOM-TOKEN"
184
- }
185
- })
186
- end
187
- .add("squared", release: "https://github.com/anpham6/squared/archive/refs/tags/??") # squared:unpack:zip[v5.4.0,/tmp/squared]
188
- end
189
- ```
190
-
191
- ### Clone
192
-
193
- The task is only active when the project directory is empty or does not exist.
194
-
195
- ```ruby
196
- Workspace::Application
197
- .new(main: "squared")
198
- .git(
199
- "emc": "https://github.com/anpham6/e-mc", # rake emc:clone
200
- "pir": { # rake pir:clone
201
- uri: "https://github.com/anpham6/pi-r", #
202
- options: { #
203
- "origin": "github", # --origin=github
204
- "recurse-submodules": false, # --no-recurse-submodules
205
- "shallow-exclude": ["v0.0.1", "v0.0.2"] # --shallow-exclude=v0.0.1 --shallow-exclude=v0.0.2
206
- }
207
- }
208
- )
209
- .git("squared", "/path/to/squared", options: { local: true }) # Relative paths resolve from workspace root
210
- .git(
211
- {
212
- emc: { uri: "e-mc", options: { "depth": 2 } }, # https://github.com/anpham6/e-mc
213
- pir: "pi-r" # Maps task alias to repository folder
214
- },
215
- base: "https://github.com/anpham6", # Required
216
- repo: ["squared", "android-docs", "chrome-docs"], # https://github.com/anpham6/squared
217
- options: { # Only "repo"
218
- "depth": 1,
219
- "quiet": true
220
- }
221
- )
222
- .with(:node) do # rake clone:node
223
- add("e-mc", "emc") # https://github.com/anpham6/e-mc
224
- add("pi-r", "pir") # https://github.com/anpham6/pi-r
225
- add("squared") # https://github.com/anpham6/squared
226
- end
227
- .with(:python) do # rake clone:python
228
- add("android-docs")
229
- add("chrome-docs") do
230
- revbuild(include: "source/", exclude: ["source/conf.py"]) # Limit files being watched
231
- end
232
- end
233
- .git("https://github.com/anpham6", ["emc", "pir"]) # Targets any defined project
234
- .git("https://github.com/anpham6", cache: true) # Uses already defined root projects + revbuild
235
- .revbuild # Enables task revbuild (squared.revb)
236
- .revbuild(file: "../build.json") # $ROOT/build.json
237
- .build(parallel: ["clone"]) # rake clone + rake clone:sync
238
- ```
239
-
240
- ### Build
241
-
242
- #### Chain
243
-
244
- There has to be at least one project which uses the ``step`` attribute. Other placement attributes are ignored.
245
-
246
- **NOTE**: Projects can only reference non-global namespaced tasks. (e.g. with ":")
247
-
248
- ```ruby
249
- Workspace::Application
250
- .new
251
- .with(:node) do
252
- add("e-mc", "emc") do
253
- chain "all", "clean", step: 1 # Required
254
- chain "all", "build", step: 2
255
- end
256
- add("pi-r", "pir") do
257
- chain "all", "build", after: "emc:build" # step: 3
258
- end
259
- add("pi-r2", "pir2") do
260
- chain "all", "build", before: "squared" # step: 3
261
- end
262
- add("squared-express", "express") do
263
- chain "all", "clean", with: "emc" # step: 1
264
- chain "all", "build", with: "pir" # step: 3
265
- end
266
- add("squared") do
267
- revbuild(include: %w[src/ framework/ types/]) # Git revision build command (optional)
268
- chain "all", "revbuild", after: "express:build" # step: 4
269
- chain "publish", "bump:patch", "publish:latest", step: 0, sync: true # rake publish
270
- end
271
- end
272
- .with(:python) do
273
- doc("make html")
274
- add("android-docs") do
275
- chain "all", "doc", with: "squared", after: "squared" # step: 4
276
- end
277
- add("chrome-docs") do
278
- chain "all", "doc", with: "squared", before: "squared:revbuild" # Same
279
- end
280
- end
281
- .chain("all", "status", with: "squared", after: "android-docs") # Global tasks (e.g. without ":")
282
- .build
283
- ```
284
-
285
- ```sh
286
- rake all # all[1-3-4]
287
- rake all:print
288
- ```
289
-
290
- Threaded is the default when there are two or more tasks. Using ``with`` and either **before** or **after** will create a synchronous group.
291
-
292
- * Step 1: emc:clean + express:clean (thread)
293
- * Step 2: emc:build (sync)
294
- * Step 3: pir:build + express:build + pir2:build (thread)
295
- * Step 4: chrome-docs:doc + squared:revbuild + android-docs:doc + status (sync)
296
-
297
- #### Graph
298
-
299
- ```ruby
300
- Workspace::Application
301
- .new(main: "squared")
302
- .graph(["depend"], ref: :git) # Optional
303
- .with(:python) do
304
- doc(windows? ? ".\make.bat html" : "make html") # rake android-docs:doc | rake doc:python
305
- add("android-docs", "android", venv: "/home/user/.venv") # rake android-docs:depend
306
- add("chrome-docs", "chrome", graph: "android", venv: %w[.venv --clear]) do # /workspaces/chrome-docs/.venv
307
- variable_set :dependindex, 1 # Use Poetry for dependencies (optional)
308
- end
309
- end
310
- .with(:node) do
311
- graph(["build", "copy"], on: { # Overrides "git"
312
- first: proc { puts "1" },
313
- last: proc { puts "2" }
314
- })
315
- script("build:dev") # npm run build:dev
316
- # OR
317
- run([nil, "build:dev", { "PATH" => "~/.bin" }, "--workspace", "--silent"]) # PATH="~/.bin" npm run build:dev --workspace -- --silent
318
- # OR
319
- run({ # Same
320
- script: "build:dev", #
321
- env: { "PATH" => "~/.bin" }, #
322
- opts: "--workspace", #
323
- args: "--silent" #
324
- })
325
-
326
- add("e-mc", "emc") do
327
- first("build", "emc:clean", "emc:depend") # rake emc:clean && rake emc:depend && rake emc:build && echo "123"
328
- last("build", out: "123") { |out: nil| puts out } #
329
- error("build") { |err: nil| log.debug err } #
330
- end
331
- add("pi-r", "pir", graph: "emc", first: {
332
- build: proc { puts self.name } # puts "pir"
333
- })
334
- add("squared-express", "express", graph: "pir")
335
- add("squared", graph: ["chrome", "express"]) do
336
- first("git:ls-files") { puts "1" } # skipped
337
- first("git:ls-files", override: true) { puts "2" } # puts "2"
338
- last("git:ls-files") { puts workspace.root } # puts "/workspaces"
339
- end
340
- end
341
- .with(:ruby) do
342
- run("gem build") # gem build
343
- # OR
344
- run("gem build", on: { first: -> { p "2" }, last: -> { p "4" } }) do # run | depend | graph | clean | doc | lint | test
345
- p "1"
346
- end
347
- # OR
348
- run(on: { first: -> { p "pass" }, last: -> { p "pass" } }) do
349
- p "1"
350
- end
351
- # OR
352
- run(["gem build", "--force", { "RUBY_VERSION" => "3.4.0" }]) # RUBY_VERSION="3.4.0" gem build --force
353
- # OR
354
- run({ #
355
- command: "gem build", # RUBY_VERSION="3.4.0" gem build --silent --force
356
- opts: "--force", # composable
357
- env: { "PATH" => "~/.bin" }, #
358
- args: { silent: true } #
359
- })
360
- # OR
361
- run(["gem pristine", ["gem build", "gem cleanup"], nil, "--debug"]) # gem pristine --debug && gem build --debug && gem cleanup --debug
362
- #
363
- # All commands are either Array or Hash
364
- #
365
- run([ # PATH="~/.bin" GEM_HOME="~/.gems/ruby-3.4.0" (merged)
366
- ["gem pristine", "--all", { "PATH" => "~/.bin" }, "--silent"], # gem pristine --silent --all
367
- ["gem build", { strict: true }, { "GEM_HOME" => "~/.gems/ruby-3.4.0" }] # gem build --strict
368
- ]) #
369
- # OR
370
- run([ # Same
371
- { #
372
- env: { "PATH" => "~/.bin" }, #
373
- command: "gem pristine", #
374
- opts: "--all", args: "--silent" #
375
- }, #
376
- { #
377
- env: { "GEM_HOME" => "~/.gems/ruby-3.4.0" }, #
378
- command: "gem build", #
379
- opts: { strict: true } #
380
- } #
381
- ])
382
-
383
- add("pathname", test: ["rake test", { jobs: ENV["RAKE_JOBS"] }]) # rake test --jobs 4
384
- add("fileutils", graph: "pathname")
385
- add("optparse", run: "gem build", env: { "PATH" => "~/.bin" }, opts: "-v") # PATH="~/.bin" gem build -v
386
- add("rake", graph: ["fileutils", "optparse"])
387
- banner(command: false) # Always hide banner
388
- end
389
- .build
390
- ```
391
-
392
- ```sh
393
- rake pir:graph # emc + pir
394
- rake express:graph # emc + pir + express
395
- rake chrome:graph # android + chrome
396
- rake graph:python # same
397
- rake squared:graph # android + chrome + emc + pir + express + squared
398
- rake graph:node # same
399
- rake rake:graph # pathname + fileutils + optparse + rake
400
- rake graph:ruby # same
401
- rake graph # graph:node + graph:ruby
402
-
403
- rake squared:graph:run[express,pir] # emc + pir + express + squared
404
- rake squared:graph:run[node,-emc] # pir + express + squared
405
- ```
406
-
407
- ### Tasks
408
-
409
- ```ruby
410
- Workspace::Series.batch(:ruby, :node, {
411
- stage: %i[graph test],
412
- reset: %i[stash pull]
413
- })
414
-
415
- Workspace::Series.rename("depend", "install")
416
- ```
417
-
418
- ## Usage
419
-
420
- ```sh
421
- rake -T # List tasks
422
- rake # rake status (usually "build")
423
-
424
- # GIT_OPTIONS=rebase
425
- rake pull # All except "default" + "app"
426
- rake pull:ruby # pathname + optparse + logger
427
- rake pull:default # pathname + optparse
428
- rake pull:app # squared
429
- rake pull:node # emc + pir + squared
430
-
431
- rake build # All except "android"
432
- rake doc # optparse + android
433
- rake depend # All except "default"
434
-
435
- rake build:ruby # rake compile + rake install + rake install
436
-
437
- rake clean # All except "default" + "app"
438
- rake clean:ruby # rake clean + rake clean + ["tmp/"]
439
- rake clean:default # rake clean + rake clean + skip
440
- rake clean:app # none + skip + ["build/"]
441
- rake clean:node # none + ["publish/**/*.js", "tmp/"] + ["build/"]
442
-
443
- rake squared:run[#] # List scripts (node)
444
- rake squared:rake[#] # List tasks (ruby)
445
- ```
446
-
447
- ```sh
448
- rake build:app # squared + cli + sqd-serve
449
- rake squared:build:workspace # cli + sqd-serve
450
- rake pull:sqd # sqd-admin
451
- rake squared:pull:workspace # sqd-serve + sqd-admin
452
- rake squared:outdated:workspace # cli + sqd-serve + sqd-admin
453
- ```
454
-
455
- ## Methods
456
-
457
- Task:
458
-
459
- * run
460
- * script
461
- * depend
462
- * archive
463
- * graph
464
- * doc
465
- * lint
466
- * test
467
- * clean
468
-
469
- Non-task:
470
-
471
- * log
472
- * exclude
473
-
474
- ## Styles
475
-
476
- * banner
477
- * border
478
- * header
479
- * active
480
- * inline
481
- * subject
482
- * border
483
- * warn
484
- * caution
485
- * current
486
- * latest
487
- * extra
488
- * major
489
- * red
490
- * yellow
491
- * green
492
-
493
- ## Git
494
-
495
- Most project classes will inherit from `Git` which enables these tasks:
496
-
497
- | Task | Git | Command |
498
- | :--------- | :--------------- | :-------------------------------------------- |
499
- | branch | branch | create set delete move copy list edit current |
500
- | checkout | checkout | commit branch track detach path |
501
- | commit | commit | add all amend amend-orig fixup |
502
- | diff | diff | head cached branch files between contain |
503
- | fetch | fetch | origin remote all |
504
- | files | ls-files | cached modified deleted others |
505
- | git | | add blame clean mv rm revert |
506
- | merge | merge | commit no-commit send |
507
- | pull | pull | origin remote all |
508
- | rebase | rebase | branch onto send |
509
- | refs | ls-remote --refs | heads tags remote |
510
- | reset | reset | commit index patch mode |
511
- | restore | restore | staged worktree |
512
- | rev | rev | commit output |
513
- | show | show | format oneline |
514
- | stash | stash | push pop apply branch drop clear list |
515
- | switch | switch | branch create detach |
516
- | tag | tag | add sign delete list |
517
-
518
- You can disable all of them at once using the `exclude` property.
519
-
520
- ```ruby
521
- Workspace::Application.exclude('autostash', 'rebase')
522
-
523
- Workspace::Application
524
- .new
525
- .add("squared", exclude: :git)
526
- ```
527
-
528
- You can disable one or more of them using the `pass` property as a *string*.
529
-
530
- ```ruby
531
- Workspace::Application
532
- .new
533
- .add("squared", pass: ["pull"], ref: :node)
534
- .pass("pull", ref: :node) { read_packagemanager(:private) }
535
- ```
536
-
537
- ### Commit Hash
538
-
539
- Commands which use commit hashes are parsed using a ":" prefix as to not be confused for an option.
540
-
541
- ```sh
542
- rake squared:log:view[:af012345] # git log af012345
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
- BUILD_SQUARED_OPTS="NODE_TAG=24 RUBY_VERSION=3.4.0" DOCKER_SQUARED_OPTS="--no-cache --label=v1" rake squared:build
694
- docker build --no-cache --label=v1 --build-arg='NODE_TAG=24' --build-arg='RUBY_VERSION=3.4.0' .
695
- ```
696
-
697
- | Command | Flag | ENV |
698
- | :--------- | :---------------- | :---------------------------------------------- |
699
- | buildx | build | TAG=s |
700
- | buildx | bake | SERVICE=s |
701
- | compose | build | TARGET=s |
702
- | container | commit | REGISTRY=s PLATFORM=s DISABLE_CONTENT_TRUST=0,1 |
703
- | image | rm | Y=0,1 |
704
- | image | push | TAG=s REGISTRY=s |
705
-
706
- ### Repo
707
-
708
- These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
709
-
710
- ```sh
711
- REPO_ROOT # parent dir
712
- REPO_HOME # project dir (main)
713
- REPO_BUILD # run,script
714
- REPO_GROUP # string
715
- REPO_REF # e.g. ruby,node
716
- REPO_DEV # pattern,0,1
717
- REPO_PROD # pattern,0,1
718
- REPO_WARN # 0,1
719
- REPO_SYNC # 0,1
720
- REPO_URL # manifest repository
721
- REPO_MANIFEST # e.g. latest,nightly,prod
722
- REPO_STAGE # 0,1,2,3
723
- REPO_TIMEOUT # confirm dialog (seconds)
724
- ```
725
-
726
- ## LICENSE
727
-
728
- BSD 3-Clause