diff --git a/examples/ex.rb b/examples/ex.rb index 2d8e4c3..16fe0b0 100644 --- a/examples/ex.rb +++ b/examples/ex.rb @@ -4,9 +4,10 @@ include WhichRuby -%w{jruby ruby ree rubinius}.each do |ru| +puts "running on #{ruby_type} #{ruby_description}" +%w{jruby ruby rubinius}.each do |ru| puts "checking #{ru}?" check = send(:"#{ru}?") puts " #{ru} is #{check}" - puts " with version #{version}" if check + puts " with version #{ruby_version}" if check end \ No newline at end of file diff --git a/lib/which_ruby.rb b/lib/which_ruby.rb index c91fc7f..cb51d72 100644 --- a/lib/which_ruby.rb +++ b/lib/which_ruby.rb @@ -1,10 +1,10 @@ module WhichRuby @@mappings = { - :rbx => :rubinious, + :rubinius => :rbx, } - @@rubies = [:ruby, :jruby, :rubinius, :ree] + @@rubies = [:ruby, :jruby, :rbx] def ruby_type return :"#{ruby_engine.downcase}" unless ruby_engine.nil? @@ -73,7 +73,7 @@ def strip_sym(sym) end def contains_ruby_type?(name) - @@rubies.include? name + @@rubies.include?(@@mappings[name] || name) end end \ No newline at end of file diff --git a/readme.textile b/readme.textile index eaae72c..ec3d3f4 100644 --- a/readme.textile +++ b/readme.textile @@ -1,10 +1,10 @@ h2. About -*which_ruby* is a simple helper for checking running Ruby engine. +*which_ruby* is a simple helper for checking running Ruby engines. h2. Usage -include WhichRuby: +include WhichRuby in irb:
 rvm use jruby
 gem install which_ruby
diff --git a/test/test_which_ruby.rb b/test/test_which_ruby.rb
index 2a68436..44e4f50 100644
--- a/test/test_which_ruby.rb
+++ b/test/test_which_ruby.rb
@@ -16,7 +16,7 @@ def test_r_type_from_engine
   
   def test_r_type_from_description
     @helper.stubs(:ruby_engine).returns(nil)
-    @helper.stubs(:ruby_description).returns("ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10.2.0]")
+    @helper.stubs(:ruby_description).returns("ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-darwin10.4.0], MBARI 0x6770, Ruby Enterprise Edition 2010.02")
     
     assert_equal(:ruby, @helper.ruby_type)
   end
@@ -30,6 +30,11 @@ def test_which_r?
     assert_equal(true, @helper.r?(:ruby))
   end
   
+  def test_which_r_with_mapping?
+    @helper.stubs(:ruby_engine).returns("rbx")
+    assert_equal(true, @helper.r?(:rubinius))
+  end
+  
   def test_respond_to?
     @helper.stubs(:ruby_engine).returns("jruby")
     assert_equal(true, @helper.respond_to?(:jruby?))
diff --git a/which_ruby.gemspec b/which_ruby.gemspec
index 7c6ee5b..aebe225 100644
--- a/which_ruby.gemspec
+++ b/which_ruby.gemspec
@@ -1,13 +1,13 @@
 Gem::Specification.new do |s|
   s.name = 'which_ruby'
-  s.version = '0.0.1'
+  s.version = '0.0.2'
   s.rubyforge_project = 'none'
 
   s.author = 'Peter Schröder'
   s.description = 'which_ruby is a simple helper for checking running Ruby engine'
   s.email = 'phoetmail@googlemail.com'
   s.homepage = 'http://github.com/phoet/which_ruby'
-  s.summary = 'include which_ruby module and use is_ruby_type? or ruby_type'
+  s.summary = 'include which_ruby module and use is_ruby_type? or ruby_type or jruby?'
 
   s.has_rdoc = true
   s.rdoc_options = ['-a', '--inline-source', '--charset=UTF-8']