squared 0.2.3 → 0.2.5

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: 3bc7bf1e798295581f3dcbd052d367f159a91bff55bc4bbcbe3862a6d4c39739
4
- data.tar.gz: '03919adb276a1ed4b25b217776e28d4525c90e4ffe5af508b883d3480f4fbf23'
3
+ metadata.gz: 6d7cb098a1adfae7f5e8d7737e72f73542dbc4cabdaaf5bd9364660992cc709e
4
+ data.tar.gz: 5f0bca83471206e6f0470cad9a3d4606cb66bd59e0773531f4d0c489390c1fa2
5
5
  SHA512:
6
- metadata.gz: 4ad94be493ad60c59ed738d59884bbfd815cddd8ddbe31ad6be4fd6f0e7ddf70b6b7bd6b70d65ab4b14caa99d1480f7cb985f02d39351d5a4554f6f6a91cb6a3
7
- data.tar.gz: 98783c78e94aa41d5f331110129f329cfe2c80e87e008a8d453cc0f4851701cc538524b7fe924ae19e58689641a9be2b131e354386566ee4344b7b831539cd42
6
+ metadata.gz: 9571ee76edebe66eda5b13d7ba20fb3ddb7d703237abb6a2ae69e7ea3d683d6a106091458918859f913a433947e46f8fac8bce8e628c092e5bff3c70def3abe6
7
+ data.tar.gz: b004e6c8e5aa57df1a8cfe8e4109ba0e454863da096a874408bdac7b700a8c81661717265a803f342817e5394c93d3a80d7b5aaad510fc2190a2e286f592851e
data/CHANGELOG.md CHANGED
@@ -1,11 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.5] - 2024-02-25
4
+
5
+ ### Fixed
6
+
7
+ - See `0.1.5`.
8
+
9
+ ## [0.1.5] - 2024-02-25
10
+
11
+ ### Fixed
12
+
13
+ - Node copy method ignored include argument when called directly.
14
+ - Logger is not initialized when using only Git base class.
15
+ - Hide warnings about readline during execution.
16
+ - Logger is not initialized when using only base class.
17
+ - Merging ENV build options were double escaped.
18
+
19
+ ## [0.2.4] - 2025-02-12
20
+
21
+ ### Fixed
22
+
23
+ - Git status did not show ignored or untracked files.
24
+ - Caller locations were not compatible with Ruby 2.4.
25
+
3
26
  ## [0.2.3] - 2025-02-05
4
27
 
5
28
  ### Fixed
6
29
 
7
- - Project hash options duplicated dash prefix.
8
- - Pip upgrade did not append package names.
30
+ - Project hash options duplicated dash prefix.
31
+
32
+ ## [0.1.4] - 2024-02-05
33
+
34
+ ### Fixed
35
+
36
+ - Build options with array args were not recognized.
37
+ - Base clean command did not enumerate non-string values.
38
+ - Git command refs did not include ref option.
39
+ - Pip upgrade did not append package names.
9
40
 
10
41
  ## [0.2.2] - 2025-01-19
11
42
 
@@ -62,7 +93,7 @@
62
93
  - Gem install and update non-deprecated options are fully complete.
63
94
  - Pip install options are fully complete.
64
95
  - Node command bump action version was implemented.
65
- - Node command add was implemented.
96
+ - Node command add was implemented.
66
97
  - Python command install can use single character options.
67
98
  - Gem install and pristine options are fully complete.
68
99
  - Gem command outdated was implemented.
@@ -176,10 +207,14 @@
176
207
 
177
208
  - Changelog was created.
178
209
 
