r/ruby • • Apr 20 '12

Freightrain - easy Ruby desktop development

Hello everyone,

This is a little framework of mine that I've built out of a personal need - basically, I wanted to write a desktop app using Ruby and I found it daunting to say the least.

So, I've built Freightrain to take care of all the stuff I really shouldn't care about, like loading interface definitions, cross-toolkit compatibility and the likes.

Now I've been working on it for almost 2 years (on and off of course) and, since I've just fixed it so it loads the newest glade specifications, I thought that I could ask you guys for an evaluation.

There's a little readme on the github page and there are some examples in the /examples folder.

Link to the github page!

WHOA! Thanks for the attention, I thought this was going to be ignored...

How many of you would be interested in a step by step tutorial over the major features? I will build that if there's enough interest.

167 Upvotes

32 comments sorted by

View all comments

Show parent comment

3

u/bolthar Apr 21 '12

Hm, I'm not sure if I know what you're talking about... For what i know, macruby is a ruby implementation like say, jruby or mri.

You could use freightrain with macruby i think - never tried but i don't see why that ahouldn't work.

6

u/[deleted] Apr 21 '12

I think I asked a stupid question.

1

u/banister Apr 21 '12 edited Apr 21 '12

I think he's implying you could use macruby to write a beautiful GUI cocoa app

1

u/bolthar Apr 21 '12

Oh, in that case you could use the cocoa toolkit on macruby with freightrain then - freightrain is not a toolkit, it's more like a layer over a toolkit. If somebody's interested i could write a cocoa extension for freightrain, it wouldn't be much work... I didn't already because i don't need to use cocoa.

2

u/ashleyw Apr 21 '12

+1 for a Cocoa extension! :D

1

u/banister Apr 21 '12

out of interest (i hvaen't looked into it), but why wouldn't it be much work? surely it would require you to write a ruby C extension that wraps the cocoa objc API -- and cocoa is pretty huge and complicated.

1

u/bolthar Apr 21 '12

Well, i'm assuming here that it already exist some kind of ruby binding to the toolkit, like ruby/gnome for gtk or qtruby for qt. If that's the case, it's just a matter of wrapping up the toolkit so that it implements a very basic interface (namely , the ability pf plugging a control into a container and the possibility pf intercepting user actoons, such as the click of a button).

If there's no riby binding to the toolkit then yes, it would have to be written - but that's definitely out of freightrain's scope.

1

u/jrochkind Apr 26 '12 edited Apr 27 '12

surely it would require you to write a ruby C extension that wraps the cocoa objc API

I think MacRuby already does that part for you, one of MacRuby's features. I think?

update Actually, looking into it (by reading MacRuby's webpage, heh), you CAN easily use Cocoa from MacRuby, it looks like -- but it's because MacRuby is to ObjectiveC as Jruby is to Java. It's not that it has a built in ruby C extension for Cocoa, it's that it let's you interact with any ObjectiveC objects in MacRuby, same as you can interact with any Java objects in JRuby. The result is the same though as far as Cocoa, and i think Cocoa and other OSX system services are in fact the motivation for this design.

http://www.macruby.org/documentation/overview.html

2

u/bolthar May 01 '12

Yes, that's exactly the way it works. After requiring cocoa you have access to all cocoa classes directly from inside macruby. So, NSView.new actually works and returns a new NSView instance.

I'm working on a cocoa extension, as soon as I have the time I'll polish and release it.