middleman 2.0.9.pre.2-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +13 -0
- data/.travis.yml +4 -0
- data/CHANGELOG +47 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +19 -0
- data/Rakefile +15 -0
- data/bin/middleman +73 -0
- data/bin/mm-build +9 -0
- data/bin/mm-init +9 -0
- data/bin/mm-server +9 -0
- data/features/asset_host.feature +14 -0
- data/features/automatic_image_sizes.feature +16 -0
- data/features/builder.feature +23 -0
- data/features/cache_buster.feature +26 -0
- data/features/coffee-script.feature +17 -0
- data/features/data.feature +12 -0
- data/features/directory_index.feature +29 -0
- data/features/dynamic_pages.feature +33 -0
- data/features/front-matter.feature +7 -0
- data/features/generator.feature +8 -0
- data/features/helpers_auto_javascript_include_tag.feature +27 -0
- data/features/helpers_auto_stylesheet_link_tag.feature +27 -0
- data/features/helpers_page_classes.feature +17 -0
- data/features/liquid.feature +6 -0
- data/features/markdown.feature +7 -0
- data/features/minify_css.feature +24 -0
- data/features/minify_javascript.feature +23 -0
- data/features/padrino_helpers.feature +10 -0
- data/features/page_alias_and_layouts.feature +44 -0
- data/features/relative_assets.feature +44 -0
- data/features/scss-support.feature +12 -0
- data/features/sinatra.feature +6 -0
- data/features/slim.feature +7 -0
- data/features/sprockets.feature +21 -0
- data/features/sprockets_gems.feature +7 -0
- data/features/step_definitions/asset_host_steps.rb +8 -0
- data/features/step_definitions/builder_steps.rb +40 -0
- data/features/step_definitions/generator_steps.rb +30 -0
- data/features/step_definitions/middleman_steps.rb +46 -0
- data/features/step_definitions/page_layout_steps.rb +13 -0
- data/features/support/env.rb +3 -0
- data/features/tiny_src.feature +15 -0
- data/fixtures/indexable-app/config.rb +2 -0
- data/fixtures/indexable-app/source/a_folder/needs_index.html +1 -0
- data/fixtures/indexable-app/source/leave_me_alone.html +1 -0
- data/fixtures/indexable-app/source/needs_index.html +1 -0
- data/fixtures/indexable-app/source/regular/index.html +1 -0
- data/fixtures/relative-app/config.rb +0 -0
- data/fixtures/relative-app/source/images/blank.gif +0 -0
- data/fixtures/relative-app/source/stylesheets/relative_assets.css.sass +3 -0
- data/fixtures/sprockets-app/config.rb +1 -0
- data/fixtures/sprockets-app/source/jquery_include.js +1 -0
- data/fixtures/sprockets-app/source/library/javascripts/sprockets_base.js +5 -0
- data/fixtures/sprockets-app/source/library/javascripts/sprockets_sub.js +3 -0
- data/fixtures/test-app/config.rb +51 -0
- data/fixtures/test-app/data/test.yml +4 -0
- data/fixtures/test-app/source/_liquid_partial.liquid +1 -0
- data/fixtures/test-app/source/_partial.haml +1 -0
- data/fixtures/test-app/source/a_folder/needs_index.html +1 -0
- data/fixtures/test-app/source/asset_host.html.haml +1 -0
- data/fixtures/test-app/source/auto-css.html.haml +1 -0
- data/fixtures/test-app/source/auto-css/auto-css.html.haml +1 -0
- data/fixtures/test-app/source/auto-css/index.html.haml +1 -0
- data/fixtures/test-app/source/auto-css/sub/auto-css.html.haml +1 -0
- data/fixtures/test-app/source/auto-image-sizes.html.haml +1 -0
- data/fixtures/test-app/source/auto-js.html.haml +1 -0
- data/fixtures/test-app/source/auto-js/auto-js.html.haml +1 -0
- data/fixtures/test-app/source/auto-js/index.html.haml +1 -0
- data/fixtures/test-app/source/auto-js/sub/auto-js.html.haml +1 -0
- data/fixtures/test-app/source/cache-buster.html.haml +2 -0
- data/fixtures/test-app/source/custom-layout-dir/index.html.haml +1 -0
- data/fixtures/test-app/source/custom-layout.html.haml +1 -0
- data/fixtures/test-app/source/data.html.erb +1 -0
- data/fixtures/test-app/source/data2.html.liquid +2 -0
- data/fixtures/test-app/source/front-matter.html.erb +6 -0
- data/fixtures/test-app/source/images/Child folder/regular_file(example).txt +1 -0
- data/fixtures/test-app/source/images/Read me (example).txt +1 -0
- data/fixtures/test-app/source/images/blank.gif +0 -0
- data/fixtures/test-app/source/img/blank.gif +0 -0
- data/fixtures/test-app/source/index.html.haml +6 -0
- data/fixtures/test-app/source/inline-coffeescript.html.haml +3 -0
- data/fixtures/test-app/source/inline-css.html.haml +4 -0
- data/fixtures/test-app/source/inline-js.html.haml +7 -0
- data/fixtures/test-app/source/javascripts/auto-js.js +1 -0
- data/fixtures/test-app/source/javascripts/auto-js/auto-js.js +1 -0
- data/fixtures/test-app/source/javascripts/auto-js/index.js +1 -0
- data/fixtures/test-app/source/javascripts/auto-js/sub/auto-js.js +1 -0
- data/fixtures/test-app/source/javascripts/broken-coffee.js.coffee +3 -0
- data/fixtures/test-app/source/javascripts/coffee_test.js.coffee +3 -0
- data/fixtures/test-app/source/javascripts/jquery.plugin.with.dots.js +1 -0
- data/fixtures/test-app/source/javascripts/jquery_base.js +5 -0
- data/fixtures/test-app/source/javascripts/multiple_engines.js.coffee.erb +1 -0
- data/fixtures/test-app/source/javascripts/sprockets_base.js +5 -0
- data/fixtures/test-app/source/javascripts/sprockets_sub.js +3 -0
- data/fixtures/test-app/source/layout.haml +6 -0
- data/fixtures/test-app/source/layouts/custom.haml +5 -0
- data/fixtures/test-app/source/liquid_master.html.liquid +1 -0
- data/fixtures/test-app/source/markdown.html.markdown +1 -0
- data/fixtures/test-app/source/needs_index.html +1 -0
- data/fixtures/test-app/source/padrino_test.html.haml +5 -0
- data/fixtures/test-app/source/page-classes.html.haml +1 -0
- data/fixtures/test-app/source/real.html +1 -0
- data/fixtures/test-app/source/real/index.html.erb +5 -0
- data/fixtures/test-app/source/relative_image.html.erb +1 -0
- data/fixtures/test-app/source/services/index.html.haml +1 -0
- data/fixtures/test-app/source/should_be_ignored.html +1 -0
- data/fixtures/test-app/source/should_be_ignored2.html +1 -0
- data/fixtures/test-app/source/should_be_ignored3.html +1 -0
- data/fixtures/test-app/source/slim.html.slim +7 -0
- data/fixtures/test-app/source/spaces in file.html.erb +1 -0
- data/fixtures/test-app/source/static.html +1 -0
- data/fixtures/test-app/source/stylesheets/asset_host.css.sass +3 -0
- data/fixtures/test-app/source/stylesheets/auto-css.css +3 -0
- data/fixtures/test-app/source/stylesheets/auto-css/auto-css.css +3 -0
- data/fixtures/test-app/source/stylesheets/auto-css/index.css +0 -0
- data/fixtures/test-app/source/stylesheets/auto-css/sub/auto-css.css +3 -0
- data/fixtures/test-app/source/stylesheets/layout.css.sass +2 -0
- data/fixtures/test-app/source/stylesheets/relative_assets.css.sass +3 -0
- data/fixtures/test-app/source/stylesheets/site.css.sass +1 -0
- data/fixtures/test-app/source/stylesheets/site_scss.css.scss +1 -0
- data/fixtures/test-app/source/stylesheets/static.css +2 -0
- data/fixtures/test-app/source/sub1/page-classes.html.haml +1 -0
- data/fixtures/test-app/source/sub1/sub2/page-classes.html.haml +1 -0
- data/fixtures/test-app/source/tiny_src.html.haml +1 -0
- data/lib/middleman.rb +202 -0
- data/lib/middleman/base.rb +198 -0
- data/lib/middleman/builder.rb +163 -0
- data/lib/middleman/cli.rb +87 -0
- data/lib/middleman/config.ru +2 -0
- data/lib/middleman/core_extensions/assets.rb +57 -0
- data/lib/middleman/core_extensions/builder.rb +41 -0
- data/lib/middleman/core_extensions/compass.rb +102 -0
- data/lib/middleman/core_extensions/data.rb +120 -0
- data/lib/middleman/core_extensions/default_helpers.rb +77 -0
- data/lib/middleman/core_extensions/features.rb +102 -0
- data/lib/middleman/core_extensions/front_matter.rb +116 -0
- data/lib/middleman/core_extensions/rack_map.rb +35 -0
- data/lib/middleman/core_extensions/rendering.rb +19 -0
- data/lib/middleman/core_extensions/routing.rb +87 -0
- data/lib/middleman/core_extensions/sprockets.rb +102 -0
- data/lib/middleman/features/asset_host.rb +22 -0
- data/lib/middleman/features/automatic_image_sizes.rb +31 -0
- data/lib/middleman/features/automatic_image_sizes/fastimage.rb +287 -0
- data/lib/middleman/features/cache_buster.rb +42 -0
- data/lib/middleman/features/directory_indexes.rb +56 -0
- data/lib/middleman/features/lorem.rb +126 -0
- data/lib/middleman/features/minify_css.rb +10 -0
- data/lib/middleman/features/minify_javascript.rb +43 -0
- data/lib/middleman/features/relative_assets.rb +38 -0
- data/lib/middleman/features/tiny_src.rb +11 -0
- data/lib/middleman/guard.rb +70 -0
- data/lib/middleman/renderers/coffee_script.rb +8 -0
- data/lib/middleman/renderers/haml.rb +31 -0
- data/lib/middleman/renderers/liquid.rb +29 -0
- data/lib/middleman/renderers/markdown.rb +34 -0
- data/lib/middleman/renderers/sass.rb +63 -0
- data/lib/middleman/renderers/slim.rb +8 -0
- data/lib/middleman/templates.rb +53 -0
- data/lib/middleman/templates/default.rb +17 -0
- data/lib/middleman/templates/default/source/index.html.erb +5 -0
- data/lib/middleman/templates/default/source/layout.erb +19 -0
- data/lib/middleman/templates/default/source/stylesheets/site.css.scss +32 -0
- data/lib/middleman/templates/html5.rb +16 -0
- data/lib/middleman/templates/html5/source/404.html +38 -0
- data/lib/middleman/templates/html5/source/README.md +388 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-114x114-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-57x57-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-72x72-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon-precomposed.png +0 -0
- data/lib/middleman/templates/html5/source/apple-touch-icon.png +0 -0
- data/lib/middleman/templates/html5/source/crossdomain.xml +25 -0
- data/lib/middleman/templates/html5/source/css/style.css +293 -0
- data/lib/middleman/templates/html5/source/favicon.ico +0 -0
- data/lib/middleman/templates/html5/source/humans.txt +43 -0
- data/lib/middleman/templates/html5/source/img/.gitignore +2 -0
- data/lib/middleman/templates/html5/source/index.html +79 -0
- data/lib/middleman/templates/html5/source/js/libs/jquery-1.6.2.js +8981 -0
- data/lib/middleman/templates/html5/source/js/libs/jquery-1.6.2.min.js +18 -0
- data/lib/middleman/templates/html5/source/js/libs/modernizr-2.0.6.min.js +4 -0
- data/lib/middleman/templates/html5/source/js/mylibs/.gitignore +2 -0
- data/lib/middleman/templates/html5/source/js/plugins.js +20 -0
- data/lib/middleman/templates/html5/source/js/script.js +8 -0
- data/lib/middleman/templates/html5/source/robots.txt +5 -0
- data/lib/middleman/templates/html5/source/test/index.html +31 -0
- data/lib/middleman/templates/html5/source/test/qunit/qunit.css +148 -0
- data/lib/middleman/templates/html5/source/test/qunit/qunit.js +1265 -0
- data/lib/middleman/templates/html5/source/test/tests.js +24 -0
- data/lib/middleman/templates/local.rb +20 -0
- data/lib/middleman/templates/shared/Gemfile.tt +3 -0
- data/lib/middleman/templates/shared/config.ru +4 -0
- data/lib/middleman/templates/shared/config.tt +104 -0
- data/lib/middleman/version.rb +3 -0
- data/middleman-x86-mingw32.gemspec +78 -0
- data/middleman.gemspec +78 -0
- metadata +812 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
@wip
|
2
|
+
Feature: Tiny Src
|
3
|
+
In order automatically scale images for mobile devices
|
4
|
+
|
5
|
+
Scenario: Rendering html with the feature disabled
|
6
|
+
Given "tiny_src" feature is "disabled"
|
7
|
+
And the Server is running at "test-app"
|
8
|
+
When I go to "/tiny_src.html"
|
9
|
+
Then I should see "http://test.com/image.jpg"
|
10
|
+
|
11
|
+
Scenario: Rendering html with the feature enabled
|
12
|
+
Given "tiny_src" feature is "enabled"
|
13
|
+
And the Server is running at "test-app"
|
14
|
+
When I go to "/tiny_src.html"
|
15
|
+
Then I should see "http://i.tinysrc.mobi/http://test.com/image.jpg"
|
@@ -0,0 +1 @@
|
|
1
|
+
Indexable
|
@@ -0,0 +1 @@
|
|
1
|
+
Stay away
|
@@ -0,0 +1 @@
|
|
1
|
+
Indexable
|
@@ -0,0 +1 @@
|
|
1
|
+
Regular
|
File without changes
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
set :js_dir, "library/javascripts"
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require "jquery"
|
@@ -0,0 +1,51 @@
|
|
1
|
+
page "/fake.html", :proxy => "/real.html", :layout => false
|
2
|
+
|
3
|
+
ignore "/should_be_ignored.html"
|
4
|
+
page "/should_be_ignored2.html", :ignore => true
|
5
|
+
page "/target_ignore.html", :proxy => "/should_be_ignored3.html", :ignore => true
|
6
|
+
|
7
|
+
%w(one two).each do |num|
|
8
|
+
page "/fake/#{num}.html", :proxy => "/real/index.html" do
|
9
|
+
@num = num
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
with_layout false do
|
14
|
+
page "/markdown.html"
|
15
|
+
page "/relative_image.html"
|
16
|
+
page "/inline-css.html"
|
17
|
+
page "/inline-js.html"
|
18
|
+
page "/inline-coffeescript.html"
|
19
|
+
page "/spaces in file.html"
|
20
|
+
page "/slim.html"
|
21
|
+
page "/data.html"
|
22
|
+
page "/data2.html"
|
23
|
+
page "/liquid_master.html"
|
24
|
+
page "/page-classes.html"
|
25
|
+
page "/sub1/page-classes.html"
|
26
|
+
page "/sub1/sub2/page-classes.html"
|
27
|
+
|
28
|
+
%w{
|
29
|
+
/auto-css.html
|
30
|
+
/auto-css
|
31
|
+
/auto-css/
|
32
|
+
/auto-css/auto-css.html
|
33
|
+
/auto-css/sub/auto-css.html
|
34
|
+
}.each do |path|
|
35
|
+
page path
|
36
|
+
end
|
37
|
+
|
38
|
+
%w{
|
39
|
+
/auto-js.html
|
40
|
+
/auto-js
|
41
|
+
/auto-js/
|
42
|
+
/auto-js/auto-js.html
|
43
|
+
/auto-js/sub/auto-js.html
|
44
|
+
}.each do |path|
|
45
|
+
page path
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
get "/sinatra_test" do
|
50
|
+
"Ratpack"
|
51
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Greetings
|
@@ -0,0 +1 @@
|
|
1
|
+
%p Test
|
@@ -0,0 +1 @@
|
|
1
|
+
Indexable
|
@@ -0,0 +1 @@
|
|
1
|
+
= image_tag "blank.gif"
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_stylesheet_link_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_stylesheet_link_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_stylesheet_link_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_stylesheet_link_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= image_tag "blank.gif"
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_javascript_include_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_javascript_include_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_javascript_include_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
= auto_javascript_include_tag
|
@@ -0,0 +1 @@
|
|
1
|
+
%h1 Welcome
|
@@ -0,0 +1 @@
|
|
1
|
+
%h1 Welcome
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= data.test.map { |r| r.title }.join(":") %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Regular
|
@@ -0,0 +1 @@
|
|
1
|
+
README
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
// Success
|
@@ -0,0 +1 @@
|
|
1
|
+
alert "Hello <%= data.test[0].title %>"
|
@@ -0,0 +1 @@
|
|
1
|
+
{% include "liquid_partial" %}
|
@@ -0,0 +1 @@
|
|
1
|
+
Hello World
|
@@ -0,0 +1 @@
|
|
1
|
+
Indexable
|
@@ -0,0 +1 @@
|
|
1
|
+
= page_classes
|
@@ -0,0 +1 @@
|
|
1
|
+
I am real
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= image_tag "blank.gif" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
%h2 Services
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Ignore me!</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Ignore me! 2</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Ignore me! 3</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= "spaces" %>
|
@@ -0,0 +1 @@
|
|
1
|
+
Static, no code!
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "compass/reset"
|
@@ -0,0 +1 @@
|
|
1
|
+
@import "compass/reset";
|
@@ -0,0 +1 @@
|
|
1
|
+
= page_classes
|
@@ -0,0 +1 @@
|
|
1
|
+
= page_classes
|
@@ -0,0 +1 @@
|
|
1
|
+
= image_tag "http://test.com/image.jpg"
|
data/lib/middleman.rb
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
# Middleman is a static site renderer that provides all the conveniences of
|
2
|
+
# a modern web stack, like Ruby on Rails, while remaining focused on building
|
3
|
+
# the fastest, most-professional sites possible
|
4
|
+
#
|
5
|
+
# Install Middleman:
|
6
|
+
#
|
7
|
+
# gem install middleman
|
8
|
+
#
|
9
|
+
# To accomplish its goals, Middleman supports provides access to:
|
10
|
+
#
|
11
|
+
#### Command-line tool:
|
12
|
+
# * **middleman init**: A tool for creating to new static sites.
|
13
|
+
# * **middleman server**: A tool for rapidly developing your static site.
|
14
|
+
# * **middleman build**: A tool for exporting your site into optimized HTML, CSS & JS.
|
15
|
+
#
|
16
|
+
#### Tons of templating languages including:
|
17
|
+
# * ERB (.erb)
|
18
|
+
# * Interpolated String (.str)
|
19
|
+
# * Sass (.sass)
|
20
|
+
# * Scss (.scss)
|
21
|
+
# * Haml (.haml)
|
22
|
+
# * Slim (.slim)
|
23
|
+
# * Less CSS (.less)
|
24
|
+
# * Builder (.builder)
|
25
|
+
# * Liquid (.liquid)
|
26
|
+
# * RDiscount (.markdown)
|
27
|
+
# * RedCloth (.textile)
|
28
|
+
# * RDoc (.rdoc)
|
29
|
+
# * Radius (.radius)
|
30
|
+
# * Markaby (.mab)
|
31
|
+
# * Nokogiri (.nokogiri)
|
32
|
+
# * Mustache (.mustache)
|
33
|
+
# * CoffeeScript (.coffee)
|
34
|
+
#
|
35
|
+
#### Compile-time Optimiztions
|
36
|
+
# * Javascript Minifiers: YUI, Google Closure & UglifyJS
|
37
|
+
# * Smush.it Image Compression
|
38
|
+
# * CSS Minification
|
39
|
+
#
|
40
|
+
#### Robust Extensions:
|
41
|
+
# Add your own runtime and build-time features!
|
42
|
+
#
|
43
|
+
#### Next Steps:
|
44
|
+
# * [Visit the website]
|
45
|
+
# * [Read the wiki]
|
46
|
+
# * [Email the users group]
|
47
|
+
# * [Submit bug reports]
|
48
|
+
#
|
49
|
+
# [Visit the website]: http://middlemanapp.com
|
50
|
+
# [Read the wiki]: https://github.com/tdreyno/middleman/wiki
|
51
|
+
# [Email the users group]: http://groups.google.com/group/middleman-users
|
52
|
+
# [Submit bug reports]: https://github.com/tdreyno/middleman/issues
|
53
|
+
|
54
|
+
# Setup our load paths
|
55
|
+
libdir = File.dirname(__FILE__)
|
56
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
57
|
+
|
58
|
+
# We're riding on Sinatra, so let's include it.
|
59
|
+
require "sinatra/base"
|
60
|
+
|
61
|
+
# Top-level Middleman object
|
62
|
+
module Middleman
|
63
|
+
# Auto-load modules on-demand
|
64
|
+
autoload :Base, "middleman/base"
|
65
|
+
autoload :Builder, "middleman/builder"
|
66
|
+
autoload :CLI, "middleman/cli"
|
67
|
+
autoload :Templates, "middleman/templates"
|
68
|
+
autoload :Guard, "middleman/guard"
|
69
|
+
|
70
|
+
# Custom Renderers
|
71
|
+
module Renderers
|
72
|
+
autoload :Haml, "middleman/renderers/haml"
|
73
|
+
autoload :Sass, "middleman/renderers/sass"
|
74
|
+
autoload :Slim, "middleman/renderers/slim"
|
75
|
+
autoload :Markdown, "middleman/renderers/markdown"
|
76
|
+
autoload :CoffeeScript, "middleman/renderers/coffee_script"
|
77
|
+
autoload :Liquid, "middleman/renderers/liquid"
|
78
|
+
end
|
79
|
+
|
80
|
+
module CoreExtensions
|
81
|
+
# Add Builder callbacks
|
82
|
+
autoload :Builder, "middleman/core_extensions/builder"
|
83
|
+
|
84
|
+
# Add Rack::Builder.map support
|
85
|
+
autoload :RackMap, "middleman/core_extensions/rack_map"
|
86
|
+
|
87
|
+
# Custom Feature API
|
88
|
+
autoload :Features, "middleman/core_extensions/features"
|
89
|
+
|
90
|
+
# Asset Path Pipeline
|
91
|
+
autoload :Assets, "middleman/core_extensions/assets"
|
92
|
+
|
93
|
+
# DefaultHelpers are the built-in dynamic template helpers.
|
94
|
+
autoload :DefaultHelpers, "middleman/core_extensions/default_helpers"
|
95
|
+
|
96
|
+
# Data looks at the data/ folder for YAML files and makes them available
|
97
|
+
# to dynamic requests.
|
98
|
+
autoload :Data, "middleman/core_extensions/data"
|
99
|
+
|
100
|
+
# Parse YAML from templates
|
101
|
+
autoload :FrontMatter, "middleman/core_extensions/front_matter"
|
102
|
+
|
103
|
+
# Extended version of Padrino's rendering
|
104
|
+
autoload :Rendering, "middleman/core_extensions/rendering"
|
105
|
+
|
106
|
+
# Compass framework for Sass
|
107
|
+
autoload :Compass, "middleman/core_extensions/compass"
|
108
|
+
|
109
|
+
# Sprockets 2
|
110
|
+
autoload :Sprockets, "middleman/core_extensions/sprockets"
|
111
|
+
|
112
|
+
# Pass custom options to views
|
113
|
+
autoload :Routing, "middleman/core_extensions/routing"
|
114
|
+
end
|
115
|
+
|
116
|
+
module Features
|
117
|
+
# RelativeAssets allow any asset path in dynamic templates to be either
|
118
|
+
# relative to the root of the project or use an absolute URL.
|
119
|
+
autoload :RelativeAssets, "middleman/features/relative_assets"
|
120
|
+
|
121
|
+
# AssetHost allows you to setup multiple domains to host your static
|
122
|
+
# assets. Calls to asset paths in dynamic templates will then rotate
|
123
|
+
# through each of the asset servers to better spread the load.
|
124
|
+
autoload :AssetHost, "middleman/features/asset_host"
|
125
|
+
|
126
|
+
# CacheBuster adds a query string to assets in dynamic templates to avoid
|
127
|
+
# browser caches failing to update to your new content.
|
128
|
+
autoload :CacheBuster, "middleman/features/cache_buster"
|
129
|
+
|
130
|
+
# AutomaticImageSizes inspects the images used in your dynamic templates
|
131
|
+
# and automatically adds width and height attributes to their HTML
|
132
|
+
# elements.
|
133
|
+
autoload :AutomaticImageSizes, "middleman/features/automatic_image_sizes"
|
134
|
+
|
135
|
+
# MinifyCss uses the YUI compressor to shrink CSS files
|
136
|
+
autoload :MinifyCss, "middleman/features/minify_css"
|
137
|
+
|
138
|
+
# MinifyJavascript uses the YUI compressor to shrink JS files
|
139
|
+
autoload :MinifyJavascript, "middleman/features/minify_javascript"
|
140
|
+
|
141
|
+
# Lorem provides a handful of helpful prototyping methods to generate
|
142
|
+
# words, paragraphs, fake images, names and email addresses.
|
143
|
+
autoload :Lorem, "middleman/features/lorem"
|
144
|
+
|
145
|
+
# guard-livereload
|
146
|
+
autoload :LiveReload, "middleman/features/live_reload"
|
147
|
+
|
148
|
+
# Automatically convert filename.html files into filename/index.html
|
149
|
+
autoload :DirectoryIndexes, "middleman/features/directory_indexes"
|
150
|
+
end
|
151
|
+
|
152
|
+
EXTENSION_FILE = File.join("lib", "middleman_init.rb")
|
153
|
+
def self.load_extensions_in_path
|
154
|
+
extensions = rubygems_latest_specs.select do |spec|
|
155
|
+
spec_has_file?(spec, EXTENSION_FILE)
|
156
|
+
end
|
157
|
+
|
158
|
+
extensions.each do |spec|
|
159
|
+
require spec.name
|
160
|
+
# $stderr.puts "require: #{spec.name}"
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def self.rubygems_latest_specs
|
165
|
+
# If newer Rubygems
|
166
|
+
if Gem::Specification.respond_to? :latest_specs
|
167
|
+
Gem::Specification.latest_specs
|
168
|
+
else
|
169
|
+
Gem.source_index.latest_specs
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.spec_has_file?(spec, path)
|
174
|
+
full_path = File.join(spec.full_gem_path, path)
|
175
|
+
File.exists?(full_path)
|
176
|
+
end
|
177
|
+
|
178
|
+
def self.server(&block)
|
179
|
+
sandbox = Class.new(Sinatra::Base)
|
180
|
+
sandbox.register Base
|
181
|
+
sandbox.class_eval(&block) if block_given?
|
182
|
+
sandbox
|
183
|
+
end
|
184
|
+
|
185
|
+
def self.start_server(options={})
|
186
|
+
opts = {
|
187
|
+
:Port => options[:port],
|
188
|
+
:AccessLog => []
|
189
|
+
}
|
190
|
+
|
191
|
+
app = ::Middleman.server
|
192
|
+
app.set :environment, options[:environment].to_sym
|
193
|
+
opts[:app] = app.new
|
194
|
+
opts[:server] = 'thin'
|
195
|
+
|
196
|
+
$stderr.puts "== The Middleman is standing watch on port #{opts[:Port]}"
|
197
|
+
::Rack::Server.new(opts).start
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
require "middleman/version"
|
202
|
+
Middleman.load_extensions_in_path
|