YAML filter borks Radiant

Hi. I’m new to Radiant, and still stumbling around the code.

I’ve written a filter to interpret pages written in YAML. Radiant won’t
run it – it seems that it chokes on the ‘require’ statement. Remove
the statement and it seems to choke on the rest of it. Can anyone
advise?

require ‘YAML’
class PublicationsFilter < TextFilter
description_file File.dirname(FILE) + “/…/publications.html”
def filter(text)
data = YAML::load(text)
html = “”
data.each { |book|
code = <<EOF

#{book['title']}

#{book['description']}

EOF html << code } html end end


Bruno

Bruno wrote:

I’ve written a filter to interpret pages written in YAML. Radiant won’t
run it – it seems that it chokes on the ‘require’ statement. Remove
the statement and it seems to choke on the rest of it. Can anyone
advise?

What is the error message? (Look in your logs.)


John L.
http://wiseheartdesign.com

On 2007-05-16 13:45:36 +0100, “John W. Long”
[email protected] said:

Bruno wrote:

I’ve written a filter to interpret pages written in YAML. Radiant won’t
run it – it seems that it chokes on the ‘require’ statement. Remove
the statement and it seems to choke on the rest of it. Can anyone
advise?

What is the error message? (Look in your logs.)

Well, nothing useful in the production.log or fastcgi.crash log. But
running from the command line produced the following:

eggnog% ./dispatch.fcgi
/home/cadhas/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require': no such file to load -- YAML (MissingSourceFile) from /home/cadhas/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require’
from
…/config/…/vendor/radiant/vendor/rails/activerecord/lib/…/…/activesup
port/lib/active_support/dependencies.rb:496:in require' from ../config/../vendor/radiant/vendor/rails/activerecord/lib/../../activesup port/lib/active_support/dependencies.rb:343:in new_constants_in’
from
…/config/…/vendor/radiant/vendor/rails/activerecord/lib/…/…/activesup
port/lib/active_support/dependencies.rb:496:in require' from /home/.meeko/cadhas/cadhas/vendor/extensions/publications_filter/lib/publ ications_filter.rb:1 from /home/cadhas/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require’
from
/home/cadhas/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
require' from ../config/../vendor/radiant/vendor/rails/activerecord/lib/../../activesup port/lib/active_support/dependencies.rb:496:in require’
… 20 levels…
from …/config/…/vendor/radiant/lib/radiant/initializer.rb:32:in
run' from ./../config/environment.rb:17 from ./dispatch.fcgi:21:in require’
from ./dispatch.fcgi:21


Bruno

Shouldn’t that be in lowercase:

require ‘yaml’

?

Umm…so it should. :-%

I had never realised the requires were case-sensitive. That’s three
hours of my life gone for ever, and several more saved. So thank you.
:slight_smile:

Bruno

Bruno wrote:

Well, nothing useful in the production.log or fastcgi.crash log. But
running from the command line produced the following:

eggnog% ./dispatch.fcgi
/home/cadhas/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’: no such file to load – YAML (MissingSourceFile)
from

Shouldn’t that be in lowercase:

require ‘yaml’

?


John L.
http://wiseheartdesign.com