Getting FeedParser for Ruby to work out of the extension/lib  
directory for the RSS extension proved all but impossible as far as I  
could tell. All the same stands true for the Akismet library in  
commentable too. I just don't think that the my_extension/lib is in  
the path though I know it was in the plugins/behavior world and  
thought it worked earlier when playing with extensions:

e.g.

For RssReader the FeedParser module was setup such that it had a  
there is a file at lib/feedparser.rb and also a directory including  
some of it's depedencies which it explicitely references using paths  
relative from the lib directory (e.g. require 'feedparser/ 
textconverters').

I tried this setup as well as moving the supporting files out of the  
feedparser directory and directly into lib themselves (changing the  
relative paths in the require statements).

After trying any number of tricks including giving the requires  
absolute paths from Radiant's root (a la "vendor/extensions/ 
rss_reader/lib/feedparser')

Everything I tried always got me the same error from mongrel on  
starting the server:

/Applications/Locomotive2/Bundles/standardRailsSept2006.locobundle/ 
powerpc/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in  
`gem_original_require': no such file to load -- feedparser  
(MissingSourceFile)
...


Any Page types I've put in lib do get loaded so this is fishy to me.

I hope I'm missing something, but as far as I can tell files in  
extension/lib are not reliably getting loaded?


extension_loader.rb has this:

     def discover_extensions
       config.extension_paths.map do |path|
         Dir.glob("#{path}/*").sort.select { |f| File.directory? 
(f) }.map do |ext_path|
           load_paths = %w(lib app/models app/controllers app/ 
helpers).map { |p| "#{ext_path}/#{p}" }
           load_paths << ext_path
           load_paths.each { |p| config.load_paths << p }
           config.controller_paths << "#{ext_path}/app/controllers"
           config.view_paths << "#{ext_path}/app/views"
           @extension_roots << ext_path
         end
       end.flatten
     end


Which looks to me like it should be setting-up the necessary load  
paths to make things go...

Am I crazy?

Loren Johnson
www.fn-group.com


On Jan 25, 2007, at 8:22 AM, Sean Cribbs wrote:

> A statement in general about extensions:  If your extension has any  
> dependencies, it's best to include them in the lib/ directory of  
> the extension.  That way you can avoid any 'dependency hell'.  The  
> exception, of course, is gems and other libraries like RMagick that  
> are potentially system-specific ( i.e. binary) or require  
> installation.  The thing I liked about acts_as_attachment is that  
> it still works even if you don't have RMagick.
>
> Sean

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to