Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Part 3 - Prepping for Heroku
  • Loading branch information
michaelrshannon committed Mar 23, 2015
1 parent 8ebc7cc commit f675c38
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Gemfile
Expand Up @@ -12,4 +12,9 @@ gem 'therubyracer' # faster JS compiles
gem 'oj' # faster JS compiles

gem 'middleman-search_engine_sitemap'
gem 'middleman-minify-html'
gem 'middleman-minify-html'

gem 'puma'
gem 'rack-contrib'
gem 'rack-ssl'
gem 'rack-cache'
12 changes: 12 additions & 0 deletions Gemfile.lock
Expand Up @@ -93,7 +93,15 @@ GEM
tilt (~> 1.4.1)
padrino-support (0.12.5)
activesupport (>= 3.1)
puma (2.11.1)
rack (>= 1.1, < 2.0)
rack (1.6.0)
rack-cache (1.2)
rack (>= 0.4)
rack-contrib (1.2.0)
rack (>= 0.9.1)
rack-ssl (1.4.1)
rack
rack-test (0.6.3)
rack (>= 1.0)
rb-fsevent (0.9.4)
Expand Down Expand Up @@ -136,4 +144,8 @@ DEPENDENCIES
middleman-minify-html
middleman-search_engine_sitemap
oj
puma
rack-cache
rack-contrib
rack-ssl
therubyracer
1 change: 1 addition & 0 deletions Procfile
@@ -0,0 +1 @@
web: bundle exec puma -p $PORT
7 changes: 7 additions & 0 deletions Rakefile
@@ -0,0 +1,7 @@
require 'bundler/setup'

namespace :assets do
task :precompile do
sh 'middleman build'
end
end
30 changes: 30 additions & 0 deletions config.ru
@@ -0,0 +1,30 @@
#\ -s puma
require 'rack'
require 'rack/contrib/try_static'
require 'rack/deflater'
require 'rack/cache'

# Forces SSL on all requests
unless ENV['RACK_ENV'] == 'development'
require 'rack/ssl'
use Rack::SSL
end

use Rack::Cache,
:verbose => true,
:metastore => 'file:/var/cache/rack/meta',
:entitystore => 'file:/var/cache/rack/body'

# Enables compression of http responses, used in conjunction with `activate :gzip` in config.rb
use Rack::Deflater

# Serve files from the build directory
use Rack::TryStatic,
root: 'build',
urls: %w[/],
try: %w(.html index.html /index.html)

run lambda { |env|
four_oh_four_page = File.expand_path("../build/404/index.html", __FILE__)
[404, { 'Content-Type' => 'text/html'}, [ File.read(four_oh_four_page) ]]
}
Empty file added source/404.html.erb
Empty file.

0 comments on commit f675c38

Please sign in to comment.