squared 0.4.10 → 0.4.11

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: ba613d7ba02a664fb4581573f6ee04d705f6bb2d1cb165c30c49d97eb259cbec
4
- data.tar.gz: 764888100c6a6560478e99ed1451f1593a86e120799e25400708d81be934102c
3
+ metadata.gz: fa16edc572cc39bb0bef0b2b5ba04419f2994e824923b354182f9e60b6aee1b2
4
+ data.tar.gz: 75a6b805d236d45f09b331bf62cbfcc5f9b043632d194474511763c7fc7fbf64
5
5
  SHA512:
6
- metadata.gz: 1cf6f1f10babf7bfbbe665fe5fc97527cf1df4093a3e6b8b906a4bf8cf87f538c601faee86f40decb79455de340e1d8f510fb45d0acc17694cd97a4051010539
7
- data.tar.gz: 2b537c2c6a30a17191f32eb1012b225bc29fff9e9102b663a6dcf3ffd05465f4e8a0790f4cbdd6c63b21bd64c762e85dff1d22b4eb35053702a6692e92c994cc
6
+ metadata.gz: 510b7807e4e2be74dfe8ba5202115e3b5cefbd27d94cb14af169007bcdedde7f8c8516679c1bc614cb633eb1a904a6309403346f7c0c8490ad13fa208f2bd1f0
7
+ data.tar.gz: 3a124f06b78467a4eda6a1f34c2a80f6bb9f78867c5daefbcb0f628d9eb6a4bfbf0193e0d5509f38000e7e6ce6c8c3f4d112f0c0146260d30664692cda495186
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.11] - 2025-05-09
4
+
5
+ ### Added
6
+
7
+ - Docker command build action bake is interactive.
8
+
9
+ ### Fixed
10
+
11
+ - Docker build command was not functional.
12
+
3
13
  ## [0.4.10] - 2025-05-08
4
14
 
5
15
  ### Added
@@ -655,6 +665,7 @@
655
665
 
656
666
  - Changelog was created.
657
667
 
668
+ [0.4.11]: https://github.com/anpham6/squared/releases/tag/v0.4.11-ruby
658
669
  [0.4.10]: https://github.com/anpham6/squared/releases/tag/v0.4.10-ruby
659
670
  [0.4.9]: https://github.com/anpham6/squared/releases/tag/v0.4.9-ruby
660
671
  [0.4.8]: https://github.com/anpham6/squared/releases/tag/v0.4.8-ruby
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.4.10'
4
+ VERSION = '0.4.11'
5
5
  end
@@ -602,6 +602,7 @@ module Squared
602
602
  end
603
603
 
604
604
  def powershell?
605
+ return true if ENV['SHELL']&.end_with?(File.join('', 'pwsh'))
605
606
  return false unless windows?
606
607
 
607
608
  case ENV['TERM_PROGRAM']
@@ -138,10 +138,14 @@ module Squared
138
138
  buildx(:build, args.extras, "#{flag}": param)
139
139
  end
140
140
  when :bake
141
- format_desc action, flag, 'opts*,target*,context?'
141
+ format_desc action, flag, ':?,opts*,target*,context?'
142
142
  task flag do |_, args|
143
- args = param_guard(action, flag, args: args.to_a)
144
- buildx flag, args
143
+ args = args.to_a
144
+ if args.first == ':'
145
+ choice_command :bake
146
+ else
147
+ buildx flag, args
148
+ end
145
149
  end
146
150
  end
147
151
  when 'compose'
@@ -226,11 +230,11 @@ module Squared
226
230
  image(:rm, sync: sync)
227
231
  end
228
232
 
229
- def compose(opts, flags = nil, script: false, args: nil, from: :build, **)
233
+ def compose(opts, flags = nil, script: false, args: nil, from: :run, **)
230
234
  return opts if script == false
231
235
 
232
236
  ret = docker_session
233
- if from == :build
237
+ if from == :run
234
238
  case (n = filetype)
235
239
  when 1, 2
