rakit 0.1.15 → 0.1.16

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rakit/shell.rb +10 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc637727b4665b958c91f433891aa981691c48ed2479b6694872a9f04e2f9500
4
- data.tar.gz: 21b98d6fa03bb5f3cf5168875a4de49e86b07cfc46e47a935727502f6dbfb727
3
+ metadata.gz: 7f3d31e09825b67791824b975aab507a6831b6e2028ae4a17db2cb53ebb01840
4
+ data.tar.gz: 9238db6c464534eb481f9e6dd6011768b6b7158ca08887756fdb0f33479437de
5
5
  SHA512:
6
- metadata.gz: c1260630bb1ea88b99e759a21ee558015087d598b5f2a16a7839e7ec99a253aab867fc58b3649b6cbabc941d57ee3ce7b293aa4fe49b183fc7f97b75b5197f9c
7
- data.tar.gz: 208f6f939be467a882b3bed3a552620b46a9c3464b05f9481733b1a8f57933b08328068799323a205110d1bc81e01ef1555991df533802d980248c9e45865ab8
6
+ metadata.gz: f2ffcd048b96ce26a785e8fb05bf95592e8028856795ed88523d940f3c4ec5e4701543ac36573cf055a293523c5706ad3ea44467555c167a2c6d512c8fb6b801
7
+ data.tar.gz: 7a2009c45ea2234696cc6e79673988a86871eac8283bb3b3ed41aecd7f5b0b42744179ffe195953b42194ba443ec45677ef7f97d433896b4d8a75fd35b98b7fa
data/lib/rakit/shell.rb CHANGED
@@ -186,10 +186,18 @@ module Rakit
186
186
  end
187
187
  end
188
188
 
189
- # Run a shell command string (like sh). Builds a Command (sh -c "cmd") and executes it.
189
+ # Run a shell command string. On Unix uses +sh -c+; on Windows uses +COMSPEC+ (usually +cmd.exe /c+)
190
+ # so we do not require a POSIX shell (avoids Errno::ENOENT for +sh+ on plain Windows).
190
191
  # Prints ✓ (green) + cmd on success, or ✗ (red) + cmd then stdout/stderr on failure. Returns the Command with result fields set.
191
192
  def self.run(cmd)
192
- command = Command.new(name: "sh", args: ["-c", cmd.to_s], working_directory: "")
193
+ command =
194
+ if Gem.win_platform?
195
+ exe = ENV["COMSPEC"].to_s.strip
196
+ exe = "cmd.exe" if exe.empty?
197
+ Command.new(name: exe, args: ["/c", cmd.to_s], working_directory: "")
198
+ else
199
+ Command.new(name: "sh", args: ["-c", cmd.to_s], working_directory: "")
200
+ end
193
201
  result = CommandService.execute(command)
194
202
  if result.exit_status == 0
195
203
  puts "#{CHECK} #{cmd}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - rakit