[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Gems, put an executable script in path? like rails?

warhero

7/22/2007 4:07:00 PM

Hey all, how do you put an executable in your path through gems.. like
when installing rails. you have a new command called "rails" what are
they doing to do that? - Thanks
--
Posted via http://www.ruby-....

2 Answers

Anthony Eden

7/22/2007 4:24:00 PM

0

When constructing your gem spec you need to include the bindir and the
executables array. For example, here is the relevant code from the
Rakefile for ActiveWarehouse ETL:

spec = Gem::Specification.new do |s|
#snip
s.bindir = "bin" # Use these for applications.
s.executables = ['etl']
s.default_executable = "etl"
# snip
end

This would cause the script bin/etl to appear as an executable script
on the system where the gem is installed. Inside my bin/etl script I
usually delegate to code that's actually in lib, however you may
implement as you see fit. HTH.

V/r
Anthony Eden

On 7/22/07, Aaron Smith <beingthexemplary@gmail.com> wrote:
> Hey all, how do you put an executable in your path through gems.. like
> when installing rails. you have a new command called "rails" what are
> they doing to do that? - Thanks
> --
> Posted via http://www.ruby-....
>
>


--
Cell: 808 782-5046
Current Location: Melbourne, FL

warhero

7/22/2007 4:31:00 PM

0

On 7/22/07, Anthony Eden <anthonyeden@gmail.com> wrote:
> When constructing your gem spec you need to include the bindir and the
> executables array. For example, here is the relevant code from the
> Rakefile for ActiveWarehouse ETL:
>
> spec = Gem::Specification.new do |s|
> #snip
> s.bindir = "bin" # Use these for applications.
> s.executables = ['etl']
> s.default_executable = "etl"
> # snip
> end
>
> This would cause the script bin/etl to appear as an executable script
> on the system where the gem is installed. Inside my bin/etl script I
> usually delegate to code that's actually in lib, however you may
> implement as you see fit. HTH.
>
> V/r
> Anthony Eden
>
> On 7/22/07, Aaron Smith <beingthexemplary@gmail.com> wrote:
> > Hey all, how do you put an executable in your path through gems.. like
> > when installing rails. you have a new command called "rails" what are
> > they doing to do that? - Thanks
> > --
> > Posted via http://www.ruby-....
> >
> >
>
>
> --
> Cell: 808 782-5046
> Current Location: Melbourne, FL
>
>


Thanks that worked perfectly.
Aaron