[Courses] [Ruby] Lesson 0: Installing
Anne G
anne at wjh.harvard.edu
Sat Nov 12 07:43:42 EST 2005
Hi
My name is anne. I have been programming in C and matlab. I
started to learn objective C, but I am really stumped by how
big a step I have to take, and I keep getting mad... How is
this supposed to be the next thing after C. There are way
too much idiosynchratic tricks to learn, I hate the whole
memory management, beginners like me should not have to
deal with it...
So I am delighted to try if rubi will ease the way.
First I just spend hours and hours on the install on my mac.
First, the latest rubi is 1.8.3
I found the source easily enough, but I could not find an
install application for it, and I did not know what to do
with the source. Luckily, I found a blog that saved me,
http://www.downes.ca/cgi-bin/page.cgi?post=31620
I went into the directory in the terminal window, ls ...
than I think I ran
./configure
make
sudo make install
(I had missed his instruction to become superuser, and got
an error message, permission denied at first).
rubi -v
does give me 1.8.3 version.
the application for rubicocoa was easier to find
http://rubycocoa.sourceforge.net/
I downloaded and installed the one for panther.
When I ran xcode, rubi is one of the options. I don't know
how to tell if it is the right version.
I did not try to install ruby on rails for now.
I found a tutorial on rubycocoa
http://rootprompt.org/article.php3?article=7785
and I am working my way through, but it is beyond what I
want to do right now.
I just want to run some simple code, and I don't know where
to put the code in all the files.
There is a main.m file which I think you don't usually
touch. there is an rb_main.rb file which probably is the one
to use.
require 'osx/cocoa'
def rb_main_init
path =
OSX::NSBundle.mainBundle.resourcePath.fileSystemRepresentation
rbfiles = Dir.entries(path).select {|x| /\.rb\z/ =~ x}
rbfiles -= [ File.basename(__FILE__) ]
rbfiles.each do |path|
require( File.basename(path) )
end
end
if $0 == __FILE__ then
rb_main_init
OSX.NSApplicationMain(0, nil)
end
I don't think I need to know what this says, but I do need
to know where to put a rubi instruction, such as type "hello
world"... Does anyone know?
I understand that coco+rubi may be adding more complexity
then I am supposed to have, but I an xcode environment
should be much more pleasant than text files and terminal
window compilation. So if I can figure how to do straight
rubi code and then cocoa code in the same environment, it
seems worth the extra effort
More information about the Courses
mailing list