squared 0.2.9 → 0.2.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: da84184d479e255a0a9916bfa33d081259b3965fb61ab40f32f7417fad7751b5
4
- data.tar.gz: 9dceba3df95cf08e724c13f0ab63c7ba607f7253e2cefe5f5ebab78858c58c78
3
+ metadata.gz: a71c2dd60f8ae407c47d764959de398fe63e62b62069a858ffa10ef75ca861b4
4
+ data.tar.gz: afb4976839a8bdb581086c82190fc30a369f2e025561fa95a4e8e1f573094d91
5
5
  SHA512:
6
- metadata.gz: bed08c89a0f41d484b8d18d951abbd1386b1138365ab0f9add293ec81865303c3e6861ec6cb8a6326e3e91c1b2692fad6ceb64b11410c5f4df8015f3da1226d7
7
- data.tar.gz: fc545d2ecb6a324d3a1d4869d73223d5122b15517268e248d5cbda19be39e4ddcfb5fb07627d090c9010334e7747f7121c8e6b8dbce7c2ca08f44131263a6681
6
+ metadata.gz: 07ea068884c72590aeb5317b64f1a754e8aa74d7f99692dcdb0990c0a21196c45e45b636c291506f591c5aac11f4f0ddc0d6cf7c8e521c8db1abdf1e5c286350
7
+ data.tar.gz: e289d5c37484e6bfe7045629f0be5cb5a1effeaaf70cd74b943353912a7754c4e87560cd607abfd6fb8dc6cf7149f3d01c68e9704162d1f58d46867ac91a4515
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.11] - 2025-05-15
4
+
5
+ ### Fixed
6
+
7
+ - Disabled batch and alias tasks were not hidden.
8
+ - Workspace git did not parse multiple download URIs.
9
+
10
+ ## [0.1.8] - 2025-05-15
11
+
12
+ ### Fixed
13
+
14
+ - Disabled batch and alias tasks were not hidden.
15
+ - Log messages were written to terminal twice when emphasized.
16
+ - Node outdated interactive for major would sometimes deactivate.
17
+ - Node outdated interactive for major was mislabeled as minor.
18
+
19
+ ## [0.2.10] - 2025-04-27
20
+
21
+ ### Fixed
22
+
23
+ - Project run and script tasks did not fire first and last callbacks.
24
+ - Git command clone did not read booleans for recurse-submodules.
25
+
26
+ ## [0.1.7] - 2025-04-27
27
+
28
+ ### Fixed
29
+
30
+ - Project directory context method option pass was inverted.
31
+ - Shell options with spaces and without quotes were not escaped.
32
+ - Git task status did not display branch information.
33
+ - Ruby copy method argument include was ignored when used directly.
34
+ - Git commit could not push branch without same name as remote.
35
+
3
36
  ## [0.2.9] - 2025-04-17
4
37
 
5
38
  ### Changed
@@ -173,7 +206,7 @@
173
206
  - Node tasks without any action are not displayed.
174
207
  - Git fetch commands that do not apply to pull are rejected.
175
208
 
176
- ## [0.1.3] - 2024-01-02
209
+ ## [0.1.3] - 2025-01-02
177
210
 
178
211
  ### Fixed
179
212
 
@@ -252,6 +285,8 @@
252
285
 
253
286
  - Changelog was created.
254
287
 
288
+ [0.2.11]: https://github.com/anpham6/squared/releases/tag/v0.2.11-ruby
289
+ [0.2.10]: https://github.com/anpham6/squared/releases/tag/v0.2.10-ruby
255
290
  [0.2.9]: https://github.com/anpham6/squared/releases/tag/v0.2.9-ruby
256
291
  [0.2.8]: https://github.com/anpham6/squared/releases/tag/v0.2.8-ruby
257
292
  [0.2.7]: https://github.com/anpham6/squared/releases/tag/v0.2.7-ruby
