Module: Ext::Mount

Extended by:
Equipment
Defined in:
lib/ext/mount.rb

Overview

That equipment allows you to mount whole directories as a camping controller. See ControllersClassMethods#mount for options.

Features

  • Easy to use
  • Directory listing (skinnable)
  • Resolving Content-Type on file extensions

Dependencies

  • Equipment
  • Sendfile
  • View
  • mime-types package

Example

Camping.goes :YourApp

module YourApp::Controllers mount File.dirname(File.expand_path(FILE)) #=> YourApp::Controllers::Somefolder end

that will be available under the url : "/your_app/somefolder"

Check the mount method in ControllersClassMethod for more informations. You can also redefine the dir listing template by redefining mount_listing or yourcontroller_listing

eg.

module YourApp::Views

def mount_listing
 ul do 
   @files.each { |f| li f }
   nil # array bug in markaby
 end
end

def somefolder_listing # default
end

end

Controller assignation by hand :

module YourApp::Controllers class Stylesheets < M File.dirname('../public/css'), :name => false, :listing => false end end

Known bug

There is a known bug where issued controllers appears as NilClass in the view. I really don't know why...

Defined Under Namespace

Modules: ControllersClassMethods, Views

Constant Summary

Constants included from Equipment

Equipment::DATA_PATH, Equipment::LIB_PATH

Instance Attribute Summary

Attributes included from Equipment

#debug

Method Summary

Methods included from Equipment

dependencies, depends_on, equip, equip_all, global_extensions, included