lib/tasks/apipie.rake
# Attempt to use the Rails application views, otherwise default to built in views
Attempt to use the Rails application views, otherwise default to built in views
Attempt to use the Rails application views otherwise default to built in views
def renderer
    return @apipie_renderer if @apipie_renderer
    base_paths = [File.expand_path("../../../app/views/apipie/apipies", __FILE__)]
    base_paths.unshift("#{Rails.root}/app/views/apipie/apipies") if File.directory?("#{Rails.root}/app/views/apipie/apipies")
    layouts_paths = [File.expand_path("../../../app/views/layouts", __FILE__)]
    layouts_paths.unshift("#{Rails.root}/app/views/layouts") if File.directory?("#{Rails.root}/app/views/layouts/apipie")
    if ActionView::Base.respond_to?(:with_empty_template_cache) && ActionView::Base.respond_to?(:with_view_paths)
      @apipie_renderer = ActionView::Base.with_empty_template_cache.with_view_paths(base_paths + layouts_paths)
    else
      @apipie_renderer = ActionView::Base.new(base_paths + layouts_paths)
    end
    @apipie_renderer.singleton_class.send(:include, ApipieHelper)
    return @apipie_renderer
  end
def renderer return @apipie_renderer if @apipie_renderer base_paths = [ File . expand_path ( "../../../app/views/apipie/apipies" , __FILE__ ) ] base_paths . unshift ( "#{Rails.root}/app/views/apipie/apipies" ) if File . directory? ( "#{Rails.root}/app/views/apipie/apipies" ) layouts_paths = [ File . expand_path ( "../../../app/views/layouts" , __FILE__ ) ] layouts_paths . unshift ( "#{Rails.root}/app/views/layouts" ) if File . directory? ( "#{Rails.root}/app/views/layouts/apipie" ) if ActionView :: Base . respond_to? ( :with_empty_template_cache ) && ActionView :: Base . respond_to? ( :with_view_paths ) @apipie_renderer = ActionView :: Base . with_empty_template_cache . with_view_paths ( base_paths + layouts_paths ) else @apipie_renderer = ActionView :: Base . new ( base_paths + layouts_paths ) end @apipie_renderer . singleton_class . send ( :include , ApipieHelper ) return @apipie_renderer end
Attempt to use the Rails application views, otherwise default to built in views
Attempt to use the Rails application views otherwise default to built in views