squared 0.2.6 → 0.2.8
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 +23 -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 +7 -4
- data/lib/squared/workspace/project/git.rb +5 -5
- data/lib/squared/workspace/project/python.rb +15 -12
- data/lib/squared/workspace/project/ruby.rb +10 -6
- 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: 9df30ac582767f0c30d058c5b3bf72ebbf51f926bb67b648c206d076b2525bc1
|
4
|
+
data.tar.gz: 2a1dcc43352eb74a8c1b94434916a28cb7579fde20a466bc5fdba81b14956d11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 614b1a06a725ce69a54573f4c0ab2718c5aae60442ba0f75b87f105bb60212032295beff46ac9a2cd2cbf921eb05632cb7d6391a39d0ee21679224d0b1623748
|
7
|
+
data.tar.gz: ec15f7265c437e5bb8d042eb1730e6499ecfd81a893a4456514a4b1ab6f2c0917d560f4a94285e4c982c0f6cd42d5eca8a9b474728830753461c7f78668d2b5c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.2.8] - 2025-04-12
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
|
7
|
+
- User-defined program paths were not sanitized for ENV.
|
8
|
+
- Project clean task used incompatible rmtree flag.
|
9
|
+
- Git branch unset-upstream used undefined variable.
|
10
|
+
|
11
|
+
## [0.2.7] - 2025-04-08
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
|
15
|
+
- Paths that conflict with git options can be quoted.
|
16
|
+
- Bundle command update did not append package names.
|
17
|
+
- Git result status type was truncated.
|
18
|
+
- Log messages were concatenated without separator.
|
19
|
+
- Python pip environment options used undefined session.
|
20
|
+
- Regexp "o" modifier was not used properly.
|
21
|
+
- Rake did not run individual project Rakefile.
|
22
|
+
- Ruby commands did not delimit exec arguments.
|
23
|
+
|
3
24
|
## [0.2.6] - 2025-03-06
|
4
25
|
|
5
26
|
### Fixed
|
@@ -213,6 +234,8 @@
|
|
213
234
|
|
214
235
|
- Changelog was created.
|
215
236
|
|
237
|
+
[0.2.8]: https://github.com/anpham6/squared/releases/tag/v0.2.8-ruby
|
238
|
+
[0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
|
216
239
|
[0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
|
217
240
|
[0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
|
218
241
|
[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..2]
|
@@ -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? ? "\"#{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
@@ -376,7 +376,7 @@ module Squared
|
|
376
376
|
end
|
377
377
|
|
378
378
|
def task_localname(val)
|
379
|
-
prefix && val.is_a?(String) ? val.sub(/\A#{Regexp.escape(prefix)}
|
379
|
+
prefix && val.is_a?(String) ? val.sub(/\A#{Regexp.escape(prefix)}:/, '') : val.to_s
|
380
380
|
end
|
381
381
|
|
382
382
|
def task_desc(*args, **kwargs)
|
@@ -412,7 +412,7 @@ module Squared
|
|
412
412
|
path = basepath(val)
|
413
413
|
if path.directory? && val =~ %r{[\\/]\z}
|
414
414
|
log&.warn "rm -rf #{path}"
|
415
|
-
|
415
|
+
FileUtils.rm_rf(path, verbose: verbose)
|
416
416
|
else
|
417
417
|
log&.warn "rm #{path}"
|
418
418
|
(val.include?('*') ? Dir[path] : [path]).each do |file|
|
@@ -800,6 +800,7 @@ module Squared
|
|
800
800
|
|
801
801
|
def option(*args, prefix: @session&.first, **kwargs)
|
802
802
|
if prefix
|
803
|
+
prefix = File.basename(prefix, File.extname(prefix))
|
803
804
|
args.each do |val|
|
804
805
|
ret = env("#{prefix}_#{val.gsub(/\W/, '_')}".upcase, **kwargs)
|
805
806
|
return ret if ret
|
@@ -837,9 +838,11 @@ module Squared
|
|
837
838
|
end
|
838
839
|
|
839
840
|
def option_clear(params, target: @session, **kwargs)
|
841
|
+
return if params.empty?
|
842
|
+
|
840
843
|
kwargs[:subject] ||= target&.first
|
841
|
-
kwargs[:hint] ||= '
|
842
|
-
warn log_message(:warn, params.join(', '), **kwargs)
|
844
|
+
kwargs[:hint] ||= 'unrecognized'
|
845
|
+
warn log_message(:warn, params.join(', '), **kwargs)
|
843
846
|
end
|
844
847
|
|
845
848
|
def print_item(*val)
|
@@ -1034,7 +1037,7 @@ module Squared
|
|
1034
1037
|
|
1035
1038
|
def param_guard(action, flag, args: nil, key: nil, pat: nil)
|
1036
1039
|
if args && key
|
1037
|
-
val = args
|
1040
|
+
val = args.fetch(key, nil)
|
1038
1041
|
return val unless val.nil? || (pat && !val.match?(pat))
|
1039
1042
|
|
1040
1043
|
@session = nil
|
@@ -732,10 +732,10 @@ module Squared
|
|
732
732
|
unless (origin = option('repository', prefix: 'git', ignore: false))
|
733
733
|
out = source(git_output('log -n1 --format=%h%d'), io: true, stdout: true, banner: false).first
|
734
734
|
if (data = /^#{sha} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/.match(out))
|
735
|
-
split_escape(data[1]).each do |
|
736
|
-
next unless
|
735
|
+
split_escape(data[1]).each do |s|
|
736
|
+
next unless s.end_with?("/#{branch}")
|
737
737
|
|
738
|
-
origin =
|
738
|
+
origin = s[0..s.size - branch.size - 2]
|
739
739
|
break
|
740
740
|
end
|
741
741
|
end
|
@@ -791,7 +791,7 @@ module Squared
|
|
791
791
|
cmd << '--force' if option('force')
|
792
792
|
when :set
|
793
793
|
if ref.start_with?('!')
|
794
|
-
cmd << '--unset-upstream' << shell_escape(
|
794
|
+
cmd << '--unset-upstream' << shell_escape(ref[1..-1])
|
795
795
|
target = nil
|
796
796
|
stdout = true
|
797
797
|
else
|
@@ -1009,7 +1009,7 @@ module Squared
|
|
1009
1009
|
if size > 0
|
1010
1010
|
styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
|
1011
1011
|
styles << :bold if styles.size <= 1
|
1012
|
-
puts print_footer("#{size} #{size == 1 ? type.sub(/s\z/, '') : type}",
|
1012
|
+
puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
|
1013
1013
|
sub: { pat: /\A(\d+)(.+)\z/, styles: styles })
|
1014
1014
|
else
|
1015
1015
|
puts empty_status("No #{type} were #{action}", 'grep', grep)
|
@@ -242,11 +242,14 @@ module Squared
|
|
242
242
|
end
|
243
243
|
|
244
244
|
def append_pip(flag, opts, target: @session)
|
245
|
-
|
246
|
-
|
245
|
+
if opts.empty?
|
246
|
+
append_global(target: target)
|
247
|
+
return
|
248
|
+
end
|
247
249
|
|
248
250
|
out = []
|
249
251
|
opts, pat = option_partition(opts, OPT_INSTALL + OPT_GENERAL, target: target)
|
252
|
+
append_global(target: target)
|
250
253
|
opts.each do |opt|
|
251
254
|
if opt =~ /^(v+|q+)$/
|
252
255
|
cmd << "-#{$1}"
|
@@ -277,18 +280,18 @@ module Squared
|
|
277
280
|
end
|
278
281
|
end
|
279
282
|
|
280
|
-
def append_global
|
283
|
+
def append_global(target: @session)
|
281
284
|
if (val = option('cache-dir'))
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
285
|
+
target << case val
|
286
|
+
when '0', 'false'
|
287
|
+
'--no-cache-dir'
|
288
|
+
else
|
289
|
+
quote_option('cache-dir', basepath(val))
|
290
|
+
end
|
288
291
|
end
|
289
|
-
|
290
|
-
|
291
|
-
append_nocolor
|
292
|
+
target << quote_option('proxy', val) if (val = option('proxy'))
|
293
|
+
target << quote_option('python', basepath(val)) if (val = option('python'))
|
294
|
+
append_nocolor(target: target)
|
292
295
|
end
|
293
296
|
end
|
294
297
|
|
@@ -342,7 +342,7 @@ module Squared
|
|
342
342
|
|
343
343
|
def update(flag, opts: [])
|
344
344
|
bundle_session 'update', "--#{flag}"
|
345
|
-
append_bundle
|
345
|
+
append_bundle(opts, FOR_INSTALL + OPT_UPDATE, append: flag != :all)
|
346
346
|
run_rb(from: :update)
|
347
347
|
end
|
348
348
|
|
@@ -358,7 +358,7 @@ module Squared
|
|
358
358
|
cmd << flag
|
359
359
|
end
|
360
360
|
no = flag == :pristine || flag == :outdated ? [] : OPT_GEM[:NO_GENERAL]
|
361
|
-
opts, pat = option_partition(opts, gemoption(flag), no: no, first:
|
361
|
+
opts, pat = option_partition(opts, gemoption(flag), no: no, first: flag != :outdated)
|
362
362
|
out = []
|
363
363
|
opts.each do |opt|
|
364
364
|
if opt =~ pat
|
@@ -488,7 +488,7 @@ module Squared
|
|
488
488
|
|
489
489
|
def rake(*cmd)
|
490
490
|
if cmd.empty?
|
491
|
-
run_s(rake_output(rakeapp), from: :rake, chdir: workspace.pwd)
|
491
|
+
run_s(rake_output(rakeapp), from: :rake, chdir: workspace.pwd, banner: false)
|
492
492
|
else
|
493
493
|
cmd = cmd.flatten.map { |val| rake_output(rakeapp, val) }
|
494
494
|
run_s(cmd, from: :rake, chdir: workspace.pwd, banner: false)
|
@@ -556,7 +556,7 @@ module Squared
|
|
556
556
|
run(banner: !@session.include?('--quiet'), **kwargs)
|
557
557
|
end
|
558
558
|
|
559
|
-
def append_bundle(opts, list, target: @session)
|
559
|
+
def append_bundle(opts, list, target: @session, append: false)
|
560
560
|
opts, pat = option_partition(opts, list, target: target)
|
561
561
|
out = []
|
562
562
|
opts.each do |opt|
|
@@ -575,7 +575,11 @@ module Squared
|
|
575
575
|
out << opt
|
576
576
|
end
|
577
577
|
end
|
578
|
-
|
578
|
+
if append
|
579
|
+
append_value(out, target: target, escape: true)
|
580
|
+
else
|
581
|
+
option_clear(out, target: target)
|
582
|
+
end
|
579
583
|
end
|
580
584
|
|
581
585
|
def gem_session(*cmd, **kwargs)
|
@@ -635,7 +639,7 @@ module Squared
|
|
635
639
|
end
|
636
640
|
|
637
641
|
def rakeapp
|
638
|
-
quote_option '
|
642
|
+
quote_option 'f', rakefile
|
639
643
|
end
|
640
644
|
|
641
645
|
def gempath(val = @version)
|
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.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- An Pham
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 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.7
|
124
124
|
specification_version: 4
|
125
125
|
summary: Rake task generator for managing multi-language workspaces.
|
126
126
|
test_files: []
|