@@ -262,6 +297,8 @@
262
297
  [0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
263
298
  [0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
264
299
  [0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
300
+ [0.1.8]: https://github.com/anpham6/squared/releases/tag/v0.1.8-ruby
301
+ [0.1.7]: https://github.com/anpham6/squared/releases/tag/v0.1.7-ruby
265
302
  [0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
266
303
  [0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
267
304
  [0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
@@ -53,7 +53,7 @@ module Squared
53
53
  end
54
54
  wrap = ->(s, n) { "\x1B[#{n.join(';')}m#{s}\x1B[0m" }
55
55
  code = []
56
- args.concat(as_a(styles)).each_with_index do |type, i|
56
+ args.concat(as_a(styles)).flatten.each_with_index do |type, i|
57
57
  next unless type
58
58
 
59
59
  if index == -1
@@ -171,7 +171,7 @@ module Squared
171
171
  if args.size > 1
172
172
  title = log_title(level, color: false)
173
173
  sub = { pat: /^(#{title})(.+)$/, styles: __get__(:theme)[:logger][log_sym(level)] } if color
174
- emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub)
174
+ emphasize(args, title: title + (subject ? " #{subject}" : ''), sub: sub, pipe: -1)
175
175
  else
176
176
  msg = [log_title(level, color: color)]
177
177
  msg << (color ? sub_style(subject, :underline) : subject) if subject
@@ -257,6 +257,8 @@ module Squared
257
257
  yield out
258
258
  elsif pipe
259
259
  case pipe
260
+ when -1
261
+ return out
260
262
  when 0
261
263
  pipe = $stdin
262
264
  when 2
@@ -21,7 +21,7 @@ module Squared
21
21
  return false
22
22
  end
23
23
  attempts -= 1
24
- exit 1 unless attempts >= 0
24
+ exit 1 unless attempts > 0
25
25
  end
26
26
  rescue Interrupt
27
27
  puts
@@ -10,7 +10,7 @@ module Squared
10
10
 
11
11
  def shell_escape(val, quote: false, force: false)
12
12
  if (data = /\A(--?[^= ]+)((=|\s+)(["'])?(.+?)(["'])?)?\z/m.match(val = val.to_s))
13
- return val if !data[2] || (!data[4] && data[5] =~ /\s/)
13
+ return val if !data[2] || (!data[4] && !data[5].match?(/\s/))
14
14
 
15
15
  join = ->(opt) { data[1] + data[3] + shell_quote(opt) }
16
16
  if data[4] == data[6]
@@ -21,7 +21,7 @@ module Squared
21
21
  elsif Rake::Win32.windows?
22
22
  quote ? shell_quote(val, force: force) : val
23
23
  else
24
- Shellwords.escape(val)
24
+ val.empty? ? '' : Shellwords.escape(val)
25
25
  end
26
26
  end
27
27
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.2.9'
4
+ VERSION = '0.2.11'
5
5
  end
@@ -427,7 +427,7 @@ module Squared
427
427
  tasks << key if obj.has?(key, baseref)
428
428
  elsif (batch = series.batch_get(key))
429
429
  obj.allref.each do |ref|
430
- next unless (data = batch[ref])
430
+ next unless obj.has?(key, ref) && (data = batch[ref])
431
431
 
432
432
  data.each do |val|
433
433
  if (items = task_resolve(obj, val)).empty?
@@ -446,7 +446,7 @@ module Squared
446
446
  return [] if (base && !obj.ref?(baseref)) || !(data = series.alias_get(key))
447
447
 
448
448
  obj.allref.each do |ref|
449
- next unless (alt = data[ref])
449
+ next unless obj.has?(key, ref) && (alt = data[ref])
450
450
 
451
451
  ret = task_resolve(obj, alt)
452
452
  break unless ret.empty?
@@ -352,10 +352,10 @@ module Squared
352
352
  self
353
353
  end
354
354
 
355
- def build(*args, from: :build, sync: invoked_sync?('build'), **)
355
+ def build(*args, from: :run, sync: invoked_sync?('build'), **)
356
356
  banner = verbose
357
357
  if args.empty?
358
- return unless from == :build
358
+ return unless from == :run
359
359
 
360
360
  cmd, opts, var, flags = @output
361
361
  banner = verbose == 1 if task_invoked?('build', 'build:sync')
@@ -376,6 +376,7 @@ module Squared
376
376
  return unless respond_to?(:compose)
377
377
 
378
378
  cmd = compose(opts, flags, from: from, script: true)
379
+ from = :script if from == :run && script?
379
380
  end
380
381
  run(cmd, var, from: from, banner: banner, sync: sync)
381
382
  end
@@ -1118,7 +1119,7 @@ module Squared
1118
1119
  pwd = Pathname.pwd
1119
1120
  if block_given?
1120
1121
  begin
1121
- if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join >= RUBY_VERSION)
1122
+ if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join <= RUBY_VERSION)
1122
1123
  ret = instance_eval(&blk)
1123
1124
  else
1124
1125
  Dir.chdir(path)
@@ -12,7 +12,11 @@ module Squared
12
12
  check = ->(proj) { proj.is_a?(Project::Git) && !proj.exclude?(Project::Git.ref) && git_clone?(proj.path) }
13
13
  if uri.is_a?(Array)
14
14
  base = name
15
- uri.each { |val| repo << proj if (proj = @project[val.to_s]) && check.(proj) }
15
+ uri.each do |val|
16
+ if (proj = @project[val.to_s]) && check.(proj)
17
+ repo << proj
18
+ end
19
+ end
16
20
  elsif uri
17
21
  data[name.to_s] = uri
18
22
  elsif name.is_a?(Enumerable)
@@ -543,6 +547,7 @@ module Squared
543
547
  def status(*, sync: invoked_sync?('status'), **)
544
548
  cmd = git_session 'status'
545
549
  cmd << (option('long') ? '--long' : '--short')
550
+ cmd << '--branch' if option('branch')
546
551
  if (val = option('ignore-submodules', ignore: false))
547
552
  cmd << basic_option('ignore-submodules', case val
548
553
  when '0', 'none'
@@ -722,53 +727,39 @@ module Squared
722
727
  raise_error('commit', 'pathspec', hint: 'missing') if (files = projectmap(files)).empty?
723
728
  "-- #{files.join(' ')}"
724
729
  end
725
- origin = nil
730
+ format = '%(if)%(HEAD)%(then)%(refname:short)...%(upstream:short)...%(upstream:track)%(end)'
726
731
  branch = nil
727
- upstream = nil
728
- source(git_output('fetch --no-tags --quiet'), io: true, banner: false)
729
- source(git_output('branch -vv --list'), io: true, banner: false).first.each do |val|
730
- next unless (data = /^\*\s(\S+)\s+(\h+)(?:\s\[(.+?)(?=\]\s)\])?\s/.match(val))
731
-
732
- branch = data[1]
733
- sha = data[2]
734
- if !data[3]
735
- unless (origin = option('repository', prefix: 'git', ignore: false))
736
- out = source(git_output('log -n1 --format=%h%d'), io: true, stdout: true, banner: false).first
737
- if (data = /^#{sha} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/.match(out))
738
- split_escape(data[1]).each do |s|
739
- next unless s.end_with?("/#{branch}")
740
-
741
- origin = s[0..s.size - branch.size - 2]
742
- break
743
- end
744
- end
745
- end
746
- upstream = true if origin
747
- elsif (data = Regexp.new("^(.+)/#{Regexp.escape(branch)}$").match(data[3]))
748
- origin = data[1]
732
+ origin = nil
733
+ source(git_output('fetch --no-tags --quiet'), io: true, banner: false, stdout: true)
734
+ cmd = git_output("for-each-ref --format=\"#{format}\" refs/heads")
735
+ source(cmd, io: true, banner: false).first.each do |line|
736
+ next if (line = line.chomp).empty?
737
+
738
+ branch, origin, hint = line.split('...')
739
+ if hint && !hint.match?(/^\[(\D+0,\D+0)\]$/)
740
+ raise_error('work tree is not usable', hint: hint[1..-2])
741
+ elsif origin.empty?
742
+ return nil if pass
743
+
744
+ raise_error('no remote upstream', hint: branch)
749
745
  end
750
746
  break
751
747
  end
752
- raise_error('commit', 'work tree is not usable') unless origin && branch
748
+ i = origin.index('/')
749
+ branch = "#{branch}:#{origin[i + 1..-1]}" unless origin.end_with?("/#{branch}")
750
+ origin = origin[0..i - 1]
753
751
  cmd = git_session('commit', option('dry-run') && '--dry-run', options: false)
754
- if amend
755
- cmd << '--amend'
756
- else
757
- cmd.delete('--amend')
758
- end
752
+ cmd << '--amend' if amend
759
753
  if message
760
754
  append_message message
761
755
  elsif flag == :'amend-orig' || option('no-edit')
762
756
  cmd << '--no-edit'
763
757
  end
764
758
  a = git_output 'add', '--verbose'
765
- b = git_output 'push', upstream && '--set-upstream'
766
- if dryrun?
767
- a << '--dry-run'
768
- b << '--dry-run'
769
- end
759
+ b = git_output 'push'
760
+ b << '--dry-run' if dryrun?
770
761
  a << pathspec
771
- b << '--force' if amend
762
+ b << '--force-with-lease' if amend
772
763
  b << origin << branch
773
764
  puts if pass
774
765
  source a
@@ -1097,16 +1088,22 @@ module Squared
1097
1088
  return unless (val = option('recurse-submodules', target: target, ignore: false))
1098
1089
 
1099
1090
  if from == :clone
1100
- projectmap(split_escape(val)).each do |path|
1101
- target << basic_option('recurse-submodules', path)
1091
+ case val
1092
+ when '0', 'false'
1093
+ target << '--no-recurse-submodules'
1094
+ when '1', 'true'
1095
+ target << '--recurse-submodules'
1096
+ else
1097
+ projectmap(split_escape(val)).each do |path|
1098
+ target << basic_option('recurse-submodules', path)
1099
+ end
1102
1100
  end
1103
- target
1104
1101
  else
1105
1102
  target << case val
1106
1103
  when 'no', '0'
1107
1104
  '--no-recurse-submodules'
1108
1105
  when 'yes', 'on-demand'
1109
- "--recurse-submodules#{from == :reset ? '' : "=#{val}"}"
1106
+ "--recurse-submodules=#{val}"
1110
1107
  else
1111
1108
  '--recurse-submodules'
1112
1109
  end
@@ -403,7 +403,7 @@ module Squared
403
403
  index = if a != c
404
404
  1
405
405
  elsif b != d
406
- 3
406
+ a == '0' ? 1 : 3
407
407
  else
408
408
  5
409
409
  end
@@ -437,7 +437,8 @@ module Squared
437
437
  col2 = size_col.(found, 1) + 4
438
438
  found.each_with_index do |item, i|
439
439
  a, b, c, d, e = item
440
- if inter && (rev != :major || e || semmajor?(item[5], item[6])) && !confirm_outdated(a, c, d, e)
440
+ f = inter && (rev != :major || e || semmajor?(item[5], item[6]))
441
+ if f && !confirm_outdated(a, c, d, e)
441
442
  cur = -1
442
443
  else
443
444
  cur = modified
@@ -577,8 +578,8 @@ module Squared
577
578
  run
578
579
  end
579
580
 
580
- def compose(opts, flags = nil, script: false, from: :build)
581
- return unless opts && script && from == :build
581
+ def compose(opts, flags = nil, script: false, from: nil)
582
+ return unless opts && script
582
583
 
583
584
  ret = session dependbin, 'run', flags
584
585
  append_loglevel
@@ -588,7 +589,7 @@ module Squared
588
589
  when String
589
590
  ret << opts
590
591
  else
591
- raise_error("#{dependbin} script name", hint: opts.nil? ? 'missing' : 'invalid')
592
+ raise_error("#{dependbin} script name: given #{opts}", hint: from)
592
593
  end
593
594
  ret
594
595
  end
@@ -605,6 +606,10 @@ module Squared
605
606
  dependfile.exist?
606
607
  end
607
608
 
609
+ def refresh?
610
+ !Node.prod?
611
+ end
612
+
608
613
  def yarn?
609
614
  (@pm[:yarn] ||= if basepath('yarn.lock', ascend: dependext).exist?
610
615
  if (rc = basepath('.yarnrc.yml', ascend: dependext)).exist?
@@ -192,13 +192,15 @@ module Squared
192
192
  end
193
193
  end
194
194
 
195
- def copy(from: 'lib', include: nil, exclude: nil, into: @gemdir, override: false)
195
+ def copy(from: 'lib', into: @gemdir, override: false, **kwargs)
196
+ glob = kwargs[:include]
197
+ pass = kwargs[:exclude]
196
198
  if @copy && !override
197
199
  return super if runnable?(@copy)
198
200
 
199
201
  from = @copy[:from] if @copy.key?(:from)
200
202
  glob = @copy[:include] if @copy.key?(:include)
201
- exclude = @copy[:exclude] if @copy.key?(:exclude)
203
+ pass = @copy[:exclude] if @copy.key?(:exclude)
202
204
  into = @copy[:into] if @copy.key?(:into)
203
205
  end
204
206
  return unless into
@@ -210,10 +212,10 @@ module Squared
210
212
  as_a(from).each_with_index do |val, i|
211
213
  a = basepath(val)
212
214
  b = dest.join(val)
213
- c = glob[i] || glob[0]
215
+ c = glob[i] || glob.first
214
216
  log.info "cp #{a.join(c)} #{b}"
215
217
  begin
216
- copy_dir(a, b, c, pass: exclude, verbose: verbose)
218
+ copy_dir(a, b, c, pass: pass, verbose: verbose)
217
219
  rescue StandardError => e
218
220
  log.error e
219
221
  ret = on(:error, :copy, e)
@@ -3,8 +3,6 @@
3
3
  module Squared
4
4
  module Workspace
5
5
  module Repo
6
- include Common::Format
7
-
8
6
  class << self
9
7
  def read_manifest(path)
10
8
  require 'rexml/document'
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-05-15 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rake
@@ -106,6 +107,7 @@ metadata:
106
107
  homepage_uri: https://github.com/anpham6/squared
107
108
  source_code_uri: https://github.com/anpham6/squared
108
109
  documentation_uri: https://squared.readthedocs.io
110
+ post_install_message:
109
111
  rdoc_options: []
110
112
  require_paths:
111
113
  - lib
@@ -120,7 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
122
  - !ruby/object:Gem::Version
121
123
  version: '0'
122
124
  requirements: []
123
- rubygems_version: 3.6.8
125
+ rubygems_version: 3.1.6
126
+ signing_key:
124
127
  specification_version: 4
125
128
  summary: Rake task generator for managing multi-language workspaces.
126
129
  test_files: []