[rspec-users] Color output in pagers

2009-12-02 Thread P. A.
Hi.

Is it possible to get color text in less, more or other pagers while
piping the color output of Cucumber and RSpec? If it's not possible is
there any other methods to work with the color text in a console without
permanent “rewinding” the output back to the beginning?

Thanks.
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Re: [rspec-users] Color output in pagers

2009-12-02 Thread Paul Hinze
P. A. li...@ruby-forum.com on 2009-12-02 at 09:08:
 Is it possible to get color text in less, more or other pagers while
 piping the color output of Cucumber and RSpec?

Have a look at these options for `less`:

From LESS(1) man page:
 -r or --raw-control-chars
 
   Causes raw control characters to be displayed.  The default is to
   display control characters using the caret notation; for example, a
   control-A (octal 001) is displayed as ^A.  Warning: when the -r
   option is used, less cannot keep track of the actual appearance of
   the screen (since this depends on how the screen responds to  each
   type of control character).  Thus, various display problems may
   result, such as long lines being split in the wrong place.
 
 -R or --RAW-CONTROL-CHARS
 
   Like  -r,  but  only ANSI color escape sequences are output in
   raw form.  Unlike -r, the screen appearance is maintained correctly
   in most cases. 

You can set default options for less to use via the LESS evironment variable.
As an example, here is the value of mine:

$ echo $LESS
-X -e -R

Cheers,

Paul
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Color output in pagers

2009-12-02 Thread P. A.
I solve it by myself.

To enable piping color output in Cucumber it needs to run the cucumber 
command with the -c option.

$ cucumber -c | less #= color output

To enable piping color output in RSpec it needs to set the RSPEC_COLOR 
environment variable to true.

$ export RSPEC_COLOR=true
$ spec path/to/spec | less #= color output

However, if RSPEC_COLOR is set to true the output to a file will include 
color tags. To prevent it, it needs to unset RSPEC_COLOR.

$ unset RSPEC_COLOR
$ spec path/to/spec  file #= no color tags

Cheers!
-- 
Posted via http://www.ruby-forum.com/.
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] Color output in pagers

2009-12-02 Thread Paul Hinze
P. A. li...@ruby-forum.com on 2009-12-02 at 10:13:
 $ cucumber #= color output
 $ cucumber | less -R #= monochrome

Ah now I see what you're saying.  We're getting burned by this line:

http://github.com/aslakhellesoy/cucumber/blob/master/lib/cucumber/formatter/ansicolor.rb#L20
 Term::ANSIColor.coloring = false if !STDOUT.tty? and not 
 ENV.has_key?(AUTOTEST)

So, we can either feature request an override variable for this line, or
perhaps there is a way to trick a program that STDOUT is actually a tty...?

Paul
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


[rspec-users] color output?

2007-10-02 Thread Jonathan Linowes
does story runner have commandline options ,eg to add color to output?
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] color output?

2007-10-02 Thread David Chelimsky
Not yet. Patches welcome!

On 10/2/07, Jonathan Linowes [EMAIL PROTECTED] wrote:
 does story runner have commandline options ,eg to add color to output?
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] color output?

2007-10-02 Thread David Chelimsky
On 10/2/07, David Chelimsky [EMAIL PROTECTED] wrote:
 Not yet. Patches welcome!

Actually - there's nothing to patch yet - we plan to align the runners
in the near future. So 

Not yet. Coming soon!


 On 10/2/07, Jonathan Linowes [EMAIL PROTECTED] wrote:
  does story runner have commandline options ,eg to add color to output?
  ___
  rspec-users mailing list
  rspec-users@rubyforge.org
  http://rubyforge.org/mailman/listinfo/rspec-users
 

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] color output?

2007-10-02 Thread Jonathan Linowes
feature request:

I have a story with a bunch of different scenarios that vary by just  
one (or two) things. In fact, within the story I've written a method  
that sets up the common set of Givens, and another than checks for a  
common set of results, e.g.

   Scenario no User record do
 given_a_project_with_manager_logged_in

 And **system has no user**, Invitee do |username|
   User.find_by_email(make_email(username)).should be_nil
 end

 When inviting a new user, Invitee do |username|
   @invitee_email = make_email username
   post_via_redirect /projects/[EMAIL PROTECTED]/ 
memberships, :email = @invitee_email,
   response.should be_success
 end

 then_user_should_be_successfully_invited
   end

Actually that's kind of besides the point, except to say the  
scenarios may have a bunch of Givens, but only one or two change from  
one scenario to the next.

So I've highlighted the thing thats different about this scenario  
with asterix (**system has no user**). The next scenario may say  
And **Invitee is registered but not a member of this project**

Feature request: let me use color to highlight the text that  
describes whats different from one scenario to the next


On Oct 2, 2007, at 11:34 AM, David Chelimsky wrote:

 On 10/2/07, David Chelimsky [EMAIL PROTECTED] wrote:
 Not yet. Patches welcome!

 Actually - there's nothing to patch yet - we plan to align the runners
 in the near future. So 

 Not yet. Coming soon!


 On 10/2/07, Jonathan Linowes [EMAIL PROTECTED] wrote:
 does story runner have commandline options ,eg to add color to  
 output?
 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users


 ___
 rspec-users mailing list
 rspec-users@rubyforge.org
 http://rubyforge.org/mailman/listinfo/rspec-users

___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users


Re: [rspec-users] color output?

2007-10-02 Thread David Chelimsky
On 10/2/07, Jonathan Linowes [EMAIL PROTECTED] wrote:
 feature request:

http://rspec.rubyforge.org/community/contribute.html
http://rubyforge.org/tracker/?atid=3152group_id=797func=browse
___
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users