checking OS?

1 view
Skip to first unread message

Matt Williams

unread,
Jul 24, 2008, 2:06:19 PM7/24/08
to columbusrb
Could someone on OSX do the following for me?

1. load irb
2. execute the following:
require 'rconfig'
p Config::CONFIG["target_os"]


Thanks

If you're curious, I'm porting xrefresh-server to linux (it's on OSX
right now) -- it is for a "windows-only" firefox plugin which will
update a tab containing a website/url when a file which is a dependency
for that url is changed/added/updated.

Thanks again,
Matt

Matt Darby

unread,
Jul 24, 2008, 2:10:11 PM7/24/08
to colum...@googlegroups.com
On Jul 24, 2008, at 2:06 PM, Matt Williams wrote:

>
> Could someone on OSX do the following for me?
>
> 1. load irb
> 2. execute the following:
> require 'rconfig'
> p Config::CONFIG["target_os"]

mdarby@macbook:~:
irb
>
> require 'rconfig'
LoadError: no such file to load -- rconfig
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`require'
from (irb):1
from :0
>> exit
mdarby@macbook:~: ./script/console
Loading development environment (Rails 2.1.0)
>> require 'rconfig'
MissingSourceFile: no such file to load -- rconfig
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in
`require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
active_support/dependencies.rb:509:in `require'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
active_support/dependencies.rb:354:in `new_constants_in'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/
active_support/dependencies.rb:509:in `require'
from (irb):1
>> exit
mdarby@macbook:~: gem install rconfig
ERROR: could not find gem rconfig locally or in a repository

Joe OBrien

unread,
Jul 24, 2008, 2:11:46 PM7/24/08
to colum...@googlegroups.com
[objo-laptop | scripsafe ] $ irb

>> require 'rconfig'
LoadError: no such file to load -- rconfig

I didn't see it in the gems list.


-Joe
_______________
Joe O'Brien, artisan
EdgeCase
theedgecase.com

614/453-5527

On Jul 24, 2008, at 2:06 PM, Matt Williams wrote:

Ryan Briones

unread,
Jul 24, 2008, 2:13:22 PM7/24/08
to colum...@googlegroups.com
I think you meant 'rbconfig' instead of 'rconfig':

/Users/ryanbriones ~ irb
>> require 'rbconfig'
=> false
>> Config::CONFIG['target_os']
=> "darwin9.0"
--
Ryan Carmelo Briones

Ryan Briones

unread,
Jul 24, 2008, 2:14:15 PM7/24/08
to colum...@googlegroups.com
BTW, i'm on OS X Leopard.
--
Ryan Carmelo Briones

Matt Williams

unread,
Jul 24, 2008, 2:58:44 PM7/24/08
to colum...@googlegroups.com
Yes, sorry, I fat-fingered it.

Thanks,
Matt

Matt Williams

unread,
Jul 24, 2008, 2:59:01 PM7/24/08
to colum...@googlegroups.com
I'm sorry, I meant rbconfig
Matt

Matt Williams

unread,
Jul 24, 2008, 2:59:17 PM7/24/08
to colum...@googlegroups.com
I'm sorry, I meant rbconfig

thanks,
matt

ryanmsmith

unread,
Jul 25, 2008, 8:29:27 AM7/25/08
to Columbus Ruby Brigade
irb(main):003:0> require 'rbconfig'
=> true
irb(main):004:0> p Config::CONFIG["target_os"]
"darwin9.2.0"
=> nil
irb(main):005:0>

OS X 10.5.4

-Ryan


Rob Biedenharn

unread,
Jul 25, 2008, 7:41:06 PM7/25/08
to colum...@googlegroups.com
On Jul 24, 2008, at 2:06 PM, Matt Williams wrote:

That might not give you all the info you need. For example, the ruby
on Leopard is a universal binary (compare CFLAGS, LDFLAGS, and
target_cpu to the fact that my machine is an Intel Mac).

irb> pp Config::CONFIG.select{|name,value|name=~/target|FLAG/}
[["target", "powerpc-apple-darwin9.0"],
["target_alias", ""],
["XCFLAGS", " -DRUBY_EXPORT"],
["target_vendor", "apple"],
["YFLAGS", ""],
["LDFLAGS", "-L. -arch ppc -arch i386"],
["DLDFLAGS", ""],
["target_cpu", "powerpc"],
["target_os", "darwin9.0"],
["RPATHFLAG", ""],
["ASFLAGS", ""],
["LIBRUBY_DLDFLAGS",
"-install_name /System/Library/Frameworks/Ruby.framework/Versions/
1.8/usr/lib/libruby.1.dylib -current_version 1.8.6 -
compatibility_version 1.8"],
["XLDFLAGS", ""],
["CCDLFLAGS", " -fno-common"],
["CFLAGS", "-arch ppc -arch i386 -Os -pipe -fno-common"],
["LIBPATHFLAG", " -L\"%s\""],
["CPPFLAGS", ""],
["OUTFLAG", "-o "],
["ARCH_FLAG", ""]]
=> nil

-Rob

abe...@wcnet.org

unread,
Jul 25, 2008, 8:23:47 PM7/25/08
to colum...@googlegroups.com
class Platform
def self.detect
if RUBY_PLATFORM =~ /darwin/i
{ :os => "unix", :implementation => "macosx" }
elsif RUBY_PLATFORM =~ /linux/i
{ :os => "unix", :implementation => "linux" }
elsif RUBY_PLATFORM =~ /mswin/i
{ :os => "win32", :implementation => "mswin" }
elsif RUBY_PLATFORM =~ /cygwin/i
{ :os => "unix", :implementation => "cygwin" }
elsif RUBY_PLATFORM =~ /mingw/i
{ :os => "win32", :implementation => "mingw" }
elsif RUBY_PLATFORM =~ /solaris/i
{ :os => "unix", :implementation => "solaris" }
else
{ :os => "unknown", :implementation => "unknown" }
end
end
end

~Aaron

---------------------------------------------
This message was sent using Endymion MailMan.
http://www.endymion.com/products/mailman/


Reply all
Reply to author
Forward
0 new messages