How can I get ruby to look for gems in the local repository first, then in the site repository? The following bash env vars are set and exported: GEM_HOME=/home5/allcarsm/ruby/gems GEM_PATH=/home5/allcarsm/ruby/gems:/usr/lib/ruby/gems/1.8:/usr/lib64/ ruby/gems/1.8 Local gems are in /home/allcarsm/ruby/gem and chronic-0.2.3 is installed there. But when I run the controller which includes chronic, I get ---- uninitialized constant HomeyController::Chronic I''ve been looking high and low for a config or env var to set for Ruby but cant seem to solve this. Help? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 12, 3:52 pm, Larry K <lkang...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I get ruby to look for gems in the local repository first, > then in the site repository? > > The following bash env vars are set and exported: > > GEM_HOME=/home5/allcarsm/ruby/gems > GEM_PATH=/home5/allcarsm/ruby/gems:/usr/lib/ruby/gems/1.8:/usr/lib64/ > ruby/gems/1.8 > > Local gems are in /home/allcarsm/ruby/gem and chronic-0.2.3 is > installed there. > > But when I run the controller which includes chronic, I get > > ---- uninitialized constant HomeyController::ChronicHave you included the chronic gem as a dependency in config/ environment.rb? The error message that you''re getting tends to imply not. Try this - open config/environment.rb, and add this line: config.gem ''chronic'' to the initializer block (you should see commented examples in the file already). --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I figured it out. The apache server doesnt start ruby using bash, so GEM_HOME and GEM_PATH were not set. These env vars are used by Ruby to find the gems. I figured out by reading the boot.rb code that I can create a file config/preinitializer.rb and set the env vars using Ruby language constructs. This file is included (and executed) early in the boot process. Now the system runs and finds the gems in the local repository. On Jan 12, 12:52 pm, Larry K <lkang...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How can I get ruby to look for gems in the local repository first, > then in the site repository? > > The following bash env vars are set and exported: > > GEM_HOME=/home5/allcarsm/ruby/gems > GEM_PATH=/home5/allcarsm/ruby/gems:/usr/lib/ruby/gems/1.8:/usr/lib64/ > ruby/gems/1.8 > > Local gems are in /home/allcarsm/ruby/gem and chronic-0.2.3 is > installed there. > > But when I run the controller which includes chronic, I get > > ---- uninitialized constant HomeyController::Chronic > > I''ve been looking high and low for a config or env var to set for Ruby > but cant seem to solve this. Help?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.