From a3b276d489f5343df47d9ab2c19d88ae00dd9a18 Mon Sep 17 00:00:00 2001 From: tdreyno Date: Tue, 21 Sep 2010 18:30:17 -0700 Subject: [PATCH] coderay support --- VERSION | 2 +- lib/middleman/features.rb | 2 ++ lib/middleman/features/code_ray.rb | 12 ++++++++++++ lib/middleman/features/live_reload.rb | 21 +++++++++++++++++++++ lib/middleman/features/livereload.rb | 19 ------------------- lib/middleman/server.rb | 3 +++ lib/middleman/template/config.rbt | 7 +++++++ middleman.gemspec | 5 ++--- 8 files changed, 48 insertions(+), 23 deletions(-) create mode 100644 lib/middleman/features/code_ray.rb create mode 100644 lib/middleman/features/live_reload.rb delete mode 100644 lib/middleman/features/livereload.rb diff --git a/VERSION b/VERSION index cc3f899b..f4e959ee 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.99.3.pre +0.99.4.pre diff --git a/lib/middleman/features.rb b/lib/middleman/features.rb index f80dd229..a576d0c2 100644 --- a/lib/middleman/features.rb +++ b/lib/middleman/features.rb @@ -9,6 +9,8 @@ module Middleman::Features autoload :MinifyJavascript, "middleman/features/minify_javascript" autoload :Slickmap, "middleman/features/slickmap" autoload :SmushPNGs, "middleman/features/smush_pngs" + autoload :CodeRay, "middleman/features/code_ray" + # autoload :LiveReload, "middleman/features/live_reload" class << self def registered(app) diff --git a/lib/middleman/features/code_ray.rb b/lib/middleman/features/code_ray.rb new file mode 100644 index 00000000..0733ff4f --- /dev/null +++ b/lib/middleman/features/code_ray.rb @@ -0,0 +1,12 @@ +module Middleman::Features::CodeRay + class << self + def registered(app) + begin + require 'haml-coderay' + rescue LoadError + puts "CodeRay not available. Install it with: gem install haml-coderay" + end + end + alias :included :registered + end +end \ No newline at end of file diff --git a/lib/middleman/features/live_reload.rb b/lib/middleman/features/live_reload.rb new file mode 100644 index 00000000..ebe03af1 --- /dev/null +++ b/lib/middleman/features/live_reload.rb @@ -0,0 +1,21 @@ +module Middleman::Features::LiveReload + class << self + def registered(app) + return unless Middleman::Server.environment == :development + + begin + require 'livereload' + rescue LoadError + puts "Livereload not available. Install it with: gem install livereload" + end + + new_config = ::LiveReload::Config.new do |config| + config.exts = ::Tilt.mappings.keys + end + + # Middleman::Server.public + ::LiveReload.run [Middleman::Server.views], new_config + end + alias :included :registered + end +end \ No newline at end of file diff --git a/lib/middleman/features/livereload.rb b/lib/middleman/features/livereload.rb deleted file mode 100644 index 2c5ec88d..00000000 --- a/lib/middleman/features/livereload.rb +++ /dev/null @@ -1,19 +0,0 @@ -module Middleman::Features::LiveReload - def initialize(app, config) - return unless Middleman::Server.environment == :development - - begin - require 'livereload' - rescue LoadError - puts "Livereload not available. Install it with: gem install livereload" - end - - new_config = ::LiveReload::Config.new do |config| - config.exts = %w(haml sass scss coffee less builder) - end - - ::LiveReload.run [Middleman::Server.public, Middleman::Server.views], new_config - end -end - -Middleman::Features.register :livereload, Middleman::Features::LiveReload \ No newline at end of file diff --git a/lib/middleman/server.rb b/lib/middleman/server.rb index 3b9283fc..a496485b 100644 --- a/lib/middleman/server.rb +++ b/lib/middleman/server.rb @@ -128,6 +128,9 @@ module Middleman return result end + status 404 + rescue Padrino::Rendering::TemplateNotFound + $stderr.puts "File not found: #{request.path}" status 404 end end diff --git a/lib/middleman/template/config.rbt b/lib/middleman/template/config.rbt index 52abfc46..087496f6 100755 --- a/lib/middleman/template/config.rbt +++ b/lib/middleman/template/config.rbt @@ -1,6 +1,9 @@ # Automatic sitemaps # activate :slickmap +# CodeRay syntax highlighting in Haml +# activate :code_ray + # Automatic image dimension calculations # activate :automatic_image_sizes @@ -51,6 +54,10 @@ configure :build do # Enable cache buster # activate :cache_buster + + # Generate ugly/obfuscated HTML from Haml + # activate :ugly_haml + # Or use a different image path # set :http_path, "/Content/images/" diff --git a/middleman.gemspec b/middleman.gemspec index fd50a80c..eed70b38 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{middleman} - s.version = "0.99.3.pre" + s.version = "0.99.4.pre" s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["Thomas Reynolds"] - s.date = %q{2010-09-11} + s.date = %q{2010-09-21} s.email = %q{tdreyno@gmail.com} s.executables = ["mm-init", "mm-build", "mm-server"] s.extra_rdoc_files = [ @@ -84,7 +84,6 @@ Gem::Specification.new do |s| "lib/middleman/features/automatic_image_sizes/fastimage.rb", "lib/middleman/features/cache_buster.rb", "lib/middleman/features/default_helpers.rb", - "lib/middleman/features/livereload.rb", "lib/middleman/features/minify_css.rb", "lib/middleman/features/minify_javascript.rb", "lib/middleman/features/minify_javascript/rack.rb",