【发布时间】:2016-06-15 04:49:46
【问题描述】:
我目前正在尝试在 Windows 10 上学习 Ruby on Rails。
我在关注优秀的railstutorial by Michael Hartl。
但是,当我运行 rake test 时出现“gem install win32console”消息(并且缺少颜色),这让我感到困扰。我该如何解决这个问题?
样本输出:
$ 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
我的设置:
基地:Ruby 2.2 Rails Installer for Windows.
使用 Git Bash 运行命令。
我还安装了minitest-reporters gem (step 3.7.1 of tutorial)。
我尝试过的:
首先我运行
gem install win32console但这没有任何效果,即使当我运行gem list时 gem 是可见的。然后我看到win32console is deprecated所以我安装了ansicon。
这也没有效果。无论如何,Windows 10 似乎都支持颜色。
例如。我可以运行 this blog 上的 Hello World 示例puts "\e[34mHello \e[31mWorld\e[0m",它显示蓝色和红色文本,无论是否安装了 ansicon。
但是,rake test输出中的颜色无法正确显示,我仍然收到警告。
【问题讨论】:
-
你把它添加到你的 Gemfile 了吗?
-
啊我没想到!那可能应该解决它。但是,我实际上随后收到一条错误消息:rake aborted! LoadError:无法加载此类文件 - 2.2/Console_ext 。 . .
-
我将按照this blog post的建议尝试重建win32console
标签: ruby-on-rails ruby rake rake-test