squared 0.3.0 → 0.3.2

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: 7ffee6667b4033ad1987ad90e83c912134bfbc449efbbe1d6c90e3370fd568d1
4
- data.tar.gz: 5ded113c3c6058688db13120068f35983decfcf772af8f67318a073bf65c7e9a
3
+ metadata.gz: f312781b98b855b5dc0ae4a57dc39ecceda128c36a899cb80d4bcb02fddba16d
4
+ data.tar.gz: '0152856705e845789742fe9c99b6d60aa732641271af511493b7c889049176ae'
5
5
  SHA512:
6
- metadata.gz: ddbfe113d51f8f89fbc20c950b6de97a9800a8c76dffb04a1ba8e56708a7c3142b1007e1678368df662e9b340ff567d93aeb781656e92a262fa1a417f05f7bb7
7
- data.tar.gz: ee09e3e0766d396c644ee7be9ef0e88461fec646e57e4e5c58949042d3a87697215f8069781ef1116d12cf0cdda10b62ab609ded409da954f28a85d6489c12f6
6
+ metadata.gz: 704fcf52f4f8c74b074e38ad206d25d8d7b57cc9ea3d7d725e92115a4ab969b0a982b5c4ad4e3ce1ddc0d58ceeed2a32f0d7ceeab0d2b47966c40e22a6d9fe65
7
+ data.tar.gz: 241500ace7319da50eab69c5fd55068f9ee2e05ac81961832b7593d1a5e787ca942ea7901dc745259d00e814e2c58a45c3d4577a17918ce3ede2637a4fc7720e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.2] - 2024-02-25
4
+
5
+ ### Fixed
6
+
7
+ - Task program command options used unrecognized symbol.
8
+
9
+ ## [0.2.5] - 2024-02-25
10
+
11
+ ### Fixed
12
+
13
+ - See `0.1.5`.
14
+
15
+ ## [0.1.5] - 2024-02-25
16
+
17
+ ### Fixed
18
+
19
+ - Node copy method ignored include argument when called directly.
20
+ - Logger is not initialized when using only Git base class.
21
+ - Hide warnings about readline during execution.
22
+ - Logger is not initialized when using only base class.
23
+ - Merging ENV build options were double escaped.
24
+
25
+ ## [0.3.1] - 2025-02-12
26
+
27
+ ### Fixed
28
+
29
+ - Build ENV options error message used undeclared variable.
30
+
31
+ ## [0.2.4] - 2025-02-12
32
+
33
+ ### Fixed
34
+
35
+ - Git status did not show ignored or untracked files.
36
+ - Caller locations were not compatible with Ruby 2.4.
37
+
3
38
  ## [0.3.0] - 2025-02-07
4
39
 
5
40
  ### Added
@@ -60,8 +95,14 @@
60
95
 
61
96
  ### Fixed
62
97
 
63
- - Project hash options duplicated dash prefix.
64
- - Pip upgrade did not append package names.
98
+ - Project hash options duplicated dash prefix.
99
+
100
+ ## [0.1.4] - 2024-02-05
101
+
102
+ ### Fixed
103
+
104
+ - Build options with array args were not recognized.
105
+ - Pip upgrade did not append package names.
65
106
 
66
107
  ## [0.2.2] - 2025-01-19
67
108
 
@@ -232,11 +273,17 @@
232
273
 
233
274
  - Changelog was created.
234
275
 
276
+ [0.3.2]: https://github.com/anpham6/squared/releases/tag/v0.3.2-ruby
277
+ [0.3.1]: https://github.com/anpham6/squared/releases/tag/v0.3.1-ruby
235
278
  [0.3.0]: https://github.com/anpham6/squared/releases/tag/v0.3.0-ruby
279
+ [0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
280
+ [0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
236
281
  [0.2.3]: https://github.com/anpham6/squared/releases/tag/v0.2.3-ruby
237
282
  [0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
238
283
  [0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
239
284
  [0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
285
+ [0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
286
+ [0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
240
287
  [0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
241
288
  [0.1.2]: https://github.com/anpham6/squared/releases/tag/v0.1.2-ruby
242
289
  [0.1.1]: https://github.com/anpham6/squared/releases/tag/v0.1.1-ruby
@@ -279,7 +279,7 @@ module Squared
279
279
  end
280
280
 
281
281
  def raise_error(*args, hint: nil, kind: ArgumentError)
282
- raise kind, message(*args, hint: hint, empty: true), caller_locations(1)
282
+ raise kind, message(*args, hint: hint, empty: true), caller_locations(1).map(&:to_s)
283
283
  end
284
284
  end
285
285
  end
@@ -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 unless data[2]
13
+ return val if !data[2] || (!data[4] && data[5] =~ /\s/)
14
14
 
15
15
  join = ->(opt) { data[1] + data[3] + shell_quote(opt) }
16
16
  if data[4] == data[6]
@@ -32,8 +32,9 @@ module Squared
32
32
  Rake::Win32.windows? || ARG[:QUOTE] == '"' ? "\"#{double_quote(val)}\"" : "'#{single_quote(val)}'"
33
33
  end
34
34
 
35
- def shell_split(val, quote: false, join: nil)
36
- val = Shellwords.split(val).map { |opt| shell_escape(opt, quote: quote) }
35
+ def shell_split(val, escape: true, quote: false, join: nil)
36
+ val = Shellwords.split(val)
37
+ val = val.map { |opt| shell_escape(opt, quote: quote) } if escape
37
38
  return val unless join
38
39
 
39
40
  val.join(join.is_a?(::String) ? join : ' ')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.2'
5
5
  end
@@ -208,16 +208,16 @@ module Squared
208
208
  if @output[2] != false && (val = env('BUILD', suffix: 'ENV'))
209
209
  begin
210
210
  data = JSON.parse(val)
211
- raise_error('invalid JSON object', val, hint: "#{prefix}_ENV") unless data.is_a?(Hash)
211
+ raise_error('invalid JSON object', val, hint: "BUILD_#{@envname}_ENV") unless data.is_a?(Hash)
212
212
  rescue StandardError => e
213
- log.warn e
213
+ log&.warn e
214
214
  else
215
215
  @output[2] = data
216
216
  end
217
217
  end
218
218
  if cmd != false && !cmd.is_a?(Array)
219
- @output[cmd ? 1 : 3] = shell_split(val, join: true) if (val = env('BUILD', suffix: 'OPTS'))
220
- @output[4] = shell_split(val, join: true) if cmd.nil? && (val = env('SCRIPT', suffix: 'OPTS'))
219
+ @output[cmd ? 1 : 3] = shell_split(val, escape: false, join: true) if (val = env('BUILD', suffix: 'OPTS'))
220
+ @output[4] = shell_split(val, escape: false, join: true) if !cmd && (val = env('SCRIPT', suffix: 'OPTS'))
221
221
  end
222
222
  @version = val if (val = env('BUILD', suffix: 'VERSION'))
223
223
  return unless (val = env('BUILD', strict: true))
@@ -298,7 +298,7 @@ module Squared
298
298
  if val.directory? && !val.empty?
299
299
  true
300
300
  else
301
- log.warn "workspace \"#{val}\" (#{val.empty? ? 'empty' : 'not found'})"
301
+ log&.warn "workspace \"#{val}\" (#{val.empty? ? 'empty' : 'not found'})"
302
302
  false
303
303
  end
304
304
  end
@@ -435,7 +435,7 @@ module Squared
435
435
  begin
436
436
  @clean.each { |cmd, opts| build(cmd.to_s, opts, sync: sync) }
437
437
  rescue StandardError => e
438
- log.error e
438
+ log&.error e
439
439
  ret = on(:error, from, e)
440
440
  raise if @exception && ret != true
441
441
  end
@@ -444,17 +444,17 @@ module Squared
444
444
  val = val.to_s
445
445
  path = basepath(val)
446
446
  if path.directory? && val =~ %r{[\\/]\z}
447
- log.warn "rm -rf #{path}"
447
+ log&.warn "rm -rf #{path}"
448
448
  path.rmtree(verbose: verbose)
449
449
  else
450
- log.warn "rm #{path}"
450
+ log&.warn "rm #{path}"
451
451
  (val.include?('*') ? Dir[path] : [path]).each do |file|
452
452
  next unless File.file?(file)
453
453
 
454
454
  begin
455
455
  File.delete(file)
456
456
  rescue StandardError => e
457
- log.error e
457
+ log&.error e
458
458
  end
459
459
  end
460
460
  end
@@ -540,7 +540,7 @@ module Squared
540
540
  instance_variable_set :"@#{key}", val.first
541
541
  end
542
542
  else
543
- log.warn "variable_set: @#{key} (private)"
543
+ log&.warn "variable_set: @#{key} (private)"
544
544
  end
545
545
  end
546
546
 
@@ -675,11 +675,11 @@ module Squared
675
675
  return
676
676
  end
677
677
  cmd = session_done(cmd)
678
- log.info cmd
678
+ log&.info cmd
679
679
  on :first, from
680
680
  begin
681
681
  if cmd.match?(/\A[^:]+:[^:]/) && workspace.task_defined?(cmd)
682
- log.warn "ENV was discarded: #{var}" if var
682
+ log&.warn "ENV was discarded: #{var}" if var
683
683
  task_invoke(cmd, exception: exception, warning: warning?)
684
684
  else
685
685
  print_item format_banner(cmd, banner: banner) if sync
@@ -687,7 +687,7 @@ module Squared
687
687
  shell(*args, chdir: chdir, exception: exception)
688
688
  end
689
689
  rescue StandardError => e
690
- log.error e
690
+ log&.error e
691
691
  ret = on(:error, from, e)
692
692
  raise unless ret == true
693
693
  else
@@ -1303,7 +1303,7 @@ module Squared
1303
1303
  Dir.chdir(pwd)
1304
1304
  end
1305
1305
  rescue StandardError => e
1306
- log.error e
1306
+ log&.error e
1307
1307
  unless dryrun
1308
1308
  ret = on(:error, from, e)
1309
1309
  raise if exception && ret != true
@@ -84,11 +84,11 @@ module Squared
84
84
  show: %w[s exit-code histogram].freeze
85
85
  }.freeze,
86
86
  fetch: {
87
- base: %w[multiple progress P|prune-tags refetch stdin u|update-head-ok recurse-submodules=s
87
+ base: %w[multiple progress P|prune-tags refetch stdin u|update-head-ok recurse-submodules=b
88
88
  recurse-submodules-default=b].freeze,
89
89
  pull: %w[4 6 n t a|append atomic dry-run f|force k|keep n|negotiate-only prefetch p|prune q|quiet
90
90
  set-upstream unshallow update-shallow v|verbose deepen=i depth=i j|jobs=i negotiation-tip=q
91
- refmap=q o|server-option=e shallow-exclude=e shallow-since=s upload-pack=e].freeze
91
+ refmap=q o|server-option=e shallow-exclude=e shallow-since=b upload-pack=e].freeze
92
92
  }.freeze,
93
93
  log: {
94
94
  base: %w[all all-match alternate-refs author-date-order basic-regexp bisect boundary cherry cherry-mark
@@ -119,7 +119,7 @@ module Squared
119
119
  no-empty-directory recurse-submodules sparse s|stage u|unmerged abbrev=i x|exclude=q
120
120
  X|exclude-from=p exclude-per-directory=p format=q with-tree=q].freeze,
121
121
  ls_remote: %w[exit-code get-url q|quiet o|server-option=e symref sort=q upload-pack=e].freeze,
122
- pull: %w[e n allow-unrelated-histories ff-only S|gpg-sign=e log=i rebase=s s|strategy=b
122
+ pull: %w[e n allow-unrelated-histories ff-only S|gpg-sign=e log=i r|rebase=b? s|strategy=b
123
123
  X|strategy-option=e].freeze,
124
124
  rebase: %w[n C=i allow-empty-message apply committer-date-is-author-date edit-todo f|force-rebase ignore-date
125
125
  ignore-whitespace i|interactive keep-base m merge no-ff q|quiet quit r|rebase-merges=b?
@@ -674,7 +674,8 @@ module Squared
674
674
  end
675
675
 
676
676
  def status(*, sync: invoked_sync?('status'), **)
677
- cmd = git_session 'status', option('long') ? '--long' : '--short'
677
+ cmd = git_session 'status'
678
+ cmd << (option('long') ? '--long' : '--short')
678
679
  if (val = option('ignore-submodules', ignore: false))
679
680
  cmd << basic_option('ignore-submodules', case val
680
681
  when '0', 'none'
@@ -695,8 +696,8 @@ module Squared
695
696
  end
696
697
  ret = write_lines(out, banner: banner, sub: if verbose
697
698
  [
698
- { pat: /^(.)([A-Z])(.+)$/, styles: :red, index: 2 },
699
- { pat: /^([A-Z])(.+)$/, styles: :green },
699
+ { pat: /^(.)([A-Z?!])(.+)$/, styles: :red, index: 2 },
700
+ { pat: /^([A-Z?!])(.+)$/, styles: :green },
700
701
  { pat: /^(\?\?)(.+)$/, styles: :red },
701
702
  { pat: /^(## )(.+)(\.{3})(.+)$/,
702
703
  styles: [nil, :green, nil, :red], index: -1 }
@@ -895,14 +896,14 @@ module Squared
895
896
  origin = nil
896
897
  branch = nil
897
898
  upstream = nil
898
- source(git_output('fetch', '--no-tags', '--quiet'), io: true, banner: false)
899
- source(git_output('branch', '-vv', '--list'), io: true, banner: false).first.each do |val|
899
+ source(git_output('fetch --no-tags --quiet'), io: true, banner: false)
900
+ source(git_output('branch -vv --list'), io: true, banner: false).first.each do |val|
900
901
  next unless (data = /^\*\s(\S+)\s+(\h+)(?:\s\[(.+?)(?=\]\s)\])?\s/.match(val))
901
902
 
902
903
  branch = data[1]
903
904
  if !data[3]
904
905
  unless (origin = option('repository', prefix: 'git', ignore: false))
905
- out = source(git_output('log', '-n1', '--format=%h%d'), io: true, stdout: true, banner: false).first
906
+ out = source(git_output('log -n1 --format=%h%d'), io: true, stdout: true, banner: false).first
906
907
  if out =~ /^#{data[2]} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/
907
908
  split_escape($1).each do |val|
908
909
  next unless val.end_with?("/#{branch}")
@@ -1120,7 +1121,7 @@ module Squared
1120
1121
  banner &&= cmd.temp { |val| val.start_with?('--work-tree') || val.start_with?('--git-dir') }
1121
1122
  end
1122
1123
  cmd = session_done(cmd)
1123
- log.info cmd
1124
+ log&.info cmd
1124
1125
  on :first, from
1125
1126
  banner = if banner
1126
1127
  format_banner((banner.is_a?(String) ? banner : cmd).gsub(File.join(path, ''), ''), banner: true)
@@ -1156,7 +1157,7 @@ module Squared
1156
1157
  end
1157
1158
  end
1158
1159
  rescue StandardError => e
1159
- log.error e
1160
+ log&.error e
1160
1161
  ret = on(:error, from, e)
1161
1162
  raise if exception && ret != true
1162
1163
 
@@ -1181,7 +1182,7 @@ module Squared
1181
1182
  next if grep&.none? { |pat| pat.match?(line) }
1182
1183
 
1183
1184
  if loglevel
1184
- log.add loglevel, line
1185
+ log&.add loglevel, line
1185
1186
  else
1186
1187
  sub&.each { |h| line = sub_style(line, **h) }
1187
1188
  if banner
@@ -1220,7 +1221,7 @@ module Squared
1220
1221
  rsm = append_submodules(target: target)
1221
1222
  out = []
1222
1223
  refspec = []
1223
- opts, pat = option_sanitize(opts, remote ? list + ['refspec=s'] : list, target: target, no: no)
1224
+ opts, pat = option_sanitize(opts, remote ? list + ['refspec=b'] : list, target: target, no: no)
1224
1225
  opts.each do |opt|
1225
1226
  if opt =~ pat
1226
1227
  case $1
@@ -5,7 +5,7 @@ module Squared
5
5
  module Project
6
6
  class Node < Git
7
7
  OPT_NPM = {
8
- common: %w[dry-run include-workspace-root workspaces w|workspace=s].freeze,
8
+ common: %w[dry-run include-workspace-root workspaces=b? w|workspace=b].freeze,
9
9
  install: %w[prefer-dedupe package-lock-only cpu=q libc=e os=q].freeze,
10
10
  install_base: %w[ignore-scripts install-links strict-peer-deps include=b omit=b install-strategy=b].freeze,
11
11
  install_no: %w[audit bin-links fund package-lock].freeze,
@@ -218,8 +218,8 @@ module Squared
218
218
  end
219
219
  end
220
220
 
221
- def copy(from: 'build', into: 'node_modules', workspace: false, include: nil, exclude: nil, scope: nil,
222
- also: nil, create: nil, link: false, force: false, override: false)
221
+ def copy(from: 'build', into: 'node_modules', workspace: false, scope: nil, also: nil, create: nil,
222
+ link: false, force: false, override: false, **kwargs)
223
223
  return if @copy == false
224
224
 
225
225
  if @copy && !override
@@ -235,6 +235,9 @@ module Squared
235
235
  scope = @copy[:scope]
236
236
  also = @copy[:also]
237
237
  create = @copy[:create]
238
+ else
239
+ glob = kwargs[:include]
240
+ exclude = kwargs[:exclude]
238
241
  end
239
242
  items = []
240
243
  items << @workspace.home if build? && path != @workspace.home && @workspace.home?
@@ -14,7 +14,7 @@ module Squared
14
14
  install: %w[break-system-packages check-build-dependencies compile dry-run force-reinstall I|ignore-installed
15
15
  ignore-requires-python no-build-isolation no-clean no-compile no-deps no-index no-warn-conflicts
16
16
  no-warn-script-location pre prefer-binary require-hashes U|upgrade use-pep517 user abi=e
17
- config-settings=q c|constraint=p e|editable=s? extra-index-url=q f|find-links=q global-option=q
17
+ config-settings=q c|constraint=p e|editable=b? extra-index-url=q f|find-links=q global-option=q
18
18
  implementation=b i|index-url=q no-binary=q only-binary=q platform=q prefix=p progress-bar=b
19
19
  python-version=q report=p r|requirement=p root=p root-user-action=e src=p t|target=p
20
20
  upgrade-strategy=b].freeze
@@ -25,7 +25,7 @@ module Squared
25
25
  platform=q source=q].freeze,
26
26
  push: %w[no-http-proxy attestation=p host=q key=e otp=e p|http-proxy=q?].freeze,
27
27
  build: %w[force strict o|output=p platform=q].freeze,
28
- exec: %w[conservative prerelease no-prerelease g|gem=s version=e].freeze,
28
+ exec: %w[conservative prerelease no-prerelease g|gem=b version=e].freeze,
29
29
  pristine: %w[all env-shebang extensions no-env-shebang no-extensions only-executables only-missing-extensions
30
30
  only-plugins n|bindir=p i|install-dir=p skip=e v|version=e].freeze,
31
31
  shared: %w[f b|both clear-sources conservative default development development-all E|explain
data/squared.gemspec CHANGED
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency "rake"
28
28
  spec.add_dependency "logger"
29
29
  spec.add_dependency "rexml"
30
+ spec.add_dependency "readline"
30
31
  end
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.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-07 00:00:00.000000000 Z
10
+ date: 2025-02-25 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -51,6 +51,20 @@ dependencies:
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: readline
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
54
68
  description: Rake task generator for managing multi-language workspaces.
55
69
  email:
56
70
  - anpham6@gmail.com
@@ -106,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
120
  - !ruby/object:Gem::Version
107
121
  version: '0'
108
122
  requirements: []
109
- rubygems_version: 3.6.3
123
+ rubygems_version: 3.6.2
110
124
  specification_version: 4
111
125
  summary: Rake task generator for managing multi-language workspaces.
112
126
  test_files: []