squared 0.1.6 → 0.1.8

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: 7630bfea46c3328ad2c6a12c865a913c3efad5609815b4b5dee647abd9e43665
4
- data.tar.gz: 7c791bd8356e85949829196c6eddca1ad29227189471a9a89c02b8eb48c101cc
3
+ metadata.gz: 2de07baaee5e8dab48b40441f8ec83a471e1b54c464fe8d06bb360eeef06c6d0
4
+ data.tar.gz: 3f2fab32edfcbec1cd13a0f320ce540f174d8da54b89e70c29eff9033c3b8244
5
5
  SHA512:
6
- metadata.gz: 8fa16263ea3d1d1012d308bc41dda0f72557329c1e0e491fce519b3cb9d9fd67b6ebc635747737053213ffb3dd21e86d4318b49c1de72dbffdce7d93f5cb698a
7
- data.tar.gz: 73d2f5163e5d5c87abbb9894933829a88a8d589424eb70bfb39ae8c8721af1050da7f8e1c2e3d2566f914ccd90ea230fc7138dcad7d77fbd559131aa4121c7aa
6
+ metadata.gz: e9199678633fe880e68d0adc7d9a2bb61cef4b9d7298b395e4d34621669f8db4b74f38321bc644f5113783d4b722a0547228e21d53c36ea22d5f25f34778aff1
7
+ data.tar.gz: 6c4905fd7a1d74e68951644633c40f78e3acc6dde48ac8ba397c853759101439ef7d43ef5a2e446cc1c99eb73ef237ebd3caf22764b9593331c44b87b764b034
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.8] - 2025-05-15
4
+
5
+ ### Fixed
6
+
7
+ - Disabled batch and alias tasks were not hidden.
8
+ - Log messages were written to terminal twice when emphasized.
9
+ - Node outdated interactive for major would sometimes deactivate.
10
+ - Node outdated interactive for major was mislabeled as minor.
11
+
12
+ ## [0.1.7] - 2025-04-27
13
+
14
+ ### Fixed
15
+
16
+ - Project directory context method option pass was inverted.
17
+ - Shell options with spaces and without quotes were not escaped.
18
+ - Git task status did not display branch information.
19
+ - Ruby copy method argument include was ignored when used directly.
20
+ - Git commit could not push branch without same name as remote.
21
+
3
22
  ## [0.1.6] - 2025-04-17
4
23
 
5
24
  ### Fixed
@@ -108,6 +127,8 @@
108
127
 
109
128
  - Changelog was created.
110
129
 
130
+ [0.1.8]: https://github.com/anpham6/squared/releases/tag/v0.1.8-ruby
131
+ [0.1.7]: https://github.com/anpham6/squared/releases/tag/v0.1.7-ruby
111
132
  [0.1.6]: https://github.com/anpham6/squared/releases/tag/v0.1.6-ruby
