Skip to content
Browse files

Add support for IronRuby

  • Loading branch information...
1 parent 6734f23 commit 2062d94dc5424b394ab065883da29694b957ac07 @aslakhellesoy aslakhellesoy committed
Showing with 19 additions and 8 deletions.
  1. +9 −1 bin/cucumber
  2. +10 −7 lib/cucumber/formatters/ansicolor.rb
View
10 bin/cucumber
@@ -1,4 +1,12 @@
#!/usr/bin/env ruby
-$:.unshift(File.dirname(__FILE__) + '/../lib/') unless $:.include?(File.dirname(__FILE__) + '/../lib/')
+require 'rbconfig'
+if Config::CONFIG['sitedir'] =~ /IronRuby/
+ mri = ENV['MRI'] || "C:/ruby"
+ %w{treetop-1.2.4 term-ansicolor-1.0.3 rspec-1.1.11}.each do |gem|
+ $:.unshift(File.join(mri, 'lib/ruby/gems/1.8/gems', gem, 'lib'))
+ end
+end
+# Add .rb to work around an IronRuby bug
+$:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib')
require 'cucumber/cli'
Cucumber::CLI.execute
View
17 lib/cucumber/formatters/ansicolor.rb
@@ -1,22 +1,25 @@
-gem 'term-ansicolor'
+require 'rbconfig'
+
+jruby = defined?(JRUBY_VERSION)
+win = Config::CONFIG['host_os'] =~ /mswin|mingw/
+ironruby = Config::CONFIG['sitedir'] =~ /IronRuby/
+wincolour =
+
+gem 'term-ansicolor' unless ironruby # Rubygems don't work here yet.
# Hack to work around Win32/Console, which bundles a licence-violating, outdated
# copy of term/ansicolor that doesn't implement Term::ANSIColor#coloring=.
# We want the official one!
$LOAD_PATH.each{|path| $LOAD_PATH.unshift($LOAD_PATH.delete(path)) if path =~ /term-ansicolor/}
require 'term/ansicolor'
-require 'rbconfig'
-
-win = Config::CONFIG['host_os'] =~ /mswin|mingw/
-jruby = defined?(JRUBY_VERSION)
begin
- require 'Win32/Console/ANSI' if (win && !jruby)
+ require 'Win32/Console/ANSI' if (win && !jruby && !ironruby)
rescue LoadError
STDERR.puts "You must gem install win32console to get coloured output on this ruby platform (#{PLATFORM})"
::Term::ANSIColor.coloring = false
end
-::Term::ANSIColor.coloring = false if !STDOUT.tty? || (win && jruby)
+::Term::ANSIColor.coloring = false if !STDOUT.tty? || (win && (jruby || ironruby))
module Cucumber
module Formatters

0 comments on commit 2062d94

Please sign in to comment.
Something went wrong with that request. Please try again.