简体   繁体   中英

How to fix win32console message in rake test output?

I'm currently trying to learn Ruby on Rails on Windows 10 .

I'm following the excellent railstutorial by Michael Hartl .

However, I'm getting bugged by the 'gem install win32console' message (and lack of colour) appearing when I run rake test . How can I fix this?

Sample output:

$ bundle exec rake test
ansi: 'gem install win32console' to use color on Windows
Started

  3/3: [===================================] 100% Time: 00:00:00, Time: 00:00:00

Finished in 0.35885s
3 tests, 6 assertions, 0 failures, 0 errors, 0 skips

My setup:

Base: Ruby 2.2 Rails Installer for Windows .
Running commands using Git Bash .
I also have the minitest-reporters gem installed ( step 3.7.1 of tutorial ).

What I've tried:

  1. First I ran gem install win32console bu this had no effect, even though the gem is visible when I run gem list .

  2. Then I saw win32console is deprecated so I installed ansicon .
    This also had no effect. And it seems colours are supported on Windows 10 anyway.
    Eg I can run the Hello World example puts "\\e[34mHello \\e[31mWorld\\e[0m" found on this blog and it shows blue and red text, whether ansicon is installed or not.
    However, colours won't show up correctly in rake test output and I still get the warning.

Hooray got it working!

In the end your comment Jordan plus the suggestions on Paul's Perambulations got me there.

Steps taken, for anyone else stuck on this:

  1. Download and unzip win32console source
  2. Install specific (older) versions of the dependencies:
    • gem install rake -v 10.4.2
    • gem install rake-compiler -v 0.9.9 (this is current latest anyway)
    • gem install hoe -v 3.7.0
  3. Run rake _10.4.2_ gem in the win32console source directory (to use correct version)
  4. Run gem install pkg/win32console-1.3.2.gem (had to change version number and flip the slash around from original instructions)
  5. Add gem "win32console", '1.3.2' to Gemfile
  6. Go back to project directory and run bundle install
  7. Finally run bundle exec rake test - the info message has disappeared and colours are showing correctly!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM