New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Windows color support properly #356

Merged
merged 3 commits into from Nov 26, 2013

Conversation

Projects
None yet
2 participants
@ddfreyne
Member

ddfreyne commented Nov 25, 2013

This is a potential fix for #352. It makes sure 'Win32/Console/ANSI' is required as soon as possible, i.e. when the cli.rb file is loaded. (This should have been here all along, because it does not really make sense to load color support when setting up cleaning streams.)

Minor changes:

  • Created Nanoc.on_windows? method that is referenced everywhere else, so that the RUBY_PLATFORM check only happens in a single location
  • Added many more Windows-ish platforms to the RUBY_PLATFORM check (not strictly necessary, but better to do it right, I figured)

@raphinesse Can you verify whether this patch works on Windows?

Show outdated Hide outdated lib/nanoc.rb
@raphinesse

This comment has been minimized.

Show comment
Hide comment
@raphinesse

raphinesse Nov 25, 2013

Contributor

Looks good, I have colors! 😀

Two small changes to Nanoc::TestHelpers setup and teardown:

# Go quiet
unless ENV['QUIET'] == 'false'
  @orig_stdout = $stdout
  @orig_stderr = $stderr

  $stdout = StringIO.new
  $stderr = StringIO.new
end
# Go unquiet
unless ENV['QUIET'] == 'false'
  $stdout = @orig_stdout
  $stderr = @orig_stderr
end

I also get following warning when running Nanoc::Extra::Deployers::FogTest#test_run:

←[33m[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.←[0m

But that is because their Logger seems to use STDOUT directly, otherwise the output wouldn't appear at all.

Contributor

raphinesse commented Nov 25, 2013

Looks good, I have colors! 😀

Two small changes to Nanoc::TestHelpers setup and teardown:

# Go quiet
unless ENV['QUIET'] == 'false'
  @orig_stdout = $stdout
  @orig_stderr = $stderr

  $stdout = StringIO.new
  $stderr = StringIO.new
end
# Go unquiet
unless ENV['QUIET'] == 'false'
  $stdout = @orig_stdout
  $stderr = @orig_stderr
end

I also get following warning when running Nanoc::Extra::Deployers::FogTest#test_run:

←[33m[fog][WARNING] Unable to load the 'unf' gem. Your AWS strings may not be properly encoded.←[0m

But that is because their Logger seems to use STDOUT directly, otherwise the output wouldn't appear at all.

@ddfreyne

This comment has been minimized.

Show comment
Hide comment
@ddfreyne

ddfreyne Nov 26, 2013

Member

@raphinesse Added your #setup/#teardown fix and removed the double cygwin in the RUBY_PLATFORM regex. Do I get a 👍 from you now? ;)

Member

ddfreyne commented Nov 26, 2013

@raphinesse Added your #setup/#teardown fix and removed the double cygwin in the RUBY_PLATFORM regex. Do I get a 👍 from you now? ;)

@raphinesse

This comment has been minimized.

Show comment
Hide comment
@raphinesse

raphinesse Nov 26, 2013

Contributor

Looks good, yes 👍 Really looking forward to using nanoc with color support 😀

Contributor

raphinesse commented Nov 26, 2013

Looks good, yes 👍 Really looking forward to using nanoc with color support 😀

ddfreyne added a commit that referenced this pull request Nov 26, 2013

Merge pull request #356 from nanoc/bug/windows-colors
Load Windows color support properly

@ddfreyne ddfreyne merged commit b6a24a3 into release-3.6.x Nov 26, 2013

@ddfreyne ddfreyne deleted the bug/windows-colors branch Nov 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment