Stable Version: 0.0.3
This gem is specifically for Rails 3.1 projects that wish to use HTML5 and its offline cache feature with the Asset Pipeline.
Installation is straight forward simply add the gem to your gemfile and do a bundle install or on the terminal as follows
$ gem install assets_offline
# Last Updated DD/MM/YYYY application: asset-cache: - "application.css" - "checkout.js" - "favicon.ico" - "favicon.png" - "logo.png" cache: - "/dictionary.json" fallback: - "/prompts.json # /prompts.json" - "/prices.json # /prices.json" network: - "/checkout/start_transaction.json" - "/checkout/submit_transaction.json"
The yaml file “assets_offline.yml” needs to be added to the rails config folder. The yaml is split by route name. So the exmaple above can be added to html using “/assets_offline/application”. You can add as many root nodes to the yaml as you require and just add the name to the path to get the generated file.
There are 6 sections to add files to in the Yaml
Sections starting asset will use the rails asset_path() helper to get the file path. Non asset sections will use the path specified.
Fallback requires two paths which need to be seperated by a “#”
Manifest file generates a hash key in development this key is changed every 5 seconds so the cache will never function, in production the key is based on the hash of the yaml file. To force a cache refresh you must update the last updated value in the yaml file.
- Rake task to create YAML files
- Automating key update in production mode
- Adding directories to cache file rather than individual files
- Beta release
- [broomyocymru](mailto: firstname.lastname@example.org)
Copyright © 2011 broomyocymru
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
“Software”), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.