May 2005 Archives

Here is a breakdown of what we did:

Card #TitleRiskEstimateSpent
1Package ListLow1 hr4 hr
2autorequire should be a list, not a stringLow2.5h T + .5h C3h
3Binwrappers vs symlinksLow1.5h2h
10No more DateHigh3h4h
11gemrc settings like cvsrcMed2h1h

Behind the scenes was a lot of test refactoring as well. The old tests relied on you running the tests from the parent directory of the tests and also had a fair amount of redundancy in a couple of classes. I popped in an abstract superclass on top of all the tests that set up a temporary directory for everything to go and extra methods to create gems and files quickly.

Our next weekend will be spent on 6 more cards, but I won't go into detail on those because, well, we want to do them. :)

We started our RubyGems Hackfest Saturday, with a turnout of 6 people. Five were regulars from Seattle.rb, and we even got someone up from Portland! We started Saturday by brainstorming things we'd like, writing up story cards, estimating and risking them. Then we paired up and got testing!

The gun is good.

| | Comments (1)
hal9000_: freedom is slavery, ignorance is strength
batkins_`: oooh orwellian
zenspider: The gun is good. The penis is evil. The penis shoots
seeds, and makes new life, and poisons the earth with a plague
of men, as once it was. But the gun shoots death, and purifies
the earth of the filth of brutals.
Go forth and kill! procreate has quit the server batkins_`: haha. procreate always logs on or off at
such ironic times
hal9000_: i want to pass ruby source to the parser and
hal9000_: get an abstract syntax tree back
hal9000_: in fact, i'd like the option to make it a "concrete" syntax tree -- with all tokens and line/char info
zenspider: hal9000_... um... have you looked at ParseTree?
hal9000_: no?
zenspider: well, you might want to. :P
hal9000_: was that the ferret??
zenspider: heh. yes.
hal9000_: I didn't look at it because it was a stinky brown ferret
Eric did something very very cool the other day. He wrote a new tail to the ruby2c pipeline that outputs Ruby C instead of generic C. As a result, he is able to automatically translate the following:
$ cat demo/factorial.rb
class F
  def factorial(n)
    f = 1
    n.downto(2) { |x| f *= x }
    return f
  end

  def main # horrid but funny hack
    return factorial(5)
  end
end
into:
// BEGIN METARUBY PREAMBLE
#include <ruby.h>
#define case_equal_long(x, y) (rb_funcall((x), rb_intern("==="), 1, (y)))
// END METARUBY PREAMBLE
// class F < Object

static VALUE
rrc_cF_factorial(VALUE __self, VALUE n) {
VALUE f;
VALUE x;
f = LONG2FIX(1);
x = n;
while (RTEST(rb_funcall(x, rb_intern(">="), 1, LONG2FIX(2)))) {
f = rb_funcall(f, rb_intern("*"), 1, x);
x = rb_funcall(x, rb_intern("-"), 1, LONG2FIX(1));
};
return f;
}

void
Init_F() {
VALUE rrc_cF = rb_define_class("F", rb_path2class("Object"));
rb_define_method(rrc_cF, "factorial", rrc_cF_factorial, 1);
}
As a result, pretty much any ruby code can be automatically translated to C with no real effort on our part. We can even bypass the type inference engine (for now at least). I think this is the first real step towards a ruby obfuscator.