squared 0.3.11 → 0.3.12

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: 249f3799dc2e8a511a03aec91e04dc84f707cf7b21eb194b89e53805321001c6
4
- data.tar.gz: 4906775ef2c64fae979a3b21a142a19b1f4d17ad4e659b577a41dc971e1c7b4d
3
+ metadata.gz: f6ba5fce68ca21d291620e1877a4a00733e795d1cc9fa5cccfe9866d422554b6
4
+ data.tar.gz: 8b22eaea56b0a8ccc5ad9880fd3efc12060246228a09e902d346a054947b31b6
5
5
  SHA512:
6
- metadata.gz: a575c60ad790e1852dad7220d2783bd32e03bfd62d0a04326e5ee72a1868d89ed49b3a50f85504d097ba06d9bd673997770abd091fc0a6da661c7253186b861f
7
- data.tar.gz: fb026dc84454c92e2c09ee52d1fc3fddf0f6f33a071f389abbbc0de6ec584d696e1feed133e05502d5f431d2b67998133e6e5f79b98dd5d382c337e000469d98
6
+ metadata.gz: 8312fe3ccf942363b0bce6b05e24fbb012860b3e1dd3e36956dfc754a0b563db1edac58e054a1409c65d71cdf82f2dd5d4b487e2ee6d1da8c24a650c73132e42
7
+ data.tar.gz: 6553a12173f0e5e4ee421772fa503c58d9e77f98738cedd25c5d06775ac4f13bf6c1a2b5eab6b0cae07f7ce23e60b60ed95c098b6eb2eaf938bc081c0f1f7e55
data/CHANGELOG.md CHANGED
@@ -1,7 +1,41 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.12] - 2025-07-05
4
+
5
+ ### Fixed
6
+
7
+ - Gem command exec did not include gem option flag.
8
+ - Project graph did not print first level border.
9
+ - Node command update did not use correct event name.
10
+ - Gem command push did not validate gem file to publish.
11
+ - Node command publish did not publish when silent.
12
+
13
+ ## [0.2.12] - 2025-07-05
14
+
15
+ ### Fixed
16
+
17
+ - See `0.1.9`.
18
+
19
+ ## [0.1.9] - 2025-07-05
20
+
21
+ ### Added
22
+
23
+ - Initial support for using JRuby.
24
+ - Config viewer theme color for boolean was implemented.
25
+
26
+ ### Fixed
27
+
28
+ - Workspace did not add prefix to duplicate project names.
29
+ - Project output divider was not printed when not verbose.
30
+ - Directory context was not threaded using JRuby.
31
+ - Index character was not captured on Windows.
32
+ - Common method is used for Kernel shell commands.
33
+ - Git did not highlight output for single commands.
34
+
3
35
  ## [0.3.11] - 2025-05-15
4
36
 
37
+ ### Fixed
38
+
5
39
  - See `0.2.11`.
6
40
 
7
41
  ## [0.2.11] - 2025-05-15
@@ -92,6 +126,8 @@
92
126
 
93
127
  ## [0.3.7] - 2025-04-08
94
128
 
129
+ ### Fixed
130
+
95
131
  - See `0.2.7`.
96
132
 
97
133
  ## [0.2.7] - 2025-04-08
@@ -421,6 +457,7 @@
421
457
 
422
458
  - Changelog was created.
423
459
 
460
+ [0.3.12]: https://github.com/anpham6/squared/releases/tag/v0.3.12-ruby
424
461
  [0.3.11]: https://github.com/anpham6/squared/releases/tag/v0.3.11-ruby
425
462
  [0.3.10]: https://github.com/anpham6/squared/releases/tag/v0.3.10-ruby
426
463
  [0.3.9]: https://github.com/anpham6/squared/releases/tag/v0.3.9-ruby
