win32console version 1.3.0.beta2 has been released! * <http://rubyforge.org/projects/winconsole> * <http://github.com/luislavena/win32console> * <http://rdoc.info/projects/luislavena/win32console> Win32::Console allows controling the windows command line terminal thru an OO-interface. This allows you to query the terminal (find its size, characters, attributes, etc). The interface and functionality should be identical to Perl's counterpart. A port of Perl's Win32::Console and Win32::Console::ANSI modules. This gem packages Gonzalo Garramuno's Win32::Console project, and includes a compiled binary for speed. The Win32::Console project's home can be found at: http://rubyforge.org/projects/win32console How to install: Since this is a prerelease gem, you need updated version of RubyGems (greater than 1.3.4) gem install win32console --prerelease This will install the latest available version from RubyGems.org Changes: ### 1.3.0.beta2 / 2010-03-07 * Enhancements * Redirect STDERR to be processed also for ANSI codes. Closes GH-4 * Allow ECHO to be displayed [jloveces]
on 2010-03-07 16:21
on 2010-03-08 02:13
On Sun, Mar 7, 2010 at 11:20 PM, Luis Lavena <luislavena@gmail.com> wrote: > win32console version 1.3.0.beta2 has been released! > Hi Luis, thanks for this gem. I've been waiting something like this. Quick q: does it implement all the features listed here http://www.xav.com/perl/site/lib/Win32/Console.html ? thanks and best regards -botp
on 2010-03-08 09:05
On Mar 8, 2:10 am, botp <botp...@gmail.com> wrote: > On Sun, Mar 7, 2010 at 11:20 PM, Luis Lavena <luislav...@gmail.com> wrote: > > win32console version 1.3.0.beta2 has been released! > > Hi Luis, thanks for this gem. I've been waiting something like this. > Quick q: does it implement all the features listed herehttp://www.xav.com/perl/site/lib/Win32/Console.html ? > > thanks and best regards -botp win32console gem is a wrapper around this project: http://rubyforge.org/projects/win32console/ Which is a direct port from Perl. That means API-wise should be pretty similar. However, I've asked before what is the usage of win32console here: http://blog.mmediasys.com/2009/12/17/win32console-upcoming-changes-and-feedback/ And people responded that they mainly use to mimic ANSI coloring in the terminal, not all the Win32::Console functionality. Also, in this release it no longer automates the codepage conversion, which will need to be done manually. See here: http://github.com/luislavena/win32console/blob/master/History.txt#L16-24 HTH,
on 2010-03-08 21:27
> Win32::Console allows controling the windows command line terminal > thru an OO-interface. This allows you to query the terminal (find > its size, characters, attributes, etc). The interface and functionality > should be identical to Perl's counterpart. I noticed it doesn't seem to do "too much" for colored specs. 16) â†[31mActiveRecord::StatementInvalid in 'Abc should create a new instance given valid attributes' Could not find table 'abcs'â†[0m E:/dev/ruby/old/spork/test_rails/spec/models/abc_spec.rb:11:in `block (2 levels) in <top (required)>' Any guess as to who's to blame there? Thanks. -rp E:\dev\ruby\old\spork\test_rails\spec>cat spec.opts --colour --format progress --loadby mtime --reverse
on 2010-03-09 08:31
On Mar 8, 9:27 pm, Roger Pack <rogerpack2...@gmail.com> wrote: > Could not find table 'abcs'â†[0m > E:/dev/ruby/old/spork/test_rails/spec/models/abc_spec.rb:11:in `block (2 > levels) in <top (required)>' > > Any guess as to who's to blame there? Are you using autospec? If so, is not win32console, as I mentioned to you before. This as proven to work for standard Windows prompt without any issue, and I use it for "rake spec" in rake-compiler: C:\Users\Luis\Projects\oss\rake-compiler>type spec\spec.opts --colour --format nested --loadby mtime
on 2010-03-09 09:28
On 09/03/2010 07:30, Luis Lavena wrote: > Are you using autospec? If so, is not win32console, as I mentioned to > you before. The RSpec people seem to think it might be a win32console problem: http://j.mp/a4XYT3 Charles
on 2010-03-09 09:45
On Mar 9, 9:28 am, Charles Roper <reac...@charlesroper.co.uk> wrote: > On 09/03/2010 07:30, Luis Lavena wrote: > > > Are you using autospec? If so, is not win32console, as I mentioned to > > you before. > > The RSpec people seem to think it might be a win32console problem: > > http://j.mp/a4XYT3 > No, is not win32console, I've emailed rspec team before on this: http://rubyforge.org/pipermail/rspec-devel/2010-January/005341.html No answer. I've described there what could be the root of the issue. Does a previous version of win32console result in the same issue? If so, then is not win32console.
on 2010-03-09 13:56
On 09/03/2010 08:45, Luis Lavena wrote: > > No, is not win32console, I've emailed rspec team before on this: > > http://rubyforge.org/pipermail/rspec-devel/2010-January/005341.html > > No answer. I've described there what could be the root of the issue. > > Does a previous version of win32console result in the same issue? > > If so, then is not win32console. Thanks for the confirmation, Luis. I've updated the ticket: http://j.mp/a4XYT3 Charles
on 2010-03-09 14:49
> No, is not win32console, I've emailed rspec team before on this: > > http://rubyforge.org/pipermail/rspec-devel/2010-January/005341.html Thanks for the link. Appears it is a bug with spec since autospec doesn't show colors but normal "spec" does. Thanks for your work on this. -rp
on 2010-03-10 05:35
On Tue, Mar 9, 2010 at 7:49 AM, Roger Pack <rogerpack2005@gmail.com> wrote: > -rp > -- > Posted via http://www.ruby-forum.com/. > > If all of this code still works the way I remember it, this is actually easy to fix. Last time I checked, autospec relies on autotest, so you should be able to just require win32console in your ~/.autotest file. autospec runs the rspec framework as a subprocess. It parses the results, then spits them out on the screen. On posix systems, the escape codes work, because posix systems are designed to handle them. In Windows, the escape codes just get dumped to stdout, so you have to make sure the current process knows how to handle them. I hope that makes sense.
on 2010-03-10 09:35
On Mar 10, 5:34 am, Gordon Thiesfeld <gthiesf...@gmail.com> wrote: > > Thanks for your work on this. > handle them. In Windows, the escape codes just get dumped to stdout, > so you have to make sure the current process knows how to handle them. > > I hope that makes sense. It does, however, as I mentioned in the RSpec-dev mailing list post, trying to recreate it just end prematurely, doesn't complete. Ignoring for a second that ZenTest/autospec changes the first two lines of the autotest rubygem stub, check the following example: #ruby ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32] #gem list: win32console (1.3.0.beta2, 1.3.0.beta1) rspec (1.3.0) ZenTest (4.2.1) # ~/.autotest STDOUT.puts "OUT: THIS IS ~/.autotest file" STDERR.puts "ERR: THIS IS ~/.autotest file" require 'win32console' puts "$stdout.redirected? #{$stdout.redirected?}" puts "$stderr.redirected? #{$stderr.redirected?}" # rake-compiler/.autotest STDOUT.puts "OUT: THIS IS rake-compiler/.autotest file" STDERR.puts "ERR: THIS IS rake-compiler/.autotest file" require 'win32console' puts "$stdout.redirected? #{$stdout.redirected?}" puts "$stderr.redirected? #{$stderr.redirected?}" Running autospec in my folder, output this: C:\Users\Luis\Projects\oss\rake-compiler>autospec (Not running features. To run features in autotest, set AUTOFEATURE=true.) loading autotest/rspec OUT: THIS IS ~/.autotest file ERR: THIS IS ~/.autotest file $stdout.redirected? false $stderr.redirected? false OUT: THIS IS rake-compiler/.autotest file ERR: THIS IS rake-compiler/.autotest file $stdout.redirected? false $stderr.redirected? false C:\Users\Luis\Tools\Ruby\ruby-1.8.6-p398-i386-mingw32\bin\ruby C:/ Users/Luis/.gem/ruby/x86-mingw32/1.8/gems/rspec-1.3.0/bin/spec -- autospec C:/Users/Luis/Projects/oss/rake-compiler/spec/lib/rake/ javaextensiontask_spec.rb C:/Users/Luis/Projects/oss/rake-compiler/ spec/lib/rake/extensiontask_spec.rb -O spec/spec.opts And from there beautiful colors (well, not beautiful, but seems it works). The following version also works: ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] But NOT 1.9.1: C:\Users\Luis\Projects\oss\rake-compiler>autospec loading autotest/rspec OUT: THIS IS ~/.autotest file ERR: THIS IS ~/.autotest file $stdout.redirected? false $stderr.redirected? false OUT: THIS IS rake-compiler/.autotest file ERR: THIS IS rake-compiler/.autotest file $stdout.redirected? false $stderr.redirected? false C:\Users\Luis\Tools\Ruby\ruby-1.9.1-p378-i386-mingw32\bin\ruby C:/ Users/Luis/.gem/ruby/x86-mingw32/1.9.1/gems/rspec-1.3.0/bin/spec -- autospec C:/Users/Luis/Projects/oss/rake-compiler/spec/lib/rake/ extensiontask_spec.rb C:/Users/Luis/Projects/oss/rake-compiler/spec/ lib/rake/javaextensiontask_spec.rb -O spec/spec.opts Rake::ExtensionTask #new (basic) WARNING: You're cross-compiling a binary extension for JRuby, but are using another interpreter. If your Java classpath or extension dir settings are not correctly detected, then either check the appropriate environment variables or execute the Rake compilation task using the JRuby interpreter. (e.g. `jruby -S rake compile:java`) ==== Stops there, all without colors. Now, running rake spec or spec -c spec display all colors too, so is something around autospec/autotest and Ruby 1.9 ==== Hope I explained better this time since seems nobody answered on RSpec- dev maybe my english wasn't good enough. Regards,
on 2010-03-10 15:43
On Wed, Mar 10, 2010 at 2:35 AM, Luis Lavena <luislavena@gmail.com> wrote: > dev maybe my english wasn't good enough. > Ah! I see the problem now. I'm afraid it is in win32console[1], and I'm afraid I wrote it. This code will reproduce the bug: ruby -e "require 'rubygems'; require 'win32console'; %Q{\e[31mred\e[0m \e[32mgreen\e[0m}.each_byte{|i| putc i }" ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32] red green # in color ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] red green # in color ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] [31mred[0m [32mgreen[0m Autotest uses getc to read from stdout, and putc to write to it. I redefined Kernel#putc to cache escape codes and write them all at once. Otherwise, win32console won't work. The problem in 1.9 is that "?\e" doesn't return the byte value, but the string. I'll submit a patch. [1] http://github.com/luislavena/win32console/blob/master/lib/Win32/Console/ANSI.rb#L103
on 2010-03-11 01:03
On Mar 10, 3:40 pm, Gordon Thiesfeld <gthiesf...@gmail.com> wrote: > > Hope I explained better this time since seems nobody answered on RSpec- > ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32] > Autotest uses getc to read from stdout, and putc to write to it. I > redefined Kernel#putc to cache escape codes and write them all at > once. Otherwise, win32console won't work. The problem in 1.9 is that > "?\e" doesn't return the byte value, but the string. I'll submit a > patch. > > [1]http://github.com/luislavena/win32console/blob/master/lib/Win32/Conso... > Gordon, your patch fix the issue with red/green sample, but still generates ANSI codes when running under 1.9.1 with autospec. I just cleared all the previous versions of win32console due buggy load path of 1.9 and still see the same issue. The positive side is that the specs now completes instead of prematurely terminate itself. Adding this to either project .autospec file or ~/.autospec file: %Q{\e[31mred\e[0m \e[32mgreen\e[0m}.each_byte{|i| putc i } Produces colored output, while adding to spec_helper.rb or any of the files being evaluated inside autospec returns ANSI color codes.
on 2010-03-11 04:25
On Wed, Mar 10, 2010 at 6:00 PM, Luis Lavena <luislavena@gmail.com> wrote: >> >> >> > generates ANSI codes when running under 1.9.1 with autospec. > > Produces colored output, while adding to spec_helper.rb or any of the > files being evaluated inside autospec returns ANSI color codes. > > -- > Luis Lavena > > My patch didn't fix the whole problem. I was assuming that the argument to putc would always be an integer, but apparently in 1.9 it can be an integer or a string. I'll send you another pull request. I tested with autospec this time on 1.8.6, 1.8.7, and 1.9.1.
on 2010-03-12 09:40
On Mar 11, 4:24 am, Gordon Thiesfeld <gthiesf...@gmail.com> wrote: > > My patch didn't fix the whole problem. I was assuming that the > argument to putc would always be an integer, but apparently in 1.9 it > can be an integer or a string. I'll send you another pull request. I > tested with autospec this time on 1.8.6, 1.8.7, and 1.9.1. Change received, merged and tested. I've pushed a new beta release (beta3). This closes GH-3 report about the incorrect behavior under autospec. Can you guys install the new prerelease and let me know? That way we can make it official 1.3.0 and I can move to the other projects with pending releases ;-) Thank you.
on 2010-03-12 18:42
On Fri, Mar 12, 2010 at 2:40 AM, Luis Lavena <luislavena@gmail.com> wrote: > the incorrect behavior under autospec. > > Can you guys install the new prerelease and let me know? That way we > can make it official 1.3.0 and I can move to the other projects with > pending releases ;-) > > Thank you. > -- > Luis Lavena > > It looks good to me. Thanks, Luis.
on 2010-03-19 20:07
> Change received, merged and tested. > > I've pushed a new beta release (beta3). This closes GH-3 report about > the incorrect behavior under autospec. > > Can you guys install the new prerelease and let me know? That way we > can make it official 1.3.0 and I can move to the other projects with > pending releases ;-) Interesting. For some reason on my box, if I run "autospec", it runs this command: E:\installs\ruby191p376\bin\ruby E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/bin/spec --autospec E:/dev/ruby/old/spork/test_rails/spec/models/abc_spec.rb E:/dev/ruby/old/spork/test_rails/spec/views/abcs/edit.html.erb_spec.rb E:/dev/ruby/old/spork/test_rails/spec/views/abcs/index.html.erb_spec.rb E:/dev/ruby/old/spork/test_rails/spec/views/abcs/new.html.erb_spec.rb E:/dev/ruby/old/spork/test_rails/spec/views/abcs/show.html.erb_spec.rb E:/dev/ruby/old/spork/test_rails/spec/controllers/abcs_controller_spec.rb E:/dev/ruby/old/spork/test_rails/spec/helpers/abcs_helper_spec.rb E:/dev/ruby/old/spork/test_rails/spec/routing/abcs_routing_spec.rb -O spec/spec.opts which outputs, for colors: in prefork local.rb E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement â†[32m.â†[0mâ†[32m.â†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[32m.â†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[32m.â†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[31mFâ†[0mâ†[31mFâ†[0m (like it forgot to require win32console or something, even though spec.opts has --color). Any thoughts there? (spork via drb seems to do the same). Thx. -rp If I run that command by itself, colors look fine. If
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.