squared 0.2.4 → 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: a1aedaf9ac684379d28ad4e69449ada34e1e04a1b5241607e29c1142b8ad759d
4
- data.tar.gz: 3d13f6d09a48cf2e394ec4497e5c838d69f4eb7cde83df4811059c0e743e029c
3
+ metadata.gz: 6d7cb098a1adfae7f5e8d7737e72f73542dbc4cabdaaf5bd9364660992cc709e
4
+ data.tar.gz: 5f0bca83471206e6f0470cad9a3d4606cb66bd59e0773531f4d0c489390c1fa2
5
5
  SHA512:
6
- metadata.gz: 16928495ed31d6e0ea9876ff0ce6aef9366e98324a96bceffe99e3d7b60ee0eabc863b8846443947342164166047476d68eab992102dc7143ace991fad3b7575
7
- data.tar.gz: 151c60e043f2129f0d84bf04a36531d9131e5a2abcec244311d22e03b23b2b4810b1d24e14663724acf3b25d2a5f3bd166577a294f419a427a0602db9bddabe1
6
+ metadata.gz: 9571ee76edebe66eda5b13d7ba20fb3ddb7d703237abb6a2ae69e7ea3d683d6a106091458918859f913a433947e46f8fac8bce8e628c092e5bff3c70def3abe6
7
+ data.tar.gz: b004e6c8e5aa57df1a8cfe8e4109ba0e454863da096a874408bdac7b700a8c81661717265a803f342817e5394c93d3a80d7b5aaad510fc2190a2e286f592851e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
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
+
3
19
  ## [0.2.4] - 2025-02-12
4
20
 
5
21
  ### Fixed
@@ -11,8 +27,16 @@
11
27
 
12
28
  ### Fixed
13
29
 
14
- - Project hash options duplicated dash prefix.
15
- - 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.
16
40
 
17
41
  ## [0.2.2] - 2025-01-19
18
42
 
@@ -183,11 +207,14 @@
183
207
 
184
208
  - Changelog was created.
185
209
 
210
+ [0.2.5]: https://github.com/anpham6/squared/releases/tag/v0.2.5-ruby
186
211
  [0.2.4]: https://github.com/anpham6/squared/releases/tag/v0.2.4-ruby
187
212
  [0.2.3]: https://github.com/anpham6/squared/releases/tag/v0.2.3-ruby
188
213
  [0.2.2]: https://github.com/anpham6/squared/releases/tag/v0.2.2-ruby
189
214
  [0.2.1]: https://github.com/anpham6/squared/releases/tag/v0.2.1-ruby
190
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
191
218
  [0.1.3]: https://github.com/anpham6/squared/releases/tag/v0.1.3-ruby
192
219
  [0.1.2]: https://github.com/anpham6/squared/releases/tag/v0.1.2-ruby
193
220
  [0.1.1]: https://github.com/anpham6/squared/releases/tag/v0.1.1-ruby
@@ -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.4'
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
@@ -934,7 +934,7 @@ module Squared
934
934
  banner &&= cmd.temp { |val| val.start_with?('--work-tree') || val.start_with?('--git-dir') }
935
935
  end
936
936
  cmd = session_done(cmd)
937
- log.info cmd
937
+ log&.info cmd
938
938
  on :first, from if from
939
939
  banner = if banner
940
940
  format_banner((banner.is_a?(String) ? banner : cmd).gsub(File.join(path, ''), ''), banner: true)
@@ -970,7 +970,7 @@ module Squared
970
970
  end
971
971
  end
972
972
  rescue StandardError => e
973
- log.error e
973
+ log&.error e
974
974
  ret = on(:error, from, e) if from
975
975
  raise if exception && ret != true
976
976
 
@@ -989,7 +989,7 @@ module Squared
989
989
  next if grep && !line.match?(grep)
990
990
 
991
991
  if loglevel
992
- log.add loglevel, line
992
+ log&.add loglevel, line
993
993
  else
994
994
  sub&.each { |h| line = sub_style(line, **h) }
995
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.4
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-13 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