Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Advice on setup on Mac

Reply
Thread Tools

Advice on setup on Mac

 
 
Sophie
Guest
Posts: n/a
 
      11-16-2009
[Apologies if this appears as 2 posts -- my last post never seemed to
make it through]

I just setup NetBeans for Ruby on my Mac (quite like it so far). I'm
familiar to Ruby, getting back to it after a break. I will be using it
with my young kids, teaching them basics of programming to go with
their beginning algebra, physics, etc.

Over time I expect to use command line, simple GUIs, perhaps some
graphics/animation, eventually simple games.

Am seeking advice on the set up for this, what libraries / gems to
use, etc. I am not set on any particular ones, do not need awesome
power, just want something that will work without too much effort on
the Mac.

- Which version of Ruby to use? NetBeans shows a jRuby install +
1.8.6. Pros/cons of 1.9.1 for my usage?

- What tool / gems to use for GUI (Tk? Shoes? Other?

- What tool / gems to use for games (Gosu? Chingu? other?)

Thanks! --- Sophie
 
Reply With Quote
 
 
 
 
Robert Gleeson
Guest
Posts: n/a
 
      11-16-2009
> - Which version of Ruby to use? NetBeans shows a jRuby install +
> 1.8.6. Pros/cons of 1.9.1 for my usage?
>

If you're on OSX, why not try MacRuby?
http://www.macruby.org

> - What tool / gems to use for GUI (Tk? Shoes? Other?
>

Use the cocoa framework Tightly integrated into macruby, and has a
nice abstract layer called 'hotcocoa' that makes writing cocoa very
rubyish.

> - What tool / gems to use for games (Gosu? Chingu? other?)
>

Not too sure to be honest, I haven't written any games.

An old but good video on macruby can be found here:
http://rubyconf2008.confreaks.com/ma...-your-mac.html

YARV has been dropped from macruby since the making of that video, but
definitely worth the time to watch it.

Hope this helps,
Rob
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Sophie
Guest
Posts: n/a
 
      11-16-2009
> If you're on OSX, why not try MacRuby?http://www.macruby.org

My lack of knowledge Do you know if NetBeans could be set up to
work with MacRuby?

Cocoa sounds good, but the HotCocoa tutorial page is a "to do" .

Does the current MacRuby run most Ruby libs/gems painlessly? I'm a bit
concerned I'd get stuck on something like Gruff (draws graphs) etc.

> Hope this helps,


Certainly does, thank you Rob!
 
Reply With Quote
 
Marnen Laibow-Koser
Guest
Posts: n/a
 
      11-16-2009
Robert Gleeson wrote:
>> - Which version of Ruby to use? NetBeans shows a jRuby install +
>> 1.8.6. Pros/cons of 1.9.1 for my usage?
>>

> If you're on OSX, why not try MacRuby?
> http://www.macruby.org


Why bother? The Ruby 1.8.7 interpreter that comes with Leopard and
later is perfectly adequate, unless you specifically want 1.9.

>
>> - What tool / gems to use for GUI (Tk? Shoes? Other?
>>

> Use the cocoa framework Tightly integrated into macruby, and has a
> nice abstract layer called 'hotcocoa' that makes writing cocoa very
> rubyish.


Again, probably not. This is not my area of expertise, but I think most
people use RubyCocoa for cocoa development.

Of course, that only works for Mac (and maybe GnuStep) apps. I'm
working on a cross-platform app now with JRuby and Monkeybars.

>
>> - What tool / gems to use for games (Gosu? Chingu? other?)
>>

> Not too sure to be honest, I haven't written any games.
>


Nor have I.

[...]
> Hope this helps,
> Rob


Best,
--
Marnen Laibow-Koser
http://www.marnen.org
http://www.velocityreviews.com/forums/(E-Mail Removed)
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Robert Gleeson
Guest
Posts: n/a
 
      11-16-2009
> Why bother? The Ruby 1.8.7 interpreter that comes with Leopard and
> later is perfectly adequate, unless you specifically want 1.9.
>

Why bother? well, personally i don't develop on 18 anymore - so, yeah, I
want a 19 implementation but macruby has a lot of interesting things
going on, not to mention that it can compile to "highly optimized" OSX
machine code. ( "highly optimized" taken from macruby.org, and only from
macruby 0.5b )
You've also got Obj C's GC to boot.

> Again, probably not. This is not my area of expertise, but I think most
> people use RubyCocoa for cocoa development.


I advise you to watch the video i posted in my first post He goes
into all the problems that RubyCocoa has, RubyCocoa is a "bridge"
between C & Obj C but MacRuby has direct access to the Cocoa API on top
of the Obj C runtime - it also has hotcocoa, which is a *damn* cool
abstract API to cocoa for writing sexy GUI apps easily.

Nothing wrong with the official interpreter of course - i use it
everyday, but i think you'd be crazy not to try macruby if you're on a
Mac and moving away from 18(As far as I know, macruby will be the
official 19 interpreter on OSX)

Rob
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Marnen Laibow-Koser
Guest
Posts: n/a
 
      11-16-2009
Robert Gleeson wrote:
>> Why bother? The Ruby 1.8.7 interpreter that comes with Leopard and
>> later is perfectly adequate, unless you specifically want 1.9.
>>

> Why bother? well, personally i don't develop on 18 anymore - so, yeah, I
> want a 19 implementation but macruby has a lot of interesting things
> going on, not to mention that it can compile to "highly optimized" OSX
> machine code. ( "highly optimized" taken from macruby.org, and only from
> macruby 0.5b )
> You've also got Obj C's GC to boot.
>
>> Again, probably not. This is not my area of expertise, but I think most
>> people use RubyCocoa for cocoa development.

>
> I advise you to watch the video i posted in my first post He goes
> into all the problems that RubyCocoa has, RubyCocoa is a "bridge"
> between C & Obj C but MacRuby has direct access to the Cocoa API on top
> of the Obj C runtime - it also has hotcocoa, which is a *damn* cool
> abstract API to cocoa for writing sexy GUI apps easily.


Interesting. I confess that I don't know much about MacRuby. I may now
have to find out.

>
> Nothing wrong with the official interpreter of course - i use it
> everyday, but i think you'd be crazy not to try macruby if you're on a
> Mac and moving away from 18


I thought the MacRuby project was stalled or abandoned. Am I wrong?

> (As far as I know, macruby will be the
> official 19 interpreter on OSX)


What do you mean? 1.9 is already available for Mac, and the official
interpreter isn't MacRuby.

Or are you saying that Apple is planning to include MacRuby 1.9 in
future developer toolkits?

>
> Rob


Best,
--
Marnen Laibow-Koser
http://www.marnen.org
(E-Mail Removed)
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Robert Gleeson
Guest
Posts: n/a
 
      11-16-2009
> Cocoa sounds good, but the HotCocoa tutorial page is a "to do" .
This might help(but it's a year old):
http://rubyconf2008.confreaks.com/os...-hotcocoa.html

> Does the current MacRuby run most Ruby libs/gems painlessly? I'm a bit
> concerned I'd get stuck on something like Gruff (draws graphs) etc.

It should work for gems that are 19 compatiable.
(you can check at http://www.isitruby19.com)

Hope this helps,
Rob
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Robert Gleeson
Guest
Posts: n/a
 
      11-16-2009
> I thought the MacRuby project was stalled or abandoned. Am I wrong?

I doubt it is The macruby developer is expected to speak at rubyconf
this year, and 0.5b was released recently.


> What do you mean? 1.9 is already available for Mac, and the official
> interpreter isn't MacRuby.
>
> Or are you saying that Apple is planning to include MacRuby 1.9 in
> future developer toolkits?


Yeah, that was the impression I got from his video(a year old now), but
I would expect that apple will let macruby mature before they start
shipping it with OSX.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Leslie Viljoen
Guest
Posts: n/a
 
      11-16-2009
On Mon, Nov 16, 2009 at 3:35 AM, Sophie <(E-Mail Removed)> wrote:
> [Apologies if this appears as 2 posts -- my last post never seemed to
> make it through]
>
> I just setup NetBeans for Ruby on my Mac (quite like it so far). I'm
> familiar to Ruby, getting back to it after a break. I will be using it
> with my young kids, teaching them basics of programming to go with
> their beginning algebra, physics, etc.
>
> Over time I expect to use command line, simple GUIs, perhaps some
> graphics/animation, eventually simple games.
>
> Am seeking advice on the set up for this, what libraries / gems to
> use, etc. I am not set on any particular ones, do not need awesome
> power, just want something that will work without too much effort on
> the Mac.
>
> - Which version of Ruby to use? NetBeans shows a jRuby install +
> 1.8.6. Pros/cons of 1.9.1 for my usage?
>
> - What tool / gems to use for GUI (Tk? Shoes? Other?


I am having a lot of success with Fox right now - I find it possible
to build quite a nice interface
with few lines of code, and there's foxGUIb if you want something to
help you build forms.
Its not seamless like Visual Studio dragging and dropping and then
double-clicking a control,
but you can still get a very nice interface working quite quickly once
you have a bit of experience.

> - What tool / gems to use for games (Gosu? Chingu? other?)


Gosu is great. Every now and then I take a photo of one of my
daughter's great works of art
and then write a class to specify the behaviour of this new
"character". Then I add the character
to the existing collection and they all move around together in their own way.

My daughter loves to see her art animated and she always has requests when she
sees it: "can I make the doggie move?" etc.

I'll post a few examples (you'll need to add your own custom artwork):


---- basic "character.rb"

class Character
attr_accessor , :y

def initialize(image, x, y, x_scale = 1, y_scale = 1, col = 0xffffffff)
@image, @x, @y, @x_scale, @y_scale, @col = image, x, y, x_scale, y_scale, col
end

def draw
@image.draw(@x, @y, 0, @x_scale, @y_scale, @col)
end

def update
end

def width
@image.width
end

def height
@image.height
end
end

---- a "snail.rb"
require 'character'

class Snail < Character
def initialize(image, x, y)
super(image, x, y, 0.5, 0.5, 0xffffffff)
end

def update
@x += 1 if(rand(10) < 3)
@x -= 1 if(rand(10) < 1)
@x = 0 if @x < 0
@x = 1280 if @x > 1280
end
end

---- a "doggie.rb"

require 'character'

class Doggie < Character
def initialize(image, x, y, x_scale = 1, y_scale = 1, col = 0xffffffff)
super(image, x, y, x_scale, y_scale, col)
@s = 0
@base = 470
@xr = 0
@xl = 0
end

def update
@y = @base - 30 * Math::sin(@s)
@s += 0.1
@s = 0 if @s >= Math:I

if @xr > 0
@x += 1
@xr -= 1
end

if @xl > 0
@x -= 1
@xl -= 1
end
end

def right
@xr = 50
end

def left
@xl = 50
end
end


---- some "grass.rb"
require 'character'

class Grass < Character
end

----- the "sun.rb"
require 'character'

class Sun < Character
end


----- main "garden.rb"

#!/usr/bin/ruby

require 'rubygems'
require 'gosu'

require 'snail'
require 'doggie'
require 'sun'
require 'grass'

$W = 1280
$H = 800

class MainWindow < Gosu::Window
def initialize
super($W, $H, true)
self.caption = 'Garden'

@characters =
grow_grass(0.6, 10, $H - 226, 0x7fbbbbbb) + #back
grow_grass(0.7, 9, $H - 194, 0x9fbbbbbb) +
grow_grass(0.8, 8, $H - 162, 0xbfbbbbbb) +
grow_grass(0.9, 7, $H - 130, 0xdfbbbbbb) +
grow_grass(1.0, 6, $H - 98, 0xffbbbbbb) + #front
[
Sun.new(Gosu::Image.new(self, 'media/sun-320.png'), $W - 200, 30, 0.5, 0.5),
@dog = Doggie.new(Gosu::Image.new(self, 'media/doggie-320.png'),
500, $H - 270, 0.5, 0.5),
Snail.new(Gosu::Image.new(self, 'media/snail-320.png'), 0, $H - 150)
]
end

def grow_grass(scale, div, y, col)
blades = Grass.new(Gosu::Image.new(self, 'media/grass-320.png'), 0,
0, scale, scale, col)
grass = []
div.times do |x|
b = blades.dup
b.x = (x * ($W / div)) - 20
b.y = y
grass << b
end
grass
end

def update
@characters.each {|c| c.update}
end

def draw
draw_quad(0, 0, 0xdd0080ff,
0, $H, 0x1100ff00,
$W, $H, 0xffffff00, #top right
$W, 0, 0x1100ff00) #bottom right
@characters.each {|c| c.draw}
end

def button_down(id)
close if id == Gosu::Button::KbEscape
@dog.right if id == Gosu::Button::KbRight
@dog.left if id == Gosu::Button::KbLeft
end
end

main = MainWindow.new
main.show

 
Reply With Quote
 
Marnen Laibow-Koser
Guest
Posts: n/a
 
      11-17-2009
Leslie Viljoen wrote:
> On Mon, Nov 16, 2009 at 3:35 AM, Sophie <(E-Mail Removed)> wrote:
>>
>> Am seeking advice on the set up for this, what libraries / gems to
>> use, etc. I am not set on any particular ones, do not need awesome
>> power, just want something that will work without too much effort on
>> the Mac.
>>
>> - Which version of Ruby to use? NetBeans shows a jRuby install +
>> 1.8.6. Pros/cons of 1.9.1 for my usage?
>>
>> - What tool / gems to use for GUI (Tk? Shoes? Other?

>
> I am having a lot of success with Fox right now - I find it possible
> to build quite a nice interface
> with few lines of code, and there's foxGUIb if you want something to
> help you build forms.

[...]

Fox doesn't work with Aqua, though.


Best,
--
Marnen Laibow-Koser
http://www.marnen.org
(E-Mail Removed)
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ANN] Ruby Setup 5 (setup.rb) Intransition Ruby 0 01-13-2010 04:24 PM
Setup VPN on Mac OS X Server through Cisco 877 router network_newbie Cisco 0 04-11-2008 06:01 AM
python setup.py: how to override a setup.cfg value ? Chris Shenton Python 1 08-24-2007 06:27 AM
Mac OS 10.4.3 - Koday Easyshare Printer Dock Series 3 Setup Ale Digital Photography 2 01-14-2006 11:22 PM
Windows XP Setup Restarts the Setup Program =?Utf-8?B?UmFkYXIxNjU=?= Windows 64bit 21 12-14-2005 04:27 AM



Advertisments