sprout 1.0.0.pre → 1.0.1.pre
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.
Potentially problematic release.
This version of sprout might be problematic. Click here for more details.
- data/lib/sprout/system/win_nix_system.rb +8 -1
- data/lib/sprout/version.rb +1 -1
- data/test/unit/win_nix_system_test.rb +12 -6
- metadata +2 -2
@@ -30,12 +30,19 @@ module Sprout::System
|
|
30
30
|
|
31
31
|
def win_nix_home
|
32
32
|
path = win_home.split('\\').join("/")
|
33
|
-
path
|
33
|
+
return path if File.exists?(path)
|
34
|
+
|
34
35
|
parts = path.split("/")
|
35
36
|
path = parts.shift().downcase + "/" + parts.join("/")
|
37
|
+
path = path.split(":").join("")
|
36
38
|
"/cygdrive/" + path
|
37
39
|
end
|
38
40
|
|
41
|
+
private
|
42
|
+
|
43
|
+
def mingw_home_exists? path
|
44
|
+
File.exists?(path)
|
45
|
+
end
|
39
46
|
end
|
40
47
|
end
|
41
48
|
|
data/lib/sprout/version.rb
CHANGED
@@ -6,20 +6,26 @@ class WinNixSystemTest < Test::Unit::TestCase
|
|
6
6
|
context "new windows nix (cygwin/mingw) system" do
|
7
7
|
|
8
8
|
setup do
|
9
|
-
@
|
10
|
-
@
|
9
|
+
@sys = Sprout::System::WinNixSystem.new
|
10
|
+
@sys.stubs(:win_home).returns 'C:\Documents and Settings\Some System'
|
11
11
|
end
|
12
12
|
|
13
|
-
should "find home" do
|
14
|
-
|
13
|
+
should "find home on cygwin" do
|
14
|
+
File.stubs(:exists?).returns false
|
15
|
+
assert_equal '/cygdrive/c/Documents and Settings/Some System', @sys.home
|
16
|
+
end
|
17
|
+
|
18
|
+
should "find home on mingw" do
|
19
|
+
File.stubs(:exists?).returns true
|
20
|
+
assert_equal 'C:/Documents and Settings/Some System', @sys.home
|
15
21
|
end
|
16
22
|
|
17
23
|
should "wrap paths that have spaces with escaped quotes" do
|
18
|
-
assert_equal "\'foo bar\'", @
|
24
|
+
assert_equal "\'foo bar\'", @sys.clean_path("foo bar")
|
19
25
|
end
|
20
26
|
|
21
27
|
should "not modify paths that have no spaced" do
|
22
|
-
assert_equal "foobar", @
|
28
|
+
assert_equal "foobar", @sys.clean_path("foobar")
|
23
29
|
end
|
24
30
|
end
|
25
31
|
end
|