lib/nanoc/cli.rb in nanoc-3.6.6 vs lib/nanoc/cli.rb in nanoc-3.6.7
- old
+ new
@@ -6,10 +6,17 @@
$stderr.puts e
$stderr.puts "If you are using a Gemfile, make sure that the Gemfile contains nanoc ('gem \"nanoc\"')."
exit 1
end
+if Nanoc.on_windows?
+ begin
+ require 'Win32/Console/ANSI'
+ rescue LoadError
+ end
+end
+
module Nanoc::CLI
module Commands
end
@@ -189,13 +196,11 @@
# @return [Boolean] true if color support is present, false if not
def self.enable_ansi_colors?(io)
return false if !io.tty?
- begin
- require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /mswin|mingw/
- rescue LoadError
- return false
+ if Nanoc.on_windows?
+ return defined?(::Win32::Console::ANSI)
end
return true
end