[Nitro] Smarter nitro executable

Thomas Leitner t_leitner at gmx.at
Sun Dec 9 02:20:46 EST 2007


I do the following for getting the data directory in webgen which  
works in all cases (not installed, installed via setup.rb and  
installed via gems):

module Webgen

   # Returns the data directory for webgen.
   def self.data_dir
     unless defined?( @@data_dir )
       @@data_dir =  File.expand_path( File.join( File.dirname 
( __FILE__ ), '..', '..', 'data', 'webgen') )

       @@data_dir = File.expand_path( File.join( Config::CONFIG 
["datadir"], "webgen" ) ) if !File.exists?( @@data_dir )

       raise "Could not find webgen data directory! This is a bug,  
report it please!" unless File.directory?( @@data_dir )
     end
     @@data_dir
   end

end

Something similar should do the trick for the load path.

*hth*,
   Thomas

On 08.12.2007, at 10:38, George Moschovitis wrote:

> Interesting idea,
>
> do you feel capable of implementing this? It would be a great  
> contribution.
>
> -g.
>
> On Dec 8, 2007 8:33 AM, Arne Brasseur < arne at arnebrasseur.net> wrote:
> Another idea I've had, if the nitro executable would be able to figure
> out if it's installed as a gem or not, it could in the second  case  
> take
> care itself of setting the loadpath for nitro. That way when running
> from the repo you wouldn't have to juggle too many environment  
> variables
> and the likes, it would "just work".
>
> Opinions?
>
> (ab)
>
> --
> Ein Fuchs muß tun, was ein Fuchs tun muß
> arne at arnebrasseur.net
>
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
>
>
> -- 
> http://me.gr
> http://joy.gr
> http://cull.gr
> http://nitroproject.org
> http://phidz.com
> http://joyerz.com
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20071209/8c67d353/attachment.html 


More information about the Nitro-general mailing list