squared 0.2.5 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d7cb098a1adfae7f5e8d7737e72f73542dbc4cabdaaf5bd9364660992cc709e
4
- data.tar.gz: 5f0bca83471206e6f0470cad9a3d4606cb66bd59e0773531f4d0c489390c1fa2
3
+ metadata.gz: a7fd35d264ca1091cf44ddda96ddf8520d93a763c0581fd7dd91a116f214943b
4
+ data.tar.gz: 8dd9129e5a2fefa412c5038c5c56c72dfce6bbd9159baabb651786babd0ca243
5
5
  SHA512:
6
- metadata.gz: 9571ee76edebe66eda5b13d7ba20fb3ddb7d703237abb6a2ae69e7ea3d683d6a106091458918859f913a433947e46f8fac8bce8e628c092e5bff3c70def3abe6
7
- data.tar.gz: b004e6c8e5aa57df1a8cfe8e4109ba0e454863da096a874408bdac7b700a8c81661717265a803f342817e5394c93d3a80d7b5aaad510fc2190a2e286f592851e
6
+ metadata.gz: e32e3f595443651477f6a1394203c1d5476fbf25f4980a258aa832970c7332b250e109f2a4c0c615feb9a26bcde548a0572fcfbbd9f19bda2ff0ffd315a3a8fd
7
+ data.tar.gz: e4c81fd53f4bfa5d0028320cf93922edcd421fda3bca1984c4933a24c3918fb1a29a4560e7724c44ded9e686595483c4f0631f612291bf0dc1841a4e5b2ff5cf
data/CHANGELOG.md CHANGED
@@ -1,12 +1,31 @@
1
1
  # Changelog
2
2
 
3
- ## [0.2.5] - 2024-02-25
3
+ ## [0.2.7] - 2025-04-08
4
+
5
+ ### Fixed
6
+
7
+ - Paths that conflict with git options can be quoted.
8
+ - Bundle command update did not append package names.
9
+ - Git result status type was truncated.
10
+ - Log messages were concatenated without separator.
11
+ - Python pip environment options used undefined session.
12
+ - Regexp "o" modifier was not used properly.
13
+ - Rake did not run individual project Rakefile.
14
+ - Ruby commands did not delimit exec arguments.
15
+
16
+ ## [0.2.6] - 2025-03-06
17
+
18
+ ### Fixed
19
+
20
+ - Git rebase did not include flag with pull command.
21
+
22
+ ## [0.2.5] - 2025-02-25
4
23
 
5
24
  ### Fixed
6
25
 
7
26
  - See `0.1.5`.
8
27
 
9
- ## [0.1.5] - 2024-02-25
28
+ ## [0.1.5] - 2025-02-25
10
29
 
11
30
  ### Fixed
12
31
 
@@ -29,7 +48,7 @@
29
48
 
30
49
  - Project hash options duplicated dash prefix.
31
50
 
32
- ## [0.1.4] - 2024-02-05
51
+ ## [0.1.4] - 2025-02-05
33
52
 
34
53
  ### Fixed
35
54
 
@@ -157,7 +176,7 @@
157
176
  - Workspace did not check base project for Windows filename.
158
177
  - Regexp for SemVer did not recognize package names.
159
178
 
160
- ## [0.1.1] - 2025-12-14
179
+ ## [0.1.1] - 2024-12-14
161
180
 
162
181
  ### Added
163
182
 
@@ -207,6 +226,8 @@
207
226
 
208
227
  - Changelog was created.
209
228
 
229
+ [0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
230
+ [0.2.6]: https://github.com/anpham6/squared/releases/tag/v0.2.6-ruby
210
231
  [0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
211
232
  [0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
212
233
  [0.2.3]: https://github.com/anpham6/squared/releases/tag/v0.2.3-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 >= 0 && val <= 256
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
- msg << (color ? sub_style(subject, :underline) : subject)
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
@@ -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 (!force && !val.include?(' ')) || val.match?(/(?:^|\S=|[^=]\s+)(["']).+\1\z/m)
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*/o)
83
+ val.split(/\s*(?<!\\)#{char}\s*/)
83
84
  end
84
85
  end
85
86
  end
@@ -77,7 +77,7 @@ module Squared
77
77
  return ret.to_i
78
78
  end
79
79
  when ::Numeric
80
- return key if key >= 0 && key <= 2
80
+ return key if key.between?(0, 2)
81
81
  end
82
82
  default
83
83
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.2.5'
4
+ VERSION = '0.2.7'
5
5
  end
@@ -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)}:/o, '') : val.to_s
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)
@@ -837,9 +837,11 @@ module Squared
837
837
  end
838
838
 
839
839
  def option_clear(params, target: @session, **kwargs)
840
+ return if params.empty?
841
+
840
842
  kwargs[:subject] ||= target&.first
841
- kwargs[:hint] ||= 'not used'
842
- warn log_message(:warn, params.join(', '), **kwargs) unless params.empty?
843
+ kwargs[:hint] ||= 'unrecognized'
844
+ warn log_message(:warn, params.join(', '), **kwargs)
843
845
  end
844
846
 
845
847
  def print_item(*val)
@@ -1034,7 +1036,7 @@ module Squared
1034
1036
 
1035
1037
  def param_guard(action, flag, args: nil, key: nil, pat: nil)
1036
1038
  if args && key
1037
- val = args[key]
1039
+ val = args.fetch(key, nil)
1038
1040
  return val unless val.nil? || (pat && !val.match?(pat))
1039
1041
 
1040
1042
  @session = nil
@@ -439,7 +439,7 @@ module Squared
439
439
  end
440
440
 
441
441
  def pull(flag = nil, sync: invoked_sync?('pull', flag), remote: nil, opts: [])
442
- cmd = git_session 'pull'
442
+ cmd = git_session 'pull', flag && "--#{flag}"
443
443
  if (val = option('rebase', ignore: false))
444
444
  cmd << case val
445
445
  when '0'
@@ -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 |val|
736
- next unless val.end_with?("/#{branch}")
735
+ split_escape(data[1]).each do |s|
736
+ next unless s.end_with?("/#{branch}")
737
737
 
738
- origin = val[0..val.size - branch.size - 2]
738
+ origin = s[0..s.size - branch.size - 2]
739
739
  break
740
740
  end
741
741
  end
@@ -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
- append_nocolor(target: target)
246
- return if opts.empty?
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
- cmd << case val
283
- when '0', 'false'
284
- '--no-cache-dir'
285
- else
286
- quote_option('cache-dir', basepath(val))
287
- end
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
- cmd << quote_option('proxy', val) if (val = option('proxy'))
290
- cmd << quote_option('python', basepath(val)) if (val = option('python'))
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 opts, FOR_INSTALL + OPT_UPDATE
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: true)
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
- option_clear(out, target: target)
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 'rakefile', Rake.application.rakefile
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.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-25 00:00:00.000000000 Z
10
+ date: 2025-04-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake