squared 0.4.22 → 0.4.23

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: 4f67ab37dd0b66feaeb78631ac257ba860df78acba313f2e5fe2ffeb01136acf
4
- data.tar.gz: 8d0570c44cbdf41ba282b5c2fd9a0196b4c5678d595ca5774393b442b88eb854
3
+ metadata.gz: 8d6cb2868bb0cf1337f5b55837f5347d280408fece9d5ced520fa0a4b4dcf66a
4
+ data.tar.gz: 473e53ee64c8f98d4005ae4a36a31f652f67513fb9892f3beb9696a6eba27df4
5
5
  SHA512:
6
- metadata.gz: 01b00bf5afdd80a370ef363c0d546f76d8f2533474b25029fc37c9bb0bfb1b2104ea4aa78c38cb044cf8d2f194630496b6d1b48ad4d94e8be284b28dd5dfa03c
7
- data.tar.gz: 3968c3a15796f1c41939b95b4e50c8a8830f7f95fb6570a193c24c0043e259c82c6ac28571bd4cdbcddd2b77d6b47f38b55a963c3e567bad6e8e949a41ba8698
6
+ metadata.gz: e99a8c8804d50e7b051ccb3a3fc5233f8209a0a2ec9a4b8ca82fae5a5917da851b639123294f5948a1dbe1e1749157e0a150c9b7b9a4053f043fc600477d2f9a
7
+ data.tar.gz: bbc77a9801a42360e468a388c008e24f7e2c5d2d431de46174871bcc11d482b7595d9339455824d9077861d889577c55649bcfada9a5617c058ab1ba95db04ad
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.23] - 2025-10-11
4
+
5
+ ### Fixed
6
+
7
+ - Node task outdated did not compare wanted and latest by semver.
8
+ - Project base method append_hash did not have target when joined.
9
+ - Docker build for compose and bake was completely incapacitated.
10
+
3
11
  ## [0.4.22] - 2025-10-08
4
12
 
5
13
  ### Added
@@ -1010,6 +1018,7 @@
1010
1018
 
1011
1019
  - Changelog was created.
1012
1020
 
1021
+ [0.4.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.23
1013
1022
  [0.4.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.22
1014
1023
  [0.4.21]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.21
1015
1024
  [0.4.20]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.20
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.22'
4
+ VERSION = '0.4.23'
5
5
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'json'
4
4
  require 'date'
5
- require 'time'
6
5
  require 'logger'
7
6
 
8
7
  module Squared
@@ -209,7 +208,7 @@ module Squared
209
208
  def initialize_env(dev: nil, prod: nil, **)
210
209
  @dev = env_match('BUILD', dev, suffix: 'DEV', strict: true)
211
210
  @prod = env_match('BUILD', prod, suffix: 'PROD', strict: true)
212
- unless @output[2] == false || !(val = env('BUILD', suffix: 'ENV'))
211
+ if (val = env('BUILD', suffix: 'ENV')) && @output[2] != false
213
212
  @output[2] = parse_json(val, hint: "BUILD_#{@envname}_ENV") || @output[2]
214
213
  end
215
214
  unless @output[0] == false || @output[0].is_a?(Array)
@@ -465,11 +464,11 @@ module Squared
465
464
  a, b, c, d, e = val
466
465
  case b
467
466
  when Hash
468
- b = append_hash(b, build: true).join(' ')
467
+ b = append_hash(b, target: [], build: true).join(' ')
469
468
  when Enumerable
470
469
  b = b.to_a.join(' ')
471
470
  end
472
- d = append_hash(d).join(' ') if d.is_a?(Hash)
471
+ d = append_hash(d, target: []).join(' ') if d.is_a?(Hash)
473
472
  if a
474
473
  cmd << [a, d, b].compact.join(' ')
475
474
  else
@@ -490,11 +489,13 @@ module Squared
490
489
  if cmd
491
490
  cmd = as_get(cmd, from)
492
491
  opts = compose(opts, script: false) if opts && respond_to?(:compose)
493
- flags = append_hash(flags).join(' ') if flags.is_a?(Hash)
492
+ flags = append_hash(flags, target: []).join(' ') if flags.is_a?(Hash)
494
493
  case opts
495
494
  when Hash
496
- opts = append_hash(opts, build: true)
497
- cmd = Array(cmd).push(flags).concat(opts).compact.join(' ')
495
+ cmd = Array(cmd).push(flags)
496
+ .concat(append_hash(opts, target: [], build: true))
497
+ .compact
498
+ .join(' ')
498
499
  when Enumerable
499
500
  cmd = Array(cmd).concat(opts.to_a)
500
501
  cmd.map! { |val| "#{val} #{flags}" } if flags
@@ -1267,11 +1268,11 @@ module Squared
1267
1268
  end
1268
1269
 
1269
1270
  def option(*args, target: @session, prefix: target&.first, **kwargs)
1270
- if prefix
1271
- args.each do |val|
1272
- ret = env(env_key(stripext(prefix), val), **kwargs)
1273
- return ret if ret
1274
- end
1271
+ return unless prefix
1272
+
1273
+ args.each do |val|
1274
+ ret = env(env_key(stripext(prefix), val), **kwargs)
1275
+ return ret if ret
1275
1276
  end
1276
1277
  nil
1277
1278
  end
@@ -1450,7 +1451,7 @@ module Squared
1450
1451
  opts.each { |val| target << shell_option(flag, val) }
1451
1452
  end
1452
1453
 
1453
- def append_hash(data, target: @session, build: false)
1454
+ def append_hash(data, target: @session || [], build: false)
1454
1455
  if build && (type = env('BUILD', suffix: 'TYPE') || ENV['BUILD_TYPE'])
1455
1456
  type = "__#{type}__"
1456
1457
  if (extra = data[type] || data[type.to_sym]).is_a?(Hash)
@@ -1553,7 +1554,7 @@ module Squared
1553
1554
  when String
1554
1555
  "#{base} #{data}"
1555
1556
  when Hash
1556
- "#{append_hash(base).join(' ')} #{data}"
1557
+ "#{append_hash(base, target: []).join(' ')} #{data}"
1557
1558
  when Enumerable
1558
1559
  "#{base.to_a.join(' ')} #{data}"
1559
1560
  else
@@ -1562,11 +1563,11 @@ module Squared
1562
1563
  when Hash
1563
1564
  case base
1564
1565
  when String
1565
- "#{base} #{append_hash(data).join(' ')}"
1566
+ "#{base} #{append_hash(data, target: []).join(' ')}"
1566
1567
  when Hash
1567
1568
  base.merge(data)
1568
1569
  when Enumerable
1569
- Set.new(base.to_a + append_hash(data)).to_a
1570
+ Set.new(base.to_a + append_hash(data, target: [])).to_a
1570
1571
  else
1571
1572
  data
1572
1573
  end
@@ -1575,7 +1576,7 @@ module Squared
1575
1576
  when String
1576
1577
  "#{base} #{data.to_a.join(' ')}"
1577
1578
  when Hash
1578
- "#{append_hash(base).join(' ')} #{data.to_a.join(' ')}"
1579
+ "#{append_hash(base, target: []).join(' ')} #{data.to_a.join(' ')}"
1579
1580
  when Enumerable
1580
1581
  Set.new(base.to_a + data.to_a).to_a
1581
1582
  else
@@ -264,11 +264,11 @@ module Squared
264
264
  ret = docker_session
265
265
  if from == :run
266
266
  if bake?(n = filetype)
267
- ret << 'buildx' << 'bake'
267
+ ret << 'buildx bake'
268
268
  append_file n
269
269
  from = :bake
270
270
  elsif compose?(n)
271
- ret << 'compose' << 'build'
271
+ ret << 'compose build'
272
272
  append_file n
273
273
  from = :compose
274
274
  else
@@ -281,7 +281,7 @@ module Squared
281
281
  when String
282
282
  ret << opts
283
283
  when Hash
284
- ret.merge(append_hash(opts, build: true))
284
+ ret.merge(append_hash(opts, target: [], build: true))
285
285
  when Enumerable
286
286
  ret.merge(opts.to_a)
287
287
  end
@@ -622,7 +622,7 @@ module Squared
622
622
  target << list.join(' && ') unless list.empty?
623
623
  end
624
624
 
625
- def append_file(type, target: @session)
625
+ def append_file(type, target: @session, index: 2)
626
626
  return if !@file || (ENV['COMPOSE_FILE'] && compose?(type))
627
627
 
628
628
  unless @file.is_a?(Array)
@@ -635,10 +635,10 @@ module Squared
635
635
  end
636
636
  files = Array(@file).map { |val| quote_option('file', basepath(val)) }
637
637
  if target.is_a?(Set)
638
- opts = target.to_a.insert(2, *files)
638
+ opts = target.to_a.insert(index, *files)
639
639
  target.clear.merge(opts)
640
640
  else
641
- target.insert(2, *files)
641
+ target.insert(index, *files)
642
642
  end
643
643
  end
644
644
 
@@ -604,7 +604,7 @@ module Squared
604
604
  detach = args.detach
605
605
  commit = commithead args.commit
606
606
  end
607
- param_guard(action, flag, args: { create: create }, key: :create, pat: /\Ab\z/i) if create
607
+ param_guard(action, flag, args: { create: create }, key: :create, pat: /\A[Bb]\z/) if create
608
608
  else
609
609
  branch = choice_refs 'Choose a branch to switch'
610
610
  end
@@ -824,7 +824,7 @@ module Squared
824
824
  []
825
825
  else
826
826
  commit = choice_refs 'Choose "onto" branch'
827
- target, opts = choice_commit(multiple: 2, values: ['Options'], reflog: false)
827
+ target, opts = choice_commit(reflog: false, multiple: 2, values: ['Options'])
828
828
  branch, upstream = target
829
829
  OptionPartition.strip(opts)
830
830
  end
@@ -134,13 +134,13 @@ module Squared
134
134
  exact = true
135
135
  save = save[1..-1]
136
136
  end
137
- case save
138
- when 'prod', 'dev', 'optional', 'peer'
139
- packages = args.extras
140
- else
141
- save = 'prod'
142
- packages = args.to_a
143
- end
137
+ packages = case save
138
+ when 'prod', 'dev', 'optional', 'peer'
139
+ args.extras
140
+ else
141
+ save = 'prod'
142
+ args.to_a
143
+ end
144
144
  param_guard(action, 'name', args: packages)
145
145
  depend(:add, packages: packages, save: save, exact: exact)
146
146
  end
@@ -527,7 +527,19 @@ module Squared
527
527
  next
528
528
  end
529
529
  current = val['current'] || file
530
- want = rev == :major && !latest[SEM_VER, 6] ? latest : val['wanted']
530
+ want = val['wanted']
531
+ unless latest[SEM_VER, 6]
532
+ case rev
533
+ when :major
534
+ want = latest
535
+ when :minor
536
+ want = latest if latest[SEM_VER, 1] == want[SEM_VER, 1]
537
+ when :patch
538
+ if (g = latest.match(SEM_VER)) && (h = want.match(SEM_VER)) && g[1] == h[1] && g[3] == h[3]
539
+ want = latest
540
+ end
541
+ end
542
+ end
531
543
  next unless (current != want || file != want) && (want.match?(SEM_VER) || !file.match?(SEM_VER))
532
544
 
533
545
  f = semscan file
@@ -845,7 +857,7 @@ module Squared
845
857
  when String
846
858
  target
847
859
  when Hash
848
- append_hash(target).join(' ')
860
+ append_hash(target, target: []).join(' ')
849
861
  when Enumerable
850
862
  target.to_a.join(' ')
851
863
  else
@@ -7,7 +7,7 @@ module Squared
7
7
  DEP_PYTHON = %w[poetry.lock setup.cfg pyproject.toml setup.py requirements.txt].freeze
8
8
  DIR_PYTHON = (DEP_PYTHON + %w[README.rst]).freeze
9
9
  OPT_PYTHON = {
10
- common: %w[b B d E h i I O OO P q s S u v x c=q m=b W=b X=q check-hash-based-pycs=b].freeze,
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
11
  build: %w[n|no-isolation s|sdist x|skip-dependency-check v|verbose w|wheel C|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
@@ -614,7 +614,7 @@ module Squared
614
614
  def python_session(*cmd, opts: nil)
615
615
  return session('python', *preopts(quiet: false), *cmd, path: venv.nil?) unless opts
616
616
 
617
- op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: /\Av+\z/)
617
+ op = OptionPartition.new(opts, OPT_PYTHON[:common], project: self, single: /\A(?:v+|OO)\z/)
618
618
  ret = session('python', *op.to_a, *cmd, path: venv.nil?)
619
619
  [ret, op.extras]
620
620
  end
@@ -874,7 +874,7 @@ module Squared
874
874
  op = OptionPartition.new(opts, OPT_PYTHON[:venv], cmd, project: self)
875
875
  op.append(dir, delim: true)
876
876
  .clear(pass: false)
877
- status = op.arg?(/\A-v+\z/, 'verbose')
877
+ status = op.arg?(/\A-v+\z/)
878
878
  run(op, env, exception: true, banner: banner)
879
879
  puts(dir.directory? ? "Success: #{dir}" : 'Failed') if banner && !status
880
880
  end
@@ -77,7 +77,7 @@ module Squared
77
77
  def select(list, bare: true, no: true, single: false, double: false)
78
78
  ret = bare ? list.grep_v(/=/) : list.grep(/=/).map! { |val| val.split('=', 2).first }
79
79
  ret.map! { |val| val.split('|', 2).last }
80
- ret = ret.grep_v(/^no-/) unless no
80
+ ret = ret.grep_v(/\Ano-/) unless no
81
81
  return ret if single == double
82
82
 
83
83
  ret.select { |val| single ? val.size == 1 : val.size > 1 }
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.22
4
+ version: 0.4.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham