From 83d9542b77c66a0de31066a60ace956b3f0fa22f Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 20 Oct 2010 09:28:57 -0700 Subject: [PATCH] Fix slickmap loading bug --- bin/mm-build | 5 ++++- fixtures/test-app/config.rb | 2 +- lib/middleman/builder.rb | 2 +- lib/middleman/features/slickmap.rb | 11 ++++++----- lib/middleman/templater+dynamic_renderer.rb | 2 +- middleman.gemspec | 6 +++--- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bin/mm-build b/bin/mm-build index 3fa9ac70..e34345d9 100755 --- a/bin/mm-build +++ b/bin/mm-build @@ -6,7 +6,10 @@ ENV['MM_ENV'] = "build" require File.join(File.dirname(__FILE__), "..", "lib", "middleman") require 'middleman/builder' +# Initialize server once so features are loaded +Middleman::Server.new + # Middleman::Server.init! Middleman::Builder.init! -Middleman::Generators.run_cli(Dir.pwd, 'mm-build', 1, %w(build --force).concat(ARGV)) \ No newline at end of file +Middleman::Generators.run_cli(Dir.pwd, 'mm-build', 1, %w(build --force).concat(ARGV)) diff --git a/fixtures/test-app/config.rb b/fixtures/test-app/config.rb index 98de204b..1ccf22a6 100644 --- a/fixtures/test-app/config.rb +++ b/fixtures/test-app/config.rb @@ -25,4 +25,4 @@ end get "/sub1/sub2/auto-css.html" do haml :"auto-css.html", :layout => false -end \ No newline at end of file +end diff --git a/lib/middleman/builder.rb b/lib/middleman/builder.rb index 97fbb1d0..3e2d4143 100644 --- a/lib/middleman/builder.rb +++ b/lib/middleman/builder.rb @@ -57,4 +57,4 @@ module Middleman add :build, ::Middleman::Builder end -end \ No newline at end of file +end diff --git a/lib/middleman/features/slickmap.rb b/lib/middleman/features/slickmap.rb index 72cc5ccd..9ea37e4c 100755 --- a/lib/middleman/features/slickmap.rb +++ b/lib/middleman/features/slickmap.rb @@ -5,13 +5,14 @@ module Middleman::Features::Slickmap def registered(app) require 'slickmap' - @sitemap_url = config[:url] || "sitemap.html" + @sitemap_url = "sitemap.html" + @sitemap_url = app.sitemap_url if app.respond_to?(:slickmap_url) - if Middleman::Server.environment == :build + if app.environment == :build Middleman::Builder.template :slickmap, @sitemap_url, @sitemap_url end - Middleman::Server.helpers do + app.helpers do def sitemap_node(n, first=false) if n.children.length < 1 if !first && File.extname(n.dir).length > 0 @@ -45,7 +46,7 @@ module Middleman::Features::Slickmap end end - Middleman::Server.get "/#{@sitemap_url}" do + app.get "/#{@sitemap_url}" do # Return :utility to put it util top menu. False to ignore @tree, @utility = Middleman::Features::Slickmap.build_sitemap do |file_name| :valid @@ -86,4 +87,4 @@ module Middleman::Features::Slickmap entry end -end \ No newline at end of file +end diff --git a/lib/middleman/templater+dynamic_renderer.rb b/lib/middleman/templater+dynamic_renderer.rb index acdf5055..d9659cb3 100755 --- a/lib/middleman/templater+dynamic_renderer.rb +++ b/lib/middleman/templater+dynamic_renderer.rb @@ -23,4 +23,4 @@ class Templater::Actions::Template @@rack_test.last_response.body end end -end \ No newline at end of file +end diff --git a/middleman.gemspec b/middleman.gemspec index 22bfd35b..eaa5e01b 100644 --- a/middleman.gemspec +++ b/middleman.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Thomas Reynolds"] - s.date = %q{2010-09-24} + s.date = %q{2010-10-11} s.email = %q{tdreyno@gmail.com} s.executables = ["mm-init", "mm-build", "mm-server"] s.extra_rdoc_files = [ @@ -108,14 +108,14 @@ Gem::Specification.new do |s| s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubyforge_project = %q{middleman} - s.rubygems_version = %q{1.3.7} + s.rubygems_version = %q{1.3.6} s.summary = %q{A static site generator utilizing Haml, Sass and providing YUI compression and cache busting} if s.respond_to? :specification_version then current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 1.0"]) s.add_runtime_dependency(%q, ["~> 1.2.0"]) s.add_runtime_dependency(%q, ["~> 0.8.0"])