Project

manifesto

0.01
No commit activity in last 3 years
No release in over 3 years
Dynamically generates an HTML5 cache manifest from the contents of a directory
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 1.2.9
 Project Readme

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)

Manifesto has been successfully tested against the following Ruby releases:

  • Ruby 1.8.6

  • Ruby 1.8.7

  • Ruby 1.9.1

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

# Add network includes
Manifesto.cache :directory => '.mobile', :network_includes => ['http://google.com', 'http://github.com']

# Add file exclusions
Manifesto.cache :directory => '.mobile', :excludes => ['dynamic-dir/', 'dynamic.js')]

Sample Output¶ ↑

CACHE MANIFEST
# Generated by manifesto (http://github.com/johntopley/manifesto)
# Hash: 7013a3b8292ceeeb6336849bee1d1365
CACHE:
/apple-touch-icon.png
/apple-touch-startup.png
/index.html
/mobile/mobile.css
/mobile/mobile.js

NETWORK:
http://github.com

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¶ ↑

  • Create a route for the cache manifest:

    map.manifest '/manifest', :controller => 'manifest', :action => 'show' # Rails 2.x
    
    -- or --
    
    match '/manifest' => 'manifest#show' # Rails 3.x
  • Create a controller action:

    def show
      headers['Content-Type'] = 'text/cache-manifest'
      render :text => Manifesto.cache, :layout => false
    end
    

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

Thanks¶ ↑

Copyright © 2010 John Topley. See LICENSE for details.