remove Implied Extensions feature. Closes #1211

This commit is contained in:
Thomas Reynolds 2014-03-20 17:03:15 -07:00
parent 1721dff4c7
commit ce7636ad18
50 changed files with 3 additions and 267 deletions

View file

@ -1,6 +1,7 @@
master
===
* Removed "Implied Extension feature"
* Remove 'upgrade' and 'install' CLI commands.
* Gemfile may be in a parent directory of your Middleman project root (where 'config.rb' is).
* All dependencies for your Middleman project must be expressed in `Gemfile` - Bundler is no longer optional.

View file

@ -2,11 +2,6 @@ Feature: Neighboring YAML Front Matter
Scenario: Rendering html (yaml)
Given the Server is running at "frontmatter-neighbor-app"
When I go to "/front-matter-auto.html"
Then I should see "<h1>This is the title</h1>"
Then I should not see "---"
When I go to "/front-matter-auto.erb.frontmatter"
Then I should see "File Not Found"
When I go to "/front-matter-2.php"
Then I should see "<h1>This is the title</h1>"
Then I should see "<?php"
@ -38,14 +33,6 @@ Feature: Neighboring YAML Front Matter
Scenario: Rendering html (json)
Given the Server is running at "frontmatter-neighbor-app"
When I go to "/json-front-matter-auto.html"
Then I should see "<h1>This is the title</h1>"
Then I should not see ";;;"
When I go to "/json-front-matter-auto.erb.frontmatter"
Then I should see "File Not Found"
When I go to "/json-front-matter.html"
Then I should see "<h1>This is the title</h1>"
Then I should not see ";;;"
When I go to "/json-front-matter.html.erb.frontmatter"
Then I should see "File Not Found"
When I go to "/json-front-matter-2.php"

View file

@ -3,9 +3,6 @@ Feature: YAML Front Matter
Scenario: Rendering html (yaml)
Given the Server is running at "frontmatter-app"
When I go to "/front-matter-auto.html"
Then I should see "<h1>This is the title</h1>"
Then I should not see "---"
When I go to "/front-matter-2.php"
Then I should see "<h1>This is the title</h1>"
Then I should see "<?php"
@ -35,9 +32,6 @@ Feature: YAML Front Matter
Scenario: Rendering html (json)
Given the Server is running at "frontmatter-app"
When I go to "/json-front-matter-auto.html"
Then I should see "<h1>This is the title</h1>"
Then I should not see ";;;"
When I go to "/json-front-matter.html"
Then I should see "<h1>This is the title</h1>"
Then I should not see ";;;"

View file

@ -1,69 +0,0 @@
Feature: Use default extensions when user doesn't supply them
Scenario: Default extensions preview
Given the Server is running at "implied-extensions-app"
When I go to "/"
Then I should see "hello: world"
When I go to "/index.html"
Then I should see "hello: world"
When I go to "/index.erb"
Then I should see "File Not Found"
When I go to "/index"
Then I should see "File Not Found"
Scenario: Override erb extension
Given a fixture app "implied-extensions-app"
And a file named "config.rb" with:
"""
template_extensions :erb => :htm
"""
And the Server is running
When I go to "/"
Then I should see "File Not Found"
When I go to "/index.htm"
Then I should see "hello: world"
When I go to "/index.erb"
Then I should see "File Not Found"
When I go to "/index"
Then I should see "File Not Found"
When I go to "/index.html"
Then I should see "File Not Found"
Scenario: Override erb extension
Given a fixture app "implied-extensions-app"
And a file named "config.rb" with:
"""
set :index_file, "index.htm"
template_extensions :erb => :htm
"""
And the Server is running
When I go to "/"
Then I should see "hello: world"
When I go to "/index.htm"
Then I should see "hello: world"
Scenario: Default extensions build
Given a fixture app "implied-extensions-app"
And a successfully built app at "implied-extensions-app"
When I cd to "build"
Then the following files should exist:
| index.html |
Then the following files should not exist:
| index |
| index.erb |
And the file "index.html" should contain "hello: world"
Scenario: Default extensions build with override
Given a fixture app "implied-extensions-app"
And a file named "config.rb" with:
"""
template_extensions :erb => :htm
"""
And a successfully built app at "implied-extensions-app"
When I cd to "build"
Then the following files should exist:
| index.htm |
Then the following files should not exist:
| index |
| index.erb |
| index.html |

