mini_portile 0.7.0.rc3 → 0.7.0.rc4
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 +4 -4
- data/.travis.yml +1 -5
- data/CHANGELOG.md +5 -0
- data/lib/mini_portile/mini_portile.rb +9 -8
- data/lib/mini_portile/version.rb +1 -1
- data/test/test_unescaping_commands.rb +12 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13e154f5ec48faf357e723128554adbf010dbb83
|
4
|
+
data.tar.gz: 2df757250068da8befe741764764c2c0d59bef16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3abf6d4f20ed7202f9e821c46ccfc3a06bbbf2d2071108c04fee2a4240c8f277fc8f8f5a78f0be5cf8baad5bcca5622dde6db09813d636017c383709a701de
|
7
|
+
data.tar.gz: 1a6e61c274a691e8a7ec4d4f07c6d50db6c6d9e8992c8c0f657954fe5cc3f4156861387ec7bd1ec2855d7b3464ea2c8a188d133df9b7efb1a7610a49849e5ce8
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,7 @@ require 'digest/md5'
|
|
8
8
|
require 'open-uri'
|
9
9
|
require 'cgi'
|
10
10
|
require 'rbconfig'
|
11
|
+
require 'shellwords'
|
11
12
|
|
12
13
|
# Monkey patch for Net::HTTP by ruby open-uri fix:
|
13
14
|
# https://github.com/ruby/ruby/commit/58835a9
|
@@ -342,12 +343,12 @@ private
|
|
342
343
|
pid = spawn(*args)
|
343
344
|
Process.wait(pid)
|
344
345
|
else
|
345
|
-
if command.kind_of?(Array)
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
346
|
+
redirected = if command.kind_of?(Array)
|
347
|
+
%Q{#{command.map(&:shellescape).join(" ")} > #{log_out.shellescape} 2>&1}
|
348
|
+
else
|
349
|
+
%Q{#{command} > #{log_out.shellescape} 2>&1}
|
350
|
+
end
|
351
|
+
system redirected
|
351
352
|
end
|
352
353
|
|
353
354
|
if $?.success?
|
@@ -497,8 +498,8 @@ private
|
|
497
498
|
end
|
498
499
|
|
499
500
|
def unescape_options_from command
|
500
|
-
return command unless unescape_commands
|
501
|
-
|
501
|
+
return command unless unescape_commands && command.kind_of?(Array)
|
502
|
+
command.map do |opt|
|
502
503
|
if opt =~ /\\/
|
503
504
|
warn "NOTICE: MiniPortile: escaping shell characters is not necessary in MiniPortile 0.7.0+ (\"#{opt}\"). Set the `:unescape_commands` option to false if you actually want to preserve escapes."
|
504
505
|
opt.gsub!(/\\/, "")
|
data/lib/mini_portile/version.rb
CHANGED
@@ -8,10 +8,19 @@ class TestUnescapingCommands < TestCase
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
+
def is_windows
|
12
|
+
!! (RbConfig::CONFIG['target_os'] =~ /mingw32|mswin/)
|
13
|
+
end
|
14
|
+
|
11
15
|
def echo_helper recipe, string
|
12
16
|
FileUtils.mkdir_p File.join(recipe.send(:tmp_path), "workdir")
|
13
|
-
|
14
|
-
|
17
|
+
command = if is_windows
|
18
|
+
["cmd", "/C", "echo", string]
|
19
|
+
else
|
20
|
+
["/usr/bin/env", "echo", string]
|
21
|
+
end
|
22
|
+
recipe.send :execute, "echo", command
|
23
|
+
File.read(Dir.glob("tmp/**/echo.log").first).chop
|
15
24
|
end
|
16
25
|
|
17
26
|
def test_setting_unescape_to_true_unescapes_escaped_strings
|
@@ -21,7 +30,7 @@ class TestUnescapingCommands < TestCase
|
|
21
30
|
|
22
31
|
def test_setting_unescape_to_false_does_not_touch_unescaped_strings
|
23
32
|
recipe = MiniPortile.new("foo", "1.0", :unescape_commands => false)
|
24
|
-
assert_equal
|
33
|
+
assert_equal 'this\tthat', echo_helper(recipe, 'this\tthat')
|
25
34
|
end
|
26
35
|
|
27
36
|
def test_default_unescape_setting_is_true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_portile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.rc4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luis Lavena
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|