lib/user.rb in sprout-0.5.0 vs lib/user.rb in sprout-0.5.9
- old
+ new
@@ -18,14 +18,14 @@
if(impl.nil?)
impl = Platform::IMPL
end
if(os == :win32 && impl == :vista)
@@user = VistaUser.new
+ elsif(os == :win32 && impl == :cygwin)
+ @@user = CygwinUser.new
elsif(os == :win32)
@@user = WinUser.new
- elsif(os == :unix && impl == :cygwin)
- @@user = CygwinUser.new
elsif(os == :unix && impl == :macosx)
@@user = OSXUser.new
elsif(os == :unix && impl == :linux)
@@user = UnixUser.new
else
@@ -124,18 +124,21 @@
else
return Platform::IMPL
end
end
+ def get_process_runner(command)
+ return ProcessRunner.new(command)
+ end
+
def execute(tool, options='')
tool = Sprout.load(tool)
target = tool.archive_path
Log.puts(">> Execute: #{File.basename(target)} #{options}")
- runner = CommandRunner.new("#{clean_path(target)} #{options}")
- runner.run
+ runner = get_process_runner("#{clean_path(target)} #{options}")
result = runner.read
- error = runner.readError.to_s
+ error = runner.read_err
if(result.size > 0)
Log.puts result
end
if(error.size > 0)
raise ExecutionError.new("[ERROR] #{error}")
@@ -218,9 +221,15 @@
return name.capitalize
end
end
class CygwinUser < WinUser
+ def clean_path(path)
+ if(path.index(' '))
+ return %{'#{path}'}
+ end
+ return path
+ end
end
class VistaUser < WinUser
def home
profile = ENV['USERPROFILE']