piotrmurach/pastel

Can pastel work in Jenkins?

ashayh opened this issue · 2 comments

I tried using pastel in Jenkins, but no colors are seen.

The colorize gem works in Jenkins with a few tweaks, but pastel seems to have more features.

It would be great if pastel could work in Jenkins.

Thanks for using the library. Of course we can make it work in Jenkins!

Would you mind showing me the snippet of code you use to color the output in Jenkins?

By default pastel tries to auto detect color support. This is implemented in separate dependency tty-color. It is possible that for some reason pastel decided that Jenkins doesn't support colors. It would be good if you could check this by issuing:

pastel.enabled?

I suspect this is false for some reason, I'd be keen to find out why.

Regardless, pastel allows to enforce coloring by invoking:

pastel = Pastel.new(enabled: true)

Please let me know if that option changes anything.

I'm also working on simple pastel executable which may be of interest to you see. It isn't released yet but that's where your input would be good as well.

Hi,
I was able to make it work in jenkins log with:

pastel = Pastel.new(:enabled => true)
puts pastel.red.on_green.bold('Unicorns!')

Thanks for the support, pastel is really useful!
pastel-cli also looks useful and something I might use.