Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Commit

Permalink
use Rack::Cache in production.
Browse files Browse the repository at this point in the history
  • Loading branch information
hmans committed Mar 1, 2012
1 parent f845110 commit 957a179
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
@@ -1,5 +1,11 @@
== 0.2.0 (unreleased)

Upgrade Notes:

* Schnitzelpress now adds Rack::Cache in production by itself; you no longer need to do it in your blog app's config.ru file. It is recommended that you remove the Rack::Cache invocation from your app.

Changes:

* Schnitzelpress now has a light-weight, custom-built asset pipeline that serves all Javascripts and Stylesheets as one single file each, compressed and ready for hardcore caching.
* Post with dates now use double-digit days and months in their canonical URLs. (Your existing posts will forward to the new canonical URLs automatically.)
* Rebranded from SchnitzelPress to Schnitzelpress. (You'll probably need to change your blog app's code for this.)
Expand Down
1 change: 1 addition & 0 deletions lib/schnitzelpress.rb
Expand Up @@ -6,6 +6,7 @@
require 'redcarpet'
require 'schnitzelstyle'
require 'rack/contrib'
require 'rack/cache'
require 'mongoid'
require 'chronic'

Expand Down
1 change: 1 addition & 0 deletions lib/schnitzelpress/app.rb
Expand Up @@ -5,6 +5,7 @@ class App < Sinatra::Base
set :views, ['./views/', File.expand_path('../../views/', __FILE__)]
set :public_folder, File.expand_path('../../public/', __FILE__)

use Rack::Cache if Schnitzelpress.env.production?
use Rack::ShowExceptions
use Rack::StaticCache,
:urls => STATIC_PATHS,
Expand Down
1 change: 0 additions & 1 deletion lib/templates/new_blog/Gemfile
@@ -1,7 +1,6 @@
source 'https://rubygems.org'

gem 'unicorn', '~> 4.2.0'
gem 'rack-cache', '~> 1.1.0', :require => 'rack/cache'
gem 'schnitzelpress', '~> 0.1.0'

group :development do
Expand Down
12 changes: 0 additions & 12 deletions lib/templates/new_blog/config.ru.tt
@@ -1,18 +1,6 @@
$stdout.sync = true
require File.expand_path("../app.rb", __FILE__)

# Add some caching. This is designed to work out of the box
# on Heroku, but feel free to change this if eg. you'd prefer
# to use Memcache.
#
if Schnitzelpress.env.production?
use Rack::Cache, {
:verbose => true,
:metastore => URI.encode("file:/tmp/cache/meta"),
:entitystore => URI.encode("file:/tmp/cache/body")
}
end

# Run the app, with support for files in ./public/
#
run App.with_local_files
1 change: 1 addition & 0 deletions schnitzelpress.gemspec
Expand Up @@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
# base dependencies
gem.add_dependency 'rack', '~> 1.4.1'
gem.add_dependency 'rack-contrib', '~> 1.1.0'
gem.add_dependency 'rack-cache', '~> 1.1.0'
gem.add_dependency 'sinatra', '~> 1.3.2'
gem.add_dependency 'activesupport', '~> 3.2.0'

Expand Down

0 comments on commit 957a179

Please sign in to comment.