236
240
  ret << 'buildx' << 'bake'
@@ -254,14 +258,16 @@ module Squared
254
258
  when Enumerable
255
259
  ret.merge(opts.to_a)
256
260
  end
257
- [args, flags].each_with_index do |target, index|
258
- next unless target
259
261
 
260
- target = append_any(target, target: []) unless target.is_a?(Array)
261
- ret.merge(target.map { |arg| index == 0 ? fill_option(arg) : quote_option('build-arg', arg) })
262
+ [args, flags].each_with_index do |target, index|
263
+ if target.is_a?(String)
264
+ ret << target
265
+ elsif (target = append_any(target, target: []))
266
+ ret.merge(target.map { |arg| index == 0 ? fill_option(arg) : quote_option('build-arg', arg) })
267
+ end
262
268
  end
263
269
  case from
264
- when :build
270
+ when :run
265
271
  case @secrets
266
272
  when String
267
273
  ret << quote_option('secret', @secrets, double: true)
@@ -683,6 +689,8 @@ module Squared
683
689
  ['Choose an image', 'images -a', 2]
684
690
  when :exec
685
691
  ['Choose a container', 'ps -a', 0]
692
+ when :bake
693
+ ['Choose a target', 'buildx bake --list=type=targets', 0]
686
694
  else
687
695
  ['Choose a network', 'network ls', 0]
688
696
  end
@@ -698,10 +706,10 @@ module Squared
698
706
  when :run, :exec
699
707
  values = [['Options', flag == :run], ['Arguments', flag == :exec]]
700
708
  cmd = flag.to_s
701
- when :rm
709
+ when :rm, :bake
702
710
  values = ['Options']
703
711
  multiple = true
704
- cmd = "image #{flag}"
712
+ cmd = flag == :rm ? 'image rm' : "buildx bake -f #{shell_quote(dockerfile)}"
705
713
  else
706
714
  values = ['Options', ['Container', true]]
707
715
  cmd = "network #{flag}"
@@ -288,17 +288,20 @@ module Squared
288
288
  namespace(name = ws.task_name('git')) do
289
289
  all = ws.task_join(name, 'all')
290
290
 
291
- ws.format_desc(all, %w[stash|rebase depend])
291
+ ws.format_desc(all, 'stash|rebase|autostash?,depend?')
292
292
  task 'all' do |_, args|
293
- opts = args.to_a
294
- cmd = if opts.include?('stash')
295
- [ws.task_sync('stash'), ws.task_sync('pull')]
296
- elsif opts.include?('rebase')
297
- [ws.task_sync('rebase')]
293
+ args = args.to_a
294
+ cmd = if args.include?('stash')
295
+ ['stash', 'pull']
296
+ elsif args.include?('rebase')
297
+ ['rebase']
298
+ elsif args.include?('autostash')
299
+ ['autostash']
298
300
  else
299
- [ws.task_sync('pull')]
301
+ ['pull']
300
302
  end
301
- cmd << ws.task_sync('depend') if opts.include?('depend') && !ws.series[:depend].empty?
303
+ cmd.map! { |val| ws.task_sync(val) }
304
+ cmd << ws.task_sync('depend') if args.include?('depend') && !ws.series.exclude?(:depend, true)
302
305
  cmd << ws.task_sync('build')
303
306
  Common::Utils.task_invoke(*cmd, **ws.invokeargs)
304
307
  end
@@ -184,12 +184,12 @@ module Squared
184
184
  task flag, [:strategy] do |_, args|
185
185
  case (strategy = args.strategy)
186
186
  when 'eager', 'only-if-needed'
187
- opts = args.extras
187
+ args = args.extras
188
188
  else
189
- opts = args.to_a
189
+ args = args.to_a
190
190
  strategy = nil
191
191
  end
192
- install(flag, opts, strategy: strategy)
192
+ install(flag, args, strategy: strategy)
193
193
  end
194
194
  when :target
195
195
  task flag, [:dir] do |_, args|
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.10
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham