[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

setup.rb and/or gem assist

Hal E. Fulton

9/28/2004 4:17:00 PM

Hello all...

I am rather package-phobic and usually just offer a .tgz and a readme.
But I'm thinking of doing a little more this time.

I have an app I want to package, and I want to create a gem.

I *believe* that setup.rb is still required, is it not??

Anyhow, I have never used setup.rb except to play with it, and I've
never created a gem.

Some of my constraints are:

1. I have libs that are require'd only by this app (i.e., they are
just separate pieces for convenience). Where should they go, and
how should I reference them in the app?
2. Same question for data files and such. Where to put them, how to
reference them?
3. Suppose I have a file of marshalled data and want to run a little
utility program to load it into a .db -- how/when should I do this?

Any assistance appreciated.


Thanks,
Hal




8 Answers

Jim Weirich

9/28/2004 4:35:00 PM

0


Hal Fulton said:
> Hello all...
>
> I am rather package-phobic and
[...]
> I have an app I want to package, and I want to create a gem.

There are two steps to creating a gem ...
1) Create a Gem Specification.
2) Run: gem builder gemspecfile.

The hard part is step one where you need to come up with all the metadata.
A good place to start is:

http://rubygems.rubyforge.org/wiki/wiki.pl?CreateAGemIn...

The page has a gem spec that you can start with an edit to your
satisfication.

Or wait till this weekend and we can help you in person!

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



Hal E. Fulton

9/28/2004 5:05:00 PM

0

Jim Weirich wrote:

> There are two steps to creating a gem ...
> 1) Create a Gem Specification.
> 2) Run: gem builder gemspecfile.

Reminds me of the old recipe for elephant stew. Or -- was it Carl Sagan
who said, "To make chicken soup from scratch, you must first create the
universe"?

> The hard part is step one where you need to come up with all the metadata.
> A good place to start is:
>
> http://rubygems.rubyforge.org/wiki/wiki.pl?CreateAGemIn...
>
> The page has a gem spec that you can start with an edit to your
> satisfication.

Yes, I did read that. My questions were all post-RTFM FWIW. One should
always RTFM ASAP IMHO.

> Or wait till this weekend and we can help you in person!

Now there's a thought.

Really it shouldn't take long. Maybe Thur evening?

At any rate, I want to make it available no later than my talk. Just in case
people want to look at it.


Thanks,
Hal





Mauricio Fernández

9/28/2004 5:56:00 PM

0

On Wed, Sep 29, 2004 at 01:17:27AM +0900, Hal Fulton wrote:
> Hello all...
>
> I am rather package-phobic and usually just offer a .tgz and a readme.
> But I'm thinking of doing a little more this time.

If you point me to your .tgz, RPA might repackage it for you ;-)

> I have an app I want to package, and I want to create a gem.
>
> I *believe* that setup.rb is still required, is it not??

RubyGems does not require setup.rb; it needs a "gemspec".

> Anyhow, I have never used setup.rb except to play with it, and I've
> never created a gem.
>
> Some of my constraints are:
>
> 1. I have libs that are require'd only by this app (i.e., they are
> just separate pieces for convenience). Where should they go, and
> how should I reference them in the app?

If they are packaged independently, you can indicate the dependencies.
You probably want to install them under a common namespace (myapp/).

> 2. Same question for data files and such. Where to put them, how to
> reference them?

There's a problem with RubyGems + datafiles;
see http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
and http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

Data files are normally found under
File.join(::Config::CONFIG["datadir"], "share")
but this won't work with RubyGems so you would have to modify your program.

> 3. Suppose I have a file of marshalled data and want to run a little
> utility program to load it into a .db -- how/when should I do this?

A mechanism to run post-installation scripts is being discussed in
RubyGems' ML. It seems unlikely to be implemented, though, since the
majority seems to be against it.

> Any assistance appreciated.

Just give me a link to the tgz :-)

--
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com



Chad Fowler

9/28/2004 7:25:00 PM

0

On Wed, 29 Sep 2004 02:56:29 +0900, Mauricio Fernández
<batsman.geo@yahoo.com> wrote:
> > 2. Same question for data files and such. Where to put them, how to
> > reference them?
>
> There's a problem with RubyGems + datafiles;

"problem" is an overstatement, butyou're generally right. It's
obviously possible, but it requires RubyGems-specific code. A
standard ruby library that is gems-aware, as you suggest would be a
way to abstract it. The second option seems like a recipe for
disaster.

> see http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
> and http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
>
> Data files are normally found under
> File.join(::Config::CONFIG["datadir"], "share")
> but this won't work with RubyGems so you would have to modify your program.
>
> > 3. Suppose I have a file of marshalled data and want to run a little
> > utility program to load it into a .db -- how/when should I do this?
>
> A mechanism to run post-installation scripts is being discussed in
> RubyGems' ML. It seems unlikely to be implemented, though, since the
> majority seems to be against it.
>

I'd say it _is_ likely, actually. RubyConf will be a great time for
us to discuss some of the ongoing questions and reach resolutions.

It's also a great time for attendees to contribute ideas, opinions,
CODE, etc. :) Looking forward to making some big RubyGems progress as
a result of its first conference-year birthday.

> > Any assistance appreciated.
>
> Just give me a link to the tgz :-)
>

If not before the conference, catch me when you get there. We'll
package your app together.

There's also a chapter in the Pickaxe II that will help (available
online as a PDF preview).

Chad



dblack

9/28/2004 8:15:00 PM

0

Eivind Eklund

10/1/2004 12:30:00 PM

0

On Wed, 29 Sep 2004 04:24:45 +0900, Chad Fowler <chadfowler@gmail.com> wrote:
> I'd say it _is_ likely, actually. RubyConf will be a great time for
> us to discuss some of the ongoing questions and reach resolutions.

Will there be anybody at RubyConf that has experience with packaging
and/or full operating systems engineering? Neither Mauricio nor I
will be there.

If nobody else with large scale experience step up to be the "voice of
criticism and care", I think making decisions there is a bad idea.

Eivind.


vruz

10/1/2004 3:08:00 PM

0

> If nobody else with large scale experience step up to be the "voice of
> criticism and care", I think making decisions there is a bad idea.

Especially being Mr Matz absent from it this year...

Pushing standards for technical excellence is okay, it's great, it's
at the very core of the opensource philosophy.

Pushing standards for the sake of it ignoring experienced people,
ignoring relevant engineering processes: now that sucks, it's
anti-opensource.

Proprietary lock-in, land-grabbing, blocking out "competition", and
defining standards in closed rooms are practices that have NOTHING to
do with an opensource community.

This attempt doesn't have ANYTHING to do with the concept of meritocracy.

It's not only a bad idea, it's a SHAME.

The decision of what's a standard and what's not a standard in Ruby
has always been taken by Mr Yukihiro Matsumoto, and it should be kept
that way.

I recognise no other authority in the Rubysphere.

> Eivind.

--
--- vruz


dblack

10/1/2004 5:21:00 PM

0