cloudfoundry/vmc — pull request #46 by schinen (2012-01-25 03:37:10+00:00)
Title: Use rbconfig's RbConfig::CONFIG['host_os'] instead of RUBY_PLATFORM

Hi.

This pull request is small improvement for vmc on jruby on windows.

Currently, vmc on jruby on windows often display ugly output, such as:

>vmc stop -n
Stopping Application 'app01': [0m[32mOK[0m

Because, vmc and gem 'interact' that vmc depends on, use RUBY_PLATFORM constants for detect host os.
but, RUBY_PLATFORM returns incorrect result in some situations. such as using on JRuby.

Ruby 1.9.3 on windows 7(64bit) result:

>ruby --version
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

>ruby -e "puts RUBY_PLATFORM"
i386-mingw32

JRuby 1.6.5.1 (Ruby 1.9 mode) on windows 7(64bit) result:

>jruby --version
jruby 1.6.5.1 (ruby-1.9.2-p136) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_02) [Windows 7-amd64-java]

>jruby -e "puts RUBY_PLATFORM"
java

The better way to detect host os is to use RbConfig::CONFIG['host_os'] instead of RUBY_PLATFORM constants.

Ruby 1.9.3 on windows 7(64bit) result:

>ruby -rrbconfig -e "puts RbConfig::CONFIG['host_os']"
mingw32

JRuby 1.6.5.1 (Ruby 1.9 mode) on windows 7(64bit) result:

>jruby -rrbconfig -e "puts RbConfig::CONFIG['host_os']"
mswin32

The above improvements, vmc will be fixed two problems on jruby on windows.

* vmc display ugly output
* VMC::Cli::ZipUtil.to_dev_null return null device correctly.

Thanks.