diff --git a/Gemfile b/Gemfile index fdbe280..6af35c6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,22 +1,22 @@ -source "http://rubygems.org" +source "https://rubygems.org" -gem "builder" gem "rake" -#gem "kss" -gem "middleman", "~>3.1.5" -gem "middleman-favicon-maker" -gem "middleman-livereload" -gem "middleman-syntax" -#gem "middleman-smusher" -gem "redcarpet" -gem "susy", "2.0.0.alpha.4" -gem "breakpoint" -gem "typogruby" -gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw] -gem 'rack-rewrite' -platforms :mri_18 do - gem "ruby18_source_location" +group :development do + gem "middleman", "~>3.1.5" + gem "middleman-favicon-maker" + gem "middleman-livereload" + gem "middleman-syntax" + gem "redcarpet" + gem "susy", "2.0.0.alpha.4" + gem "breakpoint" + gem "typogruby" + gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw] + platforms :mri_18 do + gem "ruby18_source_location" + end +end + +group :deploy do + gem 'rack-rewrite' end -# gem "rack-codehighlighter" -# gem "pygments.rb" diff --git a/Gemfile.lock b/Gemfile.lock index 08e3fc9..17fbf90 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GEM - remote: http://rubygems.org/ + remote: https://rubygems.org/ specs: activesupport (3.2.14) i18n (~> 0.6, >= 0.6.4) @@ -7,7 +7,6 @@ GEM breakpoint (2.0.7) compass (>= 0.12.1) sass (>= 3.2.0) - builder (3.2.2) chunky_png (1.2.8) coffee-script (2.2.0) coffee-script-source @@ -123,7 +122,6 @@ PLATFORMS DEPENDENCIES breakpoint - builder middleman (~> 3.1.5) middleman-favicon-maker middleman-livereload diff --git a/config.rb b/config.rb index dfc7cb0..a7b517e 100644 --- a/config.rb +++ b/config.rb @@ -1,4 +1,3 @@ -require "builder" require 'susy' require 'breakpoint' require 'middleman-syntax' diff --git a/config.ru b/config.ru index 4cf6ef2..346d7e6 100644 --- a/config.ru +++ b/config.ru @@ -1,12 +1,26 @@ require "rubygems" -require "middleman" -require "typogruby" -require "rack/rewrite" -use Rack::Rewrite do - r301 %r{/docs/yardoc/(.*)}, '/documentation/$1' - r301 %r{/tutorial\.html}, '/guide' - r301 %r{/download\.html}, '/install' +if ENV["HEROKU"].nil? || ENV["HEROKU"] == 'false' + require "middleman" + run Middleman.server +else + require "rack/rewrite" + + use Rack::Rewrite do + r301 %r{/docs/yardoc/(.*)}, '/documentation/$1' + r301 '/tutorial.html', '/guide' + r301 '/download.html', '/install' + r301 '/documentation', '/documentation/' + + rewrite(%r{^(.*)/([^/.]+)$}, lambda do |match, rack_env| + path = "#{File.dirname(__FILE__)}/build#{match[0]}" + next "#{match[1]}/#{match[2]}/index.html" if Dir.exists?(path) + next match[0] if File.exists?(path) + "#{match[0]}.html" + end) + end + + use Rack::Static, :urls => [""], :root => 'build', :index => 'index.html' + + run lambda {} end - -run Middleman.server \ No newline at end of file