@@ -433,6 +470,7 @@
433
470
  [0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
434
471
  [0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
435
472
  [0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
473
+ [0.2.12]: https://github.com/anpham6/squared/releases/tag/v0.2.12-ruby
436
474
  [0.2.11]: https://github.com/anpham6/squared/releases/tag/v0.2.11-ruby
437
475
  [0.2.10]: https://github.com/anpham6/squared/releases/tag/v0.2.10-ruby
438
476
  [0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
@@ -445,6 +483,7 @@
445
483
  [0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
446
484
  [0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
447
485
  [0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
486
+ [0.1.9]: https://github.com/anpham6/squared/releases/tag/v0.1.9-ruby
448
487
  [0.1.8]: https://github.com/anpham6/squared/releases/tag/v0.1.8-ruby
449
488
  [0.1.7]: https://github.com/anpham6/squared/releases/tag/v0.1.7-ruby
450
489
  [0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
@@ -55,6 +55,7 @@ module Squared
55
55
  hash: %i[green black!],
56
56
  array: %i[blue black!],
57
57
  number: [:magenta],
58
+ boolean: [:magenta],
58
59
  undefined: %i[red italic]
59
60
  },
60
61
  logger: {
@@ -95,13 +96,15 @@ module Squared
95
96
  return [] if obj.nil?
96
97
 
97
98
  unless obj.is_a?(::Array)
98
- obj = if obj.respond_to?(:to_a) && !obj.is_a?(::Hash) && (val = obj.to_a).is_a?(::Array)
99
+ obj = if obj.respond_to?(:to_ary)
100
+ obj.to_ary
101
+ elsif obj.respond_to?(:to_a) && !obj.is_a?(::Hash) && (val = obj.to_a).is_a?(::Array)
99
102
  val
100
103
  else
101
104
  [obj]
102
105
  end
103
106
  end
104
- obj = obj.flatten(flat.is_a?(::Numeric) ? flat : nil) if flat
107
+ obj = flat.is_a?(::Numeric) ? obj.flatten(flat) : obj.flatten if flat
105
108
  obj = obj.compact if compact
106
109
  obj = obj.map(&meth) if meth
107
110
  block_given? ? obj.select(&blk) : obj
@@ -1,23 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'pathname'
4
- require 'fileutils'
4
+ require 'rake'
5
5
 
6
6
  module Squared
7
7
  module Common
8
8
  module System
9
9
  module_function
10
10
 
11
- def shell(*args, **kwargs)
12
- if RUBY_VERSION < '2.6'
13
- exception = kwargs.delete(:exception)
14
- ret = system(*args, **kwargs)
15
- return ret if ret || !exception
16
-
17
- raise $?.to_s
11
+ def shell(*args, name: :system, **kwargs)
12
+ if RUBY_ENGINE == 'jruby' && Rake::Win32.windows?
13
+ e = kwargs[:exception]
14
+ if (dir = kwargs[:chdir]) && ((pwd = Dir.pwd) != dir)
15
+ Dir.chdir(dir)
16
+ ret = Kernel.send(name, *args)
17
+ Dir.chdir(pwd)
18
+ else
19
+ ret = Kernel.send(name, *args)
20
+ end
21
+ elsif RUBY_VERSION < '2.6'
22
+ e = kwargs.delete(:exception)
23
+ ret = Kernel.send(name, *args, **kwargs)
18
24
  else
19
- system(*args, **kwargs)
25
+ return Kernel.send(name, *args, **kwargs)
20
26
  end
27
+ return ret if ret || !e
28
+
29
+ raise $?.to_s
21
30
  end
22
31
 
23
32
  def copy_dir(src, dest, glob = ['**/*'], create: false, link: nil, force: false, pass: nil, verbose: true)
@@ -29,10 +38,9 @@ module Squared
29
38
  dest.mkpath if create
30
39
  if pass
31
40
  exclude = []
32
- pass = [pass] unless pass.is_a?(::Array)
33
- pass.each { |val| exclude += Dir.glob(src.join(val)) }
41
+ Array(pass).each { |val| exclude += Dir.glob(src.join(val)) }
34
42
  end
35
- (glob.is_a?(::Array) ? glob : [glob]).each do |val|
43
+ Array(glob).each do |val|
36
44
  Dir.glob(src.join(val)) do |path|
37
45
  next if exclude&.include?(path) || (path = Pathname.new(path)).directory?
38
46
 
@@ -79,8 +87,7 @@ module Squared
79
87
  def copy_guard(src, dest, link: nil, force: false, verbose: true)
80
88
  unless force
81
89
  if (path = Pathname.new(dest)).directory?
82
- src = [src] unless src.is_a?(::Array)
83
- src = src.reject { |val| path.join(File.basename(val)).exist? }
90
+ src = Array(src).reject { |val| path.join(File.basename(val)).exist? }
84
91
  return if src.empty?
85
92
  elsif path.exist?
86
93
  return
@@ -250,6 +250,8 @@ module Squared
250
250
  { pat: /\A(.+ : ")(.+)("\s*)\z/m, styles: theme[:string], index: 2 },
251
251
  { pat: /\A(.+ : \{)(.+)(\}\s*)\z/m, styles: theme[:hash], index: 2 },
252
252
  { pat: /\A(.+ : \[)(.+)(\]\s*)\z/m, styles: theme[:array], index: 2 },
253
+ { pat: /\A(.+ : )(true|false)(\s*)\z/m, styles: theme[:boolean],
254
+ index: 2 },
253
255
  { pat: /\A(.+ : (?!undefined))([^"\[{].*)\z/m, styles: theme[:value],
254
256
  index: 2 }
255
257
  ]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.3.11'
4
+ VERSION = '0.3.12'
5
5
  end
@@ -296,7 +296,7 @@ module Squared
296
296
  index = 0
297
297
  while @project[name]
298
298
  index += 1
299
- name = "#{project}-#{index}"
299
+ name = task_name "#{project}-#{index}"
300
300
  end
301
301
  proj = ((if !ref.is_a?(Class)
302
302
  Application.find(ref, path: path)
@@ -587,6 +587,14 @@ module Squared
587
587
  Rake::Win32.windows?
588
588
  end
589
589
 
590
+ def jruby?
591
+ RUBY_ENGINE == 'jruby'
592
+ end
593
+
594
+ def jruby_win?
595
+ jruby? && windows?
596
+ end
597
+
590
598
  def rootpath(*args)
591
599
  root.join(*args)
592
600
  end
@@ -676,10 +676,8 @@ module Squared
676
676
 
677
677
  def run(cmd = @session, var = nil, exception: @exception, sync: true, banner: true, chdir: path, from: nil, **)
678
678
  unless cmd
679
- if warning?
680
- from &&= from.to_s
681
- warn log_message(Logger::WARN, from || 'unknown', subject: project, hint: 'no command given')
682
- end
679
+ from &&= from.to_s
680
+ warn log_message(Logger::WARN, from || 'unknown', subject: project, hint: 'no command given')
683
681
  return
684
682
  end
685
683
  cmd = session_done(cmd)
@@ -766,7 +764,7 @@ module Squared
766
764
 
767
765
  t = dedupe.(proj.name)
768
766
  j = if out
769
- if i == items.size - 1 || check.(post = items[i + 1..-1]).empty?
767
+ if i == items.size - 1 || check.(post = items[(i + 1)..-1]).empty?
770
768
  true
771
769
  elsif !t.empty? && depth > 0
772
770
  post.reject { |pr| t.include?(pr) }.empty?
@@ -804,7 +802,7 @@ module Squared
804
802
  k = 0
805
803
  final = data.keys.last
806
804
  while k < depth
807
- indent = k > 0 && ((last && !j) || (j && k == depth - 1) || single)
805
+ indent = k > 0 ? ((last && !j) || (j && k == depth - 1) || single) : j && last && depth == 1
808
806
  s += "#{indent || (last && data[final].last == context) ? ' ' : a} "
809
807
  k += 1
810
808
  end
@@ -992,7 +990,7 @@ module Squared
992
990
  end
993
991
 
994
992
  def print_item(*val)
995
- puts if @@print_order > 0 && verbose && !stdin?
993
+ puts if @@print_order > 0
996
994
  @@print_order += 1
997
995
  puts val unless val.empty? || (val.size == 1 && val.first.nil?)
998
996
  end
@@ -1273,15 +1271,17 @@ module Squared
1273
1271
  end
1274
1272
 
1275
1273
  def indexitem(val)
1276
- return unless val =~ /\A\^(\d+)(:.+)?\z/
1277
-
1278
- [$1.to_i, $2 && $2[1..-1]]
1274
+ [$1.to_i, $2 && $2[1..-1]] if val =~ /\A#{Regexp.escape(indexchar)}(\d+)(:.+)?\z/
1279
1275
  end
1280
1276
 
1281
1277
  def indexerror(val, list = nil)
1282
1278
  raise_error("requested index #{val}", hint: list && "of #{list.size}")
1283
1279
  end
1284
1280
 
1281
+ def indexchar
1282
+ workspace.windows? ? '+' : '^'
1283
+ end
1284
+
1285
1285
  def color(val)
1286
1286
  ret = theme[val]
1287
1287
  ret && !ret.empty? ? ret : [val]
@@ -1315,7 +1315,8 @@ module Squared
1315
1315
  pwd = Pathname.pwd
1316
1316
  if block_given?
1317
1317
  begin
1318
- if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join <= RUBY_VERSION)
1318
+ pass = semscan(pass).join <= RUBY_VERSION if pass.is_a?(String)
1319
+ if (path == pwd || pass == true) && !workspace.jruby_win?
1319
1320
  ret = instance_eval(&blk)
1320
1321
  else
1321
1322
  Dir.chdir(path)
@@ -589,7 +589,7 @@ module Squared
589
589
  source(sync: sync, sub: if verbose
590
590
  [
591
591
  { pat: /^(.+)(\|\s+\d+\s+)([^-]*)(-+)(.*)$/, styles: :red, index: 4 },
592
- { pat: /^(.+)(\|\s+\d+\s+)(\++)(-*)(.*)$/, styles: :green, index: 3 }
592
+ { pat: /^(.+)(\|\s+\d+\s+)(\++)(.*)$/, styles: :green, index: 3 }
593
593
  ]
594
594
  end, **threadargs)
595
595
  end
@@ -914,7 +914,8 @@ module Squared
914
914
  origin = nil
915
915
  source(git_output('fetch --no-tags --quiet'), io: true, banner: false, stdout: true)
916
916
  cmd = git_output("for-each-ref --format=\"#{format}\" refs/heads")
917
- source(cmd, io: true, banner: false).first.each do |line|
917
+ out = source(cmd, io: true, stdout: workspace.windows?, banner: false).first
918
+ (workspace.windows? ? out.lines : out).each do |line|
918
919
  next if (line = line.chomp).empty?
919
920
 
920
921
  branch, origin, hint = line.split('...')
@@ -928,8 +929,8 @@ module Squared
928
929
  break
929
930
  end
930
931
  i = origin.index('/')
931
- branch = "#{branch}:#{origin[i + 1..-1]}" unless origin.end_with?("/#{branch}")
932
- origin = origin[0..i - 1]
932
+ branch = "#{branch}:#{origin[(i + 1)..-1]}" unless origin.end_with?("/#{branch}")
933
+ origin = origin[0..(i - 1)]
933
934
  cmd = git_session('commit', option('dry-run') && '--dry-run', options: false)
934
935
  cmd << '--amend' if amend
935
936
  if message
@@ -1132,9 +1133,14 @@ module Squared
1132
1133
  format_banner((banner.is_a?(String) ? banner : cmd).gsub(File.join(path, ''), ''), banner: true)
1133
1134
  end
1134
1135
  begin
1135
- return [stdout ? `#{cmd}` : IO.popen(cmd), banner, from] if io
1136
-
1137
- if stdin? ? sync : stdout
1136
+ if io
1137
+ ret = if stdout
1138
+ [`#{cmd}`]
1139
+ else
1140
+ [IO.popen(cmd), banner, from]
1141
+ end
1142
+ return ret
1143
+ elsif stdin? ? sync : stdout
1138
1144
  print_item banner unless multiple
1139
1145
  ret = `#{cmd}`
1140
1146
  if !ret.empty?
@@ -1142,7 +1148,7 @@ module Squared
1142
1148
  elsif banner && stdout && !stdin?
1143
1149
  puts 'Success'
1144
1150
  end
1145
- elsif sync || (!exception && !stderr)
1151
+ elsif !sub && (sync || (!exception && !stderr))
1146
1152
  print_item banner unless multiple
1147
1153
  shell(cmd, exception: exception)
1148
1154
  else
@@ -1202,20 +1208,18 @@ module Squared
1202
1208
  end
1203
1209
 
1204
1210
  def list_result(size, type, from: nil, action: 'found', grep: nil)
1205
- if verbose
1206
- if size > 0
1207
- styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
1208
- styles << :bold if styles.size <= 1
1209
- puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
1210
- sub: { pat: /\A(\d+)(.+)\z/, styles: styles })
1211
- else
1212
- puts empty_status("No #{type} were #{action}", 'grep', grep.is_a?(Array) ? case grep.size
1213
- when 0
1214
- nil
1215
- else
1216
- grep.join(', ')
1217
- end : grep.to_s)
1218
- end
1211
+ if size == 0
1212
+ puts empty_status("No #{type} were #{action}", 'grep', grep.is_a?(Array) ? case grep.size
1213
+ when 0
1214
+ nil
1215
+ else
1216
+ grep.join(', ')
1217
+ end : grep.to_s)
1218
+ elsif verbose
1219
+ styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
1220
+ styles << :bold if styles.size <= 1
1221
+ puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
1222
+ sub: { pat: /\A(\d+)(.+)\z/, styles: styles })
1219
1223
  end
1220
1224
  on :last, from
1221
1225
  end
@@ -127,7 +127,7 @@ module Squared
127
127
  end
128
128
  case save
129
129
  when 'prod', 'dev', 'optional', 'peer'
130
- packages = args.to_a.drop(1)
130
+ packages = args.extras
131
131
  else
132
132
  save = 'prod'
133
133
  packages = args.to_a
@@ -138,10 +138,10 @@ module Squared
138
138
  when 'run'
139
139
  next if (list = read_scripts).empty?
140
140
 
141
- format_desc action, nil, 'command+|^index|#,pattern*'
141
+ format_desc action, nil, "command+|#{indexchar}index|#,pattern*"
142
142
  task action, [:command] do |_, args|
143
143
  if args.command == '#'
144
- format_list(list, 'run[^N]', 'scripts', grep: args.extras, from: dependfile.to_s)
144
+ format_list(list, "run[#{indexchar}N]", 'scripts', grep: args.extras, from: dependfile.to_s)
145
145
  else
146
146
  cmd = param_guard(action, 'command', args: args.to_a)
147
147
  cmd.each do |val|
@@ -175,7 +175,7 @@ module Squared
175
175
  outdated flag, args.to_a
176
176
  end
177
177
  when 'package'
178
- format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : 'names*')
178
+ format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : 'name*')
179
179
  task flag do |_, args|
180
180
  package flag, args.to_a
181
181
  end
@@ -536,49 +536,44 @@ module Squared
536
536
  end
537
537
 
538
538
  def update(*)
539
- package 'update'
539
+ package('update', from: :update)
540
540
  end
541
541
 
542
542
  def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, dryrun: nil, **)
543
- if read_packagemanager(:private)
544
- warn log_message(Logger::WARN, 'invalid task "publish"', subject: name, hint: 'private') if warning?
543
+ if !version || read_packagemanager(:private)
544
+ warn log_message(Logger::WARN, 'invalid task "publish"', subject: name, hint: version ? 'private' : nil)
545
545
  return
546
546
  end
547
- return unless version
548
-
549
547
  cmd = session 'npm', 'publish'
550
548
  otp = option('otp') if otp.nil?
551
549
  tag = option('tag') if tag.nil?
552
550
  dryrun = dryrun?('npm') if dryrun.nil?
553
551
  cmd << basic_option('otp', otp) if otp
554
552
  cmd << shell_option('tag', tag) if tag
555
- if verbose
556
- if dryrun
557
- cmd << '--dry-run'
558
- else
559
- log.info cmd.to_s
560
- end
561
- unless sync
562
- on :first, :publish unless dryrun
563
- pwd_set(from: :publish, dryrun: dryrun) do
564
- require 'open3'
565
- banner = format_banner(cmd.to_s)
566
- Open3.popen2e(cmd.done) do |_, out|
567
- write_lines(out, banner: banner, sub: npmnotice + [
568
- { pat: /^(.+)(Tarball .+)$/, styles: :blue, index: 2 }
569
- ])
570
- end
553
+ if dryrun
554
+ cmd << '--dry-run'
555
+ else
556
+ from = :publish
557
+ log.info cmd.to_s
558
+ end
559
+ if sync
560
+ run(from: from, sync: sync)
561
+ else
562
+ on :first, from
563
+ pwd_set(from: from, dryrun: dryrun) do
564
+ require 'open3'
565
+ banner = format_banner(cmd.to_s)
566
+ Open3.popen2e(cmd.done) do |_, out|
567
+ write_lines(out, banner: banner, sub: npmnotice + [
568
+ { pat: /^(.+)(Tarball .+)$/, styles: :blue, index: 2 }
569
+ ])
571
570
  end
572
- on :last, :publish unless dryrun
573
- return
574
571
  end
575
- elsif dryrun
576
- return
572
+ on :last, from
577
573
  end
578
- run(from: :publish, sync: sync)
579
574
  end
580
575
 
581
- def package(flag, opts = [])
576
+ def package(flag, opts = [], from: nil)
582
577
  if (yarn = dependtype(:yarn)) > 0
583
578
  cmd = session 'yarn', if flag == :update
584
579
  flag = yarn == 1 ? 'upgrade' : 'up'
@@ -619,6 +614,7 @@ module Squared
619
614
  out << opt
620
615
  end
621
616
  end
617
+ cmd << '--save=true' if option('save')
622
618
  append_nocolor
623
619
  append_loglevel
624
620
  if flag == :dedupe
@@ -628,7 +624,7 @@ module Squared
628
624
  end
629
625
  option_clear err
630
626
  end
631
- run(from: :"package:#{flag}")
627
+ run(from: from || :"package:#{flag}")
632
628
  end
633
629
 
634
630
  def bump(flag, val = nil)
@@ -836,9 +832,11 @@ module Squared
836
832
  @pm[:_] = false
837
833
  nil
838
834
  else
839
- return @pm[key] if key
840
-
841
- !(ret = @pm[:_]) || (version && ret[ret.index('@') + 1..-1] < version) ? nil : ret
835
+ if key
836
+ @pm[key]
837
+ elsif (ret = @pm[:_]) && !(version && ret[(ret.index('@') + 1)..-1] < version)
838
+ ret
839
+ end
842
840
  end
843
841
 
844
842
  def read_install
@@ -121,11 +121,11 @@ module Squared
121
121
  when 'rake'
122
122
  next unless rakefile
123
123
 
124
- format_desc action, nil, 'command*|^index,args*|#,pattern*'
124
+ format_desc action, nil, "command*|#{indexchar}index,args*|#,pattern*"
125
125
  task action, [:command] do |_, args|
126
126
  if args.command == '#'
127
- format_list(read_rakefile, 'rake[^N]', 'tasks', grep: args.extras, from: rakefile.to_s,
128
- each: ->(val) { val[0] + val[1].to_s })
127
+ format_list(read_rakefile, "rake[#{indexchar}N]", 'tasks', grep: args.extras, from: rakefile.to_s,
128
+ each: ->(val) { val[0] + val[1].to_s })
129
129
  elsif (data = indexitem(args.command))
130
130
  n, opts = data
131
131
  list = read_rakefile
@@ -155,7 +155,10 @@ module Squared
155
155
  when 'gem'
156
156
  case flag
157
157
  when :outdated, :build, :push, :exec
158
- format_desc(action, flag, 'opts*', before: flag == :exec ? 'command+' : nil)
158
+ format_desc(action, flag, 'opts*', before: case flag
159
+ when :exec then 'command+'
160
+ when :push then 'file'
161
+ end)
159
162
  task flag do |_, args|
160
163
  gemx flag, args.to_a
161
164
  end
@@ -358,7 +361,8 @@ module Squared
358
361
  end
359
362
  cmd << flag
360
363
  when :push
361
- cmd << flag << project
364
+ raise_error('gem not found', hint: flag) if opts.empty? || !(file = path + opts.shift).exist?
365
+ cmd << flag << shell_quote(file)
362
366
  when :'user-install'
363
367
  cmd << 'install' << '--user-install'
364
368
  else
@@ -379,7 +383,7 @@ module Squared
379
383
  if opt =~ pat
380
384
  case $1
381
385
  when 'g', 'gem'
382
- cmd << (flag == :exec ? shell_option($1, $2) : quote_option($1, basepath($2)))
386
+ cmd << (flag == :exec ? basic_option($1, $2) : quote_option($1, basepath($2)))
383
387
  end
384
388
  else
385
389
  out << opt
@@ -476,7 +480,8 @@ module Squared
476
480
  end
477
481
  when :exec
478
482
  raise_error('gem', flag, hint: 'no command given') if out.empty?
479
- cmd << project << out.join(' ')
483
+ cmd << basic_option('gem', project) unless session_arg?('g', 'gem')
484
+ cmd << '--' << out.join(' ')
480
485
  else
481
486
  if out.empty? && cmd.none? { |val| val =~ /^--system(?:=|$)/ }
482
487
  raise_error('gem', flag, hint: 'no gemname given')
@@ -492,7 +497,7 @@ module Squared
492
497
  version = name[1..-1]
493
498
  else
494
499
  cmd << shell_escape(name[0, n])
495
- version = name[n + 1..-1]
500
+ version = name[(n + 1)..-1]
496
501
  end
497
502
  cmd << shell_option('version', version)
498
503
  out.clear
@@ -175,7 +175,7 @@ module Squared
175
175
  parse_opts.(args)
176
176
  stage = 'init'
177
177
  puts if newline
178
- system("repo init -u #{manifest_url} -m #{args.manifest || target}.xml", chdir: root)
178
+ Common::System.shell("repo init -u #{manifest_url} -m #{args.manifest || target}.xml", chdir: root)
179
179
  repo['all'].invoke
180
180
  end
181
181
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.11
4
+ version: 0.3.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-05-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rake
@@ -107,7 +106,6 @@ metadata:
107
106
  homepage_uri: https://github.com/anpham6/squared
108
107
  source_code_uri: https://github.com/anpham6/squared
109
108
  documentation_uri: https://squared.readthedocs.io
110
- post_install_message:
111
109
  rdoc_options: []
112
110
  require_paths:
113
111
  - lib
@@ -122,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
120
  - !ruby/object:Gem::Version
123
121
  version: '0'
124
122
  requirements: []
125
- rubygems_version: 3.1.6
126
- signing_key:
123
+ rubygems_version: 3.6.7
127
124
  specification_version: 4
128
125
  summary: Rake task generator for managing multi-language workspaces.
129
126
  test_files: []