View file

@ -1,50 +0,0 @@
Feature: More default extensions
Scenario: Default extensions preview
Given the Server is running at "more-implied-extensions-app"
When I go to "/test.html"
Then I should see "Hello"
When I go to "/test2.html"
Then I should see "World"
When I go to "/test3.html"
Then I should see "Howdy"
When I go to "/test4.html"
Then I should see "HELLO"
When I go to "/javascripts/app.js"
Then I should see "derp"
Then I should not see "I am in the layout"
When I go to "/stylesheets/style.css"
Then I should see "section"
Then I should not see "I am in the layout"
When I go to "/stylesheets/style2.css"
Then I should see "section"
Then I should not see "I am in the layout"
When I go to "/stylesheets/style3.css"
Then I should see "color"
Then I should not see "I am in the layout"
Scenario: Default extensions build
Given a fixture app "more-implied-extensions-app"
And a successfully built app at "more-implied-extensions-app"
When I cd to "build"
Then the following files should exist:
| test.html |
| test2.html |
| test3.html |
| test4.html |
| javascripts/app.js |
| stylesheets/style.css |
| stylesheets/style2.css |
| stylesheets/style3.css |
And the file "test.html" should contain "Hello"
And the file "test2.html" should contain "World"
And the file "test3.html" should contain "Howdy"
And the file "test4.html" should contain "HELLO"
And the file "javascripts/app.js" should contain "derp"
And the file "javascripts/app.js" should not contain "I am in the layout"
And the file "stylesheets/style.css" should contain "section"
And the file "stylesheets/style.css" should not contain "I am in the layout"
And the file "stylesheets/style2.css" should contain "section"
And the file "stylesheets/style2.css" should not contain "I am in the layout"
And the file "stylesheets/style3.css" should contain "color"
And the file "stylesheets/style3.css" should not contain "I am in the layout"

View file

@ -1,6 +0,0 @@
---
layout: false
title: This is the title
---
<h1><%= current_page.data.title %></h1>

View file

@ -1,6 +0,0 @@
;;;
"layout": false,
"title": "This is the title"
;;;
<h1><%= current_page.data.title %></h1>

View file

@ -1 +0,0 @@
<h1><%= current_page.data.title %></h1>

View file

@ -1,4 +0,0 @@
---
layout: false
title: This is the title
---

View file

@ -1 +0,0 @@
<h1><%= current_page.data.title %></h1>

View file

@ -1,4 +0,0 @@
;;;
"layout": false,
"title": "This is the title"
;;;

View file

@ -1 +0,0 @@
hello: <%= "world" %>

View file

@ -1 +0,0 @@
hello = (args...) -> "derp"

View file

@ -1,3 +0,0 @@
I am in the layout
<%= yield %>

View file

@ -1,3 +0,0 @@
@import "compass";
@include global-reset;

View file

@ -1,3 +0,0 @@
@import "compass"
+global-reset

View file

@ -1,4 +0,0 @@
@base: #f938ab;
.box {
color: @base;
}

View file

@ -1,4 +0,0 @@
!!!
%html
%body
Hello

View file

@ -1,3 +0,0 @@
html
body
| Howdy

View file

@ -1 +0,0 @@
{{ 'Hello' | upcase }}

View file

@ -6,7 +6,7 @@ module Middleman
attr_reader :app
# Whitelist methods that can reach out.
delegate :config, :logger, :activate, :use, :map, :mime_type, :data, :template_extensions, :root, :to => :app
delegate :config, :logger, :activate, :use, :map, :mime_type, :data, :root, :to => :app
def initialize(app, template_context_class)
@app = app

View file

@ -11,9 +11,6 @@ module Middleman
# Once registered
def included(app)
# Include methods
app.send :include, InstanceMethods
app.define_hook :before_render
app.define_hook :after_render
@ -98,20 +95,6 @@ module Middleman
end
end
end
# Rendering instance methods
module InstanceMethods
# Add or overwrite a default template extension
#
# @param [Hash] extension_map
# @return [Hash]
def template_extensions(extension_map=nil)
@_template_extensions ||= {}
@_template_extensions.merge!(extension_map) if extension_map
@_template_extensions
end
end
end
end
end

View file

@ -12,9 +12,6 @@ module Middleman
:attributes => %W(showtitle env=middleman env-middleman middleman-version=#{::Middleman::VERSION})
}, 'AsciiDoc engine options (Hash)'
app.config.define_setting :asciidoc_attributes, [], 'AsciiDoc custom attributes (Array)'
app.before_configuration do
template_extensions :adoc => :html
end
app.after_configuration do
# QUESTION should base_dir be equal to docdir instead?

View file

@ -16,7 +16,6 @@ module Middleman
::Tilt.prefer(DebuggingCoffeeScriptTemplate)
app.before_configuration do
template_extensions :coffee => :js
DebuggingCoffeeScriptTemplate.middleman_app = self
end
end

View file

@ -7,10 +7,6 @@ module Middleman
# once registered
def registered(app)
app.before_configuration do
template_extensions :erb => :html
end
# After config
app.after_configuration do
::Tilt.prefer(Template, :erb)

View file

@ -44,10 +44,6 @@ module Middleman
def registered(app)
::Tilt.prefer(::Middleman::Renderers::HamlTemplate, 'haml')
app.before_configuration do
template_extensions :haml => :html
end
# Add haml helpers to context
::Middleman::TemplateContext.send :include, ::Haml::Helpers
end

View file

@ -14,10 +14,6 @@ module Middleman
# Default less options
app.config.define_setting :less, {}, 'LESS compiler options'
app.before_configuration do
template_extensions :less => :css
end
app.after_configuration do
::Less.paths << File.join(source_dir, config[:css_dir])
end

View file

@ -12,10 +12,6 @@ module Middleman
# Once registerd
def registered(app)
app.before_configuration do
template_extensions :liquid => :html
end
# After config, setup liquid partial paths
app.after_configuration do
::Liquid::Template.file_system = ::Liquid::LocalFileSystem.new(source_dir)

View file

@ -13,14 +13,6 @@ module Middleman
app.config.define_setting :markdown_engine, :kramdown, 'Preferred markdown engine'
app.config.define_setting :markdown_engine_prefix, ::Tilt, 'The parent module for markdown template engines'
app.before_configuration do
template_extensions :markdown => :html,
:mdown => :html,
:md => :html,
:mkd => :html,
:mkdn => :html
end
# Once configuration is parsed
app.after_configuration do
markdown_exts = %w(markdown mdown md mkd mkdn)

View file

@ -14,11 +14,6 @@ module Middleman
# Default sass options
app.config.define_setting :sass, {}, 'Sass engine options'
app.before_configuration do
template_extensions :scss => :css,
:sass => :css
end
# Tell Tilt to use it as well (for inline sass blocks)
::Tilt.register 'sass', SassPlusCSSFilenameTemplate
::Tilt.prefer(SassPlusCSSFilenameTemplate)

View file

@ -26,10 +26,6 @@ module Middleman
# Once registered
def registered(app)
app.before_configuration do
template_extensions :slim => :html
end
# Setup Slim options to work with partials
::Slim::Engine.set_default_options(
:buffer => '@_out_buf',

View file

@ -14,11 +14,6 @@ module Middleman
def registered(app)
# Default stylus options
app.config.define_setting :styl, {}, 'Stylus config options'
app.before_configuration do
template_extensions :styl => :css
end
end
alias :included :registered

View file

@ -205,11 +205,7 @@ module Middleman
# @return [String]
def extensionless_path(file)
path = file.dup
path = remove_templating_extensions(path)
# If there is no extension, look for one
path = find_extension(path, file) if File.extname(strip_away_locale(path)).empty?
path
remove_templating_extensions(path)
end
# Actually update the resource list, assuming anything has called
@ -271,22 +267,6 @@ module Middleman
path
end
# Finds an extension for path according to file's extension
# @param [String] path without extension
# @param [String] file path with original extensions
def find_extension(path, file)
input_ext = File.extname(file)
if !input_ext.empty?
input_ext = input_ext.split('.').last.to_sym
if @app.template_extensions.has_key?(input_ext)
path << ".#{@app.template_extensions[input_ext]}"
end
end
path
end
end
end
end