Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make unix? an instance method.

  • Loading branch information...
commit 4183c89526247e4626ac3142ea106c5b334eeea3 1 parent ae8ae22
@gabebw gabebw authored
View
2  .bundle/config
@@ -0,0 +1,2 @@
+---
+BUNDLE_BIN: bundler_binstubs
View
12 lib/cocaine/command_line.rb
@@ -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
View
6 spec/cocaine/command_line_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.