Repository URL to install this package:
| 
      
     
      
        
        
        Version: 
        
         
  
        
    
          
          0.0.3  ▾
        
         
  
      
        
      
  
      
  
     | 
| lib | 
| .gitignore | 
| CHANGELOG.md | 
| Gemfile | 
| LICENSE | 
| README.md | 
| Rakefile | 
| capistrano-public-cache.gemspec | 
Cache dynamic pages into your public folder on deploy.
Add this line to your application's Gemfile:
gem 'capistrano', '~> 3.1.0' gem 'capistrano-public-cache'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-public-cache
Require in Capfile to use the default task:
require 'capistrano/public-cache'
In most cases you will want to run the task after deploy:published as part of Capistrano's default deploy. To do that, just add the following to your deploy.rb:
after 'deploy:published', 'public_cache:build'
It can also be run in isolation with cap public_cache:build.
Configurable options:
set :public_cache_roles, :web # this is default set :public_cache_base_url, '' # this is default set :public_cache_curl_flags, '-sS' # this is default set :public_cache_files, {} # this is default
Some notes about configuration:
:public_cache_base_url and :public_cache_files as their default values will result in nothing happening when the task is run.:public_cache_base_url should be set to the base URL of your application, e.g. http://youapp.com, http://localhost:5000, etc.:public_cache_files should be a hash where the keys are the source path of the content you want to cache and the values are the file path (relative to your deployment's public directory) where you want it cached.:public_cache_curl_flags can be a string of flags to pass through to curl. The default is -sS, which keeps curl silent except when failure occurs.We like to manage our application's error pages within Rails, but it's also a good idea to have static versions available for the web server to use too. As such, our configuration usually looks like this:
set :public_cache_files, '/errors/403' => '403.html', '/errors/404' => '404.html', '/errors/422' => '422.html', '/errors/502' => '502.html', '/errors/500' => '500.html'
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)