Forum: Radiant CMS YAML filter borks Radiant

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bruno (Guest)
on 2007-05-16 11:01
(Received via mailing list)
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
  <div class="book">
  <img src="http://{book['image']}" />
  <h3>#{book['title']}</h3>
  <p class="description">#{book['description']}</p>
  </div>
  EOF
           html << code
             }
        html
   end
end


--
Bruno
John W. Long (Guest)
on 2007-05-16 16:46
(Received via mailing list)
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
Bruno (Guest)
on 2007-05-16 18:18
(Received via mailing list)
On 2007-05-16 13:45:36 +0100, "John W. Long"
<removed_email_address@domain.invalid> 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
John W. Long (Guest)
on 2007-05-16 18:51
(Received via mailing list)
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
Bruno (Guest)
on 2007-05-16 19:46
(Received via mailing list)
>
> 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.
:-)

Bruno
This topic is locked and can not be replied to.