rubyworks / ansi

Set of ANSI Code based classes and modules for Ruby

Home Page:https://rubyworks.github.com/ansi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

win32console deprecated (windows)

erasmux opened this issue · comments

commented

First the issue, even with win32console I can't get colors on windows:

irb(main):001:0> require 'ansi/code'
ansi: 'gem install win32console' to use color on Windows

The reason is that win32console is deprecated (and does not load on recent ruby versions). The good news is that, to the best of the my knowledge, it is no longer needed in ruby 2.0+.

The fix is very simple: don't require 'win32console' when ruby version is 2.0+ (assuming I am not missing anything here).

I verified this by changing code.rb, line 9 to:
if RUBY_PLATFORM =~ /(win32|w32)/ && RUBY_VERSION < "2.0"
This seems to work fine for me.