Reputation:
I am writing a gem, and I need a .bat
file to be installed into bin
when the gem is downloaded from rubygems.
The rails gem appears to do something similar, since after running gem install rails
, the rails.bat
file shows up in my ruby install directory (I'm on windows, but I'm sure that the equivalent shell script shows up on *nix systems)
My question is, how does rails.bat
get to the bin directory, and how can I mimic this action to get my .bat
file into bin when users install my gem?
Upvotes: 2
Views: 244
Reputation: 18762
In the gemspec, you can use executables
option to add binaries.
Rails does this in its railties.gemspec
, by adding rails executable as below:
s.executables = ['rails']
RubyGems guide has a section on "Adding an executable"
gem install <gem-name>
takes cares of creating .bat
file in Ruby's bin
folder
Upvotes: 1