The Accidental Rubyist

invalid byte sequence in UTF-8

Archive for November 2009

Getting ruby Tracker to work

with 3 comments

I had tried out Tracker recently (a simple bug tracker using sqlite as a backend). Gave errors, and the author reported that it had been a long time
and then he went silent. Today, made a few corrections and its working.
However, it is *very slow*. Each command takes a few seconds to respond. I am on 1.9.

I added require acts_as_list in environment.rb. You will need to install this gem in addition to active_record.

2 files contain :with_scope which is now protected.
Corrected as per http://ropiku.wordpress.com/tag/with_scope/. Now all the actions mentioned on the rubyforge page are working.

In the meantime, I had got ditz to work in ruby 1.9 but with *some errors* (using someones fork). So i am not
too keen on it, although i might start using it later. So i have adapted todo.txt (a cute shell script todo list manager) to create bug files. However, using flat files in email header format does limit the ability to do searches for multiple keys. Its like reinventing the wheel with multiple greps. Much better to use sql instead.

todo.txt is great for todo’s but only stores a line per todo, no comments, fixes etc so it can’t be used for tracking bugs. I really should redo this shell-script based bug tracker using ruby thor and highline.

Advertisements

Written by totalrecall

November 8, 2009 at 10:22 am

Posted in ruby

rbcurse 0.1.3 released

leave a comment »

Just released 0.1.3 on http://gemcutter.org/gems/rbcurse containing a tiny bug fix in Listbox.

Silly of me not to have released a version for 1.9 when I had made the changes and tested out.
Without committing or releasing I started work on SplitPanes and Scrollpanes etc which have
resulted in major changes to base classes too. So now the first 1.9 version will have all these
additions and changes too.


# Instead of defining a local variable with some initial content (often just an empty hash or array), you can instead define it “on the go” so you can perform operations on it at the same time:

(z ||= []) << 'test'


http://www.rubyinside.com/21-ruby-tricks-902.html

Written by totalrecall

November 4, 2009 at 1:14 pm

Posted in ncurses, rbcurse

Command-line bug tracking

leave a comment »

Have been using todo.txt for a few days. However, i find i am using it more
for recording bugs. todo.txt allows me to mark a task as done but not put
a comment or status. e.g. I need to put in details of what I have done as a bug-fix.

So I just checked up the net a bit and came across a bunch of command-line bug
trackers. Need something simple and CLI.

Two nice-looking projects are: tracker and ditz (coincidentally ruby, I hope
1.9.1). ticgit also looks good, but perhaps a little more complicated than what
i want.

Let me know if you are using something nice and simple for your small projects.

OUCH ! Both are giving errors! Tried tracker in both 1.8 and 1.9. There are some dependencies not mentioned. Gives an error in active-record.

$ trac bootstrap
/opt/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:1667:in `method_missing’: undefined method `acts_as_list’ for #<Class:0x17973f8> (NoMethodError)
from /opt/local/lib/ruby/gems/1.8/gems/Tracker-1.0.0/bin/../lib/comment.rb:3
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’

$ ditz

/opt/local/lib/ruby1.9/gems/1.9.1/gems/ditz-0.5/lib/model-objects.rb:1:in `require’: /opt/local/lib/ruby1.9/gems/1.9.1/gems/ditz-0.5/lib/model.rb:214: multiple assignment in conditional (SyntaxError)

The person on the ditz mailing list, says he is no longer maintaining it since it never really met his needs.

The saga continues:

I install gnu gnats (sudo port install gnats), installs fine, but on executing send-pr it complains it cannot find a file pr-edit.

I install another ruby bug tracker, ticgit. Seems to be for 1.8 since I ran into a “when :” error. Fixed that but it goes on to another.

$ ti new -t ‘my new ticket’
/opt/local/lib/ruby1.9/gems/1.9.1/gems/git-1.2.5/lib/git/lib.rb:329:in `chdir’: wrong number of arguments (1 for 0) (ArgumentError)
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/git-1.2.5/lib/git/lib.rb:329:in `config_get’
from /opt/local/lib/ruby1.9/gems/1.9.1/gems/git-1.2.5/lib/git/base.rb:135:in `config’

So no command-line bug-tracking for me, … as of now at least.


Vim + Firefox: http://vimperator.org/

Written by totalrecall

November 3, 2009 at 5:46 pm

Posted in being_geeky

Progress on SplitPane and ScrollPane

leave a comment »

Great progress on rbcurse’s Scrollpanes and Splitpanes. Scrollpanes contain a viewport which handles the window or porthole into it’s child object. The scrollpane handles communication with the viewport, and the scrollbars. I’ve just added some neat scrollbars. However, there’s a lot of drudge work to be done such as event listeners, and allowing editable objects inside scrollpanes and splitpanes.

rbcurse scrollpane

Scrollpane using ncurses

Splitpanes: tested a splitpane with 2 splitpanes as its child components. However, have to use real world objects inside that. Objects that go inside scroll and splitpanes need to be buffered using pads. That and their handling of cursor position etc need to be taken care of.

SplitPane using ncurses (rbcurse)

SplitPane using ncurses (rbcurse)

A major change in the upcoming version (0.1.3), is that widgets will no longer write directly onto the screen. That was quick and easy and light. But for real world apps, when one has splitpanes, scrollpanes etc, then parent objects need to clip and place their child objects themselves. Child widgets don’t even know their coordinates. So using pads internally was required.

That means that most of the existing classes will need to be modified to use pads for painting. A lot of drudge coding. May need to make borders and scrollbars into classes. The upcoming version should be exciting. Now it should be possible to make a Tree class, too.


# print section of file from regex to end of file
$ cat | ruby -pe ‘@found=true if $_ =~ /regex/; next unless @found’

Written by totalrecall

November 1, 2009 at 10:55 pm

Posted in ncurses, rbcurse, ruby