I''ve created a rake task that does various things, one of which is calling a script. When I call that script from my Rails.root folder, it works, but it doesn''t work inside my rake task. [This is rails 3] That is, the following line works from bash: lib/daemons/mailer_ctl start However, inside my rake task, this line does not work: puts `lib/daemons/mailer_ctl start` The error message is: lib/daemons/mailer_ctl:3:in `require'': no such file to load -- daemons (LoadError) from lib/daemons/mailer_ctl:3 So, it can''t be a problem with the current working directory, because it found the file to execute. The daemon is very typical. The first few lines are: #!/usr/bin/env ruby require ''rubygems'' require "daemons" require ''yaml'' require ''erb'' So, the require for rubygems must have succeeded, since it failed on the require for daemons. Why does it work from the command line, but not from the rake task? Thanks, -- 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 Oct 6, 7:51 pm, Paul <p...-mzPrHiy5csbYtjvyW6yDsg@public.gmane.org> wrote:> So, the require for rubygems must have succeeded, since it failed on > the require for daemons. > > Why does it work from the command line, but not from the rake task? >Check the environment used by `` - could it be picking up a different $PATH (and thus a different ruby install) ? Fred> Thanks,-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> Check the environment used by `` - could it be picking up a different > $PATH (and thus a different ruby install) ? > > FredWell, that''s odd, too. If I put: puts `set` in my rake file, it gives me the error: /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.0/lib/rails/application.rb:103: command not found: set Which doesn''t make sense to me at all. Anyway, `ruby -v` gives the same version from the command line as from the rake file, and this computer only has one version of ruby anyway, so I figured it would. Any other ideas? Or any workarounds? -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
SOLVED: I needed: gem ''daemons'' in my Gemfile. When I ran it from the command line, it doesn''t go through bundler, but evidently, even though I''m supposedly just spawning a separate process, it magically is. -- 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.