squared 0.4.31 → 0.4.32

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: e24f3f18639483d5b698d06a1fd471251623658359121940dd4d6597d3e5f453
4
- data.tar.gz: 90eb6cd2b8b5e28497d666d655758422d124b4eb47701164ce3712a11ecc2936
3
+ metadata.gz: 913d20d3c4a6de7260752fb6603305cee9af765f2885ae74a57d145abe0c2e4e
4
+ data.tar.gz: 4c07a15fb013d871a8ebf0f93343146b4366a127ca1f1c18467648d9f7c4ca44
5
5
  SHA512:
6
- metadata.gz: 4a7a4c5283e6bd65ed22fe9053d3f14552f2de61200e48c8c0c8e8013d0915db2c72a76ad2f7de784d0127ac47a8dd87c48ceea7a6c8c93468119487820886d7
7
- data.tar.gz: 8aee7c98eb186fec5968373ab0f3acffefcbe45d6c85adce46c581536ca51d77c71af89f1c0b95cf4be10e850a24df6b783c35eb9fc32da0fa3918d360f8d779
6
+ metadata.gz: 13a87e14e520b801a71e00c5012eb06e8a557b1f6c7d14cf30702e0a4b2ed0d87bb5535d8ffc970275da0f7a65958562e4ca586cebca847c886a80a6df438d5b
7
+ data.tar.gz: 48626887ad8b660747dc389e321c2b179b9855cba8ddc9c98d3e48416b87d3ab5899de9f416db068ce47e983f56ce27174057ebed38b148b5331cc4088e12e9c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.32] - 2025-11-25
4
+
5
+ ### Fixed
6
+
7
+ - Git method commit did not include --dry-run with add command.
8
+ - JoinSet method include? did not always search to start of delimiter.
9
+ - Config viewer did not check for a readable package registry document.
10
+ - Powershell executable did not check for alternate path location.
11
+
3
12
  ## [0.4.31] - 2025-11-22
4
13
 
5
14
  ### Changed
@@ -138,6 +138,13 @@ module Squared
138
138
  super + extras.size
139
139
  end
140
140
 
141
+ def include?(obj)
142
+ return true if super
143
+ return extras.include?(obj) unless (n = extras.index(@partition))
144
+
145
+ extras[0..n].include?(obj)
146
+ end
147
+
141
148
  def to_a
142
149
  pass
143
150
  end
@@ -160,6 +167,7 @@ module Squared
160
167
 
161
168
  alias add :<<
162
169
  alias add? :<<
170
+ alias member? include?
163
171
 
164
172
  private
165
173
 
@@ -110,7 +110,8 @@ module Squared
110
110
  end
111
111
 
112
112
  def shell_bin(name, env: true)
113
- key = name.upcase
113
+ key = name.to_s.upcase
114
+ key = File.basename(key, '.*') if Rake::Win32.windows?
114
115
  shell_quote((env && ENV["PATH_#{key}"]) || PATH[key] || PATH[key.to_sym] || name,
115
116
  option: false, force: false, double: true)
116
117
  end
@@ -22,8 +22,8 @@ module Squared
22
22
  nil
23
23
  end
24
24
 
25
- def link(project, main = project.dependfile.basename, name = nil, **kwargs, &blk)
26
- return unless project.enabled?
25
+ def link(project, main = project.dependfile&.basename, name = nil, **kwargs, &blk)
26
+ return unless project.enabled? && main
27
27
 
28
28
  ret = Viewer.new(main, name, project: project, **kwargs)
29
29
  ret.instance_eval(&blk) if block_given?
@@ -159,7 +159,7 @@ module Squared
159
159
  end
160
160
 
161
161
  def also(path, type = nil, name: nil, **kwargs)
162
- return self if @mime.frozen? || !(file = basepath(path)).exist?
162
+ return self unless (file = basepath(path)).exist? && !@mime.frozen?
163
163
 
164
164
  ext = mimetype file
165
165
  type ||= ext
@@ -321,7 +321,9 @@ module Squared
321
321
  end
322
322
 
323
323
  def warning?
