I''m experiencing some require-weirdness when deploying a railsapp which uses the Rails PDF Plugin gem[1]. I''m not sure if anyone on this list has any experience with this gem, or has a moment to try to help me troubleshoot this, but I figured it was worth a shot. The plugin page on rubyforge has not been active in almost a year, so... ;) I''m developing on my local machine (mac), using the Locomotive rails environment[2]. I''m deploying to a linux server[2]. Both machines are running the same version of ruby and applicable gems. While everything works fine locally, when I deploy to the server and try to access the the railsapp, I receive Application Error 500s from the webserver ("premature end of script headers"). Running dispatch.cgi locally (on the server) reveals an issue with RailsPDF: /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in `require__'': no such file to load -- RailsPDF (MissingSourceFile) Line 18 in custom_require.rb is part of the Kernel module, which loads gems on demand[4]. So its apparently not finding the RailsPDF gem when it attempts to load it. But "gem list --local" does find the gem (see [2]), and I can visually confirm its presence by looking in "/usr/local/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/". This leaves me stumped. Is there any way I can determine exactly where custom_require.rb is looking for the RailsPDF gem? I assume loadpath is "/usr/local/lib/ruby/gems/1.8/gems/", but I don''t know this for certain. This is certainly where all my other gems are located and none of them have failed to load. What other questions should I be asking at this point? Any pointers that someone could offer would be greatly appreciated! Thanks in advance, ~gwendy [1] http://rubyforge.org/projects/railspdfplugin/ http://wiki.rubyonrails.org/rails/pages/Rails+PDF+Plugin/versions/18 [2] Development environment: webserver: lightty (as built into Locomotive) database: sqlite3 $ ruby -v ruby 1.8.4 (2005-12-24) [i686-darwin8.6.1] $ gem list --local [edit: list is truncated to the potentially relevant] *** LOCAL GEMS *** activerecord (1.14.4, 1.14.3, 1.14.2) Implements the ActiveRecord pattern for ORM. activesupport (1.3.1) Support and utility classes used by the Rails framework. capistrano (1.2.0, 1.1.0) Capistrano is a framework and utility for executing commands in parallel on multiple remote machines, via SSH. The primary goal is to simplify and automate the deployment of web applications. capistrano-ext (1.0.1) Capistrano Extensions is a set of useful task libraries and methods that other developers may reference in their own recipe files. color-tools (1.3.0) color-tools provides colour space definition and manpiulation as well as commonly named RGB colours. pdf-writer (1.1.3) A pure Ruby PDF document creation library. rails (1.1.6, 1.1.4, 1.1.2) Web-application framework with template engine, control-flow layer, and ORM. rake (0.7.1) Ruby based make-like utility. transaction-simple (1.3.0) Simple object transaction support for Ruby. [3] Production environment: webserver: apache 1.3.36 database: MySQL 4.1.21 # ruby -v ruby 1.8.4 (2005-12-24) [i686-linux] # gem list --local *** LOCAL GEMS *** activerecord (1.14.4, 1.14.3, 1.14.0, 1.13.2, 1.11.1) Implements the ActiveRecord pattern for ORM. activesupport (1.3.1, 1.3.0, 1.2.5, 1.1.1) Support and utility classes used by the Rails framework. capistrano (1.2.0) Capistrano is a framework and utility for executing commands in parallel on multiple remote machines, via SSH. The primary goal is to simplify and automate the deployment of web applications. color-tools (1.3.0) color-tools provides colour space definition and manpiulation as well as commonly named RGB colours. pdf-writer (1.1.3) A pure Ruby PDF document creation library. rails (1.1.6, 1.1.4, 1.1.0, 1.0.0, 0.13.1) Web-application framework with template engine, control-flow layer, and ORM. rake (0.7.1, 0.7.0, 0.6.2) Ruby based make-like utility. transaction-simple (1.3.0) Simple object transaction support for Ruby. [4] /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb 3 module Kernel 4 alias require__ require 5 6 # 7 # We replace Ruby''s require with our own, which is capable of loading gems on demand. 8 # 9 # When you call <tt>require ''x''</tt>, this is what happens: 10 # * If the file can be loaded from the existing Ruby loadpath, it is. 11 # * Otherwise, installed gems are searched for a file that matches. If it''s found in gem 12 # ''y'', that gem is activated (added to the loadpath). 13 # 14 # The normal <tt>require</tt> functionality of returning false if that file has already been 15 # loaded is preserved. 16 # 17 def require(path) 18 require__ path 19 rescue LoadError => load_error 20 begin 21 @gempath_searcher ||= Gem::GemPathSearcher.new 22 if spec = @gempath_searcher.find(path) 23 Gem.activate(spec.name, true, "= #{spec.version}") 24 require__ path 25 else 26 raise load_error 27 end 28 end 29 end 30 end # module Kernel --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
What do you get if you type?>gem environmenton your server? _Kevin --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
_Kevin wrote:> What do you get if you type? >> gem environment >> > on your server? >Thank you for the suggestion! On the plus side, that shows me what I wanted to see: # gem environment Rubygems Environment: - VERSION: 0.8.10 (0.8.10) - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8 - GEM PATH: - /usr/local/lib/ruby/gems/1.8 - REMOTE SOURCES: - http://gems.rubyforge.org On the not plus side, the gem path appears to be where I expected it to be, and it doesn''t reveal an easy answer as to why the Rails PDF gem is not being found. I''m not sure if this is pertinent or not, but it looks like ruby is looking for a gem called "RailsPDF" ("no such file to load -- RailsPDF (MissingSourceFile)"), but I can''t find anything within /usr/local/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/ which contains or references that name. ~gwendy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/26/06, gwendy <gwendolyn@3.14159.ca> wrote:> I''m not sure if this is pertinent or not, but it looks like ruby is > looking for a gem called "RailsPDF" ("no such file to load -- RailsPDF > (MissingSourceFile)"), but I can''t find anything within > /usr/local/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/ which contains or > references that name.That''s because the RailsPDF gem is separate from PDF::Writer and it is not maintained by the PDF::Writer maintainer. (That would be me, even though I''m too busy to do much maintaining right now.) There is no file to require ''RailsPDF''. You need to see how you''re supposed to use the Rails PDF plugin according to that documentation. -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:> On 9/26/06, gwendy <gwendolyn@3.14159.ca> wrote: > >> I''m not sure if this is pertinent or not, but it looks like ruby is >> looking for a gem called "RailsPDF" ("no such file to load -- RailsPDF >> (MissingSourceFile)"), but I can''t find anything within >> /usr/local/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/ which contains or >> references that name. >> > > That''s because the RailsPDF gem is separate from PDF::Writer and it is > not maintained by the PDF::Writer maintainer. (That would be me, even > though I''m too busy to do much maintaining right now.) > >And confusion abounds! (On my end, that is!) This is what happens when you come back to something after a break. Details get muddled and you forget what''s what :( I''d forgotten that I had at one point looked at two different PDF tools! Let''s forget that reference to PDF::Writer all together. Its not relevant ;)> There is no file to require ''RailsPDF''. You need to see how you''re > supposed to use the Rails PDF plugin according to that documentation. >Alas, its not so simple as consulting the documentation (which amounts to "install and use" anyway). The plugin IS installed and working on my development box. The source is checked in to svn, and has been deployed to my production server. Same source, same configuration. I''m even still running in "Development" mode on both machines. Here it works. There it doesn''t. What''s the difference? The only thing that I can see is the physical environment that the source is being run in. But we''re still talking about the same *versions* of ruby on down. I''m also intrigued, now, as to why ruby appears to be looking for a RailsPDF gem when it is not a gem at all. I''m certainly not referencing it as a gem anywhere. But so it goes. The learning experience continues..... ~gwendy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/26/06, gwendy <gwendolyn@3.14159.ca> wrote:> And confusion abounds! (On my end, that is!) This is what happens when > you come back to something after a break. Details get muddled and you > forget what''s what :(> I''d forgotten that I had at one point looked at two different PDF > tools! Let''s forget that reference to PDF::Writer all together. Its > not relevant ;)It is, in a way. The Rails PDF plugin uses PDF::Writer as its PDF creator. The plugin only enables .rpdf capabilities.>> There is no file to require ''RailsPDF''. You need to see how you''re >> supposed to use the Rails PDF plugin according to that documentation.> Alas, its not so simple as consulting the documentation (which amounts > to "install and use" anyway). The plugin IS installed and working on > my development box. The source is checked in to svn, and has been > deployed to my production server. Same source, same configuration. I''m > even still running in "Development" mode on both machines. Here it > works. There it doesn''t. What''s the difference? The only thing that I > can see is the physical environment that the source is being run in. > But we''re still talking about the same *versions* of ruby on down.> I''m also intrigued, now, as to why ruby appears to be looking for a > RailsPDF gem when it is not a gem at all. I''m certainly not > referencing it as a gem anywhere.I can''t answer to the plugins; but the error you reported is simply that "require ''RailsPDF''" isn''t working because there''s no file ''RailsPDF''. -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:> On 9/26/06, gwendy <gwendolyn@3.14159.ca> wrote: > > And confusion abounds! (On my end, that is!) This is what happens when > > you come back to something after a break. Details get muddled and you > > forget what''s what :( > > > I''d forgotten that I had at one point looked at two different PDF > > tools! Let''s forget that reference to PDF::Writer all together. Its > > not relevant ;) > > It is, in a way. The Rails PDF plugin uses PDF::Writer as its PDF > creator. The plugin only enables .rpdf capabilities. > > >> There is no file to require ''RailsPDF''. You need to see how you''re > >> supposed to use the Rails PDF plugin according to that documentation. > > > Alas, its not so simple as consulting the documentation (which amounts > > to "install and use" anyway). The plugin IS installed and working on > > my development box. The source is checked in to svn, and has been > > deployed to my production server. Same source, same configuration. I''m > > even still running in "Development" mode on both machines. Here it > > works. There it doesn''t. What''s the difference? The only thing that I > > can see is the physical environment that the source is being run in. > > But we''re still talking about the same *versions* of ruby on down. > > > I''m also intrigued, now, as to why ruby appears to be looking for a > > RailsPDF gem when it is not a gem at all. I''m certainly not > > referencing it as a gem anywhere. > > I can''t answer to the plugins; but the error you reported is simply that > "require ''RailsPDF''" isn''t working because there''s no file ''RailsPDF''. > > -austin > -- > Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ > * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ > * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.orgI''d try this.. Get the ''Gems'' plugin (see http://www.agilewebdevelopment.com/plugins/gems). Use it to freeze all your gems into your rails vendor directory Make sure it works. Deploy the new version with all the gems packed into it. then you won''t need to worry about different gem versions on your local machine and the server. _Kevin --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Austin Ziegler wrote:>> I can''t answer to the plugins; but the error you reported is simply that >> "require ''RailsPDF''" isn''t working because there''s no file ''RailsPDF''. >>Yes; I know that. That is precisely the point of my confusion, and the reason I posted in the first place: I''m getting an error because ruby is unable to find "RailsPDF". It appears to be looking for a gem of that name (*if* I''ve interpreted the full error message correctly). There *is* *no* gem called "RailsPDF". It is a plugin, and the plugin *is* by all accounts properly installed. On my development box, the *exact* same source does not cause ruby to go on a wild goosechase for this mythical "RailsPDF" file (gem or otherwise). Hence the "wtf" look on my face. If I''ve misunderstood the error, and ruby is not looking for gem, then that is useful information for me to work with. I understand that you don''t know anything about this plugin. That''s fair; I''m not specifically looking to you for answers. And I thank you for your time and interest. As I''m about to say below, though, I''m going to shelve this problem for the time being. _Kevin wrote:> I''d try this.. > > Get the ''Gems'' plugin (see > http://www.agilewebdevelopment.com/plugins/gems). > Use it to freeze all your gems into your rails vendor directory > Make sure it works. > Deploy the new version with all the gems packed into it. > > then you won''t need to worry about different gem versions on your local > machine and the server. >Thanks for this suggestion. I tried it, but it had no impact on the problem at hand. I can verify that all of my gems are now included locally in the source (both machines were currently in sync in terms of gem versions anyway, but ensuring things *stay that way* in the future sounds like good insurance to me ;)) I''m about ready to chalk this one up to gremlins. Being able to deploy is more urgent at this point than having PDF support. I''ll look in to it again for version 2 ;) ~gwendy --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/27/06, gwendy <gwendolyn@3.14159.ca> wrote:> Yes; I know that. That is precisely the point of my confusion, and the > reason I posted in the first place: > I''m getting an error because ruby is unable to find "RailsPDF".Is there a file RailsPDF.rb in any of your files on your server? What''s your development platform as opposed to your deployment platform? Could it be that the file is actually railspdf.rb and not RailsPDF.rb? If you''re developing on Windows, Ruby doesn''t care about case sensitivity (because Windows doesn''t). You are misunderstanding the error: when you are using RubyGems, it currently implements a custom Kernel#require method that implements the gem require capabilities (the ability to search within Gem directories for files to require). -austin -- Austin Ziegler * halostatue-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org * http://www.halostatue.ca/ * austin-/yODNl0JVVCozMbzO90S/Q@public.gmane.org * http://www.halostatue.ca/feed/ * austin-BGvFLPKiNqwsA/PxXw9srA@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---