Browse files

I knew I had forgotten something

  • Loading branch information...
1 parent e0f4f9e commit d06cb6ae855cd5a5b3299d3258601b1610b68bf9 @aslakhellesoy aslakhellesoy committed Nov 19, 2008
Showing with 16 additions and 24 deletions.
  1. +1 −8 bin/cucumber
  2. +2 −3 lib/cucumber.rb
  3. +13 −13 lib/cucumber/formatters/ansicolor.rb
View
9 bin/cucumber
@@ -1,12 +1,5 @@
#!/usr/bin/env ruby
-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
+# Add '.rb' to work around a bug in IronRuby's File#dirname
$:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib')
require 'cucumber/cli'
View
5 lib/cucumber.rb
@@ -1,5 +1,7 @@
$:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
+
+require 'cucumber/platform'
require 'rubygems'
require 'treetop/runtime'
require 'treetop/ruby_extensions'
@@ -14,9 +16,6 @@
require 'cucumber/cli'
require 'cucumber/broadcaster'
-$KCODE='u'
-require 'jcode'
-
module Cucumber
LANGUAGE_FILE = File.expand_path(File.dirname(__FILE__) + '/cucumber/languages.yml')
View
26 lib/cucumber/formatters/ansicolor.rb
@@ -1,24 +1,24 @@
-require 'rbconfig'
+gem 'term-ansicolor'
-jruby = defined?(JRUBY_VERSION)
-win = Config::CONFIG['host_os'] =~ /mswin|mingw/
-ironruby = Config::CONFIG['sitedir'] =~ /IronRuby/
-
-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'
-begin
- 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
+if $CUCUMBER_WINDOWS_MRI
+ begin
+ require 'Win32/Console/ANSI'
+ rescue LoadError
+ STDERR.puts "You must gem install win32console to get coloured output on this ruby platform (#{PLATFORM})"
+ Term::ANSIColor.coloring = false
+ end
+else
+ $KCODE='u'
end
-::Term::ANSIColor.coloring = false if !STDOUT.tty? || (win && (jruby || ironruby))
+
+Term::ANSIColor.coloring = false if !STDOUT.tty? || ($CUCUMBER_WINDOWS && !$CUCUMBER_WINDOWS_MRI)
+require 'jcode'
module Cucumber
module Formatters

0 comments on commit d06cb6a

Please sign in to comment.