Fix slickmap loading bug

This commit is contained in:
Thomas Reynolds 2010-10-20 09:28:57 -07:00
parent 5a161a21a0
commit 83d9542b77
6 changed files with 16 additions and 12 deletions

View file

@ -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))
Middleman::Generators.run_cli(Dir.pwd, 'mm-build', 1, %w(build --force).concat(ARGV))

View file

@ -25,4 +25,4 @@ end
get "/sub1/sub2/auto-css.html" do
haml :"auto-css.html", :layout => false
end
end

View file

@ -57,4 +57,4 @@ module Middleman
add :build, ::Middleman::Builder
end
end
end

View file

@ -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
end

View file

@ -23,4 +23,4 @@ class Templater::Actions::Template
@@rack_test.last_response.body
end
end
end
end

View file

@ -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<rack>, ["~> 1.0"])
s.add_runtime_dependency(%q<thin>, ["~> 1.2.0"])
s.add_runtime_dependency(%q<shotgun>, ["~> 0.8.0"])