prepare pre-1.0 release

This commit is contained in:
tdreyno 2009-09-29 14:30:01 -07:00
parent 1a975efa61
commit a3f4e73f61
7 changed files with 72 additions and 72 deletions

View file

@ -1 +1 @@
0.5.5 0.9.0

View file

@ -30,7 +30,9 @@ module Generators
if (args[0] === args[1]) if (args[0] === args[1])
args[1] = args[0].gsub("#{File.basename(Middleman::Base.views)}/", "") args[1] = args[0].gsub("#{File.basename(Middleman::Base.views)}/", "")
.gsub("#{File.basename(Middleman::Base.public)}/", "") .gsub("#{File.basename(Middleman::Base.public)}/", "")
args[1] = args[1].gsub!(File.extname(args[1]), "") if File.basename(args[1]).split('.').length > 2 if File.extname(args[1]) != ".js"
args[1] = args[1].gsub!(File.extname(args[1]), "") if File.basename(args[1]).split('.').length > 2
end
end end
super(name, *args, &block) super(name, *args, &block)

View file

@ -32,7 +32,7 @@ module Middleman
enable :minify_css enable :minify_css
enable :minify_javascript enable :minify_javascript
enable :cache_buster enable :cache_buster
disable :slickmap # disable :slickmap
end end
def template_exists?(path, renderer=nil) def template_exists?(path, renderer=nil)
@ -51,7 +51,7 @@ module Middleman
# All other files # All other files
disable :static disable :static
not_found do not_found do
path = request.path path = request.path
path << options.index_file if path.match(%r{/$}) path << options.index_file if path.match(%r{/$})
path.gsub!(%r{^/}, '') path.gsub!(%r{^/}, '')

View file

@ -3,11 +3,13 @@ require 'compass'
class Middleman::Base class Middleman::Base
configure do configure do
::Compass.configuration do |config| ::Compass.configuration do |config|
images_location = (self.environment == "build") ? self.build_dir : self.public
config.project_path = Dir.pwd config.project_path = Dir.pwd
config.sass_dir = File.join(File.basename(self.views), self.css_dir) config.sass_dir = File.join(File.basename(self.views), self.css_dir)
config.output_style = minify_css ? :compressed : :nested config.output_style = self.minify_css? ? :compressed : :nested
config.css_dir = File.join(File.basename(self.public), self.css_dir) config.css_dir = File.join(File.basename(images_location), self.css_dir)
config.images_dir = File.join(File.basename(self.public), self.images_dir) config.images_dir = File.join(File.basename(images_location), self.images_dir)
# File.expand_path(self.images_dir, self.public) # File.expand_path(self.images_dir, self.public)
if !cache_buster? if !cache_buster?

View file

@ -2,6 +2,7 @@ module Middleman
module Haml module Haml
def self.included(base) def self.included(base)
base.supported_formats << "haml" base.supported_formats << "haml"
# base.helpers Middleman::HamlHelpers
end end
def render_path(path) def render_path(path)
@ -20,43 +21,43 @@ module Middleman
end end
end end
# module Helpers module HamlHelpers
# def haml_partial(name, options = {}) def haml_partial(name, options = {})
# item_name = name.to_sym item_name = name.to_sym
# counter_name = "#{name}_counter".to_sym counter_name = "#{name}_counter".to_sym
# if collection = options.delete(:collection) if collection = options.delete(:collection)
# collection.enum_for(:each_with_index).collect do |item,index| collection.enum_for(:each_with_index).collect do |item,index|
# haml_partial name, options.merge(:locals => {item_name => item, counter_name => index+1}) haml_partial name, options.merge(:locals => {item_name => item, counter_name => index+1})
# end.join end.join
# elsif object = options.delete(:object) elsif object = options.delete(:object)
# haml_partial name, options.merge(:locals => {item_name => object, counter_name => nil}) haml_partial name, options.merge(:locals => {item_name => object, counter_name => nil})
# else else
# haml "_#{name}".to_sym, options.merge(:layout => false) haml "_#{name}".to_sym, options.merge(:layout => false)
# end end
# end end
# end end
# module Table module Table
# include ::Haml::Filters::Base include ::Haml::Filters::Base
#
# def render(text) def render(text)
# output = '<div class="table"><table cellspacing="0" cellpadding="0">' output = '<div class="table"><table cellspacing="0" cellpadding="0">'
# line_num = 0 line_num = 0
# text.each_line do |line| text.each_line do |line|
# line_num += 1 line_num += 1
# next if line.strip.empty? next if line.strip.empty?
# output << %Q{<tr class="#{(line_num % 2 == 0) ? "even" : "odd" }#{(line_num == 1) ? " first" : "" }">} output << %Q{<tr class="#{(line_num % 2 == 0) ? "even" : "odd" }#{(line_num == 1) ? " first" : "" }">}
#
# columns = line.split("|").map { |p| p.strip } columns = line.split("|").map { |p| p.strip }
# columns.each_with_index do |col, i| columns.each_with_index do |col, i|
# output << %Q{<td class="col#{i+1}">#{col}</td>} output << %Q{<td class="col#{i+1}">#{col}</td>}
# end end
#
# output << "</tr>" output << "</tr>"
# end end
# output + "</table></div>" output + "</table></div>"
# end end
# end end
module Sass module Sass
def self.included(base) def self.included(base)
@ -69,7 +70,7 @@ module Middleman
static_version = options.public + request.path_info static_version = options.public + request.path_info
send_file(static_version) if File.exists? static_version send_file(static_version) if File.exists? static_version
location_of_sass_file = defined?(MIDDLEMAN_BUILDER) ? "build" : "views" location_of_sass_file = options.environment == "build" ? "build" : "views"
css_filename = File.join(Dir.pwd, location_of_sass_file) + request.path_info css_filename = File.join(Dir.pwd, location_of_sass_file) + request.path_info
sass(path.to_sym, Compass.sass_engine_options.merge({ :css_filename => css_filename })) sass(path.to_sym, Compass.sass_engine_options.merge({ :css_filename => css_filename }))
rescue Exception => e rescue Exception => e

View file

@ -1,19 +1,27 @@
class Middleman::Base
# config.relative_assets = true if compass?
configure do
def asset_url(path) ::Compass.configuration do |config|
if path.include?("://") config.relative_assets = true
path end
else end
request_path = request.path_info.dup end
request_path << "index.html" if path.match(%r{/$})
request_path.gsub!(%r{^/}, '') helpers do
parts = request_path.split('/') def asset_url(path)
if path.include?("://")
if parts.length > 1
"../" * (parts.length - 1) + path
else
path path
else
request_path = request.path_info.dup
request_path << "index.html" if path.match(%r{/$})
request_path.gsub!(%r{^/}, '')
parts = request_path.split('/')
if parts.length > 1
"../" * (parts.length - 1) + path
else
path
end
end end
end end
end end

View file

@ -1,18 +1,5 @@
module Middleman module Middleman
module Helpers module Helpers
def find_and_include_related_css_file
path = request.path_info.dup
path << "index.html" if path.match(%r{/$})
path.gsub!(%r{^/}, '')
path.gsub!(File.extname(path), '')
path.gsub!('/', '-')
sass_file = File.join(File.basename(self.class.views), "stylesheets", "#{path}.sass")
if File.exists? sass_file
stylesheet_link_tag "stylesheets/#{path}.css"
end
end
def page_classes(*additional) def page_classes(*additional)
path = request.path_info path = request.path_info
path << "index.html" if path.match(%r{/$}) path << "index.html" if path.match(%r{/$})