210
+ [0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
211
+ [0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
179
212
  [0.2.3]: https://github.com/anpham6/squared/releases/tag/v0.2.3-ruby
180
213
  [0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
181
214
  [0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
182
215
  [0.2.0]: https://github.com/anpham6/squared/releases/tag/v0.2.0-ruby
216
+ [0.1.5]: https://github.com/anpham6/squared/releases/tag/v0.1.5-ruby
217
+ [0.1.4]: https://github.com/anpham6/squared/releases/tag/v0.1.4-ruby
183
218
  [0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
184
219
  [0.1.2]: https://github.com/anpham6/squared/releases/tag/v0.1.2-ruby
185
220
  [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? ? "\"#{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.2.3'
4
+ VERSION = '0.2.5'
5
5
  end
@@ -199,14 +199,14 @@ module Squared
199
199
  @prod = env_match("#{pre}_PROD", prod)
200
200
  cmd = @output[0]
201
201
  unless cmd == false || cmd.is_a?(Array) || (val = env('BUILD', suffix: 'OPTS')).nil?
202
- @output[cmd ? 1 : 3] = shell_split(val, join: true)
202
+ @output[cmd ? 1 : 3] = shell_split(val, escape: false, join: true)
203
203
  end
204
204
  unless @output[2] == false || (val = env('BUILD', suffix: 'ENV')).nil?
205
205
  begin
206
206
  data = JSON.parse(val)
207
207
  raise_error('invalid JSON object', val, hint: "#{prefix}_ENV") unless data.is_a?(Hash)
208
208
  rescue StandardError => e
209
- log.warn e
209
+ log&.warn e
210
210
  else
211
211
  @output[2] = data
212
212
  end
@@ -297,7 +297,7 @@ module Squared
297
297
  if val.directory? && !val.empty?
298
298
  true
299
299
  else
300
- log.warn "workspace \"#{val}\" (#{val.empty? ? 'empty' : 'not found'})"
300
+ log&.warn "workspace \"#{val}\" (#{val.empty? ? 'empty' : 'not found'})"
301
301
  false
302
302
  end
303
303
  end
@@ -411,17 +411,17 @@ module Squared
411
411
  val = val.to_s
412
412
  path = basepath(val)
413
413
  if path.directory? && val =~ %r{[\\/]\z}
414
- log.warn "rm -rf #{path}"
414
+ log&.warn "rm -rf #{path}"
415
415
  path.rmtree(verbose: true)
416
416
  else
417
- log.warn "rm #{path}"
417
+ log&.warn "rm #{path}"
418
418
  (val.include?('*') ? Dir[path] : [path]).each do |file|
419
419
  next unless File.file?(file)
420
420
 
421
421
  begin
422
422
  File.delete(file)
423
423
  rescue StandardError => e
424
- log.error e
424
+ log&.error e
425
425
  end
426
426
  end
427
427
  end
@@ -500,7 +500,7 @@ module Squared
500
500
  instance_variable_set :"@#{key}", val.first
501
501
  end
502
502
  else
503
- log.warn "variable_set: @#{key} (private)"
503
+ log&.warn "variable_set: @#{key} (private)"
504
504
  end
505
505
  end
506
506
 
@@ -624,11 +624,11 @@ module Squared
624
624
 
625
625
  def run(cmd = @session, var = nil, exception: @exception, sync: true, banner: true, chdir: path, from: nil, **)
626
626
  cmd = session_done(cmd)
627
- log.info cmd
627
+ log&.info cmd
628
628
  on :first, from if from
629
629
  begin
630
630
  if cmd.match?(/\A[^:]+:[^:]/) && workspace.task_defined?(cmd)
631
- log.warn "ENV was discarded: #{var}" if var
631
+ log&.warn "ENV was discarded: #{var}" if var
632
632
  task_invoke(cmd, exception: exception, warning: warning?)
633
633
  else
634
634
  print_item format_banner(cmd, banner: banner) if sync
@@ -636,7 +636,7 @@ module Squared
636
636
  shell(*args, chdir: chdir, exception: exception)
637
637
  end
638
638
  rescue StandardError => e
639
- log.error e
639
+ log&.error e
640
640
  ret = on(:error, from, e) if from
641
641
  raise unless ret == true
642
642
  else
@@ -1119,7 +1119,7 @@ module Squared
1119
1119
  Dir.chdir(pwd)
1120
1120
  end
1121
1121
  rescue StandardError => e
1122
- log.error e
1122
+ log&.error e
1123
1123
  ret = on(:error, from, e) if from
1124
1124
  raise if exception && ret != true
1125
1125
  else
@@ -538,7 +538,8 @@ module Squared
538
538
  end
539
539
 
540
540
  def status(*, sync: invoked_sync?('status'), **)
541
- cmd = git_session 'status', option('long') ? '--long' : '--short'
541
+ cmd = git_session 'status'
542
+ cmd << (option('long') ? '--long' : '--short')
542
543
  if (val = option('ignore-submodules', ignore: false))
543
544
  cmd << basic_option('ignore-submodules', case val
544
545
  when '0', 'none'
@@ -559,8 +560,8 @@ module Squared
559
560
  end
560
561
  ret = write_lines(out, banner: banner, sub: if verbose
561
562
  [
562
- { pat: /^(.)([A-Z])(.+)$/, styles: :red, index: 2 },
563
- { pat: /^([A-Z])(.+)$/, styles: :green },
563
+ { pat: /^(.)([A-Z?!])(.+)$/, styles: :red, index: 2 },
564
+ { pat: /^([A-Z?!])(.+)$/, styles: :green },
564
565
  { pat: /^(\?\?)(.+)$/, styles: :red },
565
566
  { pat: /^(## )(.+)(\.{3})(.+)$/,
566
567
  styles: [nil, :green, nil, :red], index: -1 }
@@ -721,15 +722,15 @@ module Squared
721
722
  origin = nil
722
723
  branch = nil
723
724
  upstream = nil
724
- source(git_output('fetch', '--no-tags', '--quiet'), io: true, banner: false)
725
- source(git_output('branch', '-vv', '--list'), io: true, banner: false).first.each do |val|
725
+ source(git_output('fetch --no-tags --quiet'), io: true, banner: false)
726
+ source(git_output('branch -vv --list'), io: true, banner: false).first.each do |val|
726
727
  next unless (data = /^\*\s(\S+)\s+(\h+)(?:\s\[(.+?)(?=\]\s)\])?\s/.match(val))
727
728
 
728
729
  branch = data[1]
729
730
  sha = data[2]
730
731
  if !data[3]
731
732
  unless (origin = option('repository', prefix: 'git', ignore: false))
732
- out = source(git_output('log', '-n1', '--format=%h%d'), io: true, stdout: true, banner: false).first
733
+ out = source(git_output('log -n1 --format=%h%d'), io: true, stdout: true, banner: false).first
733
734
  if (data = /^#{sha} \(HEAD -> #{Regexp.escape(branch)}, (.+?)\)$/.match(out))
734
735
  split_escape(data[1]).each do |val|
735
736
  next unless val.end_with?("/#{branch}")
@@ -933,7 +934,7 @@ module Squared
933
934
  banner &&= cmd.temp { |val| val.start_with?('--work-tree') || val.start_with?('--git-dir') }
934
935
  end
935
936
  cmd = session_done(cmd)
936
- log.info cmd
937
+ log&.info cmd
937
938
  on :first, from if from
938
939
  banner = if banner
939
940
  format_banner((banner.is_a?(String) ? banner : cmd).gsub(File.join(path, ''), ''), banner: true)
@@ -969,7 +970,7 @@ module Squared
969
970
  end
970
971
  end
971
972
  rescue StandardError => e
972
- log.error e
973
+ log&.error e
973
974
  ret = on(:error, from, e) if from
974
975
  raise if exception && ret != true
975
976
 
@@ -988,7 +989,7 @@ module Squared
988
989
  next if grep && !line.match?(grep)
989
990
 
990
991
  if loglevel
991
- log.add loglevel, line
992
+ log&.add loglevel, line
992
993
  else
993
994
  sub&.each { |h| line = sub_style(line, **h) }
994
995
  if banner
@@ -152,8 +152,8 @@ module Squared
152
152
  end
153
153
  end
154
154
 
155
- def copy(from: 'build', into: 'node_modules', workspace: false, include: nil, exclude: nil, scope: nil,
156
- also: nil, create: nil, link: false, force: false, override: false)
155
+ def copy(from: 'build', into: 'node_modules', workspace: false, scope: nil,
156
+ also: nil, create: nil, link: false, force: false, override: false, **kwargs)
157
157
  return if @copy == false
158
158
 
159
159
  if @copy && !override
@@ -163,12 +163,15 @@ module Squared
163
163
  into = @copy[:into] if @copy.key?(:into)
164
164
  workspace = @copy[:workspace] if @copy.key?(:workspace)
165
165
  link = @copy[:link] if @copy.key?(:link)
166
- force = @copy[:force] if @copy.key?(:link)
166
+ force = @copy[:force] if @copy.key?(:force)
167
167
  glob = @copy[:include]
168
168
  exclude = @copy[:exclude]
169
169
  scope = @copy[:scope]
170
170
  also = @copy[:also]
171
171
  create = @copy[:create]
172
+ else
173
+ glob = kwargs[:include]
174
+ exclude = kwargs[:exclude]
172
175
  end
173
176
  items = []
174
177
  items << @workspace.home if build? && path != @workspace.home && @workspace.home?
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.2.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-05 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: []