squared 0.3.8 → 0.3.10
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 +62 -0
- data/README.ruby.md +1 -1
- data/lib/squared/common/format.rb +5 -1
- data/lib/squared/common/prompt.rb +1 -1
- data/lib/squared/common/shell.rb +2 -2
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +1 -1
- data/lib/squared/workspace/project/base.rb +32 -24
- data/lib/squared/workspace/project/git.rb +72 -74
- data/lib/squared/workspace/project/node.rb +4 -4
- data/lib/squared/workspace/project/python.rb +4 -4
- data/lib/squared/workspace/project/ruby.rb +7 -5
- data/lib/squared/workspace/repo.rb +0 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86709d5961b0a4cf2fd7192ea64d178737ca047b286f5d1888cc9cb58412697a
|
4
|
+
data.tar.gz: e95da9ca85b3e493e20743da05b552840b0a4a77f4afec1b0edd947ec3e27229
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2e5eeda8962c5d2e8e0734f0784c2138312e2c6b0c27ccd07e9c7c0a3fde17fe1b32e4c596206696a6c29daf05414c8f5474b141ff604292f18e1a3563d8aa0
|
7
|
+
data.tar.gz: af7771a53f01d2083c5d7ad7832e036aade52441493733a76604b5af884214cf26fb84ef9b7a451a84e1f725f15f396123b6eda9b49560ef7f722a24b4173b71
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,61 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.3.10] - 2025-04-27
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- Git command reset action commit used invalid delimeter.
|
8
|
+
- Git single option values were not merged as per specification.
|
9
|
+
- Project script task did not fire first and last callbacks.
|
10
|
+
- Git task status did not display branch information.
|
11
|
+
- Git checkout action commit did not include options.
|
12
|
+
|
13
|
+
### Removed
|
14
|
+
|
15
|
+
- Git command files action ignored could not be used alone.
|
16
|
+
|
17
|
+
## [0.2.10] - 2025-04-27
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
|
21
|
+
- Project run and script tasks did not fire first and last callbacks.
|
22
|
+
- Git command clone did not read booleans for recurse-submodules.
|
23
|
+
|
24
|
+
## [0.1.7] - 2025-04-27
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- Project directory context method option pass was inverted.
|
29
|
+
- Shell options with spaces and without quotes were not escaped.
|
30
|
+
- Git task status did not display branch information.
|
31
|
+
- Ruby copy method argument include was ignored when used directly.
|
32
|
+
- Git commit could not push branch without same name as remote.
|
33
|
+
|
34
|
+
## [0.3.9] - 2025-04-17
|
35
|
+
|
36
|
+
### Fixed
|
37
|
+
|
38
|
+
- Project option parser did not separate custom values.
|
39
|
+
|
40
|
+
## [0.2.9] - 2025-04-17
|
41
|
+
|
42
|
+
### Changed
|
43
|
+
|
44
|
+
- Project log file naming supports more date formats.
|
45
|
+
|
46
|
+
### Fixed
|
47
|
+
|
48
|
+
- Environment options did not always pass session object.
|
49
|
+
- Git command pull actions used unknown flags.
|
50
|
+
- Workspace describe did not merge multiple invocations.
|
51
|
+
|
52
|
+
## [0.1.6] - 2025-04-17
|
53
|
+
|
54
|
+
### Fixed
|
55
|
+
|
56
|
+
- User-defined program paths were not reduced to bare name.
|
57
|
+
- Project path validation did not include separator.
|
58
|
+
|
3
59
|
## [0.3.8] - 2025-04-12
|
4
60
|
|
5
61
|
### Fixed
|
@@ -345,6 +401,8 @@
|
|
345
401
|
|
346
402
|
- Changelog was created.
|
347
403
|
|
404
|
+
[0.3.10]: https://github.com/anpham6/squared/releases/tag/v0.3.10-ruby
|
405
|
+
[0.3.9]: https://github.com/anpham6/squared/releases/tag/v0.3.9-ruby
|
348
406
|
[0.3.8]: https://github.com/anpham6/squared/releases/tag/v0.3.8-ruby
|
349
407
|
[0.3.7]: https://github.com/anpham6/squared/releases/tag/v0.3.7-ruby
|
350
408
|
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
@@ -354,6 +412,8 @@
|
|
354
412
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
355
413
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
356
414
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
415
|
+
[0.2.10]: https://github.com/anpham6/squared/releases/tag/v0.2.10-ruby
|
416
|
+
[0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
|
357
417
|
[0.2.8]: https://github.com/anpham6/squared/releases/tag/v0.2.8-ruby
|
358
418
|
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
359
419
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
@@ -363,6 +423,8 @@
|
|
363
423
|
[0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
|
364
424
|
[0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
|
365
425
|
[0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
|
426
|
+
[0.1.7]: https://github.com/anpham6/squared/releases/tag/v0.1.7-ruby
|
427
|
+
[0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
|
366
428
|
[0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
|
367
429
|
[0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
|
368
430
|
[0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
|
data/README.ruby.md
CHANGED
@@ -433,7 +433,7 @@ Most project classes will inherit from `Git` which enables these tasks:
|
|
433
433
|
| commit | commit | add all amend amend-orig |
|
434
434
|
| diff | diff | head cached branch files between contain |
|
435
435
|
| fetch | fetch | origin remote |
|
436
|
-
| files | ls-files | cached modified deleted others
|
436
|
+
| files | ls-files | cached modified deleted others |
|
437
437
|
| pull | pull | origin remote |
|
438
438
|
| rebase | rebase | branch onto send |
|
439
439
|
| refs | ls-remote --refs | heads tags remote |
|
@@ -53,7 +53,7 @@ module Squared
|
|
53
53
|
end
|
54
54
|
wrap = ->(s, n) { "\x1B[#{n.join(';')}m#{s}\x1B[0m" }
|
55
55
|
code = []
|
56
|
-
args.concat(as_a(styles)).each_with_index do |type, i|
|
56
|
+
args.concat(as_a(styles)).flatten.each_with_index do |type, i|
|
57
57
|
next unless type
|
58
58
|
|
59
59
|
if index == -1
|
@@ -274,6 +274,10 @@ module Squared
|
|
274
274
|
val.gsub(/\x1B\[(\d+;?)+m/, '')
|
275
275
|
end
|
276
276
|
|
277
|
+
def stripext(val)
|
278
|
+
File.basename(val, File.extname(val))
|
279
|
+
end
|
280
|
+
|
277
281
|
def raise_error(*args, hint: nil, kind: ArgumentError)
|
278
282
|
raise kind, message(*args, hint: hint, empty: true), caller_locations(1).map(&:to_s)
|
279
283
|
end
|
data/lib/squared/common/shell.rb
CHANGED
@@ -10,7 +10,7 @@ module Squared
|
|
10
10
|
|
11
11
|
def shell_escape(val, quote: false, force: false)
|
12
12
|
if (data = /\A(--?[^= ]+)((=|\s+)(["'])?(.+?)(["'])?)?\z/m.match(val = val.to_s))
|
13
|
-
return val if !data[2] || (!data[4] && data[5]
|
13
|
+
return val if !data[2] || (!data[4] && !data[5].match?(/\s/))
|
14
14
|
|
15
15
|
join = ->(opt) { data[1] + data[3] + shell_quote(opt) }
|
16
16
|
if data[4] == data[6]
|
@@ -21,7 +21,7 @@ module Squared
|
|
21
21
|
elsif Rake::Win32.windows?
|
22
22
|
quote ? shell_quote(val, force: force) : val
|
23
23
|
else
|
24
|
-
Shellwords.escape(val)
|
24
|
+
val.empty? ? '' : Shellwords.escape(val)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
data/lib/squared/version.rb
CHANGED
@@ -173,19 +173,24 @@ module Squared
|
|
173
173
|
return if @log
|
174
174
|
|
175
175
|
log = log.is_a?(Hash) ? log.dup : { file: log }
|
176
|
-
|
177
|
-
file =
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
176
|
+
if (file = env('LOG_FILE'))
|
177
|
+
file = DateTime.now.strftime(file)
|
178
|
+
elsif (val = env('LOG_AUTO'))
|
179
|
+
file = "#{@name}-%s.log" % [case val
|
180
|
+
when 'y', 'year'
|
181
|
+
Date.today.year
|
182
|
+
when 'm', 'month'
|
183
|
+
Date.today.strftime('%Y-%m')
|
184
|
+
when 'd', 'day', '1'
|
185
|
+
Date.today
|
186
|
+
else
|
187
|
+
val.include?('%') ? DateTime.now.strftime(val) : DateTime.now.strftime
|
188
|
+
end]
|
189
|
+
elsif (val = log[:file])
|
190
|
+
file = val.is_a?(String) ? DateTime.now.strftime(val) : "#{@name}-#{Date.today}.log"
|
191
|
+
end
|
192
|
+
if file
|
193
|
+
file = (val = env('LOG_DIR')) ? @workspace.home.join(val, file) : @workspace.home.join(file)
|
189
194
|
begin
|
190
195
|
file = file.realdirpath
|
191
196
|
rescue StandardError => e
|
@@ -402,6 +407,7 @@ module Squared
|
|
402
407
|
return unless respond_to?(:compose)
|
403
408
|
|
404
409
|
cmd = compose(as_get(opts), flags, script: true, args: scr, from: from)
|
410
|
+
from = :script if from == :run && script?
|
405
411
|
end
|
406
412
|
run(cmd, var, from: from, banner: banner, sync: sync)
|
407
413
|
end
|
@@ -853,7 +859,7 @@ module Squared
|
|
853
859
|
end
|
854
860
|
|
855
861
|
def session(*cmd, prefix: cmd.first, main: true, options: true)
|
856
|
-
prefix = prefix.to_s.upcase
|
862
|
+
prefix = stripext(prefix.to_s).upcase
|
857
863
|
if (val = PATH[prefix] || PATH[prefix.to_sym])
|
858
864
|
cmd[0] = shell_quote(val, force: false)
|
859
865
|
end
|
@@ -888,11 +894,10 @@ module Squared
|
|
888
894
|
cmd.done
|
889
895
|
end
|
890
896
|
|
891
|
-
def option(*args,
|
897
|
+
def option(*args, target: @session, prefix: target&.first, **kwargs)
|
892
898
|
if prefix
|
893
|
-
prefix = File.basename(prefix, File.extname(prefix))
|
894
899
|
args.each do |val|
|
895
|
-
ret = env("#{prefix}_#{val.gsub(/\W/, '_')}".upcase, **kwargs)
|
900
|
+
ret = env("#{stripext(prefix)}_#{val.gsub(/\W/, '_')}".upcase, **kwargs)
|
896
901
|
return ret if ret
|
897
902
|
end
|
898
903
|
end
|
@@ -933,8 +938,10 @@ module Squared
|
|
933
938
|
p << flag
|
934
939
|
when 'i'
|
935
940
|
i << flag
|
936
|
-
|
941
|
+
when 'v'
|
937
942
|
reg << Regexp.escape(flag)
|
943
|
+
else
|
944
|
+
next
|
938
945
|
end
|
939
946
|
bare << flag if val.end_with?('?')
|
940
947
|
else
|
@@ -952,7 +959,7 @@ module Squared
|
|
952
959
|
elsif opt.start_with?('no-') && no.include?(name = opt[3..-1])
|
953
960
|
target << "--no-#{name}"
|
954
961
|
else
|
955
|
-
if opt =~
|
962
|
+
if opt =~ /\A([^=]+)=(.+)\z/
|
956
963
|
a = $1
|
957
964
|
if e.include?(a)
|
958
965
|
target << shell_option(a, $2)
|
@@ -973,7 +980,7 @@ module Squared
|
|
973
980
|
found = true if first && pass.none? { |val| opt.include?(val) }
|
974
981
|
end
|
975
982
|
end
|
976
|
-
[ret, reg.empty? ? /\A\s+\z/ :
|
983
|
+
[ret, reg.empty? ? /\A\s+\z/ : /\A(#{reg.join('|')})=(.+)\z/]
|
977
984
|
end
|
978
985
|
|
979
986
|
def option_clear(opts, target: @session, **kwargs)
|
@@ -1191,7 +1198,7 @@ module Squared
|
|
1191
1198
|
return if (list = list.flatten).empty?
|
1192
1199
|
|
1193
1200
|
list.flatten.each do |opt|
|
1194
|
-
next unless (val = option(opt, **kwargs))
|
1201
|
+
next unless (val = option(opt, target: target, **kwargs))
|
1195
1202
|
|
1196
1203
|
return target << (if flag
|
1197
1204
|
shell_option(opt, equals ? val : nil, quote: quote, escape: escape, force: force)
|
@@ -1220,7 +1227,7 @@ module Squared
|
|
1220
1227
|
end
|
1221
1228
|
|
1222
1229
|
def append_nocolor(target: @session)
|
1223
|
-
target << '--no-color' if !ARG[:COLOR] || stdin? || option('no-color', ignore: false)
|
1230
|
+
target << '--no-color' if !ARG[:COLOR] || stdin? || option('no-color', target: target, ignore: false)
|
1224
1231
|
end
|
1225
1232
|
|
1226
1233
|
def collect_hash(data, pass: [])
|
@@ -1308,7 +1315,7 @@ module Squared
|
|
1308
1315
|
pwd = Pathname.pwd
|
1309
1316
|
if block_given?
|
1310
1317
|
begin
|
1311
|
-
if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join
|
1318
|
+
if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join <= RUBY_VERSION)
|
1312
1319
|
ret = instance_eval(&blk)
|
1313
1320
|
else
|
1314
1321
|
Dir.chdir(path)
|
@@ -1397,7 +1404,8 @@ module Squared
|
|
1397
1404
|
end
|
1398
1405
|
|
1399
1406
|
def projectpath?(val)
|
1400
|
-
Pathname.new(val).
|
1407
|
+
val = Pathname.new(val).cleanpath
|
1408
|
+
val.absolute? ? val.to_s.start_with?(File.join(path, '')) : !val.to_s.start_with?(File.join('..', ''))
|
1401
1409
|
end
|
1402
1410
|
|
1403
1411
|
def semmajor?(cur, want)
|
@@ -75,7 +75,7 @@ module Squared
|
|
75
75
|
include Prompt
|
76
76
|
|
77
77
|
OPT_GIT = {
|
78
|
-
branch: %w[a|all create-reflog i|ignore-case q|quiet r|remotes v|verbose abbrev=i color=b column=b
|
78
|
+
branch: %w[a|all create-reflog i|ignore-case q|quiet r|remotes v|verbose vv abbrev=i color=b column=b
|
79
79
|
contains=e format=q merged=e no-contains=e no-merged=e points-at=e u|set-upstream-to=e sort=q
|
80
80
|
t|track=b].freeze,
|
81
81
|
checkout: %w[l d|detach f|force ignore-other-worktrees ignore-skip-worktree-bits m|merge p|patch
|
@@ -86,11 +86,12 @@ module Squared
|
|
86
86
|
show: %w[s exit-code histogram].freeze
|
87
87
|
}.freeze,
|
88
88
|
fetch: {
|
89
|
-
base: %w[multiple progress P|prune-tags refetch stdin u|update-head-ok
|
89
|
+
base: %w[multiple progress P|prune-tags refetch stdin u|update-head-ok
|
90
90
|
recurse-submodules-default=b].freeze,
|
91
|
-
pull: %w[4 6 n t a|append atomic dry-run f|force k|keep
|
91
|
+
pull: %w[4 6 n t a|append atomic dry-run f|force k|keep negotiate-only prefetch p|prune q|quiet
|
92
92
|
set-upstream unshallow update-shallow v|verbose deepen=i depth=i j|jobs=i negotiation-tip=q
|
93
|
-
refmap=q o|server-option=e shallow-exclude=e shallow-since=
|
93
|
+
recurse-submodules=v refmap=q o|server-option=e shallow-exclude=e shallow-since=v
|
94
|
+
upload-pack=e].freeze
|
94
95
|
}.freeze,
|
95
96
|
log: {
|
96
97
|
base: %w[all all-match alternate-refs author-date-order basic-regexp bisect boundary cherry cherry-mark
|
@@ -103,40 +104,40 @@ module Squared
|
|
103
104
|
exclude-hidden=b? glob=q grep=q grep-reflog=q L=q n|max-count=i max-parents=i min-parents=i
|
104
105
|
no-walk=b? remotes=q? since=q since-as-filter=q skip=i tags=q? until=q].freeze,
|
105
106
|
format: %w[t children combined-all-paths oneline left-right no-diff-merges parents relative-date
|
106
|
-
show-signature date=q diff-merges=b encoding=b expand-tabs=i format=q notes=
|
107
|
+
show-signature date=q diff-merges=b encoding=b expand-tabs=i format=q notes=b pretty=q?
|
107
108
|
show-linear-break=q?].freeze,
|
108
109
|
diff: %w[p R u z l=i G=q O=q S=q binary check compact-summary cumulative find-copies-harder full-index
|
109
110
|
W|function-context w|ignore-all-space ignore-blank-lines ignore-cr-at-eol ignore-space-at-eol
|
110
111
|
b|ignore-space-change D|irreversible-delete graph ita-invisible-in-index minimal name-only
|
111
112
|
name-status no-color-moved-ws no-prefix no-renames numstat patch-with-raw patch-with-stat patience
|
112
113
|
pickaxe-all pickaxe-regex raw shortstat summary a|text abbrev=i? anchored=q B|break-rewrites=e?
|
113
|
-
color=b color-moved=b color-moved-ws=b color-words=q? diff-algorithm=b diff-filter=e? X|dirstat=
|
114
|
-
dirstat-by-file=q? dst-prefix=q C|find-copies=
|
114
|
+
color=b color-moved=b color-moved-ws=b color-words=q? diff-algorithm=b diff-filter=e? X|dirstat=b?
|
115
|
+
dirstat-by-file=q? dst-prefix=q C|find-copies=b? find-object=e M|find-renames=b?
|
115
116
|
I|ignore-matching-lines=q ignore-submodules=b inter-hunk-context=i line-prefix=q output=p
|
116
117
|
output-indicator-context=q output-indicator-new=q output-indicator-old=q relative=p rotate-to=p
|
117
118
|
skip-to=p src-prefix=q stat=q? stat-width=i stat-name-width=i stat-count=i submodule=b? U|unified=i
|
118
|
-
word-diff=b? word-diff-regex=q ws-error-
|
119
|
+
word-diff=b? word-diff-regex=q ws-error-highlight=b].freeze
|
119
120
|
}.freeze,
|
120
|
-
ls_files: %w[z debug deduplicate directory eol error-unmatch exclude-standard full-name
|
121
|
-
no-empty-directory recurse-submodules sparse s|stage u|unmerged abbrev=i x|exclude=q
|
121
|
+
ls_files: %w[f t v z debug deduplicate directory eol error-unmatch exclude-standard full-name i|ignored
|
122
|
+
k|killed no-empty-directory recurse-submodules sparse s|stage u|unmerged abbrev=i x|exclude=q
|
122
123
|
X|exclude-from=p exclude-per-directory=p format=q with-tree=q].freeze,
|
123
124
|
ls_remote: %w[exit-code get-url q|quiet o|server-option=e symref sort=q upload-pack=e].freeze,
|
124
|
-
pull: %w[e n allow-unrelated-histories ff-only S|gpg-sign=
|
125
|
+
pull: %w[e n allow-unrelated-histories ff-only S|gpg-sign=b? log=i r|rebase=v? s|strategy=b
|
125
126
|
X|strategy-option=e].freeze,
|
126
127
|
rebase: %w[n C=i allow-empty-message apply committer-date-is-author-date edit-todo f|force-rebase ignore-date
|
127
|
-
ignore-whitespace i|interactive keep-base m
|
128
|
-
reset-author-date root show-current-patch signoff v|verbose empty=b S|gpg-sign=b onto=e
|
128
|
+
ignore-whitespace i|interactive keep-base m|merge no-ff q|quiet quit r|rebase-merges=b?
|
129
|
+
reset-author-date root show-current-patch signoff v|verbose empty=b S|gpg-sign=b? onto=e
|
129
130
|
s|strategy=b X|strategy-option=b whitespace=e].freeze,
|
130
131
|
reset: %w[N pathspec-file-nul q|quiet pathspec-from-file=p].freeze,
|
131
132
|
restore: %w[ignore-unmerged ignore-skip-worktree-bits m|merge ours p|patch pathspec-file-nul S|staged theirs
|
132
133
|
W|worktree conflict=b pathspec-from-file=p s|source=q].freeze,
|
133
134
|
rev_parse: {
|
134
135
|
output: %w[absolute-git-dir all flags git-common-dir git-dir is-bare-repository is-inside-git-dir
|
135
|
-
is-inside-work-tree is-shallow-repository local-env-vars no-flags no-revs not q|quiet
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
is-inside-work-tree is-shallow-repository local-env-vars no-flags no-revs not q|quiet revs-only
|
137
|
+
shared-index-path show-cdup show-prefix show-toplevel show-superproject-working-tree sq sq-quote
|
138
|
+
symbolic symbolic-full-name verify abbrev-ref=b? after=q before=q default=e disambiguate=b
|
139
|
+
exclude=q exclude-hidden=b glob=q git-path=p path-format=b? prefix=q branches=q? remotes=q?
|
140
|
+
resolve-git-dir=p short=i? show-object-format=b? since=q tags=q? until=q].freeze,
|
140
141
|
parseopt: %w[keep-dashdash stop-at-non-option stuck-long].freeze
|
141
142
|
}.freeze,
|
142
143
|
show: %w[t combined-all-paths no-diff-merges remerge-diff show-signature diff-merges=b encoding=b
|
@@ -229,7 +230,7 @@ module Squared
|
|
229
230
|
'commit' => %i[add all amend amend-orig].freeze,
|
230
231
|
'diff' => %i[head cached branch files view between contain].freeze,
|
231
232
|
'fetch' => %i[origin remote].freeze,
|
232
|
-
'files' => %i[cached modified deleted others
|
233
|
+
'files' => %i[cached modified deleted others].freeze,
|
233
234
|
'log' => %i[view between contain].freeze,
|
234
235
|
'pull' => %i[origin remote].freeze,
|
235
236
|
'rebase' => %i[branch onto send].freeze,
|
@@ -401,7 +402,7 @@ module Squared
|
|
401
402
|
format_desc action, flag, 'branch/commit,opts*'
|
402
403
|
task flag, [:commit] do |_, args|
|
403
404
|
commit = param_guard(action, flag, args: args, key: :commit)
|
404
|
-
checkout(flag, commit: commit)
|
405
|
+
checkout(flag, args.extras, commit: commit)
|
405
406
|
end
|
406
407
|
when :detach
|
407
408
|
format_desc action, flag, 'branch/commit?'
|
@@ -567,8 +568,11 @@ module Squared
|
|
567
568
|
end
|
568
569
|
|
569
570
|
def pull(flag = nil, opts = [], sync: invoked_sync?('pull', flag), remote: nil)
|
570
|
-
cmd = git_session 'pull'
|
571
|
-
if
|
571
|
+
cmd = git_session 'pull'
|
572
|
+
if flag == :rebase
|
573
|
+
cmd << '--rebase'
|
574
|
+
cmd << '--autostash' if option('autostash')
|
575
|
+
elsif (val = option('rebase', ignore: false))
|
572
576
|
cmd << case val
|
573
577
|
when '0'
|
574
578
|
'--no-rebase'
|
@@ -685,6 +689,7 @@ module Squared
|
|
685
689
|
def status(*, sync: invoked_sync?('status'), **)
|
686
690
|
cmd = git_session 'status'
|
687
691
|
cmd << (option('long') ? '--long' : '--short')
|
692
|
+
cmd << '--branch' if option('branch')
|
688
693
|
if (val = option('ignore-submodules', ignore: false))
|
689
694
|
cmd << basic_option('ignore-submodules', case val
|
690
695
|
when '0', 'none'
|
@@ -719,13 +724,11 @@ module Squared
|
|
719
724
|
cmd = git_session 'reset'
|
720
725
|
case flag
|
721
726
|
when :commit, :index
|
722
|
-
|
727
|
+
refs = option_sanitize(opts, OPT_GIT[:reset] + VAL_GIT[:reset], no: OPT_GIT[:no][:reset]).first
|
723
728
|
if flag == :commit
|
724
|
-
append_value
|
725
|
-
option_clear
|
729
|
+
append_value commit
|
730
|
+
option_clear refs
|
726
731
|
ref = false
|
727
|
-
else
|
728
|
-
(refs ||= []).concat(out)
|
729
732
|
end
|
730
733
|
when :mode
|
731
734
|
return unless VAL_GIT[:reset].include?(mode)
|
@@ -776,7 +779,7 @@ module Squared
|
|
776
779
|
else
|
777
780
|
out = option_sanitize(opts, OPT_GIT[:checkout], no: OPT_GIT[:no][:checkout]).first
|
778
781
|
if flag == :commit
|
779
|
-
append_value
|
782
|
+
append_value commit
|
780
783
|
option_clear out
|
781
784
|
else
|
782
785
|
append_head
|
@@ -827,7 +830,7 @@ module Squared
|
|
827
830
|
cmd << shell_quote(range.join(flag == :between ? '..' : '...'))
|
828
831
|
else
|
829
832
|
commit, files = files.partition do |val|
|
830
|
-
val.start_with?('^') || (!%r{
|
833
|
+
val.start_with?('^') || (!%r{^.(?:[\\/]|$)}.match?(val) && !%r{[\\/]$}.match?(val)) || commithash(val)
|
831
834
|
end
|
832
835
|
cmd.merge(commit.map { |val| commithash(val) || shell_quote(val) }) unless commit.empty?
|
833
836
|
end
|
@@ -902,52 +905,39 @@ module Squared
|
|
902
905
|
else
|
903
906
|
"-- #{refs.join(' ')}"
|
904
907
|
end
|
905
|
-
|
908
|
+
format = '%(if)%(HEAD)%(then)%(refname:short)...%(upstream:short)...%(upstream:track)%(end)'
|
906
909
|
branch = nil
|
907
|
-
|
908
|
-
source(git_output('fetch --no-tags --quiet'), io: true, banner: false)
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
origin = s[0, s.size - branch.size - 1]
|
921
|
-
break
|
922
|
-
end
|
923
|
-
end
|
924
|
-
end
|
925
|
-
upstream = true if origin
|
926
|
-
elsif data[3] =~ %r{^(.+)/#{Regexp.escape(branch)}$}
|
927
|
-
origin = $1
|
910
|
+
origin = nil
|
911
|
+
source(git_output('fetch --no-tags --quiet'), io: true, banner: false, stdout: true)
|
912
|
+
cmd = git_output("for-each-ref --format=\"#{format}\" refs/heads")
|
913
|
+
source(cmd, io: true, banner: false).first.each do |line|
|
914
|
+
next if (line = line.chomp).empty?
|
915
|
+
|
916
|
+
branch, origin, hint = line.split('...')
|
917
|
+
if hint && !hint.match?(/^\[(\D+0,\D+0)\]$/)
|
918
|
+
raise_error('work tree is not usable', hint: hint[1..-2])
|
919
|
+
elsif origin.empty?
|
920
|
+
return nil if pass
|
921
|
+
|
922
|
+
raise_error('no remote upstream', hint: branch)
|
928
923
|
end
|
929
924
|
break
|
930
925
|
end
|
931
|
-
|
926
|
+
i = origin.index('/')
|
927
|
+
branch = "#{branch}:#{origin[i + 1..-1]}" unless origin.end_with?("/#{branch}")
|
928
|
+
origin = origin[0..i - 1]
|
932
929
|
cmd = git_session('commit', option('dry-run') && '--dry-run', options: false)
|
933
|
-
if amend
|
934
|
-
cmd << '--amend'
|
935
|
-
else
|
936
|
-
cmd.delete('--amend')
|
937
|
-
end
|
930
|
+
cmd << '--amend' if amend
|
938
931
|
if message
|
939
932
|
append_message message
|
940
933
|
elsif flag == :'amend-orig' || option('no-edit')
|
941
934
|
cmd << '--no-edit'
|
942
935
|
end
|
943
936
|
a = git_output 'add', '--verbose'
|
944
|
-
b = git_output 'push'
|
945
|
-
if dryrun?
|
946
|
-
a << '--dry-run'
|
947
|
-
b << '--dry-run'
|
948
|
-
end
|
937
|
+
b = git_output 'push'
|
938
|
+
b << '--dry-run' if dryrun?
|
949
939
|
a << pathspec
|
950
|
-
b << '--force' if amend
|
940
|
+
b << '--force-with-lease' if amend
|
951
941
|
b << origin << branch
|
952
942
|
puts if pass
|
953
943
|
source a
|
@@ -1227,11 +1217,11 @@ module Squared
|
|
1227
1217
|
end
|
1228
1218
|
|
1229
1219
|
def append_pull(opts, list, target: @session, no: nil, flag: nil, remote: nil)
|
1230
|
-
|
1220
|
+
target << '--force' if option('force', target: target)
|
1231
1221
|
rsm = append_submodules(target: target)
|
1232
1222
|
out = []
|
1233
1223
|
refspec = []
|
1234
|
-
opts, pat = option_sanitize(opts, remote ? list + ['refspec=
|
1224
|
+
opts, pat = option_sanitize(opts, remote ? list + ['refspec=v'] : list, target: target, no: no)
|
1235
1225
|
opts.each do |opt|
|
1236
1226
|
if opt =~ pat
|
1237
1227
|
case $1
|
@@ -1252,7 +1242,7 @@ module Squared
|
|
1252
1242
|
end
|
1253
1243
|
if remote
|
1254
1244
|
append_value(remote, target: target, delim: true)
|
1255
|
-
if (val = option('refspec', strict: true))
|
1245
|
+
if (val = option('refspec', target: target, strict: true))
|
1256
1246
|
append_value(split_escape(val), target: target)
|
1257
1247
|
else
|
1258
1248
|
target.merge(refspec)
|
@@ -1271,10 +1261,10 @@ module Squared
|
|
1271
1261
|
end
|
1272
1262
|
|
1273
1263
|
def append_pathspec(files = [], target: @session, expect: false, parent: false)
|
1274
|
-
if session_arg?('pathspec-from-file')
|
1264
|
+
if session_arg?('pathspec-from-file', target: target)
|
1275
1265
|
option_clear files
|
1276
1266
|
else
|
1277
|
-
if files.empty? && (val = option('pathspec'))
|
1267
|
+
if files.empty? && (val = option('pathspec', target: target))
|
1278
1268
|
files = split_escape(val)
|
1279
1269
|
end
|
1280
1270
|
files = projectmap(files, parent: parent)
|
@@ -1297,19 +1287,25 @@ module Squared
|
|
1297
1287
|
end
|
1298
1288
|
|
1299
1289
|
def append_submodules(from = nil, target: @session)
|
1300
|
-
return unless (val = option('recurse-submodules', ignore: false))
|
1290
|
+
return unless (val = option('recurse-submodules', target: target, ignore: false))
|
1301
1291
|
|
1302
1292
|
if from == :clone
|
1303
|
-
|
1304
|
-
|
1293
|
+
case val
|
1294
|
+
when '0', 'false'
|
1295
|
+
target << '--no-recurse-submodules'
|
1296
|
+
when '1', 'true'
|
1297
|
+
target << '--recurse-submodules'
|
1298
|
+
else
|
1299
|
+
projectmap(split_escape(val)).each do |path|
|
1300
|
+
target << basic_option('recurse-submodules', path)
|
1301
|
+
end
|
1305
1302
|
end
|
1306
|
-
target
|
1307
1303
|
else
|
1308
1304
|
target << case val
|
1309
1305
|
when 'no', '0'
|
1310
1306
|
'--no-recurse-submodules'
|
1311
1307
|
when 'yes', 'on-demand'
|
1312
|
-
"--recurse-submodules
|
1308
|
+
"--recurse-submodules=#{val}"
|
1313
1309
|
else
|
1314
1310
|
'--recurse-submodules'
|
1315
1311
|
end
|
@@ -1326,7 +1322,9 @@ module Squared
|
|
1326
1322
|
end
|
1327
1323
|
|
1328
1324
|
def dryrun?(*, target: @session, **)
|
1329
|
-
|
1325
|
+
return false unless target
|
1326
|
+
|
1327
|
+
target.include?('--dry-run')
|
1330
1328
|
end
|
1331
1329
|
|
1332
1330
|
def quiet?(target: @session)
|
@@ -5,7 +5,7 @@ module Squared
|
|
5
5
|
module Project
|
6
6
|
class Node < Git
|
7
7
|
OPT_NPM = {
|
8
|
-
common: %w[dry-run include-workspace-root workspaces=b? w|workspace=
|
8
|
+
common: %w[dry-run include-workspace-root workspaces=b? w|workspace=v].freeze,
|
9
9
|
install: %w[prefer-dedupe package-lock-only cpu=q libc=e os=q].freeze,
|
10
10
|
install_base: %w[ignore-scripts install-links strict-peer-deps include=b omit=b install-strategy=b].freeze,
|
11
11
|
install_no: %w[audit bin-links fund package-lock].freeze,
|
@@ -699,12 +699,12 @@ module Squared
|
|
699
699
|
run(from: :pack)
|
700
700
|
end
|
701
701
|
|
702
|
-
def compose(opts, flags = nil, script: false, args: nil, from:
|
702
|
+
def compose(opts, flags = nil, script: false, args: nil, from: nil, **)
|
703
703
|
return unless opts
|
704
704
|
|
705
705
|
if script
|
706
706
|
ret = session dependbin, 'run'
|
707
|
-
raise_error("#{dependbin} run script: #{
|
707
|
+
raise_error("#{dependbin} run script: given #{opts}", hint: from) unless append_any(opts)
|
708
708
|
append_any flags if flags
|
709
709
|
append_loglevel
|
710
710
|
append_any(args, delim: true) if args
|
@@ -718,7 +718,7 @@ module Squared
|
|
718
718
|
when Enumerable
|
719
719
|
opts.to_a.join(' ')
|
720
720
|
else
|
721
|
-
raise_error("#{project}: #{
|
721
|
+
raise_error("#{project}: given #{opts}", hint: from)
|
722
722
|
end
|
723
723
|
end
|
724
724
|
end
|
@@ -14,7 +14,7 @@ module Squared
|
|
14
14
|
install: %w[break-system-packages check-build-dependencies compile dry-run force-reinstall I|ignore-installed
|
15
15
|
ignore-requires-python no-build-isolation no-clean no-compile no-deps no-index no-warn-conflicts
|
16
16
|
no-warn-script-location pre prefer-binary require-hashes U|upgrade use-pep517 user abi=e
|
17
|
-
config-settings=q c|constraint=p e|editable=
|
17
|
+
config-settings=q c|constraint=p e|editable=v? extra-index-url=q f|find-links=q global-option=q
|
18
18
|
implementation=b i|index-url=q no-binary=q only-binary=q platform=q prefix=p progress-bar=b
|
19
19
|
python-version=q report=p r|requirement=p root=p root-user-action=e src=p t|target=p
|
20
20
|
upgrade-strategy=b].freeze
|
@@ -305,7 +305,7 @@ module Squared
|
|
305
305
|
end
|
306
306
|
|
307
307
|
def append_global(target: @session)
|
308
|
-
if (val = option('cache-dir'))
|
308
|
+
if (val = option('cache-dir', target: target))
|
309
309
|
target << case val
|
310
310
|
when '0', 'false'
|
311
311
|
'--no-cache-dir'
|
@@ -313,8 +313,8 @@ module Squared
|
|
313
313
|
quote_option('cache-dir', basepath(val))
|
314
314
|
end
|
315
315
|
end
|
316
|
-
target << shell_option('proxy', val) if (val = option('proxy'))
|
317
|
-
target << quote_option('python', basepath(val)) if (val = option('python'))
|
316
|
+
target << shell_option('proxy', val) if (val = option('proxy', target: target))
|
317
|
+
target << quote_option('python', basepath(val)) if (val = option('python', target: target))
|
318
318
|
append_nocolor(target: target)
|
319
319
|
end
|
320
320
|
end
|
@@ -25,7 +25,7 @@ module Squared
|
|
25
25
|
platform=q source=q].freeze,
|
26
26
|
push: %w[no-http-proxy attestation=p host=q key=e otp=e p|http-proxy=q?].freeze,
|
27
27
|
build: %w[force strict o|output=p platform=q].freeze,
|
28
|
-
exec: %w[conservative prerelease no-prerelease g|gem=
|
28
|
+
exec: %w[conservative prerelease no-prerelease g|gem=v version=e].freeze,
|
29
29
|
pristine: %w[all env-shebang extensions no-env-shebang no-extensions only-executables only-missing-extensions
|
30
30
|
only-plugins n|bindir=p i|install-dir=p skip=e v|version=e].freeze,
|
31
31
|
shared: %w[f b|both clear-sources conservative default development development-all E|explain
|
@@ -186,13 +186,15 @@ module Squared
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
-
def copy(from: 'lib',
|
189
|
+
def copy(from: 'lib', into: @gemdir, override: false, **kwargs)
|
190
|
+
glob = kwargs[:include]
|
191
|
+
pass = kwargs[:exclude]
|
190
192
|
if @copy && !override
|
191
193
|
return super if runnable?(@copy)
|
192
194
|
|
193
195
|
from = @copy[:from] if @copy.key?(:from)
|
194
196
|
glob = @copy[:include] if @copy.key?(:include)
|
195
|
-
|
197
|
+
pass = @copy[:exclude] if @copy.key?(:exclude)
|
196
198
|
into = @copy[:into] if @copy.key?(:into)
|
197
199
|
end
|
198
200
|
return unless into
|
@@ -204,10 +206,10 @@ module Squared
|
|
204
206
|
as_a(from).each_with_index do |val, i|
|
205
207
|
a = basepath(val)
|
206
208
|
b = dest.join(val)
|
207
|
-
c = glob[i] || glob
|
209
|
+
c = glob[i] || glob.first
|
208
210
|
log.info "cp #{a.join(c)} #{b}"
|
209
211
|
begin
|
210
|
-
copy_dir(a, b, c, pass:
|
212
|
+
copy_dir(a, b, c, pass: pass, verbose: verbose)
|
211
213
|
rescue StandardError => e
|
212
214
|
log.error e
|
213
215
|
ret = on(:error, :copy, e)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squared
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-04-28 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.6.
|
123
|
+
rubygems_version: 3.6.2
|
124
124
|
specification_version: 4
|
125
125
|
summary: Rake task generator for managing multi-language workspaces.
|
126
126
|
test_files: []
|