PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Ruby questions
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Ruby questions

Réponse
 
LinkBack Outils de la discussion
Vieux 08/01/2008, 19h00   #1
Jeff M.
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Ruby questions

Hello, peeps. I'm dipping my feet into Ruby waters (from Smalltalk).
Just have some questions that I hope someone doesn't mind answering.
I'm on OS X 10.5.

I see that Ruby 1.9 is out and Leopard shipped with 1.8.6. I also
heard that 1.9 would introduce a new VM that would be significantly
faster than 1.8. Is that the case? If so, is there a standard way of
getting 1.9 on OS X or am I kinda stuck waiting for Apple to "do their
thing"?

I'm primarily playing around with GLUT and OpenGL in Ruby for fun.
This required getting ruby-opengl through gems (note: I think the idea
of gems is slick!). However, if I ever wanted to distribute my code or
a program, is there a proper way of distributing everything needed
with it? Is there a way of generating native executables or at least
combining the ruby executable with the source so that 2 years from now
my program still runs the same even though I have version 3.8 of ruby?

Perhaps I've missed this in documentation, but am I able to extend a
class without subclassing? Something akin to "loose methods" in
Smalltalk?

Anyway, thanks for taking the time to read/answer any of these. I
appreciate it.

Jeff M.
  Réponse avec citation
Vieux 08/01/2008, 19h15   #2
Jan Dvorak
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

On Tuesday 08 January 2008 20:05:03 Jeff M. wrote:
> I'm primarily playing around with GLUT and OpenGL in Ruby for fun.
> This required getting ruby-opengl through gems (note: I think the idea
> of gems is slick!). However, if I ever wanted to distribute my code or
> a program, is there a proper way of distributing everything needed
> with it? Is there a way of generating native executables or at least
> combining the ruby executable with the source so that 2 years from now
> my program still runs the same even though I have version 3.8 of ruby?


Try rubyscript2exe for this, it builds binary with your script, ruby
interpreter and required extensions and libraries inside.

Jan

  Réponse avec citation
Vieux 08/01/2008, 19h27   #3
James Gray
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

On Jan 8, 2008, at 1:05 PM, Jeff M. wrote:

> Hello, peeps. I'm dipping my feet into Ruby waters (from Smalltalk).


Hello and welcome to Ruby.

> I see that Ruby 1.9 is out and Leopard shipped with 1.8.6. I also
> heard that 1.9 would introduce a new VM that would be significantly
> faster than 1.8. Is that the case?


It is faster in many cases, slightly slower in a few, and similar
speed in some others.

> If so, is there a standard way of getting 1.9 on OS X or am I kinda
> stuck waiting for Apple to "do their thing"?


The important thing to know is that Ruby 1.9 is currently a
"development release." It has known problems. The core team is
sorting those out, but it's going to take a little time to firm up.
Thus, as a new user, I recommend you stick with 1.8.6 for now to avoid
running into any of these issues.

To answer your question though: you do not have to wait for Apple to
upgrade Ruby for you, no. Many of us keep our own build (in /usr/
local) and update it as we desire.

> However, if I ever wanted to distribute my code or
> a program, is there a proper way of distributing everything needed
> with it?


Short answer: yes.

Longer answer: how you handle this depends on how you distribute your
software. Gems can have dependencies, for example. There are also
some all-in-one-executable solutions.

> Perhaps I've missed this in documentation, but am I able to extend a
> class without subclassing? Something akin to "loose methods" in
> Smalltalk?


Sure. Ruby has open classes, so we can add methods to them at any time:

$ irb
>> class String
>> def to_rot13
>> tr 'a-zA-Z', 'n-za-mN-ZA-M'
>> end
>> end

=> nil
>> "James Edward Gray II".to_rot13

=> "Wnzrf Rqjneq Tenl VV"

Hope that s.

James Edward Gray II

  Réponse avec citation
Vieux 09/01/2008, 01h19   #4
Joe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

