# Gem issue

**URL:** <https://www.ruby-forum.com/t/gem-issue/84393>\
**Category:** Ruby\
**Created:** [February 3, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/gem-issue/84393 "2007-02-03T22:39:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 3, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/gem-issue/84393/1 "2007-02-03T22:39:18Z")

</div>

I’m working on Ruby program that will have a resource directory for  
storing configuration, logging information, etc. I’ve used the  
**END** and DATA trick in my main ruby program to store some sane  
defaults for the resources directory if this is the first time the  
program has been run by a user.

#!/usr/bin/env ruby

require ‘mylib’

unless File.exist?(ENV[‘HOME’] + ‘.myrc’)  
File.open(ENV[‘HOME’] + ‘.myrc/defaults’, ‘w’) do |fd|  
fd.write DATA.readlines  
end  
end

# use defaults here

**END**  
hash\_key\_1 : 1  
hash\_key\_2 : 2  
etc : and some more

This works very well when my application is run directly. But when  
installed via gems a new ruby script is created that loads my  
executable script ☹ This causes the **END** keyword in my ruby  
script to stop working, and the DATA constant is not set.

Is there a way to tell the gem installer “Hey, quit being so smart and  
just install my executable file without wrappering it with your own  
ruby script”.

Blessings,  
TwP

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 4, 2007, 12:02am UTC](https://www.ruby-forum.com/t/gem-issue/84393/2 "2007-02-04T00:02:25Z")

</div>

On Feb 3, 4:38 pm, “Tim P.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> unless File.exist?(ENV[‘HOME’] + ‘.myrc’)  
> etc : and some more
> 
> This works very well when my application is run directly. But when  
> installed via gems a new ruby script is created that loads my  
> executable script ☹ This causes the **END** keyword in my ruby  
> script to stop working, and the DATA constant is not set.
> 
> Is there a way to tell the gem installer “Hey, quit being so smart and  
> just install my executable file without wrappering it with your own  
> ruby script”.

Something like:

File.read( **FILE** ).split(“ **END** ”).last

But why not store it in a separate config file?

T.

---

<div class="post-metadata">

**Author:** ![timperrett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@timperrett](https://www.ruby-forum.com/u/timperrett)\
**Post date:** [February 4, 2007, 5:23pm UTC](https://www.ruby-forum.com/t/gem-issue/84393/3 "2007-02-04T17:23:54Z")

</div>

On 2/3/07, Trans [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > **END**  
> > just install my executable file without wrappering it with your own  
> > ruby script".
> 
> Something like:
> 
> File.read( **FILE** ).split(“ **END** ”).last
> 
> But why not store it in a separate config file?

I’m trying to be clever in the way I bootstrap this config file into  
existence. Using **END** and DATA seemed very Rubyish and clever.  
Alas that gems are smarter than I am.

I just dumped it into a here doc in the file. Just as effective.

There is a way to tell gem not to create a wrapper, but the user has  
to do it when they install the gem …

gem install --no-wrapper mygem

However, gem is not honoring the executable bit in the file permission  
😕 So the symbolic link to my executable still does not work because  
the executable is no longer executable .

TwP
