squared 0.3.2 → 0.3.4

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: f312781b98b855b5dc0ae4a57dc39ecceda128c36a899cb80d4bcb02fddba16d
4
- data.tar.gz: '0152856705e845789742fe9c99b6d60aa732641271af511493b7c889049176ae'
3
+ metadata.gz: d145fb04de12033e30ded57091da96f9420dd32729fc59d2c362e8b99b9161d2
4
+ data.tar.gz: 3bcbe852a45c17e9b4d543b9e2b99cbe255feca020cdc3339cb4fb5bb1b985d4
5
5
  SHA512:
6
- metadata.gz: 704fcf52f4f8c74b074e38ad206d25d8d7b57cc9ea3d7d725e92115a4ab969b0a982b5c4ad4e3ce1ddc0d58ceeed2a32f0d7ceeab0d2b47966c40e22a6d9fe65
7
- data.tar.gz: 241500ace7319da50eab69c5fd55068f9ee2e05ac81961832b7593d1a5e787ca942ea7901dc745259d00e814e2c58a45c3d4577a17918ce3ede2637a4fc7720e
6
+ metadata.gz: a50b05c95dbf4c14bfb5056c7978fff1d41129d2425dc9fd6248a5086d3e068ff3692d02dda8a5f07c7c4e5280d0feddfcb995867f9c22fd22e8e666e4e71771
7
+ data.tar.gz: 8ce8ab2b30a2ce191cbbd2f411bab4a70bcd5a8d2d851e2cb1272af7cc34f7ecbf964505fc4b873cc556ba9c2c399c8b90dda62569c6b3f34a01b51ccc44a72b
data/CHANGELOG.md CHANGED
@@ -1,18 +1,35 @@
1
1
  # Changelog
2
2
 
3
- ## [0.3.2] - 2024-02-25
3
+ ## [0.3.4] - 2025-03-06
4
+
5
+ ### Fixed
6
+
7
+ - Ruby bundle sub-commands used undefined method.
8
+ - Project graph did not display main tree branch.
9
+
10
+ ## [0.3.3] - 2025-03-02
11
+
12
+ ### Fixed
13
+
14
+ - Project exceptions were hard coded preventing override.
15
+ - Project clean events were called twice.
16
+ - Git events were fired for internal background tasks.
17
+ - Git list display did not support single grep pattern.
18
+ - Gem outdated did not pass -C option for PWD.
19
+
20
+ ## [0.3.2] - 2025-02-25
4
21
 
5
22
  ### Fixed
6
23
 
7
24
  - Task program command options used unrecognized symbol.
8
25
 
9
- ## [0.2.5] - 2024-02-25
26
+ ## [0.2.5] - 2025-02-25
10
27
 
11
28
  ### Fixed
12
29
 
13
30
  - See `0.1.5`.
14
31
 
15
- ## [0.1.5] - 2024-02-25
32
+ ## [0.1.5] - 2025-02-25
16
33
 
17
34
  ### Fixed
18
35
 
@@ -97,7 +114,7 @@
97
114
 
98
115
  - Project hash options duplicated dash prefix.
99
116
 
100
- ## [0.1.4] - 2024-02-05
117
+ ## [0.1.4] - 2025-02-05
101
118
 
102
119
  ### Fixed
103
120
 
@@ -194,7 +211,7 @@
194
211
  - Node tasks without any action are not displayed.
195
212
  - Git fetch commands that do not apply to pull are rejected.
196
213
 
197
- ## [0.1.3] - 2024-01-02
214
+ ## [0.1.3] - 2025-01-02
198
215
 
199
216
  ### Fixed
200
217
 
@@ -223,7 +240,7 @@
223
240
  - Workspace did not check base project for Windows filename.
224
241
  - Regexp for SemVer did not recognize package names.
225
242
 
226
- ## [0.1.1] - 2025-12-14
243
+ ## [0.1.1] - 2024-12-14
227
244
 
228
245
  ### Added
229
246
 
@@ -273,6 +290,8 @@
273
290
 
274
291
  - Changelog was created.
275
292
 