On Jan 8, 2008 2:05 PM, Jeff M. <massung@gmail.com> wrote:
> Hello, peeps. I'm dipping my feet into Ruby waters (from Smalltalk).
> Just have some questions that I hope someone doesn't mind answering.
> I'm on OS X 10.5.
>
> I see that Ruby 1.9 is out and Leopard shipped with 1.8.6. I also
> heard that 1.9 would introduce a new VM that would be significantly
> faster than 1.8. Is that the case? If so, is there a standard way of
> getting 1.9 on OS X or am I kinda stuck waiting for Apple to "do their
> thing"?
>
> I'm primarily playing around with GLUT and OpenGL in Ruby for fun.
> This required getting ruby-opengl through gems (note: I think the idea
> of gems is slick!). However, if I ever wanted to distribute my code or
> a program, is there a proper way of distributing everything needed
> with it? Is there a way of generating native executables or at least
> combining the ruby executable with the source so that 2 years from now
> my program still runs the same even though I have version 3.8 of ruby?


rubyscript2exe is windows only.
there is a package to make it a tar, but the user will still have to
install the gems you depend on if I understand it correctly.

Honestly, the best way I've seen to distribute a ruby app to actual
users that I've seen is JRuby. Compile your program to java bytecode
and you can distribute it in a jar.

The last time this came up some people talked about starkits in tcl,
and suggested something like that for ruby, but it didn't really go
anywhere.

I believe one of the goals in rubinius is to have something similar to
jar for ruby, but i could be wrong about that.
>
> Perhaps I've missed this in documentation, but am I able to extend a
> class without subclassing? Something akin to "loose methods" in
> Smalltalk?
>
> Anyway, thanks for taking the time to read/answer any of these. I
> appreciate it.
>
> Jeff M.
>
>


  Réponse avec citation
Vieux 09/01/2008, 02h30   #5
Joel VanderWerf
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

Joe wrote:
> rubyscript2exe is windows only.


Works fine on linux.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

  Réponse avec citation
Vieux 09/01/2008, 02h58   #6
Joe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

sorry, my mistake. The name of it always makes me think windows only.
It can run on all platforms, but it's not a cross platform solution.
The exe generated is only for the platform it's running on.

On Jan 8, 2008 9:30 PM, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:
> Joe wrote:
> > rubyscript2exe is windows only.

>
> Works fine on linux.
>
> --
> vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
>
>


  Réponse avec citation
Vieux 09/01/2008, 03h41   #7
Jan Dvorak
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

On Wednesday 09 January 2008 03:58:17 Joe wrote:
> Honestly, the best way I've seen to distribute a ruby app to actual
> users that I've seen is JRuby. Compile your program to java bytecode
> and you can distribute it in a jar.

What about extensions ? (ruby-opengl in this case)

> sorry, my mistake. The name of it always makes me think windows only.
> It can run on all platforms, but it's not a cross platform solution.
> The exe generated is only for the platform it's running on.


Technically speaking this is not cross-platform solution either, as the
bytecode runs only on the Java platform. For distribution you're just trading
dependency on ruby interpreter for dependency on java bytecode interpreter.

Tools like rubyscript2exe will get you OS-dependent binary, but it is
self-sustained and will run without any other dependencies.

Jan

  Réponse avec citation
Vieux 09/01/2008, 03h53   #8
Joe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Ruby questions

On Jan 8, 2008 10:41 PM, Jan Dvorak <jan.dvorak@kraxnet.cz> wrote:
> On Wednesday 09 January 2008 03:58:17 Joe wrote:
> > Honestly, the best way I've seen to distribute a ruby app to actual
> > users that I've seen is JRuby. Compile your program to java bytecode
> > and you can distribute it in a jar.

> What about extensions ? (ruby-opengl in this case)


Java OpenGL extensions are available. I don't mean to push JRuby so
hard, but when looking for a good distribution mechanism a while back
it's the best i could find. It'd also work on platforms I don't own.
I don't have a mac, but I'd like software i write to be able to run on
it. I don't expect my users to use the command line to start the
program. I guess other people have different requirements.

>
> > sorry, my mistake. The name of it always makes me think windows only.
> > It can run on all platforms, but it's not a cross platform solution.
> > The exe generated is only for the platform it's running on.

>
> Technically speaking this is not cross-platform solution either, as the
> bytecode runs only on the Java platform. For distribution you're just trading
> dependency on ruby interpreter for dependency on java bytecode interpreter.
>
> Tools like rubyscript2exe will get you OS-dependent binary, but it is
> self-sustained and will run without any other dependencies.


I guess I should have said OS independent. I'd like for something in
ruby to be similar to the jar, but it hasn't seem to emerged yet.

>
> Jan
>
>


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h25.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15506 seconds with 16 queries