Archive for the ‘rubinius’ Category

The easiest rubinius core library patch tutorial ever.

This is a 5 minutes introduction to create a core patch to Rubinius.

  1. Write a core library patch to Rubinius is really easy. First we need to decide what we want to write. Run the specs and find a bug, or write your own specs. Im going to write my own spec. I decide to implement the missing spec hypotenuse form Math Module
  2. A bit of Test driven development :
    1. Find the math specs file : RUBINIUS_HOME/spec/core/math_spec.rb
    2. Write the spec :
      1. create the describe :
        describe "Math#hypot" doend
      2. Add the basic cases :
        it "return x**2+y**2" do      
           Math.hypot(0,0).should_be_close(0.0,TOLERANCE)Math.hypot(2,10).should_be_close( 10.1980390271856 ,TOLERANCE)
           Math.hypot(5000,5000).should_be_close(7071.06781186548 ,TOLERANCE)
           Math.hypot(0.0001,0.0002).should_be_close(0.000223606797749979,TOLERANCE)
           Math.hypot(-2,-10).should_be_close(Math.hypot(2,10),TOLERANCE)
           Math.hypot(2,10).should_be_close(Math.hypot(10,2),TOLERANCE)
        end
      3. Add exceptional cases :
         it "raise an ArgumentError exception if the argument are  the wrong type" do 
           should_raise(ArgumentError){Math.hypot("test","test2")}
        end 
         it "raise an TypeError exception if the argument is nill" do  
          should_raise(ArgumentError){Math.hypot(nil)}
        end 
    3. run the specs. ruby spec/core/math_spec.rb. Umm 3 fails
  3. Ok, lets coding
    1. Find the math module : RUBINIUS_HOME/kernel/core/math.rb
    2. Write the method
      1. def hypot(x,y)
            sqrt(x**2 + y**2); 
        end
      2. rebuild the core: rake build:core
      3. run the test again … ummm two fails. not so bad.
    3. Lets code again :
      1. The method :
          def hypot(x,y)     raise ArgumentError unless x.kind_of? Numeric or y.kind_of? Numericsqrt(x**2 + y**2)end
      2. rebuild the core
      3. re run the specs … 0 fails !!
      4. Thats all.
    4. No !! thats not al. As Tony Targonski point in the comments we have a bug. Ok lets write a case for the bug.

Rebuild the core of rubinius.

I wrote sometime ago about how to build rubinius. Now the follow intructions its only about how to rebuild the core.

gem install sydparser
gem install externals/syd-parser/pkg/
rake build:core

GSoC 2007 Accepted.

My Ruby proposal Cover the core of Ruby with Rspec was accepted. I think its gone to be a great summer for me, working and learning with really intelligent people, and with a cool language and framework.

——————————————————————————————————–

Dear Applicant,

Congratulations! This email is being sent to inform you that your
application was accepted to take part in the Summer of Code. Please
check your student home page in the SoC web application at
http://code.google.com/soc/student_home.html to determine which of
your applications was accepted.

Over the next few days, you will be added to a special members only
Google Group
(http://groups.google.com/group/google-summer-of-code-students-list).
Please take a moment to browse the archive before posting.  We prefer
most of the program discussion to take place on the program discussion
list.  However, the students list is a private place for communication
about subjects where our student participants prefer to not
communicate the matter more widely.  You can find more information
about the program mailing lists here:
http://groups.google.com/group/google-summer-of-code-announce/web/guide-to-program-mailing-lists

Your mentoring organization may also set up similar mailing lists for
you and your cohorts so that they may interact with you on your
project. You should not wait for them; please feel free to contact
your mentor and let them know you are ready to start engaging with
your new project community.

You should also get into the habit of visiting your student home page
on a semi-regular basis, as we will track status, payments, paperwork
and take final surveys from this page.

If you have questions regarding payment, please wait until you see a
message from Leslie Hawthorn detailing what we will need from
you. This will take a few days as we button up the web application and
make sure all the students are properly assigned to the proper groups.

If you cannot take part for some reason, please email us at
gsoc@google.com as soon as possible so that we can allocate your slot
to another student.

Other questions and concerns should be send to gsoc@google.com

Thanks for taking part; we’re very excited to see what the Summer will bring!

Congratulations once again,

The Google Summer of Code Progam Administration Team

Installing Rubinius in ubuntu

This post is out of date 

> sudo apt-get install ruby
> sudo apt-get install irb
> sudo apt-get install rdoc
> sudo apt-get install libglib2.0-dev libglib2.0-ruby libglib2.0-data
> sudo apt-get install subversion
> sudo apt-get install make automake
> sudo apt-get install bison pkg-config build-essentials libtool libglib2.0-dev
> sudo gem install rake rubyinline rspec ruby2ruby 

> shell$ svn co http://code.fallingsnow.net/svn/rubinius/trunk rbx
> shell$ cd rbx
> sudo gem install sydparse
> sudo gem install RubyInline
> sudo apt-get install bison
# installar glib
> shell$ rake build:all
> shell$ ./shotgun/rubinius -e "puts 'hello rubinius'"
Follow

Get every new post delivered to your Inbox.