324
- project ? project.workspace.warning : true
324
+ return true unless project
325
+
326
+ project.workspace.warning
325
327
  end
326
328
 
327
329
  def stdin?
@@ -346,7 +348,9 @@ module Squared
346
348
  end
347
349
 
348
350
  def basepath(*args)
349
- project ? project.basepath(*args) : Pathname.pwd.join(*args)
351
+ return Pathname.pwd.join(*args) unless project
352
+
353
+ project.basepath(*args)
350
354
  end
351
355
  end
352
356
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.31'
4
+ VERSION = '0.4.32'
5
5
  end
@@ -83,7 +83,7 @@ module Squared
83
83
  basename = @home.basename.to_s
84
84
  if main
85
85
  @main = main.to_s.freeze
86
- @home += @main unless @main == basename || (windows? && @main.downcase == basename.downcase)
86
+ @home += @main unless @main == basename || (windows? && @main.casecmp?(basename))
87
87
  else
88
88
  @main = basename.freeze
89
89
  end
@@ -178,7 +178,9 @@ module Squared
178
178
  self
179
179
  end
180
180
 
181
- def with(*val, group: nil, **kwargs, &blk)
181
+ def with(*val, pass: false, group: nil, **kwargs, &blk)
182
+ return self if pass == true || (pass && Array(pass).map(&:to_s).any? { |s| respond_to?(s) && __send__(s) })
183
+
182
184
  @group = nil
183
185
  @ref = nil
184
186
  @withargs = kwargs.empty? ? nil : kwargs
@@ -332,7 +332,7 @@ module Squared
332
332
 
333
333
  format_desc action, flag, '(-)project*'
334
334
  task flag do |_, args|
335
- args = args.to_a.reject { |val| name == val.to_s }
335
+ args = args.to_a.reject { |val| name == val }
336
336
  if flag == :run
337
337
  graph args
338
338
  else
@@ -447,9 +447,9 @@ module Squared
447
447
  if args.empty?
448
448
  return unless from == :run
449
449
 
450
- run_b(@run, sync: sync, from: from) if series?(@run)
451
- args = @output
452
450
  banner = verbosetype > 1 if from_base?('build')
451
+ run_b(@run, sync: sync, from: from, banner: banner) if series?(@run)
452
+ args = @output
453
453
  end
454
454
  if args.first.is_a?(Struct)
455
455
  f, blk = args.first.to_a
@@ -812,7 +812,7 @@ module Squared
812
812
  def run(cmd = @session, var = nil, exception: self.exception, sync: true, from: nil, banner: true, chdir: path,
813
813
  interactive: nil, hint: nil, **)
814
814
  unless cmd
815
- print_error('no command given', subject: project, hint: from || 'unknown', pass: true)
815
+ print_error('no command session started', subject: project, hint: from || 'unknown', pass: true)
816
816
  return
817
817
  end
818
818
  cmd = cmd.target if cmd.is_a?(OptionPartition)
@@ -1061,8 +1061,8 @@ module Squared
1061
1061
  def run_b(obj, **kwargs)
1062
1062
  case obj
1063
1063
  when Struct
1064
- if (any = instance_eval(&obj.block) || obj.run)
1065
- run_b(any, **kwargs)
1064
+ if (val = instance_eval(&obj.block) || obj.run)
1065
+ run_b(val, **kwargs)
1066
1066
  end
1067
1067
  when Proc
1068
1068
  instance_eval(&obj)
@@ -1678,7 +1678,7 @@ module Squared
1678
1678
  end
1679
1679
  if values
1680
1680
  ret = Array(ret)
1681
- values.each do |val|
1681
+ Array(values).each do |val|
1682
1682
  if val.is_a?(Array)
1683
1683
  val, force = val
1684
1684
  else
@@ -1713,7 +1713,7 @@ module Squared
1713
1713
  def command(*args)
1714
1714
  return args.join(' && ') unless workspace.powershell?
1715
1715
 
