pax_global_header00006660000000000000000000000064117532224520014515gustar00rootroot0000000000000052 comment=06b94344e57a5f73f56365a93f3ad1b2aefda5f7 ruby-platform-0.4.0/000077500000000000000000000000001175322245200143215ustar00rootroot00000000000000ruby-platform-0.4.0/README000066400000000000000000000015631175322245200152060ustar00rootroot00000000000000# # Platform # # author: Matt Mower # license: LGPL # # # The Platform library offers a simple, reliable, means of # determining what platform Ruby is running on. Underlying # Platform is the RUBY_PLATFORM constant. This library is # parsing this constant for information. You could easily do # this yourself. We've just taken the hassle out of it for # you and hopefully covered a few of the more unusual cases # you mightn't have thought of yourself. # # On the other hand, if you've got cases we haven't please # mail the authors. # # ==Use # # require 'platform' # # defines # # Platform::OS # :unix # :win32 # :vms # :os2 # :unknown # # Platform::IMPL # :macosx # :linux # :freebsd # :netbsd # :mswin # :cygwin # :mingw # :bccwin # :wince # :vms # :os2 # :unknown # # Platform::ARCH # :x86 # :ia64 # :powerpc # :alpha # :unknown # ruby-platform-0.4.0/lib/000077500000000000000000000000001175322245200150675ustar00rootroot00000000000000ruby-platform-0.4.0/lib/platform.rb000066400000000000000000000045741175322245200172520ustar00rootroot00000000000000# # platform.rb: naive platform detection for Ruby # author: Matt Mower # # == Platform # # Platform is a simple module which parses the Ruby constant # RUBY_PLATFORM and works out the OS, it's implementation, # and the architecture it's running on. # # The motivation for writing this was coming across a case where # # +if RUBY_PLATFORM =~ /win/+ # # didn't behave as expected (i.e. on powerpc-darwin-8.1.0) # # It is hoped that providing a library for parsing the platform # means that we can cover all the cases and have something which # works reliably 99% of the time. # # Please report any anomalies or new combinations to the author(s). # # == Use # # require "platform" # # defines # # Platform::OS (:unix,:win32,:vms,:os2) # Platform::IMPL (:macosx,:linux,:mswin) # Platform::ARCH (:powerpc,:x86,:alpha) # # if an unknown configuration is encountered any (or all) of # these constant may have the value :unknown. # # To display the combination for your setup run # # ruby platform.rb # module Platform # Each platform is defined as # [ /regex/, ::OS, ::IMPL ] # define them from most to least specific and # [ /.*/, :unknown, :unknown ] should always come last # whither AIX, SOLARIS, and the other unixen? PLATFORMS = [ [ /darwin/i, :unix, :macosx ], [ /linux/i, :unix, :linux ], [ /freebsd/i, :unix, :freebsd ], [ /netbsd/i, :unix, :netbsd ], [ /mswin/i, :win32, :mswin ], [ /cygwin/i, :hybrid, :cygwin ], [ /mingw/i, :win32, :mingw ], [ /bccwin/i, :win32, :bccwin ], [ /wince/i, :win32, :wince ], [ /vms/i, :vms, :vms ], [ /os2/i, :os2, :os2 ], [ /solaris/i, :unix, :solaris ], [ /irix/i, :unix, :irix ], [ /.*/, :unknown, :unknown ] ] (*), OS, IMPL = PLATFORMS.find { |p| RUBY_PLATFORM =~ /#{p[0]}/ } # What about AMD, Turion, Motorola, etc..? ARCHS = [ [ /i\d86/, :x86 ], [ /ia64/, :ia64 ], [ /powerpc/, :powerpc ], [ /alpha/, :alpha ], [ /sparc/i, :sparc ], [ /mips/i, :mips ], [ /.*/, :unknown ] ] (*), ARCH = ARCHS.find { |a| RUBY_PLATFORM =~ /#{a[0]}/} end if __FILE__ == $0 puts "Platform OS=#{Platform::OS}, IMPL=#{Platform::IMPL}, ARCH=#{Platform::ARCH}" end ruby-platform-0.4.0/metadata.yml000066400000000000000000000015041175322245200166240ustar00rootroot00000000000000--- !ruby/object:Gem::Specification rubygems_version: 0.8.11 specification_version: 1 name: Platform version: !ruby/object:Gem::Version version: 0.4.0 date: 2005-12-02 00:00:00 +00:00 summary: Hopefully robust platform sensing require_paths: - lib email: self@mattmower.com homepage: http://rubyforge.org/projects/platform/ rubyforge_project: description: autorequire: platform default_executable: bindir: bin has_rdoc: true required_ruby_version: !ruby/object:Gem::Version::Requirement requirements: - - ">" - !ruby/object:Gem::Version version: 0.0.0 version: platform: ruby signing_key: cert_chain: authors: - Matt Mower files: - lib/platform.rb - README test_files: [] rdoc_options: [] extra_rdoc_files: - README executables: [] extensions: [] requirements: [] dependencies: []