ENV['_'] present on MacOS X, missing on OpenBSD

Hi,

The acts_as_ferret server refers to ENV[’_’] in server_manager.rb:

require(File.join(File.dirname(ENV[’_’]), ‘…/config/environment’))

ENV[’_’] is nil so the script fails. I am assuming that it is supposed
to be the folder name of the script that is running or something like
that, but I can’t find an documentation on it. I am also assuming that
it may be one of those automatic environment variables passed in as part
of the execution context on most systems, but may not be on FreeBSD.

Three things:

  1. What should this be returning?

  2. How can I get it to return the right thing?

  3. If it is indeed returning the name of the folder where the script is
    executing from, couldn’t I jusr replace it with:

    require(RAILS_ROOT + ‘/config/environment’)

?

TIA

Gideon

Gideon King wrote:

  1. If it is indeed returning the name of the folder where the script is
    executing from, couldn’t I jusr replace it with:

    require(RAILS_ROOT + ‘/config/environment’)

of course that won’t work because we are not in the rails environment. I
saw that there was another line in the ferret source that was commented
out, and tried that instead, and it is working:

require(File.join(File.dirname(FILE),
‘…/…/…/…/config/environment’))

don’t know if there are any downsides to doing it that way, but at least
I’m up and running.

Gideon

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs