This post originated from an RSS feed registered with Ruby Buzz
by John Topley.
Original Post: Announcing Manifesto
Feed Title: John Topley's Weblog
Feed URL: http://johntopley.com/posts.atom
Feed Description: John Topley's Weblog - some articles on Ruby on Rails development.
I’ve just released my first ever RubyGem. It’s a simple gem named Manifesto that dynamically generates an HTML 5 cache manifest for offline application caching. I got the idea whilst developing my Truth Tables Sinatra micro web application. 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.
Installation
To install the gem, use:
[sudo] gem install manifesto
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