diff --git a/.bundle/config b/.bundle/config new file mode 100644 index 0000000..4ee01a8 --- /dev/null +++ b/.bundle/config @@ -0,0 +1,2 @@ +--- +BUNDLE_BIN: bundler_binstubs diff --git a/lib/cocaine/command_line.rb b/lib/cocaine/command_line.rb index f181383..538ea61 100644 --- a/lib/cocaine/command_line.rb +++ b/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 diff --git a/spec/cocaine/command_line_spec.rb b/spec/cocaine/command_line_spec.rb index ab1aa37..1aeefa2 100644 --- a/spec/cocaine/command_line_spec.rb +++ b/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