Fix slickmap loading bug
This commit is contained in:
parent
5a161a21a0
commit
83d9542b77
|
@ -6,6 +6,9 @@ ENV['MM_ENV'] = "build"
|
||||||
require File.join(File.dirname(__FILE__), "..", "lib", "middleman")
|
require File.join(File.dirname(__FILE__), "..", "lib", "middleman")
|
||||||
require 'middleman/builder'
|
require 'middleman/builder'
|
||||||
|
|
||||||
|
# Initialize server once so features are loaded
|
||||||
|
Middleman::Server.new
|
||||||
|
|
||||||
# Middleman::Server.init!
|
# Middleman::Server.init!
|
||||||
Middleman::Builder.init!
|
Middleman::Builder.init!
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,14 @@ module Middleman::Features::Slickmap
|
||||||
def registered(app)
|
def registered(app)
|
||||||
require 'slickmap'
|
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
|
Middleman::Builder.template :slickmap, @sitemap_url, @sitemap_url
|
||||||
end
|
end
|
||||||
|
|
||||||
Middleman::Server.helpers do
|
app.helpers do
|
||||||
def sitemap_node(n, first=false)
|
def sitemap_node(n, first=false)
|
||||||
if n.children.length < 1
|
if n.children.length < 1
|
||||||
if !first && File.extname(n.dir).length > 0
|
if !first && File.extname(n.dir).length > 0
|
||||||
|
@ -45,7 +46,7 @@ module Middleman::Features::Slickmap
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Middleman::Server.get "/#{@sitemap_url}" do
|
app.get "/#{@sitemap_url}" do
|
||||||
# Return :utility to put it util top menu. False to ignore
|
# Return :utility to put it util top menu. False to ignore
|
||||||
@tree, @utility = Middleman::Features::Slickmap.build_sitemap do |file_name|
|
@tree, @utility = Middleman::Features::Slickmap.build_sitemap do |file_name|
|
||||||
:valid
|
:valid
|
||||||
|
|
|
@ -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.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Thomas Reynolds"]
|
s.authors = ["Thomas Reynolds"]
|
||||||
s.date = %q{2010-09-24}
|
s.date = %q{2010-10-11}
|
||||||
s.email = %q{tdreyno@gmail.com}
|
s.email = %q{tdreyno@gmail.com}
|
||||||
s.executables = ["mm-init", "mm-build", "mm-server"]
|
s.executables = ["mm-init", "mm-build", "mm-server"]
|
||||||
s.extra_rdoc_files = [
|
s.extra_rdoc_files = [
|
||||||
|
@ -108,14 +108,14 @@ Gem::Specification.new do |s|
|
||||||
s.rdoc_options = ["--charset=UTF-8"]
|
s.rdoc_options = ["--charset=UTF-8"]
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.rubyforge_project = %q{middleman}
|
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}
|
s.summary = %q{A static site generator utilizing Haml, Sass and providing YUI compression and cache busting}
|
||||||
|
|
||||||
if s.respond_to? :specification_version then
|
if s.respond_to? :specification_version then
|
||||||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
||||||
s.specification_version = 3
|
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<rack>, ["~> 1.0"])
|
||||||
s.add_runtime_dependency(%q<thin>, ["~> 1.2.0"])
|
s.add_runtime_dependency(%q<thin>, ["~> 1.2.0"])
|
||||||
s.add_runtime_dependency(%q<shotgun>, ["~> 0.8.0"])
|
s.add_runtime_dependency(%q<shotgun>, ["~> 0.8.0"])
|
||||||
|
|
Loading…
Reference in a new issue