mixlib-shellout 3.3.3 → 3.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75b13c5009a1396aa337d88ed6f510b35f0a31facbefc2abfbf2b0d467d8f40c
4
- data.tar.gz: '0807d12b7d09345a96355dc1d835d8bbad269d690771306b14604e186a995a43'
3
+ metadata.gz: 4674064c548531f17b0385e89bbe7c658e03282c6929207f7742257de704ebaf
4
+ data.tar.gz: 0030753a06bcd1e0d87870c9da3bf3442921006f744fa01b2752643557e1e94e
5
5
  SHA512:
6
- metadata.gz: 7300a1de75daa21a4f93e91eecd17ac99c010b6cbee2817b5bef6f3c9a008bc1c360fa15b0a2fa9df69ae128878ad126dfdb00f70f80064333987c2332039796
7
- data.tar.gz: f90c59e72a231eaebdf59885702036d01fbb138b4d90639811e72312ba7ffcc6a9274d98a810b33b862c6e274fa0f2b068fe88caeefa7667458a6810117e1765
6
+ metadata.gz: 8530b282f56ddd4e9773267fb600353b5f99453682e4e7fe3a637df90f37d63287cb0574335b9377407627a30107f0dbf786a5626c80cde51d805fdb19311a74
7
+ data.tar.gz: bfd625a28bc20f1e8711f25c617096db088c6318a764103e507c45b174e5c0a900a86e0d80a179fe6bc89548ebdca2e48d0101d51aa8e18abbd7aff7686c6732
@@ -143,14 +143,21 @@ module Mixlib
143
143
 
144
144
  # Join arguments into a string.
145
145
  #
146
- # If the argument ends with a whitespace, use it as-is. Otherwise, add
147
- # a space at the end
146
+ # Strips leading/trailing spaces from each argument. If an argument contains
147
+ # a space, it is quoted. Join into a single string with spaces between each argument.
148
148
  #
149
149
  # @param args [String] variable number of string arguments
150
150
  # @return [String] merged string
151
151
  #
152
- def __join_whitespace(*args)
153
- args.flatten.map { |e| e + (e.rstrip == e ? " " : "") }.join
152
+ def __join_whitespace(*args, quote: false)
153
+ args.map do |arg|
154
+ if arg.is_a?(Array)
155
+ __join_whitespace(*arg, quote: arg.count > 1)
156
+ else
157
+ arg = arg.include?(" ") ? sprintf('"%s"', arg) : arg if quote
158
+ arg.strip
159
+ end
160
+ end.join(" ")
154
161
  end
155
162
 
156
163
  def __shell_out_command(*args, **options)
@@ -165,7 +172,7 @@ module Mixlib
165
172
  if options[:input]
166
173
  command.concat "<<'COMMANDINPUT'\n"
167
174
  command.concat __join_whitespace(options[:input])
168
- command.concat "COMMANDINPUT\n"
175
+ command.concat "\nCOMMANDINPUT\n"
169
176
  end
170
177
  end
171
178
 
@@ -1,5 +1,5 @@
1
1
  module Mixlib
2
2
  class ShellOut
3
- VERSION = "3.3.3".freeze
3
+ VERSION = "3.3.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixlib-shellout
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-14 00:00:00.000000000 Z
11
+ date: 2025-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-utils