[Rubygems-developers] Executing code after installing gem

Luis Lavena luislavena at gmail.com
Tue Nov 25 07:24:22 EST 2008


On Tue, Nov 25, 2008 at 9:08 AM, Matt King <swdc17 at gmail.com> wrote:
> Hi all,
>
> I have been looking for a way to execute some Ruby code at the end of
> installing my gem. I can't seem to find anything that allows me to do
> this.
>
> I want to chmod a file in the gem directory. I don't want to have to
> tell my users they must do this upon install. I would have it run on
> requirement of the gem, but chmod'ing the file will most likely
> require sudo rights as well.
>
> Any help appreciated,
> -Matt

Hello Matt,

RubyGems is not designed for arbitrary code execution, which will be a
security concern.

A bad intentioned gem developer will release a gem that can take
advantage of this privilege and perform nasty tasks.

If you like to have a script marked as executable, why not create a
CLI and put into the bin directory to be mapped by rubygems as
executable for you?

http://rubygems.org/read/chapter/20#default_executable
http://rubygems.org/read/chapter/20#executables

-- 
Luis Lavena
AREA 17
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams


More information about the Rubygems-developers mailing list