squared 0.3.5 → 0.3.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 +32 -0
- data/lib/squared/common/format.rb +3 -7
- data/lib/squared/common/shell.rb +3 -2
- data/lib/squared/common/utils.rb +1 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +1 -1
- data/lib/squared/workspace/project/base.rb +15 -6
- data/lib/squared/workspace/project/git.rb +18 -9
- data/lib/squared/workspace/project/node.rb +1 -1
- data/lib/squared/workspace/project/python.rb +15 -13
- data/lib/squared/workspace/project/ruby.rb +18 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 404b6e4de1ff62a628030bfa5487287dac6a962a6e052297537533a29ff6be2c
|
4
|
+
data.tar.gz: a136f94da4653d88325e3ed571523d1d3a57d8974695ce306bfadd6c2264e6c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e2e83cdefdb8b3c9641f1aa5880432426cfbd807ddb659252f10735eafb0353d61d80ef87876251c6b8720fa434d5cb0df7a541476ff4573f71e6c8a49b27d
|
7
|
+
data.tar.gz: c457360ca63c5941594781613662c51b3d5ae18d9bac436f70357ebbc4ef2418504f8f376981cc03bb5590bc20d9540909fd2318414b631c091b64ee8e58df04
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.3.7] - 2025-04-08
|
4
|
+
|
5
|
+
- See `0.2.7`.
|
6
|
+
|
7
|
+
## [0.2.7] - 2025-04-08
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Paths that conflict with git options can be quoted.
|
12
|
+
- Bundle command update did not append package names.
|
13
|
+
- Git result status type was truncated.
|
14
|
+
- Log messages were concatenated without separator.
|
15
|
+
- Python pip environment options used undefined session.
|
16
|
+
- Regexp "o" modifier was not used properly.
|
17
|
+
- Rake did not run individual project Rakefile.
|
18
|
+
- Ruby commands did not delimit exec arguments.
|
19
|
+
|
20
|
+
## [0.3.6] - 2025-03-12
|
21
|
+
|
22
|
+
### Added
|
23
|
+
|
24
|
+
- Git command stash action clear was implemented.
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
|
28
|
+
- Git command stash did not validate index argument.
|
29
|
+
- Project graph command does not require arguments.
|
30
|
+
- Ruby gem command exec did not add project name.
|
31
|
+
|
3
32
|
## [0.3.5] - 2025-03-06
|
4
33
|
|
5
34
|
### Fixed
|
@@ -302,12 +331,15 @@
|
|
302
331
|
|
303
332
|
- Changelog was created.
|
304
333
|
|
334
|
+
[0.3.7]: https://github.com/anpham6/squared/releases/tag/v0.3.7-ruby
|
335
|
+
[0.3.6]: https://github.com/anpham6/squared/releases/tag/v0.3.6-ruby
|
305
336
|
[0.3.5]: https://github.com/anpham6/squared/releases/tag/v0.3.5-ruby
|
306
337
|
[0.3.4]: https://github.com/anpham6/squared/releases/tag/v0.3.4-ruby
|
307
338
|
[0.3.3]: https://github.com/anpham6/squared/releases/tag/v0.3.3-ruby
|
308
339
|
[0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
|
309
340
|
[0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
|
310
341
|
[0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
|
342
|
+
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
311
343
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
312
344
|
[0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
|
313
345
|
[0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
|
@@ -114,7 +114,7 @@ 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.between?(0, 256)
|
118
118
|
ret << val
|
119
119
|
elsif val < 0 && (b = val.to_s.split('.')[1])
|
120
120
|
b = b[0, 3]
|
@@ -174,12 +174,8 @@ module Squared
|
|
174
174
|
emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub)
|
175
175
|
else
|
176
176
|
msg = [log_title(level, color: color)]
|
177
|
-
if subject
|
178
|
-
|
179
|
-
else
|
180
|
-
msg += args
|
181
|
-
args.clear
|
182
|
-
end
|
177
|
+
msg << (color ? sub_style(subject, :underline) : subject) if subject
|
178
|
+
msg << args.shift if msg.size == 1
|
183
179
|
message(msg.join(' '), *args, hint: hint)
|
184
180
|
end
|
185
181
|
end
|
data/lib/squared/common/shell.rb
CHANGED
@@ -27,7 +27,8 @@ module Squared
|
|
27
27
|
|
28
28
|
def shell_quote(val, force: true)
|
29
29
|
val = val.to_s
|
30
|
-
return val if
|
30
|
+
return val if !force && !val.include?(' ')
|
31
|
+
return val if option && val =~ /(?:^|\S=|[^=]\s+|#{Rake::Win32.windows? ? '[\\\/]' : '\/'})(["']).+\1\z/m
|
31
32
|
|
32
33
|
Rake::Win32.windows? || ARG[:QUOTE] == '"' ? "\"#{double_quote(val)}\"" : "'#{single_quote(val)}'"
|
33
34
|
end
|
@@ -79,7 +80,7 @@ module Squared
|
|
79
80
|
end
|
80
81
|
|
81
82
|
def split_escape(val, char: ',')
|
82
|
-
val.split(/\s*(?<!\\)#{char}\s*/
|
83
|
+
val.split(/\s*(?<!\\)#{char}\s*/)
|
83
84
|
end
|
84
85
|
end
|
85
86
|
end
|
data/lib/squared/common/utils.rb
CHANGED
data/lib/squared/version.rb
CHANGED
@@ -404,7 +404,7 @@ module Squared
|
|
404
404
|
end
|
405
405
|
|
406
406
|
def task_localname(val)
|
407
|
-
prefix && val.is_a?(String) ? val.sub(/\A#{Regexp.escape(prefix)}
|
407
|
+
prefix && val.is_a?(String) ? val.sub(/\A#{Regexp.escape(prefix)}:/, '') : val.to_s
|
408
408
|
end
|
409
409
|
|
410
410
|
def task_desc(*args, **kwargs)
|
@@ -254,7 +254,7 @@ module Squared
|
|
254
254
|
|
255
255
|
format_desc action, flag, '(-)project*'
|
256
256
|
task flag do |_, args|
|
257
|
-
args =
|
257
|
+
args = args.to_a.reject { |val| name == val.to_s }
|
258
258
|
if flag == :run
|
259
259
|
graph args
|
260
260
|
else
|
@@ -684,7 +684,7 @@ module Squared
|
|
684
684
|
log&.warn "ENV was discarded: #{var}" if var
|
685
685
|
task_invoke(cmd, exception: exception, warning: warning?)
|
686
686
|
else
|
687
|
-
print_item format_banner(cmd, banner: banner) if sync
|
687
|
+
print_item format_banner(cmd, banner: banner) if sync && !env('BANNER', equals: '0')
|
688
688
|
args = var.is_a?(Hash) ? [var, cmd] : [cmd]
|
689
689
|
shell(*args, chdir: chdir, exception: exception)
|
690
690
|
end
|
@@ -778,7 +778,13 @@ module Squared
|
|
778
778
|
next if pass.include?(meth)
|
779
779
|
|
780
780
|
if workspace.task_defined?(cmd = task_join(proj.name, meth))
|
781
|
+
if ENV.key?(key = "BANNER_#{proj.name.upcase}")
|
782
|
+
key = nil
|
783
|
+
else
|
784
|
+
ENV[key] = '0'
|
785
|
+
end
|
781
786
|
run(cmd, sync: false, banner: false)
|
787
|
+
ENV.delete(key) if key
|
782
788
|
elsif proj.has?(meth, tasks || group ? nil : workspace.baseref)
|
783
789
|
proj.__send__(meth.to_sym, sync: sync)
|
784
790
|
end
|
@@ -892,7 +898,7 @@ module Squared
|
|
892
898
|
nil
|
893
899
|
end
|
894
900
|
|
895
|
-
def option_sanitize(opts, list, target: @session, no: nil, first: false, pass: ['='])
|
901
|
+
def option_sanitize(opts, list, target: @session, no: nil, args: false, first: false, pass: ['='])
|
896
902
|
ret = []
|
897
903
|
reg = []
|
898
904
|
bare = []
|
@@ -961,6 +967,7 @@ module Squared
|
|
961
967
|
opt = a
|
962
968
|
else
|
963
969
|
ret << opt
|
970
|
+
found = true if args
|
964
971
|
end
|
965
972
|
found = true if first && pass.none? { |val| opt.include?(val) }
|
966
973
|
end
|
@@ -969,9 +976,11 @@ module Squared
|
|
969
976
|
end
|
970
977
|
|
971
978
|
def option_clear(opts, target: @session, **kwargs)
|
979
|
+
return if opts.empty?
|
980
|
+
|
972
981
|
kwargs[:subject] ||= target&.first
|
973
|
-
kwargs[:hint] ||= '
|
974
|
-
warn log_message(
|
982
|
+
kwargs[:hint] ||= 'unrecognized'
|
983
|
+
warn log_message(:warn, opts.join(', '), **kwargs)
|
975
984
|
end
|
976
985
|
|
977
986
|
def print_item(*val)
|
@@ -1221,7 +1230,7 @@ module Squared
|
|
1221
1230
|
|
1222
1231
|
def param_guard(action, flag, args: nil, key: nil, pat: nil)
|
1223
1232
|
if args && key
|
1224
|
-
val = args
|
1233
|
+
val = args.fetch(key, nil)
|
1225
1234
|
return val unless val.nil? || (pat && !val.match?(pat))
|
1226
1235
|
|
1227
1236
|
@session = nil
|
@@ -72,12 +72,14 @@ module Squared
|
|
72
72
|
|
73
73
|
module Project
|
74
74
|
class Git < Base
|
75
|
+
include Prompt
|
76
|
+
|
75
77
|
OPT_GIT = {
|
76
78
|
branch: %w[a|all create-reflog i|ignore-case q|quiet r|remotes v|verbose abbrev=i color=b column=b
|
77
79
|
contains=e format=q merged=e no-contains=e no-merged=e points-at=e u|set-upstream-to=e sort=q
|
78
80
|
t|track=b].freeze,
|
79
81
|
checkout: %w[l d|detach f|force ignore-other-worktrees ignore-skip-worktree-bits m|merge p|patch
|
80
|
-
pathspec-file-nul q
|
82
|
+
pathspec-file-nul q|quiet orphan=e ours theirs conflict=b pathspec-from-file=p
|
81
83
|
t|track=b].freeze,
|
82
84
|
diff: {
|
83
85
|
base: %w[0 1|base 2|ours 3|theirs].freeze,
|
@@ -236,7 +238,7 @@ module Squared
|
|
236
238
|
'restore' => %i[source worktree staged overlay].freeze,
|
237
239
|
'rev' => %i[commit branch output parseopt].freeze,
|
238
240
|
'show' => %i[format oneline].freeze,
|
239
|
-
'stash' => %i[push pop apply drop list].freeze,
|
241
|
+
'stash' => %i[push pop apply drop clear list].freeze,
|
240
242
|
'tag' => %i[add delete list].freeze
|
241
243
|
}.freeze
|
242
244
|
|
@@ -544,7 +546,7 @@ module Squared
|
|
544
546
|
format_desc action, flag, 'remote,opts*,pattern*'
|
545
547
|
task flag, [:remote] do |_, args|
|
546
548
|
remote = param_guard(action, flag, args: args, key: :remote)
|
547
|
-
ls_remote(flag, args.
|
549
|
+
ls_remote(flag, args.extras, remote: remote)
|
548
550
|
end
|
549
551
|
else
|
550
552
|
format_desc action, flag, 'opts*,pattern*'
|
@@ -656,8 +658,15 @@ module Squared
|
|
656
658
|
when :push
|
657
659
|
append_pathspec refs
|
658
660
|
when :pop, :apply, :drop
|
659
|
-
|
660
|
-
|
661
|
+
unless refs.empty?
|
662
|
+
cmd << shell_escape(refs.pop)
|
663
|
+
option_clear refs
|
664
|
+
end
|
665
|
+
when :clear
|
666
|
+
if confirm("Remove #{sub_style('all', styles: theme[:active])} the stash entries? [y/N] ", 'N')
|
667
|
+
source(stdout: true)
|
668
|
+
end
|
669
|
+
return
|
661
670
|
when :list
|
662
671
|
out, banner, from = source(io: true)
|
663
672
|
print_item banner
|
@@ -905,10 +914,10 @@ module Squared
|
|
905
914
|
unless (origin = option('repository', prefix: 'git', ignore: false))
|
906
915
|
out = source(git_output('log -n1 --format=%h%d'), io: true, stdout: true, banner: false).first
|
907
916
|
if out =~ /^#{data[2]} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/
|
908
|
-
split_escape($1).each do |
|
909
|
-
next unless
|
917
|
+
split_escape($1).each do |s|
|
918
|
+
next unless s.end_with?("/#{branch}")
|
910
919
|
|
911
|
-
origin =
|
920
|
+
origin = s[0, s.size - branch.size - 1]
|
912
921
|
break
|
913
922
|
end
|
914
923
|
end
|
@@ -1203,7 +1212,7 @@ module Squared
|
|
1203
1212
|
if size > 0
|
1204
1213
|
styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
|
1205
1214
|
styles << :bold if styles.size <= 1
|
1206
|
-
puts print_footer("#{size} #{size == 1 ? type.sub(/e?s\z/, '') : type}",
|
1215
|
+
puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
|
1207
1216
|
sub: { pat: /\A(\d+)(.+)\z/, styles: styles })
|
1208
1217
|
else
|
1209
1218
|
puts empty_status("No #{type} were #{action}", 'grep', grep.is_a?(Array) ? case grep.size
|
@@ -892,7 +892,7 @@ module Squared
|
|
892
892
|
b = sub_style("#{pkg} #{ver}", styles: theme[:inline])
|
893
893
|
c, d = rev == 1 || lock ? ['y/N', 'N'] : ['Y/n', 'Y']
|
894
894
|
e = lock ? " #{sub_style('(locked)', styles: color(:red))}" : ''
|
895
|
-
|
895
|
+
confirm("Upgrade to #{a}? #{b + e} [#{c}] ", d, timeout: 60)
|
896
896
|
end
|
897
897
|
|
898
898
|
def dryrun?(prefix = dependbin, **)
|
@@ -265,10 +265,12 @@ module Squared
|
|
265
265
|
end
|
266
266
|
|
267
267
|
def append_pip(flag, opts, target: @session, from: nil)
|
268
|
-
|
269
|
-
|
270
|
-
|
268
|
+
if !from || opts.empty?
|
269
|
+
append_global(target: target)
|
270
|
+
return []
|
271
|
+
end
|
271
272
|
opts, pat = option_sanitize(opts, OPT_PIP[from] + OPT_PIP[:common], target: target)
|
273
|
+
append_global(target: target)
|
272
274
|
out = []
|
273
275
|
edit = nil
|
274
276
|
opts.each do |opt|
|
@@ -302,18 +304,18 @@ module Squared
|
|
302
304
|
end
|
303
305
|
end
|
304
306
|
|
305
|
-
def append_global
|
307
|
+
def append_global(target: @session)
|
306
308
|
if (val = option('cache-dir'))
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
309
|
+
target << case val
|
310
|
+
when '0', 'false'
|
311
|
+
'--no-cache-dir'
|
312
|
+
else
|
313
|
+
quote_option('cache-dir', basepath(val))
|
314
|
+
end
|
313
315
|
end
|
314
|
-
|
315
|
-
|
316
|
-
append_nocolor
|
316
|
+
target << shell_option('proxy', val) if (val = option('proxy'))
|
317
|
+
target << quote_option('python', basepath(val)) if (val = option('python'))
|
318
|
+
append_nocolor(target: target)
|
317
319
|
end
|
318
320
|
end
|
319
321
|
|
@@ -7,7 +7,7 @@ module Squared
|
|
7
7
|
GEMFILE = %w[Gemfile Gemfile.lock gem.deps.rb Isolate].freeze
|
8
8
|
DIR_RUBY = (GEMFILE + Rake::Application::DEFAULT_RAKEFILES + ['README.rdoc']).freeze
|
9
9
|
OPT_BUNDLE = {
|
10
|
-
common: %w[no-color V
|
10
|
+
common: %w[no-color V|verbose retry=i].freeze,
|
11
11
|
install: %w[frozen no-cache no-prune system path=p binstubs=p? standalone=q? target-rbconfig=p trust-policy=b
|
12
12
|
with=q without=q].freeze,
|
13
13
|
install_base: %w[full-index quiet retry gemfile=p j|jobs=i].freeze,
|
@@ -155,7 +155,7 @@ module Squared
|
|
155
155
|
when 'gem'
|
156
156
|
case flag
|
157
157
|
when :outdated, :build, :push, :exec
|
158
|
-
format_desc
|
158
|
+
format_desc(action, flag, 'opts*', before: flag == :exec ? 'command+' : nil)
|
159
159
|
task flag do |_, args|
|
160
160
|
gemx flag, args.to_a
|
161
161
|
end
|
@@ -342,7 +342,8 @@ module Squared
|
|
342
342
|
|
343
343
|
def update(flag, opts = [])
|
344
344
|
bundle_session 'update', "--#{flag}"
|
345
|
-
append_bundle
|
345
|
+
append_bundle(opts, OPT_BUNDLE[:install_base] + OPT_BUNDLE[:update] + OPT_BUNDLE[:common],
|
346
|
+
append: flag != :all)
|
346
347
|
run_rb(from: :update)
|
347
348
|
end
|
348
349
|
|
@@ -366,8 +367,11 @@ module Squared
|
|
366
367
|
when :install, :'user-install', :update
|
367
368
|
list += OPT_GEM[:shared]
|
368
369
|
no = OPT_GEM[:shared_no]
|
370
|
+
first = true
|
371
|
+
when :pristine
|
372
|
+
first = true
|
369
373
|
end
|
370
|
-
opts, pat = option_sanitize(opts, list, no: no, first:
|
374
|
+
opts, pat = option_sanitize(opts, list, no: no, first: first)
|
371
375
|
out = []
|
372
376
|
opts.each do |opt|
|
373
377
|
if opt =~ pat
|
@@ -470,7 +474,7 @@ module Squared
|
|
470
474
|
end
|
471
475
|
when :exec
|
472
476
|
raise_error('gem', flag, hint: 'no command given') if out.empty?
|
473
|
-
cmd << out.join(' ')
|
477
|
+
cmd << project << out.join(' ')
|
474
478
|
else
|
475
479
|
if out.empty? && cmd.none? { |val| val =~ /^--system(?:=|$)/ }
|
476
480
|
raise_error('gem', flag, hint: 'no gemname given')
|
@@ -502,7 +506,7 @@ module Squared
|
|
502
506
|
cmd = bundle_session flag
|
503
507
|
case flag
|
504
508
|
when 'exec', 'check'
|
505
|
-
args = option_sanitize(args, OPT_BUNDLE[flag.to_sym] + OPT_BUNDLE[:common]).first
|
509
|
+
args = option_sanitize(args, OPT_BUNDLE[flag.to_sym] + OPT_BUNDLE[:common], args: flag == :exec).first
|
506
510
|
end
|
507
511
|
raise_error('bundle', flag, hint: 'no command given') unless !args.empty? || flag == 'check'
|
508
512
|
cmd.merge(args)
|
@@ -511,7 +515,7 @@ module Squared
|
|
511
515
|
|
512
516
|
def rake(*cmd)
|
513
517
|
if cmd.empty?
|
514
|
-
run_s(rake_output(rakeapp), from: :rake, chdir: workspace.pwd)
|
518
|
+
run_s(rake_output(rakeapp), from: :rake, chdir: workspace.pwd, banner: false)
|
515
519
|
else
|
516
520
|
cmd = cmd.flatten.map { |val| rake_output(rakeapp, val) }
|
517
521
|
run_s(cmd, from: :rake, chdir: workspace.pwd, banner: false)
|
@@ -588,9 +592,13 @@ module Squared
|
|
588
592
|
run(banner: !@session.include?('--quiet'), **kwargs)
|
589
593
|
end
|
590
594
|
|
591
|
-
def append_bundle(opts, list, target: @session)
|
595
|
+
def append_bundle(opts, list, target: @session, append: false)
|
592
596
|
out = option_sanitize(opts, list, target: target).first
|
593
|
-
|
597
|
+
if append
|
598
|
+
append_value(out, target: target, escape: true)
|
599
|
+
else
|
600
|
+
option_clear(out, target: target)
|
601
|
+
end
|
594
602
|
end
|
595
603
|
|
596
604
|
def gem_session(*cmd, **kwargs)
|
@@ -651,7 +659,7 @@ module Squared
|
|
651
659
|
end
|
652
660
|
|
653
661
|
def rakeapp
|
654
|
-
quote_option '
|
662
|
+
quote_option 'f', rakefile
|
655
663
|
end
|
656
664
|
|
657
665
|
def rakepwd
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-09 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rake
|