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