squared 0.2.9 → 0.3.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 +55 -83
- data/README.ruby.md +150 -68
- data/lib/squared/common/base.rb +3 -1
- data/lib/squared/common/class.rb +27 -2
- data/lib/squared/common/format.rb +11 -11
- data/lib/squared/common/shell.rb +10 -12
- data/lib/squared/common/utils.rb +24 -13
- data/lib/squared/config.rb +4 -3
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +54 -19
- data/lib/squared/workspace/project/base.rb +350 -157
- data/lib/squared/workspace/project/git.rb +514 -316
- data/lib/squared/workspace/project/node.rb +248 -107
- data/lib/squared/workspace/project/python.rb +101 -78
- data/lib/squared/workspace/project/ruby.rb +175 -163
- data/lib/squared/workspace/repo.rb +7 -4
- data/lib/squared/workspace/series.rb +10 -4
- data/squared.gemspec +0 -1
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ffee6667b4033ad1987ad90e83c912134bfbc449efbbe1d6c90e3370fd568d1
|
4
|
+
data.tar.gz: 5ded113c3c6058688db13120068f35983decfcf772af8f67318a073bf65c7e9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddbfe113d51f8f89fbc20c950b6de97a9800a8c76dffb04a1ba8e56708a7c3142b1007e1678368df662e9b340ff567d93aeb781656e92a262fa1a417f05f7bb7
|
7
|
+
data.tar.gz: ee09e3e0766d396c644ee7be9ef0e88461fec646e57e4e5c58949042d3a87697215f8069781ef1116d12cf0cdda10b62ab609ded409da954f28a85d6489c12f6
|
data/CHANGELOG.md
CHANGED
@@ -1,87 +1,67 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [0.
|
3
|
+
## [0.3.0] - 2025-02-07
|
4
4
|
|
5
|
-
###
|
6
|
-
|
7
|
-
- Project log file naming supports more date formats.
|
8
|
-
|
9
|
-
### Fixed
|
10
|
-
|
11
|
-
- Environment options did not always pass session object.
|
12
|
-
- Git command pull actions used unknown flags.
|
13
|
-
- Workspace describe did not merge multiple invocations.
|
14
|
-
|
15
|
-
## [0.1.6] - 2025-04-17
|
16
|
-
|
17
|
-
### Fixed
|
18
|
-
|
19
|
-
- Project path validation did not include separator.
|
20
|
-
|
21
|
-
## [0.2.8] - 2025-04-12
|
22
|
-
|
23
|
-
### Fixed
|
24
|
-
|
25
|
-
- User-defined program paths were not sanitized for ENV.
|
26
|
-
- Project clean task used incompatible rmtree flag.
|
27
|
-
- Git branch unset-upstream used undefined variable.
|
28
|
-
|
29
|
-
## [0.2.7] - 2025-04-08
|
30
|
-
|
31
|
-
### Fixed
|
32
|
-
|
33
|
-
- Paths that conflict with git options can be quoted.
|
34
|
-
- Bundle command update did not append package names.
|
35
|
-
- Git result status type was truncated.
|
36
|
-
- Log messages were concatenated without separator.
|
37
|
-
- Python pip environment options used undefined session.
|
38
|
-
- Regexp "o" modifier was not used properly.
|
39
|
-
- Rake did not run individual project Rakefile.
|
40
|
-
- Ruby commands did not delimit exec arguments.
|
41
|
-
|
42
|
-
## [0.2.6] - 2025-03-06
|
43
|
-
|
44
|
-
### Fixed
|
45
|
-
|
46
|
-
- Git rebase did not include flag with pull command.
|
47
|
-
|
48
|
-
## [0.2.5] - 2025-02-25
|
49
|
-
|
50
|
-
### Fixed
|
51
|
-
|
52
|
-
- See `0.1.5`.
|
53
|
-
|
54
|
-
## [0.1.5] - 2025-02-25
|
55
|
-
|
56
|
-
### Fixed
|
57
|
-
|
58
|
-
- Node copy method ignored include argument when called directly.
|
59
|
-
- Logger is not initialized when using only Git base class.
|
60
|
-
- Hide warnings about readline during execution.
|
61
|
-
- Logger is not initialized when using only base class.
|
62
|
-
- Merging ENV build options were double escaped.
|
5
|
+
### Added
|
63
6
|
|
64
|
-
|
7
|
+
- NPM command publish was implemented.
|
8
|
+
- Globally created tasks can be excluded.
|
9
|
+
- Application method pass for project references was created.
|
10
|
+
- Gem command push was implemented.
|
11
|
+
- Gem command build was implemented.
|
12
|
+
- Gem command exec was implemented.
|
13
|
+
- Gem command check was implemented.
|
14
|
+
- NPM command install was implemented.
|
15
|
+
- NPM command dedupe was implemented.
|
16
|
+
- NPM command update was implemented.
|
17
|
+
- Double quotes can be used for shell option values.
|
18
|
+
- Global build commands can be aliased to alternate commands.
|
19
|
+
- Graph can be run with certain projects excluded.
|
20
|
+
- Workspace home folder can be set through ENV.
|
21
|
+
- Global task command lint was created.
|
22
|
+
- NPM command pack was implemented.
|
23
|
+
- Git command checkout and reset action commit was implemented.
|
24
|
+
- Application method script with pass-through args was created.
|
25
|
+
- Project build options can be overwritten with ENV build types.
|
26
|
+
- Pip install action editable was implemented.
|
27
|
+
- Git command log was implemented.
|
28
|
+
- Node package managers can update as depend with NODE_UPDATE.
|
29
|
+
- NPM install commands were grouped under package namespace.
|
30
|
+
- Node global task command update was created.
|
65
31
|
|
66
|
-
###
|
32
|
+
### Changed
|
67
33
|
|
68
|
-
-
|
69
|
-
-
|
34
|
+
- Global project command options use a private namespace hash.
|
35
|
+
- Global git command options use a private namespace hash.
|
36
|
+
- Base command options can be constructed from a hash.
|
37
|
+
- Git refs and files with complete options were implemented.
|
38
|
+
- Git tag action list with complete options was implemented.
|
39
|
+
- Git stash per action with complete options was implemented.
|
40
|
+
- Git diff with complete options was implemented.
|
41
|
+
- Git checkout action path with complete options was implemented.
|
42
|
+
- Git reset with complete options was implemented.
|
43
|
+
- Git restore with complete options was implemented.
|
44
|
+
- Git show with complete options was implemented.
|
45
|
+
- Git rev-parse with complete options was implemented.
|
46
|
+
- Git rebase with complete options was implemented.
|
47
|
+
- Ruby class kwargs opts was converted to optional parameter.
|
48
|
+
- Git methods use second parameter for command line options.
|
49
|
+
- Project base methods can run multiple commands per task.
|
50
|
+
- Project base methods except clean use same run wrapper.
|
51
|
+
- Bundle install uses a separate isolated method.
|
52
|
+
- Git branch action set negate symbol was inconsistent.
|
53
|
+
- Workspace applications have name suffixed ENV settings.
|
54
|
+
|
55
|
+
### Fixed
|
56
|
+
|
57
|
+
- ENV command options did not take precedence to inline options.
|
70
58
|
|
71
59
|
## [0.2.3] - 2025-02-05
|
72
60
|
|
73
61
|
### Fixed
|
74
62
|
|
75
|
-
- Project hash options duplicated dash prefix.
|
76
|
-
|
77
|
-
## [0.1.4] - 2025-02-05
|
78
|
-
|
79
|
-
### Fixed
|
80
|
-
|
81
|
-
- Build options with array args were not recognized.
|
82
|
-
- Base clean command did not enumerate non-string values.
|
83
|
-
- Git command refs did not include ref option.
|
84
|
-
- Pip upgrade did not append package names.
|
63
|
+
- Project hash options duplicated dash prefix.
|
64
|
+
- Pip upgrade did not append package names.
|
85
65
|
|
86
66
|
## [0.2.2] - 2025-01-19
|
87
67
|
|
@@ -202,7 +182,7 @@
|
|
202
182
|
- Workspace did not check base project for Windows filename.
|
203
183
|
- Regexp for SemVer did not recognize package names.
|
204
184
|
|
205
|
-
## [0.1.1] -
|
185
|
+
## [0.1.1] - 2025-12-14
|
206
186
|
|
207
187
|
### Added
|
208
188
|
|
@@ -252,19 +232,11 @@
|
|
252
232
|
|
253
233
|
- Changelog was created.
|
254
234
|
|
255
|
-
[0.
|
256
|
-
[0.2.8]: https://github.com/anpham6/squared/releases/tag/v0.2.8-ruby
|
257
|
-
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
258
|
-
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
259
|
-
[0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
|
260
|
-
[0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
|
235
|
+
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
261
236
|
[0.2.3]: https://github.com/anpham6/squared/releases/tag/v0.2.3-ruby
|
262
237
|
[0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
|
263
238
|
[0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
|
264
239
|
[0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
|
265
|
-
[0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
|
266
|
-
[0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
|
267
|
-
[0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
|
268
240
|
[0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
|
269
241
|
[0.1.2]: https://github.com/anpham6/squared/releases/tag/v0.1.2-ruby
|
270
242
|
[0.1.1]: https://github.com/anpham6/squared/releases/tag/v0.1.1-ruby
|
data/README.ruby.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# squared 0.
|
1
|
+
# squared 0.3
|
2
2
|
|
3
3
|
* [source](https://github.com/anpham6/squared)
|
4
4
|
* [manifest](https://github.com/anpham6/squared-repo)
|
@@ -6,10 +6,11 @@
|
|
6
6
|
|
7
7
|
## Version Compatibility
|
8
8
|
|
9
|
-
| Date | squared | Min | Max |
|
10
|
-
| :--------: | ------: | -----: | -----: |
|
11
|
-
| 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 |
|
12
|
-
| 2025-01-07 | 0.2.0 | 2.4.0 | 3.4.0 |
|
9
|
+
| Date | squared | Min | Max | Git |
|
10
|
+
| :--------: | ------: | -----: | -----: | -----: |
|
11
|
+
| 2024-12-07 | 0.1.0 | 2.4.0 | 3.3.6 | 2.39 |
|
12
|
+
| 2025-01-07 | 0.2.0 | 2.4.0 | 3.4.0 | 2.39 |
|
13
|
+
| 2025-02-07 | 0.3.0 | 2.4.0 | 3.4.1 | 2.39 |
|
13
14
|
|
14
15
|
The range chart indicates the latest Ruby tested against at the time of release.
|
15
16
|
|
@@ -84,6 +85,10 @@ Workspace::Application
|
|
84
85
|
.add("e-mc", "emc", copy: { from: "publish", scope: "@e-mc", also: [:pir, "squared-express/"] }, ref: :node) # Node
|
85
86
|
.add("pi-r", "pir", copy: { from: "publish", scope: "@pi-r" }, clean: ["publish/**/*.js", "tmp/"]) # Trailing slash required for directories
|
86
87
|
.add("squared", script: ["build:stage1", "build:stage2"], group: "app") do # Copy target (main)
|
88
|
+
# Repo (global)
|
89
|
+
as(:run, "build:dev", "dev") # npm run build:dev -> npm run dev
|
90
|
+
as(:run, { "build:dev": "dev", "build:prod": "prod" })
|
91
|
+
|
87
92
|
add("publish/sqd-cli", "cli", exclude: [:git]) # rake cli:build
|
88
93
|
add("publish/sqd-serve") # rake sqd-serve:build
|
89
94
|
add("publish/sqd-admin", group: "sqd", exclude: [:base])
|
@@ -97,8 +102,9 @@ Workspace::Application
|
|
97
102
|
variable_set :depend, false
|
98
103
|
variable_set :clean, ["build/sqd/"]
|
99
104
|
end
|
105
|
+
.pass("pull", group: "default") { test? || doc? } # pathname:pull | optparse:pull
|
100
106
|
.style("banner", 255.255) # 256 colors (fg | fg.bg | -0.bg)
|
101
|
-
.build(default: "build", parallel: ["pull", "fetch", "rebase", "copy", "clean", /^outdated:/]) do |workspace|
|
107
|
+
.build(default: "build", parallel: ["pull", "fetch", "rebase", "copy", "clean", /^outdated:/], pass: ['publish']) do |workspace|
|
102
108
|
workspace
|
103
109
|
.enable_aixterm
|
104
110
|
.style({
|
@@ -143,41 +149,41 @@ The task is only active when the project directory is empty or does not exist.
|
|
143
149
|
Workspace::Application
|
144
150
|
.new(main: "squared")
|
145
151
|
.git(
|
146
|
-
"emc": "https://github.com/anpham6/e-mc",
|
147
|
-
"pir": {
|
148
|
-
uri: "https://github.com/anpham6/pi-r",
|
149
|
-
options: {
|
150
|
-
"origin": "github",
|
151
|
-
"recurse-submodules": false,
|
152
|
-
"shallow-exclude": ["v0.0.1", "v0.0.2"]
|
152
|
+
"emc": "https://github.com/anpham6/e-mc", # rake emc:clone
|
153
|
+
"pir": { # rake pir:clone
|
154
|
+
uri: "https://github.com/anpham6/pi-r", #
|
155
|
+
options: { #
|
156
|
+
"origin": "github", # --origin='github'
|
157
|
+
"recurse-submodules": false, # --no-recurse-submodules
|
158
|
+
"shallow-exclude": ["v0.0.1", "v0.0.2"] # --shallow-exclude='v0.0.1' --shallow-exclude='v0.0.2'
|
153
159
|
}
|
154
160
|
}
|
155
161
|
)
|
156
|
-
.git("squared", "/path/to/squared", options: { local: true })
|
162
|
+
.git("squared", "/path/to/squared", options: { local: true }) # Relative paths resolve from workspace root
|
157
163
|
.git(
|
158
164
|
{
|
159
|
-
emc: { uri: "e-mc", options: { "depth": 2 } },
|
160
|
-
pir: "pi-r"
|
165
|
+
emc: { uri: "e-mc", options: { "depth": 2 } }, # https://github.com/anpham6/e-mc
|
166
|
+
pir: "pi-r" # Maps task alias to repository folder
|
161
167
|
},
|
162
|
-
base: "https://github.com/anpham6",
|
163
|
-
repo: ["squared", "android-docs", "chrome-docs"],
|
164
|
-
options: {
|
168
|
+
base: "https://github.com/anpham6", # Required
|
169
|
+
repo: ["squared", "android-docs", "chrome-docs"], # https://github.com/anpham6/squared
|
170
|
+
options: { # Only "repo"
|
165
171
|
"depth": 1,
|
166
172
|
"quiet": true
|
167
173
|
}
|
168
174
|
)
|
169
|
-
.with(:node) do
|
170
|
-
add("e-mc", "emc")
|
171
|
-
add("pi-r", "pir")
|
172
|
-
add("squared")
|
175
|
+
.with(:node) do # rake clone:node
|
176
|
+
add("e-mc", "emc") # https://github.com/anpham6/e-mc
|
177
|
+
add("pi-r", "pir") # https://github.com/anpham6/pi-r
|
178
|
+
add("squared") # https://github.com/anpham6/squared
|
173
179
|
end
|
174
|
-
.with(:python) do
|
180
|
+
.with(:python) do # rake clone:python
|
175
181
|
add("android-docs")
|
176
182
|
add("chrome-docs")
|
177
183
|
end
|
178
|
-
.git("https://github.com/anpham6")
|
179
|
-
.git("https://github.com/anpham6", ["emc", "pir"])
|
180
|
-
.build(parallel: ["clone"])
|
184
|
+
.git("https://github.com/anpham6") # Uses already defined root projects
|
185
|
+
.git("https://github.com/anpham6", ["emc", "pir"]) # Targets any defined project
|
186
|
+
.build(parallel: ["clone"]) # rake clone + rake clone:sync
|
181
187
|
```
|
182
188
|
|
183
189
|
### Graph
|
@@ -191,17 +197,21 @@ Workspace::Application
|
|
191
197
|
add("chrome-docs", "chrome", graph: "android")
|
192
198
|
end
|
193
199
|
.with(:node) do
|
194
|
-
graph(["build", "copy"], on: {
|
200
|
+
graph(["build", "copy"], on: { # Overrides "git"
|
195
201
|
first: proc { puts "1" },
|
196
202
|
last: proc { puts "2" }
|
197
203
|
})
|
204
|
+
script("build:dev") # npm run build:dev
|
205
|
+
# OR
|
206
|
+
run([nil, "build:dev", { "PATH" => "~/.bin" }, "--workspace", "--silent"]) # PATH="~/.bin" npm run build:dev --workspace -- --silent
|
207
|
+
|
198
208
|
add("e-mc", "emc") do
|
199
|
-
first("build", "emc:clean", "emc:depend")
|
200
|
-
last("build", out: "123") { |out: nil| puts out }
|
201
|
-
error("build") { |err: nil| log.debug err }
|
209
|
+
first("build", "emc:clean", "emc:depend") # rake emc:clean && rake emc:depend && rake emc:build && echo "123"
|
210
|
+
last("build", out: "123") { |out: nil| puts out } #
|
211
|
+
error("build") { |err: nil| log.debug err } #
|
202
212
|
end
|
203
213
|
add("pi-r", "pir", graph: "emc", first: {
|
204
|
-
build: proc { puts self.name }
|
214
|
+
build: proc { puts self.name } # puts "pir"
|
205
215
|
})
|
206
216
|
add("squared-express", "express", graph: "pir")
|
207
217
|
add("squared", graph: ["chrome", "express"]) do
|
@@ -210,11 +220,22 @@ Workspace::Application
|
|
210
220
|
end
|
211
221
|
end
|
212
222
|
.with(:ruby) do
|
213
|
-
|
223
|
+
run("gem build") # gem build
|
224
|
+
# OR
|
225
|
+
run(["gem build", "--force", { "RUBY_VERSION" => "3.4.0" }]) # RUBY_VERSION="3.4.0" gem build --force
|
226
|
+
# OR
|
227
|
+
run(["gem pristine", ["gem build", "gem cleanup"], nil, "--debug"]) # gem pristine --debug && gem build --debug && gem cleanup --debug
|
228
|
+
# OR
|
229
|
+
run([ # PATH="~/.bin" GEM_HOME="~/.gems/ruby-3.4.0" (merged)
|
230
|
+
["gem pristine", "--all", { "PATH" => "~/.bin" }, "--silent"], # gem pristine --silent --all
|
231
|
+
["gem build", { strict: true }, { "GEM_HOME" => "~/.gems/ruby-3.4.0" }] # gem build --strict
|
232
|
+
])
|
233
|
+
|
234
|
+
add("pathname", test: ["rake test", { jobs: ENV["RAKE_JOBS"] }]) # rake test --jobs 4
|
214
235
|
add("fileutils", graph: "pathname")
|
215
|
-
add("optparse")
|
236
|
+
add("optparse", run: "gem build", env: { "PATH" => "~/.bin" }, opts: "-v") # PATH="~/.bin" gem build -v
|
216
237
|
add("rake", graph: ["fileutils", "optparse"])
|
217
|
-
banner(command: false)
|
238
|
+
banner(command: false) # Always hide banner
|
218
239
|
end
|
219
240
|
.build
|
220
241
|
```
|
@@ -229,6 +250,9 @@ rake graph:node # same
|
|
229
250
|
rake rake:graph # pathname + fileutils + optparse + rake
|
230
251
|
rake graph:ruby # same
|
231
252
|
rake graph # graph:node + graph:ruby
|
253
|
+
|
254
|
+
rake squared:graph:run[express,pir] # emc + pir + express + squared
|
255
|
+
rake squared:graph:run[node,-emc] # pir + express + squared
|
232
256
|
```
|
233
257
|
|
234
258
|
### Batch
|
@@ -288,10 +312,12 @@ rake squared:outdated:workspace # cli + sqd-serve + sqd-admin
|
|
288
312
|
Task:
|
289
313
|
|
290
314
|
* run
|
315
|
+
* script
|
291
316
|
* depend
|
292
317
|
* graph
|
293
|
-
* test
|
294
318
|
* doc
|
319
|
+
* lint
|
320
|
+
* test
|
295
321
|
* clean
|
296
322
|
|
297
323
|
Non-task:
|
@@ -332,51 +358,107 @@ Common::PATH.merge!({
|
|
332
358
|
### Build
|
333
359
|
|
334
360
|
```ruby
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
# :env
|
342
|
-
#
|
343
|
-
BUILD_${NAME}
|
344
|
-
BUILD_${NAME}_OPTS
|
345
|
-
BUILD_${NAME}_ENV
|
346
|
-
BUILD_${NAME}
|
347
|
-
|
348
|
-
|
349
|
-
|
361
|
+
Workspace::Application
|
362
|
+
.new
|
363
|
+
.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
|
+
|
365
|
+
BUILD_TYPE # global
|
366
|
+
|
367
|
+
# :env :run :opts :type
|
368
|
+
# LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -g -O2
|
369
|
+
BUILD_${NAME} # gcc a.c -o a.o
|
370
|
+
BUILD_${NAME}_OPTS # -g
|
371
|
+
BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
|
372
|
+
BUILD_${NAME}_TYPE # debug
|
373
|
+
|
374
|
+
# :env :opts :script :args
|
375
|
+
# NODE_ENV="production" NO_COLOR="1" npm run --loglevel=error --workspaces=false build:dev -- --quiet
|
376
|
+
BUILD_${NAME} # build:dev
|
377
|
+
BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
|
378
|
+
BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
|
379
|
+
BUILD_${NAME}_DEV # pattern,0,1 (:dev)
|
380
|
+
BUILD_${NAME}_PROD # pattern,0,1 (:prod)
|
381
|
+
SCRIPT_${NAME}_OPTS # --quiet
|
382
|
+
|
383
|
+
BUILD_${NAME}=0 # skip project
|
350
384
|
```
|
351
385
|
|
352
|
-
|
386
|
+
### Graph
|
387
|
+
|
388
|
+
```ruby
|
389
|
+
GRAPH_${NAME} # depend,build => squared:depend + squared:build
|
390
|
+
GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
391
|
+
```
|
353
392
|
|
354
393
|
### Logger
|
355
394
|
|
395
|
+
These global options also can target the project suffix `${NAME}`. (e.g. LOG_FILE_EMC)
|
396
|
+
|
356
397
|
```ruby
|
357
|
-
LOG_FILE
|
398
|
+
LOG_FILE # %Y-%m-%d.log
|
358
399
|
# OR
|
359
|
-
LOG_AUTO
|
400
|
+
LOG_AUTO # year,y,month,m,day,d,1
|
360
401
|
# Optional
|
361
|
-
LOG_DIR
|
362
|
-
LOG_LEVEL
|
363
|
-
LOG_COLUMNS
|
402
|
+
LOG_DIR # exist?
|
403
|
+
LOG_LEVEL # See gem "logger"
|
404
|
+
LOG_COLUMNS # terminal width (default: 80)
|
364
405
|
```
|
365
406
|
|
366
407
|
### Repo
|
367
408
|
|
409
|
+
These global options also can target the application main suffix `${NAME}`. (e.g. REPO_ROOT_SQUARED)
|
410
|
+
|
411
|
+
```ruby
|
412
|
+
REPO_ROOT # parent dir
|
413
|
+
REPO_HOME # project dir (main)
|
414
|
+
REPO_BUILD # run,script
|
415
|
+
REPO_GROUP # string
|
416
|
+
REPO_REF # e.g. ruby,node
|
417
|
+
REPO_DEV # pattern,0,1
|
418
|
+
REPO_PROD # pattern,0,1
|
419
|
+
REPO_WARN # 0,1
|
420
|
+
REPO_SYNC # 0,1
|
421
|
+
REPO_MANIFEST # e.g. latest,nightly,prod
|
422
|
+
REPO_TIMEOUT # confirm dialog (seconds)
|
423
|
+
```
|
424
|
+
|
425
|
+
## Git
|
426
|
+
|
427
|
+
Most project classes will inherit from `Git` which enables these tasks:
|
428
|
+
|
429
|
+
| Task | Git | Command |
|
430
|
+
| :--------- | :--------------- | :-------------------------------------------- |
|
431
|
+
| branch | branch | create set delete move copy list edit current |
|
432
|
+
| checkout | checkout | commit branch track detach path |
|
433
|
+
| commit | commit | add all amend amend-orig |
|
434
|
+
| diff | diff | head cached branch files between contain |
|
435
|
+
| fetch | fetch | origin remote |
|
436
|
+
| files | ls-files | cached modified deleted others ignored |
|
437
|
+
| pull | pull | origin remote |
|
438
|
+
| rebase | rebase | branch onto send |
|
439
|
+
| refs | ls-remote --refs | heads tags remote |
|
440
|
+
| reset | reset | commit index patch mode |
|
441
|
+
| restore | restore | source worktree staged overlay |
|
442
|
+
| rev | rev | commit branch output parseopt |
|
443
|
+
| show | show | format oneline |
|
444
|
+
| stash | stash | push pop apply drop list |
|
445
|
+
| tag | tag | add delete list |
|
446
|
+
|
447
|
+
You can disable all of them at once using the `exclude` property.
|
448
|
+
|
368
449
|
```ruby
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
450
|
+
Workspace::Application
|
451
|
+
.new
|
452
|
+
.add("squared", exclude: :git)
|
453
|
+
```
|
454
|
+
|
455
|
+
You can disable one or more of them using the `pass` property as a *string*.
|
456
|
+
|
457
|
+
```ruby
|
458
|
+
Workspace::Application
|
459
|
+
.new
|
460
|
+
.add("squared", pass: ["pull"], ref: :node)
|
461
|
+
.pass("pull", ref: :node) { read_packagemanager(:private) }
|
380
462
|
```
|
381
463
|
|
382
464
|
## LICENSE
|
data/lib/squared/common/base.rb
CHANGED
data/lib/squared/common/class.rb
CHANGED
@@ -9,7 +9,7 @@ module Squared
|
|
9
9
|
extend Forwardable
|
10
10
|
|
11
11
|
def self.to_s
|
12
|
-
super
|
12
|
+
super[/[^:]+\z/, 0]
|
13
13
|
end
|
14
14
|
|
15
15
|
def_delegators :@data, :+, :each, :each_with_index, :entries, :to_a, :include?
|
@@ -31,7 +31,7 @@ module Squared
|
|
31
31
|
|
32
32
|
class JoinSet < Set
|
33
33
|
def self.to_s
|
34
|
-
super
|
34
|
+
super[/[^:]+\z/, 0]
|
35
35
|
end
|
36
36
|
|
37
37
|
attr_reader :delim
|
@@ -41,8 +41,33 @@ module Squared
|
|
41
41
|
@delim = delim
|
42
42
|
end
|
43
43
|
|
44
|
+
def last(val, pat)
|
45
|
+
(@last ||= []).push([val, pat, $1]) if val =~ pat
|
46
|
+
self << val
|
47
|
+
end
|
48
|
+
|
44
49
|
def pass(&blk)
|
45
50
|
ret = to_a.map!(&:to_s).reject(&:empty?)
|
51
|
+
@last&.each do |val, pat, key|
|
52
|
+
i = []
|
53
|
+
j = nil
|
54
|
+
ret.each_with_index do |opt, index|
|
55
|
+
if opt == val
|
56
|
+
j = index
|
57
|
+
elsif j && opt =~ pat && $1 == key
|
58
|
+
i << index
|
59
|
+
end
|
60
|
+
end
|
61
|
+
next unless j && !i.empty?
|
62
|
+
|
63
|
+
val = ret[j]
|
64
|
+
cur = j
|
65
|
+
i.each do |k|
|
66
|
+
ret[cur] = ret[k]
|
67
|
+
cur = k
|
68
|
+
end
|
69
|
+
ret[i.last] = val
|
70
|
+
end
|
46
71
|
block_given? ? ret.reject(&blk) : ret
|
47
72
|
end
|
48
73
|
|
@@ -66,7 +66,7 @@ module Squared
|
|
66
66
|
f, b = type.to_s.split('.')
|
67
67
|
s = wrap.(s, ['38', '5', f]) if f[0] != '-' && f.to_i <= 255
|
68
68
|
if b
|
69
|
-
b = b[0
|
69
|
+
b = b[0, 3]
|
70
70
|
s = wrap.(s, ['48', '5', b]) unless b.to_i > 255
|
71
71
|
end
|
72
72
|
else
|
@@ -114,10 +114,10 @@ module Squared
|
|
114
114
|
if !val.is_a?(::Numeric)
|
115
115
|
val = val.to_sym
|
116
116
|
ret << val if colors.key?(val) || TEXT_STYLE.include?(val)
|
117
|
-
elsif val
|
117
|
+
elsif val >= 0 && val <= 256
|
118
118
|
ret << val
|
119
119
|
elsif val < 0 && (b = val.to_s.split('.')[1])
|
120
|
-
b = b[0
|
120
|
+
b = b[0, 3]
|
121
121
|
ret << "-0.#{b}".to_f unless b.to_i > 255
|
122
122
|
end
|
123
123
|
end
|
@@ -174,8 +174,12 @@ module Squared
|
|
174
174
|
emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub)
|
175
175
|
else
|
176
176
|
msg = [log_title(level, color: color)]
|
177
|
-
|
178
|
-
|
177
|
+
if subject
|
178
|
+
msg << (color ? sub_style(subject, :underline) : subject)
|
179
|
+
else
|
180
|
+
msg += args
|
181
|
+
args.clear
|
182
|
+
end
|
179
183
|
message(msg.join(' '), *args, hint: hint)
|
180
184
|
end
|
181
185
|
end
|
@@ -185,7 +189,7 @@ module Squared
|
|
185
189
|
begin
|
186
190
|
File.open(pipe, 'a') do |f|
|
187
191
|
br = File::SEPARATOR == '\\' ? "\r\n" : "\n"
|
188
|
-
args.flatten.each { |val| f.write(
|
192
|
+
args.flatten.each { |val| f.write(strip_style(val.chomp) + br) }
|
189
193
|
end
|
190
194
|
return
|
191
195
|
rescue StandardError
|
@@ -274,12 +278,8 @@ module Squared
|
|
274
278
|
val.gsub(/\x1B\[(\d+;?)+m/, '')
|
275
279
|
end
|
276
280
|
|
277
|
-
def stripext(val)
|
278
|
-
File.basename(val, File.extname(val))
|
279
|
-
end
|
280
|
-
|
281
281
|
def raise_error(*args, hint: nil, kind: ArgumentError)
|
282
|
-
raise kind, message(*args, hint: hint, empty: true), caller_locations(1)
|
282
|
+
raise kind, message(*args, hint: hint, empty: true), caller_locations(1)
|
283
283
|
end
|
284
284
|
end
|
285
285
|
end
|