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

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-forum.com/.

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-forum.com/\.

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

Thanks that worked perfectly.
Aaron

···

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-forum.com/\.
>

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