1716
- "powershell.exe -Command #{shell_quote("& {#{args.join(' ; ')}}", option: false, double: true)}"
1716
+ "#{shell_bin('powershell.exe')} -Command \"& {#{args.join(' ; ')}}\""
1717
1717
  end
1718
1718
 
1719
1719
  def relativepath(*list, all: false)
@@ -1460,7 +1460,7 @@ module Squared
1460
1460
  co = git_session('commit', options: false)
1461
1461
  pu = git_output 'push', upstream && '--set-upstream'
1462
1462
  if dryrun
1463
- op.delete('--dry-run')
1463
+ op.adjoin('--dry-run')
1464
1464
  co << '--dry-run'
1465
1465
  pu << '--dry-run'
1466
1466
  end
@@ -1472,7 +1472,6 @@ module Squared
1472
1472
  end
1473
1473
  pu << '--force-with-lease' if amend
1474
1474
  pu.merge(repotrack(origin, branch))
1475
- puts if pass
1476
1475
  source op
1477
1476
  source co
1478
1477
  source pu
@@ -624,6 +624,7 @@ module Squared
624
624
  else
625
625
  footer.call(0, found.size)
626
626
  end
627
+ printsucc
627
628
  commit(:add, ['package.json'], pass: true)
628
629
  end
629
630
  elsif !avail.empty?
@@ -8,7 +8,7 @@ module Squared
8
8
  DIR_PYTHON = (DEP_PYTHON + %w[README.rst]).freeze
9
9
  OPT_PYTHON = {
10
10
  common: %w[b B d E h i I O P q s S u v x c=q m=b W=b X=q check-hash-based-pycs=b].freeze,
11
- build: %w[n|no-isolation s|sdist x|skip-dependency-check v|verbose w|wheel C|config-setting=q installer=b
11
+ build: %w[C=bm n|no-isolation s|sdist x|skip-dependency-check v|verbose w|wheel config-setting=q installer=b
12
12
  o|outdir=p].freeze,
13
13
  venv: %w[clear copies symlinks system-site-packages upgrade upgrade-deps without-scm-ignore-files without-pip
14
14
  prompt=q].freeze
@@ -88,7 +88,7 @@ module Squared
88
88
 
89
89
  def arg?(target, *args, value: false, **)
90
90
  r, s = args.partition { |val| val.is_a?(Regexp) }
91
- r << matchopts(s, value: value) unless s.empty?
91
+ r << matchopts(s, value) unless s.empty?
92
92
  a = target.to_a.compact
93
93
  if (n = a.index('--'))
94
94
  a = a[0..n]
@@ -300,12 +300,14 @@ module Squared
300
300
  self
301
301
  end
302
302
 
303
- def append_any(*args, **kwargs)
303
+ def append_any(*args, quote: true, **kwargs)
304
304
  (args.empty? ? extras : args.flatten).each do |val|
305
305
  if exist?(val)
306
306
  add_path(val, **kwargs)
307
- else
307
+ elsif quote
308
308
  add_quote(val, **kwargs)
309
+ else
310
+ add val
309
311
  end
310
312
  end
311
313
  self
@@ -387,7 +389,7 @@ module Squared
387
389
  end
388
390
 
389
391
  def add_path(*args, **kwargs)
390
- add shell_quote(path ? path.join(*args) : File.join(*args), **kwargs)
392
+ add shell_quote(path ? path.join(*args) : File.join(*args), option: false, **kwargs)
391
393
  self
392
394
  end
393
395
 
@@ -397,6 +399,11 @@ module Squared
397
399
  self
398
400
  end
399
401
 
402
+ def delim
403
+ add '--'
404
+ self
405
+ end
406
+
400
407
  def splice(*exclude, quote: true, delim: true, path: false, pattern: false, &blk)
401
408
  found, other = if block_given?
402
409
  partition(&blk)
@@ -20,7 +20,7 @@ module Squared
20
20
 
21
21
  def expect(name)
22
22
  ret = project name
23
- return ret if ret&.path&.directory?
23
+ return ret if ret&.path&.directory? && !ret.path.empty?
24
24
 
25
25
  raise NoMethodError, "project is not initialized (#{name})"
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.31
4
+ version: 0.4.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham