I am working on a custom project and developing my own extensions and
plugins.  Additionally, I am integrating third party extensions into my
Radiant site.  Periodically, these custom or third party extensions have
issues that prevent the application from properly loading, particularly
when uploading a site to a host.  The error message you get in console
sometimes is cryptic and so you're not really even thinking that an
extension may be to blame.  At least this was true with me...

I found it extremely helpful for debugging to put a line something like
this at the top of my extension files:

  puts "Loading MyExtension..."

Since then I've simply moved this to a separate file:

load_loaded_dependencies.rb:

module Dependencies
  alias old_log_call log_call
  def log_call(*args)
    begin
      relative_filename =
(args[0].to_s.match('/vendor/.*')[0]).to_s.gsub('/vendor/','') rescue
nil
      puts "Loading dependency: #{relative_filename}" if
relative_filename && relative_filename != @@last_relative_filename
      @@last_relative_filename = relative_filename
    rescue
    ensure
      old_log_call args
    end
  end
end


Then, I simply require this file at the top of my environment.rb file.

Hope this is useful to someone else.

Mario
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
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