# Rubyscript2Exe directory management

**URL:** <https://www.ruby-forum.com/t/rubyscript2exe-directory-management/73752>\
**Category:** Ruby\
**Created:** [October 26, 2006, 9:17pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-directory-management/73752 "2006-10-26T21:17:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmorin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@dmorin](https://www.ruby-forum.com/u/dmorin)\
**Post date:** [October 26, 2006, 9:17pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-directory-management/73752/1 "2006-10-26T21:17:12Z")

</div>

I’d like to use rubyscript2exe to move over a Ruby application and its  
environment to a production box that will be run by a sysadmin. As such  
he needs some control over things like where the app installs itself,  
and the ability to modify the config.yml file I’ve associated with the  
app. I don’t really have a handle on what I can and can’t control.  
This is a windows box, by the way.

For instance, the app and everything about it seems to install itself  
relative to c:\documents and settings\user\local settings… blah blah  
blah. I would rather be able to tell it exactly where to uninstall  
itself. Possible? I suppose I can set the TEMP environment variable,  
but that seems like a hack that I wouldn’t be too excited to write in  
the official instructions.

Second, I can’t “just extract” the app. I try running with the  
–eee-just-extract flag and I get this: COuldn’t create directory  
c:\temp\C:/ApplicationDirectory

where c:\ApplicationDirectory is what my present working directory was  
when I ran the original rubyscript2exe executable. Just thinking aloud,  
can I manipulate either the appdir or userdir variable during the  
is\_compiling phase to change this? How do I make the extra C:\ go away  
so it is a legal directory?

Is there any way to tell the app that it’s ok to use the directories  
specified? For instance in my config.yml file if I want to say datadir:  
d:\client\data\ftp or something like that, I can’t seem to get it to  
work properly. I think it is looking for this directory relative to the  
temp area where the app installed itself, which is not what I want.

Thanks for any help!

Duane

---

<div class="post-metadata">

**Author:** ![dmorin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@dmorin](https://www.ruby-forum.com/u/dmorin)\
**Post date:** [October 27, 2006, 3:59pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-directory-management/73752/2 "2006-10-27T15:59:01Z")

</div>

Ok, not really sure what changed on me, but I’m getting different  
results now. I can run --eee-justextract on my application and it does  
successfully explode itself into the current directory. I could swear  
that it tried to extract itself into the temp directory yesterday, I did  
not imagine that nested C:\ error message :).

But now my error has changed. When I run the app directly as an  
executable (something I don’t want to do, because my operations guy  
wants this thing to have a permanent home, not extract itself as  
needed), it runs. But when I extract it first and then run it, it keeps  
telling me some key gems I need are missing. ActiveRecord, for one:

./lib/rubygems.rb:251:in `report_activate_error': Could not find RubyGem activer ecord (>= 0.0.0) (Gem::LoadError) from ./lib/rubygems.rb:188:in`activate’  
from ./lib/rubygems.rb:66:in `active_gem_with_options' from ./lib/rubygems.rb:59:in`require\_gem’  
from ./lib/profileelement.rb:1  
from ./lib/rubygems/custom\_require.rb:27:in  
`gem_original_require' from ./lib/rubygems/custom_require.rb:27:in`require’  
from ./lib/pdf\_output.rb:8  
from ./lib/rubygems/custom\_require.rb:27:in  
`gem_original_require' from ./lib/rubygems/custom_require.rb:27:in`require’  
from app/init.rb:39

Which is where because, from what I can see, it’s in there:

Directory of C:\bla\lib\rubyscript2exe.gems\gems\activerecord-1.14.4

10/27/2006 09:44 AM .  
10/27/2006 09:44 AM …  
10/27/2006 09:53 AM 129,246 CHANGELOG  
10/27/2006 09:44 AM examples  
10/27/2006 09:53 AM 747 install.rb  
10/27/2006 09:44 AM lib  
10/27/2006 09:53 AM 5,997 Rakefile  
10/27/2006 09:53 AM 11,797 README  
10/27/2006 09:53 AM 1,780 RUNNING\_UNIT\_TESTS  
10/27/2006 09:44 AM test  
5 File(s) 149,567 bytes

I am specifying the -I lib\ parameter, as described in the instructions:

bin\ruby -I lib\ app\init.rb

I know it’s in there and works, because as I said, when I don’t extract,  
it works fine. Could it be extracting into the wrong place or  
something? This happened with a number of other libraries (pdf-writer,  
rubyzip) but through some juggling of directories and additional -I  
parameters I made those go away. But I’m stuck on activerecord now.

d

Duane M. wrote:

> I’d like to use rubyscript2exe to move over a Ruby application and its  
> environment to a production box that will be run by a sysadmin. As such  
> he needs some control over things like where the app installs itself,  
> and the ability to modify the config.yml file I’ve associated with the  
> app. I don’t really have a handle on what I can and can’t control.  
> This is a windows box, by the way.
> 
> For instance, the app and everything about it seems to install itself  
> relative to c:\documents and settings\user\local settings… blah blah  
> blah. I would rather be able to tell it exactly where to uninstall  
> itself. Possible? I suppose I can set the TEMP environment variable,  
> but that seems like a hack that I wouldn’t be too excited to write in  
> the official instructions.
> 
> Second, I can’t “just extract” the app. I try running with the  
> –eee-just-extract flag and I get this: COuldn’t create directory  
> c:\temp\C:/ApplicationDirectory
> 
> where c:\ApplicationDirectory is what my present working directory was  
> when I ran the original rubyscript2exe executable. Just thinking aloud,  
> can I manipulate either the appdir or userdir variable during the  
> is\_compiling phase to change this? How do I make the extra C:\ go away  
> so it is a legal directory?
> 
> Is there any way to tell the app that it’s ok to use the directories  
> specified? For instance in my config.yml file if I want to say datadir:  
> d:\client\data\ftp or something like that, I can’t seem to get it to  
> work properly. I think it is looking for this directory relative to the  
> temp area where the app installed itself, which is not what I want.
> 
> Thanks for any help!
> 
> Duane

---

<div class="post-metadata">

**Author:** ![dmorin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@dmorin](https://www.ruby-forum.com/u/dmorin)\
**Post date:** [October 29, 2006, 6:17pm UTC](https://www.ruby-forum.com/t/rubyscript2exe-directory-management/73752/3 "2006-10-29T18:17:26Z")

</div>

> > Second, I can’t “just extract” the app. I try running with  
> > the --eee-just-extract flag and I get this: COuldn’t create  
> > directory c:\temp\C:/ApplicationDirectory

It’s only possible to use a fixed directory name in %TEMP%. You  
can’t specify a full path. But it probably isn’t too hard to  
implement. I’ll consider it.

> Ok, not really sure what changed on me, but I’m getting  
> different results now. I can run --eee-justextract on my  
> application and it does successfully explode itself into the  
> current directory.

You did “–eee-justextract” instead of “–eee-just-extract”…  
;] The former works; the latter doesn’t.

> I could swear that it tried to extract itself into the temp  
> directory yesterday, I did not imagine that nested C:\ error  
> message :).

“c:\temp\C:/ApplicationDirectory” probably was a result of  
running “–eee-just-extract” in combination with  
“RUBYSCRIPT2EXE.tempdir=‘C:/ApplicationDirectory’”. Debugging  
isn’t easy when making 2 errors at the same time… ;]

> > where c:\ApplicationDirectory is what my present working  
> > directory was when I ran the original rubyscript2exe  
> > executable.

Sorry, should be “3 errors”… ;] You probably thought that  
“c:\ApplicationDirectory” was there because it was the current  
directory, although it probably was there because you specified  
it in your code. But I’m not sure, it’s just a guess.

> I am specifying the -I lib\ parameter, as described in the  
> instructions:
> 
> bin\ruby -I lib\ app\init.rb

That’s not correct, anymore. (As usual, code is faster than  
documentation…) It should be (on Windows):

bin\ruby -r .\bootstrap.rb -T1 empty.rb .\app\yourscript.rb

This bootstrap.rb sets up the (fake) RubyGems environment.

Thanks.

gegroet,  
Erik V. - [http://www.erikveen.dds.nl/](http://www.erikveen.dds.nl/)
