If it's not on-topic, it's in here.
Post a reply

someone who knows ruby wanted

Wed Jan 09, 2013 7:08 pm

I am looking for someone who is good with ruby.
Good means a bit more than the very basics.
The background: the learn packaging group for diaspora; gem2deb does a good job, but tests often fail (and then all is in darkness).
I read a bit through ruby-in-20-minutes and ruby-the-hard-way (could be renamed: ruby the boring way) and observer the debian ruby irc channel.

To make it short: if you know someone let him know that i could need help.
thanks

When i ask ice-T all he does is shouting at ruby. I can see the point in that ... (i do it all the time).

To fill this with a bit of content. The following, a typical ruby-tests.rb, would be a good start to understand _fully_ :
Code:
   require 'test/unit'
             require 'mypackage' # if 'mypackage.rb' or 'mypackage.so' was not installed properly, this will fail
             class MyPackageTest < Test::Unit::TestCase
               def test_features
                 assert_equal 4, MyPackage.sum(2,2)
               end
             end

Looks rather easy ? Ok, let's look at this one:
Code:
   require 'gem2deb/rake/testtask'
             Gem2Deb:Rake::TestTask.new do |t|
               t.test_files = FileList['test/*_test.rb']
             end


Besides that there (seem to be) changes between ruby1.8 and 1.9; in syntax. But the former is more important.

channel is debian-diaspora.

Re: someone who knows ruby wanted

Fri Jan 11, 2013 11:58 pm

After a few days of ruby-the-hard-way and ruby in 20 minutes i think i understand the second one.
The main idea, not in and out

require is clear

.new is ruby's way to create a new object of a class.
Skipping the colons (something with modules and importing them) and getting to the main idea TestTask.new creates a new object.

| var_here | is ruby's syntax what else is an easy for
for i in *; do echo "foo"; done
In ruby there is the option to do.
names.each do |i|
puts (#{i})
end

Instead of, say:
for each in a b c de
do
echo $each
done

[], like usually, is an array.

So i think:
You create a new object t and assing a list of files to it [], by the class function test_files.
Those are the test-files (the ones who check if the ruby code is working correctly) The object, not the original list. Why? **** knows. ruby wants it OOP, so it is that way.

Not perfect yet, else i wouldn't need to ask for help, but it is getting better.
What a pain.
Post a reply