293
+ [0.3.4]: https://github.com/anpham6/squared/releases/tag/v0.3.4-ruby
294
+ [0.3.3]: https://github.com/anpham6/squared/releases/tag/v0.3.3-ruby
276
295
  [0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
277
296
  [0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
278
297
  [0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.4'
5
5
  end
@@ -59,7 +59,7 @@ module Squared
59
59
  attr_reader :name, :project, :workspace, :path, :theme, :exception, :pipe, :verbose,
60
60
  :group, :parent, :dependfile
61
61
 
62
- def initialize(workspace, path, name, *, group: nil, graph: nil, pass: nil, exclude: nil,
62
+ def initialize(workspace, path, name, *, group: nil, graph: nil, pass: nil, exclude: nil, verbose: nil,
63
63
  first: {}, last: {}, error: {}, common: ARG[:COMMON], **kwargs)
64
64
  @path = path
65
65
  @workspace = workspace
@@ -74,14 +74,16 @@ module Squared
74
74
  @clean = kwargs[:clean]
75
75
  @version = kwargs[:version]
76
76
  @envname = @name.gsub(/[^\w]+/, '_').upcase.freeze
77
- kwargs[:exception] = 'PIPE_FAIL'
78
- @exception = if kwargs.key?(:exception)
79
- env_bool(kwargs[:exception], workspace.exception, strict: true)
80
- else
81
- workspace.exception
82
- end
83
- @pipe = kwargs.key?(:pipe) ? env_pipe(kwargs[:pipe], workspace.pipe, strict: true) : workspace.pipe
84
- @verbose = kwargs.key?(:verbose) ? kwargs[:verbose] : workspace.verbose
77
+ @exception = env_bool(kwargs[:exception], workspace.exception, strict: true)
78
+ @pipe = env_pipe(kwargs[:pipe], workspace.pipe, strict: true)
79
+ @verbose = case verbose
80
+ when nil
81
+ workspace.verbose
82
+ when String
83
+ env_pipe(verbose, workspace.verbose, strict: true, index: true)
84
+ else
85
+ verbose
86
+ end
85
87
  @theme = if !@verbose
86
88
  {}
87
89
  elsif common
@@ -430,7 +432,7 @@ module Squared
430
432
  on :first, :clean
431
433
  case @clean
432
434
  when String
433
- run_s(@clean, from: :clean, sync: sync)
435
+ run_s(@clean, sync: sync)
434
436
  when Hash
435
437
  begin
436
438
  @clean.each { |cmd, opts| build(cmd.to_s, opts, sync: sync) }
@@ -716,8 +718,8 @@ module Squared
716
718
  end
717
719
  end
718
720
 
719
- def graph_branch(target, data, tasks = nil, out = nil, sync: true, pass: [], done: [], depth: 0, last: false,
720
- single: false)
721
+ def graph_branch(target, data, tasks = nil, out = nil, sync: true, pass: [], done: [], depth: 0,
722
+ single: false, last: false, context: nil)
721
723
  tag = ->(proj) { "#{proj.name}#{SEM_VER =~ proj.version ? "@#{proj.version}" : ''}" }
722
724
  check = ->(deps) { deps.reject { |val| done.include?(val) } }
723
725
  dedupe = lambda do |name|
@@ -766,7 +768,7 @@ module Squared
766
768
  end
767
769
  unless start == proj.name || (none = check.(t).empty?)
768
770
  graph_branch(proj, data, tasks, out, sync: sync, pass: pass, done: done, depth: depth.succ,
769
- single: single, last: j == true)
771
+ single: single, last: j == true, context: target)
770
772
  end
771
773
  if !out
772
774
  if !tasks && (script = workspace.script_get(:graph, group: proj.group, ref: proj.allref))
@@ -788,8 +790,10 @@ module Squared
788
790
  else
789
791
  s = ''.dup
790
792
  k = 0
793
+ final = data.keys.last
791
794
  while k < depth
792
- s += "#{(last && !j) || (j && k > 0 && k == depth - 1) || single ? ' ' : a} "
795
+ indent = k > 0 && ((last && !j) || (j && k == depth - 1) || single)
796
+ s += "#{indent || (last && data[final].last == context) ? ' ' : a} "
793
797
  k += 1
794
798
  end
795
799
  s + "#{j ? d : c}#{b * 3} #{tag.(proj)}"
@@ -976,7 +980,7 @@ module Squared
976
980
  puts val unless val.empty? || (val.size == 1 && val.first.nil?)
977
981
  end
978
982
 
979
- def print_banner(*lines, styles: theme[:banner], border: theme[:border], client: false)
983
+ def print_banner(*lines, styles: theme[:banner], border: borderstyle, client: false)
980
984
  pad = 0
981
985
  if styles
982
986
  if styles.any? { |s| s.to_s.end_with?('!') }
@@ -1002,7 +1006,6 @@ module Squared
1002
1006
  end
1003
1007
 
1004
1008
  def print_footer(*lines, sub: nil, reverse: false, right: false, **kwargs)
1005
- border = kwargs.key?(:border) ? kwargs[:border] : borderstyle
1006
1009
  n = Project.max_width(lines)
1007
1010
  sub = as_a(sub)
1008
1011
  lines.map! do |val|
@@ -1010,7 +1013,7 @@ module Squared
1010
1013
  sub.each { |h| s = sub_style(s, **h) }
1011
1014
  s
1012
1015
  end
1013
- ret = [sub_style('-' * n, styles: border || theme[:border]), *lines]
1016
+ ret = [sub_style('-' * n, styles: kwargs.key?(:border) ? kwargs[:border] : borderstyle), *lines]
1014
1017
  ret.reverse! if reverse
1015
1018
  ret.join("\n")
1016
1019
  end
@@ -1443,9 +1446,7 @@ module Squared
1443
1446
  end
1444
1447
 
1445
1448
  def borderstyle
1446
- return unless (data = workspace.banner_get(*@ref, group: group))
1447
-
1448
- data[:border]
1449
+ ((data = workspace.banner_get(*@ref, group: group)) && data[:border]) || theme[:border]
1449
1450
  end
1450
1451
 
1451
1452
  def headerstyle
@@ -1115,7 +1115,9 @@ module Squared
1115
1115
  multiple: false, sub: nil)
1116
1116
  banner = nil if multiple && banner
1117
1117
  if cmd.respond_to?(:done)
1118
- if !(io && banner == false) && (from = cmd.drop(1).find { |val| val =~ /^[a-z][a-z\-]{2,}$/ })
1118
+ if io && banner == false
1119
+ from = nil
1120
+ elsif !from && (from = cmd.drop(1).find { |val| val =~ /^[a-z][a-z\-]{2,}$/ })
1119
1121
  from = :"git:#{from}"
1120
1122
  end
1121
1123
  banner &&= cmd.temp { |val| val.start_with?('--work-tree') || val.start_with?('--git-dir') }
@@ -1168,13 +1170,12 @@ module Squared
1168
1170
  end
1169
1171
 
1170
1172
  def write_lines(data, banner: nil, loglevel: nil, grep: nil, sub: nil, pass: false)
1171
- grep = if grep && !grep.empty?
1172
- as_a(grep).map do |val|
1173
- next val if val.is_a?(Regexp)
1173
+ grep = as_a(grep).map do |val|
1174
+ next val if val.is_a?(Regexp)
1174
1175
 
1175
- Regexp.new(val == '*' ? '.+' : val.to_s)
1176
- end
1177
- end
1176
+ Regexp.new(val == '*' ? '.+' : val.to_s)
1177
+ end
1178
+ grep = nil if grep.empty?
1178
1179
  sub = nil if stdin?
1179
1180
  ret = 0
1180
1181
  out = []
@@ -1202,7 +1203,7 @@ module Squared
1202
1203
  if size > 0
1203
1204
  styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
1204
1205
  styles << :bold if styles.size <= 1
1205
- puts print_footer("#{size} #{size == 1 ? type.sub(/s\z/, '') : type}",
1206
+ puts print_footer("#{size} #{size == 1 ? type.sub(/e?s\z/, '') : type}",
1206
1207
  sub: { pat: /\A(\d+)(.+)\z/, styles: styles })
1207
1208
  else
1208
1209
  puts empty_status("No #{type} were #{action}", 'grep', grep.is_a?(Array) ? case grep.size
@@ -350,7 +350,9 @@ module Squared
350
350
  cmd = gem_session
351
351
  case flag
352
352
  when :outdated
353
- cmd << pwd if (pwd = gempwd)
353
+ if (pwd = gempwd)
354
+ cmd << pwd
355
+ end
354
356
  cmd << flag
355
357
  when :push
356
358
  cmd << flag << project
@@ -503,7 +505,7 @@ module Squared
503
505
  args = option_sanitize(args, OPT_BUNDLE[flag.to_sym] + OPT_BUNDLE[:common]).first
504
506
  end
505
507
  raise_error('bundle', flag, hint: 'no command given') unless !args.empty? || flag == 'check'
506
- cmd.merge!(args)
508
+ cmd.merge(args)
507
509
  run(from: :"bundle:#{flag}")
508
510
  end
509
511
 
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.3.2
4
+ version: 0.3.4
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-03-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake