squared 0.4.6 → 0.4.7
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 +47 -0
- data/README.ruby.md +36 -32
- data/lib/squared/common/class.rb +2 -5
- data/lib/squared/common/format.rb +6 -2
- data/lib/squared/common/shell.rb +2 -2
- data/lib/squared/common/system.rb +2 -2
- data/lib/squared/common/utils.rb +7 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +3 -3
- data/lib/squared/workspace/project/base.rb +126 -204
- data/lib/squared/workspace/project/docker.rb +57 -51
- data/lib/squared/workspace/project/git.rb +147 -155
- data/lib/squared/workspace/project/node.rb +43 -30
- data/lib/squared/workspace/project/python.rb +62 -50
- data/lib/squared/workspace/project/ruby.rb +71 -60
- data/lib/squared/workspace/project/support/class.rb +197 -0
- data/lib/squared/workspace/project/support.rb +3 -0
- data/lib/squared/workspace/project.rb +1 -0
- data/lib/squared/workspace/series.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf1642a52eeb080a0aa4dadb9c7fb5a3060612904bd06a8161ab18b4e333a9a
|
4
|
+
data.tar.gz: 7bad82be155782b37036cc2d447395a37585ed33b4d37c5281e3ccd3f902ea33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77fda3077ec4c929fad3003d7255d5aeb7b0f7fa2d14a717678772572a3a972214247aabc6911d8e717103b855ae1109c81c118ca5564f46fd4e79ecfc62cf6a
|
7
|
+
data.tar.gz: 29e84ae67dc2aad4ac61c99407443d65210f96af60649784c9264a75c686473b919328a9ea6d97b6bda6e4fd61aeaa97df4e196bdf87f6e32819dfea1306c76a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,48 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.7] - 2025-04-17
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Project support class OptionPartition was created.
|
8
|
+
- Git command tag action sign was implemented.
|
9
|
+
- Gem command uninstall was implemented.
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- DateTime instances was replaced with Time.
|
14
|
+
- Utils method time_offset was renamed time_since.
|
15
|
+
- Ruby gem command build will search project for gemspec.
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
|
19
|
+
- Project task archive was not enabled.
|
20
|
+
|
21
|
+
## [0.3.9] - 2025-04-17
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- Project option parser did not separate custom values.
|
26
|
+
|
27
|
+
## [0.2.9] - 2025-04-17
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- Project log file naming supports more date formats.
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- Environment options did not always pass session object.
|
36
|
+
- Git command pull actions used unknown flags.
|
37
|
+
- Workspace describe did not merge multiple invocations.
|
38
|
+
|
39
|
+
## [0.1.6] - 2025-04-17
|
40
|
+
|
41
|
+
### Fixed
|
42
|
+
|
43
|
+
- User-defined program paths were not reduced to bare name.
|
44
|
+
- Project path validation did not include separator.
|
45
|
+
|
3
46
|
## [0.4.6] - 2025-04-12
|
4
47
|
|
5
48
|
### Added
|
@@ -490,6 +533,7 @@
|
|
490
533
|
|
491
534
|
- Changelog was created.
|
492
535
|
|
536
|
+
[0.4.7]: https://github.com/anpham6/squared/releases/tag/v0.4.7-ruby
|
493
537
|
[0.4.6]: https://github.com/anpham6/squared/releases/tag/v0.4.6-ruby
|
494
538
|
[0.4.5]: https://github.com/anpham6/squared/releases/tag/v0.4.5-ruby
|
495
539
|
[0.4.4]: https://github.com/anpham6/squared/releases/tag/v0.4.4-ruby
|
@@ -497,6 +541,7 @@
|
|
497
541
|
[0.4.2]: https://github.com/anpham6/squared/releases/tag/v0.4.2-ruby
|
498
542
|
[0.4.1]: https://github.com/anpham6/squared/releases/tag/v0.4.1-ruby
|
499
543
|
[0.4.0]: https://github.com/anpham6/squared/releases/tag/v0.4.0-ruby
|
544
|
+
[0.3.9]: https://github.com/anpham6/squared/releases/tag/v0.3.9-ruby
|
500
545
|
[0.3.8]: https://github.com/anpham6/squared/releases/tag/v0.3.8-ruby
|
501
546
|
[0.3.7]: https://github.com/anpham6/squared/releases/tag/v0.3.7-ruby
|
502
547
|
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
@@ -506,6 +551,7 @@
|
|
506
551
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
507
552
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
508
553
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
554
|
+
[0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
|
509
555
|
[0.2.8]: https://github.com/anpham6/squared/releases/tag/v0.2.8-ruby
|
510
556
|
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
511
557
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
@@ -515,6 +561,7 @@
|
|
515
561
|
[0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
|
516
562
|
[0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
|
517
563
|
[0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
|
564
|
+
[0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
|
518
565
|
[0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
|
519
566
|
[0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
|
520
567
|
[0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
|
data/README.ruby.md
CHANGED
@@ -443,7 +443,7 @@ Most project classes will inherit from `Git` which enables these tasks:
|
|
443
443
|
| rev | rev | commit branch output parseopt |
|
444
444
|
| show | show | format oneline |
|
445
445
|
| stash | stash | push pop apply drop list |
|
446
|
-
| tag | tag | add delete list
|
446
|
+
| tag | tag | add sign delete list |
|
447
447
|
|
448
448
|
You can disable all of them at once using the `exclude` property.
|
449
449
|
|
@@ -466,7 +466,7 @@ Workspace::Application
|
|
466
466
|
|
467
467
|
### Path
|
468
468
|
|
469
|
-
All project
|
469
|
+
All project binary programs can have their executable path set to a non-global alias.
|
470
470
|
|
471
471
|
```ruby
|
472
472
|
Common::PATH.merge!({
|
@@ -483,44 +483,47 @@ Common::PATH.merge!({
|
|
483
483
|
|
484
484
|
### Build
|
485
485
|
|
486
|
-
```
|
486
|
+
```ruby
|
487
487
|
Workspace::Application
|
488
488
|
.new
|
489
489
|
.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
|
490
|
+
```
|
490
491
|
|
491
|
-
|
492
|
+
```sh
|
493
|
+
BUILD_TYPE # global
|
494
|
+
${PROG}_COLOR=0 # --no-color (e.g. GIT_COLOR)
|
492
495
|
|
493
496
|
# :env :run :args :opts :type
|
494
497
|
# LD_LIBRARY_PATH="path/to/lib" CFLAGS="-Wall" gcc a.c -o a.o -g -O2
|
495
|
-
BUILD_${NAME}
|
496
|
-
BUILD_${NAME}_OPTS
|
497
|
-
BUILD_${NAME}_ENV
|
498
|
-
BUILD_${NAME}_TYPE
|
498
|
+
BUILD_${NAME} # gcc a.c -o a.o
|
499
|
+
BUILD_${NAME}_OPTS # -g
|
500
|
+
BUILD_${NAME}_ENV # {"LD_LIBRARY_PATH":"path/to/lib","CFLAGS":"-Wall"} (hash/json)
|
501
|
+
BUILD_${NAME}_TYPE # debug
|
499
502
|
|
500
503
|
# :env :script :opts :args
|
501
504
|
# NODE_ENV="production" NO_COLOR="1" npm run build:dev --loglevel=error --workspaces=false -- --quiet
|
502
|
-
BUILD_${NAME}
|
503
|
-
BUILD_${NAME}_OPTS
|
504
|
-
BUILD_${NAME}_ENV
|
505
|
-
BUILD_${NAME}_DEV
|
506
|
-
BUILD_${NAME}_PROD
|
507
|
-
${REF}_${NAME}_OPTS
|
505
|
+
BUILD_${NAME} # build:dev
|
506
|
+
BUILD_${NAME}_OPTS # --loglevel=error --workspaces=false
|
507
|
+
BUILD_${NAME}_ENV # {"NODE_ENV":"production","NO_COLOR":"1"} (hash/json)
|
508
|
+
BUILD_${NAME}_DEV # pattern,0,1 (:dev)
|
509
|
+
BUILD_${NAME}_PROD # pattern,0,1 (:prod)
|
510
|
+
${REF}_${NAME}_OPTS # --quiet (e.g. NODE_SQUARED_OPTS)
|
508
511
|
|
509
|
-
BUILD_${NAME}=0
|
510
|
-
BUILD_${NAME}_VERSION=0.1.0
|
512
|
+
BUILD_${NAME}=0 # skip project
|
513
|
+
BUILD_${NAME}_VERSION=0.1.0 # publish + detection
|
511
514
|
|
512
|
-
BANNER=0
|
513
|
-
BANNER_${NAME}=0
|
515
|
+
BANNER=0 # hide banner
|
516
|
+
BANNER_${NAME}=0 #
|
514
517
|
|
515
|
-
REVBUILD_FORCE=1
|
516
|
-
REVBUILD_FORCE_${NAME}=1
|
518
|
+
REVBUILD_FORCE=1 # Rebuild all targets
|
519
|
+
REVBUILD_FORCE_${NAME}=1 # Rebuild project
|
517
520
|
```
|
518
521
|
|
519
522
|
### Graph
|
520
523
|
|
521
524
|
```sh
|
522
|
-
GRAPH_${NAME}
|
523
|
-
GRAPH_${NAME}_PASS
|
525
|
+
GRAPH_${NAME} # depend,build => squared:depend + squared:build
|
526
|
+
GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
524
527
|
```
|
525
528
|
|
526
529
|
### Logger
|
@@ -528,22 +531,22 @@ GRAPH_${NAME}_PASS # -emc,pir,express => pir + express
|
|
528
531
|
These global options also can target the project suffix `${NAME}`. (e.g. LOG_FILE_EMC)
|
529
532
|
|
530
533
|
```sh
|
531
|
-
LOG_FILE
|
534
|
+
LOG_FILE # %Y-%m-%d.log
|
532
535
|
# OR
|
533
|
-
LOG_AUTO
|
536
|
+
LOG_AUTO # year,y,month,m,day,d,1
|
534
537
|
# Optional
|
535
|
-
LOG_DIR
|
536
|
-
LOG_LEVEL
|
537
|
-
LOG_COLUMNS
|
538
|
+
LOG_DIR # exist?
|
539
|
+
LOG_LEVEL # See gem "logger"
|
540
|
+
LOG_COLUMNS # terminal width (default: 80)
|
538
541
|
```
|
539
542
|
|
540
543
|
### Git
|
541
544
|
|
542
545
|
```sh
|
543
|
-
GIT_OPTIONS=q,strategy=ort
|
544
|
-
GIT_OPTIONS_${NAME}=v,ff
|
545
|
-
GIT_AUTOSTASH=1
|
546
|
-
GIT_AUTOSTASH_${NAME}=0
|
546
|
+
GIT_OPTIONS=q,strategy=ort # all
|
547
|
+
GIT_OPTIONS_${NAME}=v,ff # project only
|
548
|
+
GIT_AUTOSTASH=1 # rebase (all)
|
549
|
+
GIT_AUTOSTASH_${NAME}=0 # rebase (project only)
|
547
550
|
```
|
548
551
|
|
549
552
|
| Command | Flag | ENV |
|
@@ -567,7 +570,8 @@ GIT_AUTOSTASH_${NAME}=0 # rebase (project only)
|
|
567
570
|
| checkout | branch | DETACH TRACK=s |
|
568
571
|
| checkout | global path | HEAD=s PATHSPEC=s |
|
569
572
|
| checkout | * | FORCE MERGE |
|
570
|
-
| tag | add | SIGN HEAD=s
|
573
|
+
| tag | add | SIGN FORCE HEAD=s |
|
574
|
+
| tag | sign | FORCE HEAD=s |
|
571
575
|
| log | * | PATHSPEC=s |
|
572
576
|
| diff | -between -contain | MERGE_BASE |
|
573
577
|
| diff | head branch | INDEX=n |
|
data/lib/squared/common/class.rb
CHANGED
@@ -12,7 +12,7 @@ module Squared
|
|
12
12
|
super[/[^:]+\z/, 0]
|
13
13
|
end
|
14
14
|
|
15
|
-
def_delegators :@data, :+, :each, :each_with_index, :entries, :to_a, :include?
|
15
|
+
def_delegators :@data, :+, :each, :each_with_index, :entries, :merge, :to_a, :include?
|
16
16
|
|
17
17
|
def initialize(data = [])
|
18
18
|
@data = Set.new(data)
|
@@ -74,10 +74,7 @@ module Squared
|
|
74
74
|
def temp(*args, &blk)
|
75
75
|
args.compact!
|
76
76
|
ret = pass(&blk)
|
77
|
-
unless args.empty?
|
78
|
-
ret += args
|
79
|
-
ret = Set.new(ret).to_a
|
80
|
-
end
|
77
|
+
ret = Set.new(ret.concat(args)).to_a unless args.empty?
|
81
78
|
ret.join(@delim)
|
82
79
|
end
|
83
80
|
|
@@ -255,7 +255,7 @@ module Squared
|
|
255
255
|
end
|
256
256
|
out << draw.(b2, b3)
|
257
257
|
if title
|
258
|
-
out
|
258
|
+
out.concat(title.map { |t| pr.(t) })
|
259
259
|
out << draw.(b6, b7)
|
260
260
|
end
|
261
261
|
lines.each { |line| out << pr.(line) }
|
@@ -268,7 +268,7 @@ module Squared
|
|
268
268
|
s
|
269
269
|
end
|
270
270
|
end
|
271
|
-
out
|
271
|
+
out.concat(footer)
|
272
272
|
end
|
273
273
|
if block_given?
|
274
274
|
yield out
|
@@ -291,6 +291,10 @@ module Squared
|
|
291
291
|
val.gsub(/\x1B\[(\d+;?)+m/, '')
|
292
292
|
end
|
293
293
|
|
294
|
+
def stripext(val)
|
295
|
+
File.basename(val, File.extname(val))
|
296
|
+
end
|
297
|
+
|
294
298
|
def raise_error(*args, hint: nil, kind: ArgumentError)
|
295
299
|
raise kind, message(*args, hint: hint, empty: true), caller_locations(1).map(&:to_s)
|
296
300
|
end
|
data/lib/squared/common/shell.rb
CHANGED
@@ -13,7 +13,7 @@ module Squared
|
|
13
13
|
return val if !r[3] || (!r[5] && r[6].match?(/\s/))
|
14
14
|
|
15
15
|
combine = lambda do |opt|
|
16
|
-
if r[2] =~
|
16
|
+
if r[2] =~ /\A(["'])(.+)\1\z/
|
17
17
|
double = $1 == '"'
|
18
18
|
r[2] = $2
|
19
19
|
override = true
|
@@ -48,7 +48,7 @@ module Squared
|
|
48
48
|
def shell_option(flag, val = nil, escape: true, quote: true, force: true, double: false, override: false,
|
49
49
|
merge: false)
|
50
50
|
flag = flag.to_s
|
51
|
-
if flag =~
|
51
|
+
if flag =~ /\A(["'])(.+)\1\z/
|
52
52
|
double = $1 == '"'
|
53
53
|
flag = $2
|
54
54
|
escape = false
|
@@ -23,14 +23,14 @@ module Squared
|
|
23
23
|
def copy_dir(src, dest, glob = ['**/*'], create: false, link: nil, force: false, pass: nil, verbose: true)
|
24
24
|
src = Pathname.new(src)
|
25
25
|
dest = Pathname.new(dest)
|
26
|
-
raise "#{dest} (not found)" if !create && !dest.parent.exist?
|
26
|
+
raise "#{dest.cleanpath} (not found)" if !create && !dest.parent.exist?
|
27
27
|
|
28
28
|
subdir = {}
|
29
29
|
dest.mkpath if create
|
30
30
|
if pass
|
31
31
|
exclude = []
|
32
32
|
pass = [pass] unless pass.is_a?(::Array)
|
33
|
-
pass.each { |val| exclude
|
33
|
+
pass.each { |val| exclude.concat(Dir.glob(src.join(val))) }
|
34
34
|
end
|
35
35
|
(glob.is_a?(::Array) ? glob : [glob]).each do |val|
|
36
36
|
Dir.glob(src.join(val)) do |path|
|
data/lib/squared/common/utils.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'pathname'
|
4
4
|
require 'rake'
|
5
|
+
require 'time'
|
5
6
|
|
6
7
|
module Squared
|
7
8
|
module Common
|
@@ -101,6 +102,11 @@ module Squared
|
|
101
102
|
(cur.strftime('%Q').to_i + time_offset) - (val.strftime('%Q').to_i + ret)
|
102
103
|
end
|
103
104
|
|
105
|
+
def time_since(val, ms: true)
|
106
|
+
s = ms ? '%s%L' : '%s'
|
107
|
+
Time.now.utc.strftime(s).to_i - Time.parse(val).utc.strftime(s).to_i
|
108
|
+
end
|
109
|
+
|
104
110
|
def env(key, default = nil, suffix: nil, strict: false, equals: nil, ignore: nil)
|
105
111
|
ret = env_value(key, suffix: suffix, strict: strict)
|
106
112
|
return ret == equals.to_s unless equals.nil?
|
@@ -144,7 +150,7 @@ module Squared
|
|
144
150
|
def env_pipe(key, default = 1, suffix: nil, strict: false, root: nil)
|
145
151
|
if default.is_a?(::String)
|
146
152
|
begin
|
147
|
-
default = (root ? root.join(default) : Pathname.new(default)).realdirpath
|
153
|
+
default = (root ? Pathname.new(root).join(default) : Pathname.new(default)).realdirpath
|
148
154
|
rescue StandardError => e
|
149
155
|
default = 1
|
150
156
|
warn e
|
data/lib/squared/version.rb
CHANGED
@@ -38,7 +38,7 @@ module Squared
|
|
38
38
|
impl_series.alias(*args)
|
39
39
|
end
|
40
40
|
if (args = obj.bannerargs)
|
41
|
-
@attr_banner
|
41
|
+
@attr_banner.merge(args)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -350,7 +350,7 @@ module Squared
|
|
350
350
|
end
|
351
351
|
|
352
352
|
def describe(data)
|
353
|
-
@describe
|
353
|
+
@describe ||= {
|
354
354
|
alias: {},
|
355
355
|
replace: [],
|
356
356
|
pattern: {}
|
@@ -461,7 +461,7 @@ module Squared
|
|
461
461
|
tasks.clear
|
462
462
|
break
|
463
463
|
end
|
464
|
-
tasks
|
464
|
+
tasks.concat(items)
|
465
465
|
end
|
466
466
|
return tasks unless tasks.empty?
|
467
467
|
end
|