Permalink
Browse files

Make unix? an instance method.

  • Loading branch information...
1 parent ae8ae22 commit 4183c89526247e4626ac3142ea106c5b334eeea3 Gabe Berke-Williams committed Feb 3, 2012
Showing with 11 additions and 9 deletions.
  1. +2 −0 .bundle/config
  2. +6 −6 lib/cocaine/command_line.rb
  3. +3 −3 spec/cocaine/command_line_spec.rb
View
@@ -0,0 +1,2 @@
+---
+BUNDLE_BIN: bundler_binstubs
@@ -41,6 +41,10 @@ def run
output
end
+ def unix?
+ (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/).nil?
+ end
+
private
def with_modified_path
@@ -79,7 +83,7 @@ def interpolation(vars, key)
def shell_quote(string)
return "" if string.nil?
- if self.class.unix?
+ if unix?
if string.empty?
"''"
else
@@ -91,11 +95,7 @@ def shell_quote(string)
end
def bit_bucket
- self.class.unix? ? "2>/dev/null" : "2>NUL"
- end
-
- def self.unix?
- (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/).nil?
+ unix? ? "2>/dev/null" : "2>NUL"
end
end
end
@@ -143,17 +143,17 @@
end
it "detects that the system is unix" do
- Cocaine::CommandLine.unix?.should be_true
+ Cocaine::CommandLine.new("convert").unix?.should be_true
end
it "detects that the system is windows" do
on_windows!
- Cocaine::CommandLine.unix?.should be_false
+ Cocaine::CommandLine.new("convert").unix?.should be_false
end
it "detects that the system is windows (mingw)" do
on_mingw!
- Cocaine::CommandLine.unix?.should be_false
+ Cocaine::CommandLine.new("convert").unix?.should be_false
end
it "logs the command to a supplied logger" do

0 comments on commit 4183c89

Please sign in to comment.