112
133
  [0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
113
134
  [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.1.6'
4
+ VERSION = '0.1.8'
5
5
  end
@@ -343,7 +343,7 @@ module Squared
343
343
  tasks << key if obj.has?(key, baseref)
344
344
  elsif (batch = series.batch_get(key))
345
345
  obj.allref.each do |ref|
346
- next unless (data = batch[ref])
346
+ next unless obj.has?(key, ref) && (data = batch[ref])
347
347
 
348
348
  data.each do |val|
349
349
  if (items = task_resolve(obj, val)).empty?
@@ -362,7 +362,7 @@ module Squared
362
362
  return [] if (base && !obj.ref?(baseref)) || !(data = series.alias_get(key))
363
363
 
364
364
  obj.allref.each do |ref|
365
- next unless (alt = data[ref])
365
+ next unless obj.has?(key, ref) && (alt = data[ref])
366
366
 
367
367
  ret = task_resolve(obj, alt)
368
368
  break unless ret.empty?
@@ -922,7 +922,7 @@ module Squared
922
922
  def pwd_set(done = nil, pass: false, &blk)
923
923
  pwd = Pathname.pwd
924
924
  if block_given?
925
- if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join >= RUBY_VERSION)
925
+ if path == pwd || pass == true || (pass.is_a?(String) && semscan(pass).join <= RUBY_VERSION)
926
926
  ret = instance_eval(&blk)
927
927
  else
928
928
  Dir.chdir(path)
@@ -295,6 +295,7 @@ module Squared
295
295
 
296
296
  def status
297
297
  cmd = git_session 'status', option('long') ? '--long' : '--short'
298
+ cmd << '--branch' if option('branch')
298
299
  if (val = option('ignore-submodules', ignore: false))
299
300
  cmd << shell_option('ignore-submodules', case val
300
301
  when '0', 'none'
@@ -465,41 +466,29 @@ module Squared
465
466
  raise_error('commit', 'pathspec', hint: 'missing') if (files = projectmap(files)).empty?
466
467
  "-- #{files.join(' ')}"
467
468
  end
468
- origin = nil
469
+ format = '%(if)%(HEAD)%(then)%(refname:short)...%(upstream:short)...%(upstream:track)%(end)'
469
470
  branch = nil
470
- upstream = false
471
- source('git fetch --no-tags --quiet', io: true, banner: false)
472
- source('git branch -vv --list', io: true, banner: false).first.each do |val|
473
- next unless (data = /\A\*\s(\S+)\s+(\h+)(?:\s\[(.+?)(?=\]\s)\])?\s/.match(val))
474
-
475
- branch = data[1]
476
- sha = data[2]
477
- if !data[3]
478
- unless (origin = option('repository', prefix: 'git', ignore: false))
479
- out = source('git log -n1 --format=%h%d', io: true, stdout: true, banner: false).first
480
- if (data = /\A#{sha} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)\z/.match(out))
481
- split_escape(data[1]).each do |s|
482
- next unless s.end_with?("/#{branch}")
483
-
484
- origin = s[0..s.size - branch.size - 2]
485
- break
486
- end
487
- end
488
- end
489
- upstream = !origin.nil?
490
- elsif (data = Regexp.new("\\A(.+)/#{Regexp.escape(branch)}\\z").match(data[3]))
491
- origin = data[1]
471
+ origin = nil
472
+ source('git fetch --no-tags --quiet', io: true, banner: false, stdout: true)
473
+ source("git for-each-ref --format=\"#{format}\" refs/heads", io: true, banner: false).first.each do |line|
474
+ next if (line = line.chomp).empty?
475
+
476
+ branch, origin, hint = line.split('...')
477
+ if hint && !hint.match?(/^\[(\D+0,\D+0)\]$/)
478
+ raise_error('work tree is not usable', hint: hint[1..-2])
479
+ elsif origin.empty?
480
+ return nil if pass
481
+
482
+ raise_error('no remote upstream', hint: branch)
492
483
  end
493
484
  break
494
485
  end
495
- raise_error('commit', 'work tree is not usable') unless origin && branch
486
+ i = origin.index('/')
487
+ branch = "#{branch}:#{origin[i + 1..-1]}" unless origin.end_with?("/#{branch}")
488
+ origin = origin[0..i - 1]
496
489
  cmd = git_session 'commit'
497
490
  cmd << '--dry-run' if option('dry-run')
498
- if amend
499
- cmd << '--amend'
500
- else
501
- cmd.delete('--amend')
502
- end
491
+ cmd << '--amend' if amend
503
492
  if message
504
493
  append_message message
505
494
  elsif flag == :'amend-orig' || option('no-edit')
@@ -507,13 +496,9 @@ module Squared
507
496
  end
508
497
  a = ['git add --verbose']
509
498
  b = ['git push']
510
- b << '--set-upstream' if upstream
511
- if dry_run?
512
- a << '--dry-run'
513
- b << '--dry-run'
514
- end
499
+ b << '--dry-run' if dry_run?
515
500
  a << pathspec
516
- b << '--force' if amend
501
+ b << '--force-with-lease' if amend
517
502
  b << origin << branch
518
503
  puts if pass
519
504
  source a.join(' ')
@@ -340,7 +340,7 @@ module Squared
340
340
  index = if a != c
341
341
  1
342
342
  elsif b != d
343
- 3
343
+ a == '0' ? 1 : 3
344
344
  else
345
345
  5
346
346
  end
@@ -373,7 +373,8 @@ module Squared
373
373
  col2 = size_col.(found, 1) + 4
374
374
  found.each_with_index do |item, i|
375
375
  a, b, c, d, e = item
376
- if inter && (rev != :major || e || semmajor?(item[5], item[6])) && !confirm_outdated(a, c, d, e)
376
+ f = inter && (rev != :major || e || semmajor?(item[5], item[6]))
377
+ if f && !confirm_outdated(a, c, d, e)
377
378
  cur = -1
378
379
  else
379
380
  cur = modified
@@ -532,6 +533,10 @@ module Squared
532
533
  dependfile.exist?
533
534
  end
534
535
 
536
+ def refresh?
537
+ !Node.prod?
538
+ end
539
+
535
540
  def yarn?
536
541
  (@pm[:yarn] ||= if basepath('yarn.lock', ascend: dependext).exist?
537
542
  if (rc = basepath('.yarnrc.yml', ascend: dependext)).exist?
@@ -207,13 +207,15 @@ module Squared
207
207
  end
208
208
  end
209
209
 
210
- def copy(from: 'lib', include: nil, exclude: nil, into: @gemdir, override: false)
210
+ def copy(from: 'lib', into: @gemdir, override: false, **kwargs)
211
+ glob = kwargs[:include]
212
+ pass = kwargs[:exclude]
211
213
  if @copy && !override
212
214
  return super if runnable?(@copy)
213
215
 
214
216
  from = @copy[:from] if @copy.key?(:from)
215
217
  glob = @copy[:include] if @copy.key?(:include)
216
- exclude = @copy[:exclude] if @copy.key?(:exclude)
218
+ pass = @copy[:exclude] if @copy.key?(:exclude)
217
219
  into = @copy[:into] if @copy.key?(:into)
218
220
  end
219
221
  return unless into
@@ -224,9 +226,9 @@ module Squared
224
226
  as_a(from).each_with_index do |val, i|
225
227
  a = basepath(val)
226
228
  b = dest.join(val)
227
- c = glob[i] || glob[0]
229
+ c = glob[i] || glob.first
228
230
  log.info "cp #{a.join(c)} #{b}"
229
- copy_d(a, b, glob: c, pass: exclude, verbose: verbose)
231
+ copy_d(a, b, glob: c, pass: pass, verbose: verbose)
230
232
  end
231
233
  end
232
234
 
@@ -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.1.6
4
+ version: 0.1.8
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: []