manifesto
Manifesto dynamically generates an HTML5 cache manifest for offline application caching. It returns a list of files within the specified directory and sub-directories. By default it also includes a computed hash of the files’ contents, so that if a file is changed a different hash is produced, causing the cache to be automatically invalidated.
Requirements
-
Ruby >= 1.8.6 (not tested with previous versions)
Installation
This library is intended to be installed as a Gem.
$ gem install manifesto
You might need administrator privileges on your system to install it.
Usage
# Basic usage, list all non-hidden files in ./public and include a computed hash of their contents
Manifesto.cache
# Specify a directory
Manifesto.cache :directory => './mobile'
# Specify a directory and don't compute the hash
Manifesto.cache :directory => './mobile', :compute_hash => false
Sample Output
CACHE MANIFEST
# Generated by manifesto (http://github.com/johntopley/manifesto)
# Hash: 7013a3b8292ceeeb6336849bee1d1365
/apple-touch-icon.png
/apple-touch-startup.png
/index.html
/mobile/mobile.css
/mobile/mobile.js
Sinatra Example
require 'manifesto.rb'
get '/manifest' do
headers 'Content-Type' => 'text/cache-manifest' # Must be served with this MIME type
Manifesto.cache
end
Ruby on Rails Example
TODO
Issues
Please use the GitHub issues tracker.
Note on Patches/Pull Requests
-
Fork the project
-
Make your feature addition or bug fix
-
Add tests for it. This is important so I don’t break it in a future version unintentionally
-
Commit, do not mess with rakefile, version, or history (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches
Copyright
Copyright © 2010 John Topley. See LICENSE for details.