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.
Files changed (197) hide show
  1. data/.gemtest +0 -0
  2. data/.gitignore +13 -0
  3. data/.travis.yml +4 -0
  4. data/CHANGELOG +47 -0
  5. data/Gemfile +3 -0
  6. data/LICENSE +20 -0
  7. data/README.md +19 -0
  8. data/Rakefile +15 -0
  9. data/bin/middleman +73 -0
  10. data/bin/mm-build +9 -0
  11. data/bin/mm-init +9 -0
  12. data/bin/mm-server +9 -0
  13. data/features/asset_host.feature +14 -0
  14. data/features/automatic_image_sizes.feature +16 -0
  15. data/features/builder.feature +23 -0
  16. data/features/cache_buster.feature +26 -0
  17. data/features/coffee-script.feature +17 -0
  18. data/features/data.feature +12 -0
  19. data/features/directory_index.feature +29 -0
  20. data/features/dynamic_pages.feature +33 -0
  21. data/features/front-matter.feature +7 -0
  22. data/features/generator.feature +8 -0
  23. data/features/helpers_auto_javascript_include_tag.feature +27 -0
  24. data/features/helpers_auto_stylesheet_link_tag.feature +27 -0
  25. data/features/helpers_page_classes.feature +17 -0
  26. data/features/liquid.feature +6 -0
  27. data/features/markdown.feature +7 -0
  28. data/features/minify_css.feature +24 -0
  29. data/features/minify_javascript.feature +23 -0
  30. data/features/padrino_helpers.feature +10 -0
  31. data/features/page_alias_and_layouts.feature +44 -0
  32. data/features/relative_assets.feature +44 -0
  33. data/features/scss-support.feature +12 -0
  34. data/features/sinatra.feature +6 -0
  35. data/features/slim.feature +7 -0
  36. data/features/sprockets.feature +21 -0
  37. data/features/sprockets_gems.feature +7 -0
  38. data/features/step_definitions/asset_host_steps.rb +8 -0
  39. data/features/step_definitions/builder_steps.rb +40 -0
  40. data/features/step_definitions/generator_steps.rb +30 -0
  41. data/features/step_definitions/middleman_steps.rb +46 -0
  42. data/features/step_definitions/page_layout_steps.rb +13 -0
  43. data/features/support/env.rb +3 -0
  44. data/features/tiny_src.feature +15 -0
  45. data/fixtures/indexable-app/config.rb +2 -0
  46. data/fixtures/indexable-app/source/a_folder/needs_index.html +1 -0
  47. data/fixtures/indexable-app/source/leave_me_alone.html +1 -0
  48. data/fixtures/indexable-app/source/needs_index.html +1 -0
  49. data/fixtures/indexable-app/source/regular/index.html +1 -0
  50. data/fixtures/relative-app/config.rb +0 -0
  51. data/fixtures/relative-app/source/images/blank.gif +0 -0
  52. data/fixtures/relative-app/source/stylesheets/relative_assets.css.sass +3 -0
  53. data/fixtures/sprockets-app/config.rb +1 -0
  54. data/fixtures/sprockets-app/source/jquery_include.js +1 -0
  55. data/fixtures/sprockets-app/source/library/javascripts/sprockets_base.js +5 -0
  56. data/fixtures/sprockets-app/source/library/javascripts/sprockets_sub.js +3 -0
  57. data/fixtures/test-app/config.rb +51 -0
  58. data/fixtures/test-app/data/test.yml +4 -0
  59. data/fixtures/test-app/source/_liquid_partial.liquid +1 -0
  60. data/fixtures/test-app/source/_partial.haml +1 -0
  61. data/fixtures/test-app/source/a_folder/needs_index.html +1 -0
  62. data/fixtures/test-app/source/asset_host.html.haml +1 -0
  63. data/fixtures/test-app/source/auto-css.html.haml +1 -0
  64. data/fixtures/test-app/source/auto-css/auto-css.html.haml +1 -0
  65. data/fixtures/test-app/source/auto-css/index.html.haml +1 -0
  66. data/fixtures/test-app/source/auto-css/sub/auto-css.html.haml +1 -0
  67. data/fixtures/test-app/source/auto-image-sizes.html.haml +1 -0
  68. data/fixtures/test-app/source/auto-js.html.haml +1 -0
  69. data/fixtures/test-app/source/auto-js/auto-js.html.haml +1 -0
  70. data/fixtures/test-app/source/auto-js/index.html.haml +1 -0
  71. data/fixtures/test-app/source/auto-js/sub/auto-js.html.haml +1 -0
  72. data/fixtures/test-app/source/cache-buster.html.haml +2 -0
  73. data/fixtures/test-app/source/custom-layout-dir/index.html.haml +1 -0
  74. data/fixtures/test-app/source/custom-layout.html.haml +1 -0
  75. data/fixtures/test-app/source/data.html.erb +1 -0
  76. data/fixtures/test-app/source/data2.html.liquid +2 -0
  77. data/fixtures/test-app/source/front-matter.html.erb +6 -0
  78. data/fixtures/test-app/source/images/Child folder/regular_file(example).txt +1 -0
  79. data/fixtures/test-app/source/images/Read me (example).txt +1 -0
  80. data/fixtures/test-app/source/images/blank.gif +0 -0
  81. data/fixtures/test-app/source/img/blank.gif +0 -0
  82. data/fixtures/test-app/source/index.html.haml +6 -0
  83. data/fixtures/test-app/source/inline-coffeescript.html.haml +3 -0
  84. data/fixtures/test-app/source/inline-css.html.haml +4 -0
  85. data/fixtures/test-app/source/inline-js.html.haml +7 -0
  86. data/fixtures/test-app/source/javascripts/auto-js.js +1 -0
  87. data/fixtures/test-app/source/javascripts/auto-js/auto-js.js +1 -0
  88. data/fixtures/test-app/source/javascripts/auto-js/index.js +1 -0
  89. data/fixtures/test-app/source/javascripts/auto-js/sub/auto-js.js +1 -0
  90. data/fixtures/test-app/source/javascripts/broken-coffee.js.coffee +3 -0
  91. data/fixtures/test-app/source/javascripts/coffee_test.js.coffee +3 -0
  92. data/fixtures/test-app/source/javascripts/jquery.plugin.with.dots.js +1 -0
  93. data/fixtures/test-app/source/javascripts/jquery_base.js +5 -0
  94. data/fixtures/test-app/source/javascripts/multiple_engines.js.coffee.erb +1 -0
  95. data/fixtures/test-app/source/javascripts/sprockets_base.js +5 -0
  96. data/fixtures/test-app/source/javascripts/sprockets_sub.js +3 -0
  97. data/fixtures/test-app/source/layout.haml +6 -0
  98. data/fixtures/test-app/source/layouts/custom.haml +5 -0
  99. data/fixtures/test-app/source/liquid_master.html.liquid +1 -0
  100. data/fixtures/test-app/source/markdown.html.markdown +1 -0
  101. data/fixtures/test-app/source/needs_index.html +1 -0
  102. data/fixtures/test-app/source/padrino_test.html.haml +5 -0
  103. data/fixtures/test-app/source/page-classes.html.haml +1 -0
  104. data/fixtures/test-app/source/real.html +1 -0
  105. data/fixtures/test-app/source/real/index.html.erb +5 -0
  106. data/fixtures/test-app/source/relative_image.html.erb +1 -0
  107. data/fixtures/test-app/source/services/index.html.haml +1 -0
  108. data/fixtures/test-app/source/should_be_ignored.html +1 -0
  109. data/fixtures/test-app/source/should_be_ignored2.html +1 -0
  110. data/fixtures/test-app/source/should_be_ignored3.html +1 -0
  111. data/fixtures/test-app/source/slim.html.slim +7 -0
  112. data/fixtures/test-app/source/spaces in file.html.erb +1 -0
  113. data/fixtures/test-app/source/static.html +1 -0
  114. data/fixtures/test-app/source/stylesheets/asset_host.css.sass +3 -0
  115. data/fixtures/test-app/source/stylesheets/auto-css.css +3 -0
  116. data/fixtures/test-app/source/stylesheets/auto-css/auto-css.css +3 -0
  117. data/fixtures/test-app/source/stylesheets/auto-css/index.css +0 -0
  118. data/fixtures/test-app/source/stylesheets/auto-css/sub/auto-css.css +3 -0
  119. data/fixtures/test-app/source/stylesheets/layout.css.sass +2 -0
  120. data/fixtures/test-app/source/stylesheets/relative_assets.css.sass +3 -0
  121. data/fixtures/test-app/source/stylesheets/site.css.sass +1 -0
  122. data/fixtures/test-app/source/stylesheets/site_scss.css.scss +1 -0
  123. data/fixtures/test-app/source/stylesheets/static.css +2 -0
  124. data/fixtures/test-app/source/sub1/page-classes.html.haml +1 -0
  125. data/fixtures/test-app/source/sub1/sub2/page-classes.html.haml +1 -0
  126. data/fixtures/test-app/source/tiny_src.html.haml +1 -0
  127. data/lib/middleman.rb +202 -0
  128. data/lib/middleman/base.rb +198 -0
  129. data/lib/middleman/builder.rb +163 -0
  130. data/lib/middleman/cli.rb +87 -0
  131. data/lib/middleman/config.ru +2 -0
  132. data/lib/middleman/core_extensions/assets.rb +57 -0
  133. data/lib/middleman/core_extensions/builder.rb +41 -0
  134. data/lib/middleman/core_extensions/compass.rb +102 -0
  135. data/lib/middleman/core_extensions/data.rb +120 -0
  136. data/lib/middleman/core_extensions/default_helpers.rb +77 -0
  137. data/lib/middleman/core_extensions/features.rb +102 -0
  138. data/lib/middleman/core_extensions/front_matter.rb +116 -0
  139. data/lib/middleman/core_extensions/rack_map.rb +35 -0
  140. data/lib/middleman/core_extensions/rendering.rb +19 -0
  141. data/lib/middleman/core_extensions/routing.rb +87 -0
  142. data/lib/middleman/core_extensions/sprockets.rb +102 -0
  143. data/lib/middleman/features/asset_host.rb +22 -0
  144. data/lib/middleman/features/automatic_image_sizes.rb +31 -0
  145. data/lib/middleman/features/automatic_image_sizes/fastimage.rb +287 -0
  146. data/lib/middleman/features/cache_buster.rb +42 -0
  147. data/lib/middleman/features/directory_indexes.rb +56 -0
  148. data/lib/middleman/features/lorem.rb +126 -0
  149. data/lib/middleman/features/minify_css.rb +10 -0
  150. data/lib/middleman/features/minify_javascript.rb +43 -0
  151. data/lib/middleman/features/relative_assets.rb +38 -0
  152. data/lib/middleman/features/tiny_src.rb +11 -0
  153. data/lib/middleman/guard.rb +70 -0
  154. data/lib/middleman/renderers/coffee_script.rb +8 -0
  155. data/lib/middleman/renderers/haml.rb +31 -0
  156. data/lib/middleman/renderers/liquid.rb +29 -0
  157. data/lib/middleman/renderers/markdown.rb +34 -0
  158. data/lib/middleman/renderers/sass.rb +63 -0
  159. data/lib/middleman/renderers/slim.rb +8 -0
  160. data/lib/middleman/templates.rb +53 -0
  161. data/lib/middleman/templates/default.rb +17 -0
  162. data/lib/middleman/templates/default/source/index.html.erb +5 -0
  163. data/lib/middleman/templates/default/source/layout.erb +19 -0
  164. data/lib/middleman/templates/default/source/stylesheets/site.css.scss +32 -0
  165. data/lib/middleman/templates/html5.rb +16 -0
  166. data/lib/middleman/templates/html5/source/404.html +38 -0
  167. data/lib/middleman/templates/html5/source/README.md +388 -0
  168. data/lib/middleman/templates/html5/source/apple-touch-icon-114x114-precomposed.png +0 -0
  169. data/lib/middleman/templates/html5/source/apple-touch-icon-57x57-precomposed.png +0 -0
  170. data/lib/middleman/templates/html5/source/apple-touch-icon-72x72-precomposed.png +0 -0
  171. data/lib/middleman/templates/html5/source/apple-touch-icon-precomposed.png +0 -0
  172. data/lib/middleman/templates/html5/source/apple-touch-icon.png +0 -0
  173. data/lib/middleman/templates/html5/source/crossdomain.xml +25 -0
  174. data/lib/middleman/templates/html5/source/css/style.css +293 -0
  175. data/lib/middleman/templates/html5/source/favicon.ico +0 -0
  176. data/lib/middleman/templates/html5/source/humans.txt +43 -0
  177. data/lib/middleman/templates/html5/source/img/.gitignore +2 -0
  178. data/lib/middleman/templates/html5/source/index.html +79 -0
  179. data/lib/middleman/templates/html5/source/js/libs/jquery-1.6.2.js +8981 -0
  180. data/lib/middleman/templates/html5/source/js/libs/jquery-1.6.2.min.js +18 -0
  181. data/lib/middleman/templates/html5/source/js/libs/modernizr-2.0.6.min.js +4 -0
  182. data/lib/middleman/templates/html5/source/js/mylibs/.gitignore +2 -0
  183. data/lib/middleman/templates/html5/source/js/plugins.js +20 -0
  184. data/lib/middleman/templates/html5/source/js/script.js +8 -0
  185. data/lib/middleman/templates/html5/source/robots.txt +5 -0
  186. data/lib/middleman/templates/html5/source/test/index.html +31 -0
  187. data/lib/middleman/templates/html5/source/test/qunit/qunit.css +148 -0
  188. data/lib/middleman/templates/html5/source/test/qunit/qunit.js +1265 -0
  189. data/lib/middleman/templates/html5/source/test/tests.js +24 -0
  190. data/lib/middleman/templates/local.rb +20 -0
  191. data/lib/middleman/templates/shared/Gemfile.tt +3 -0
  192. data/lib/middleman/templates/shared/config.ru +4 -0
  193. data/lib/middleman/templates/shared/config.tt +104 -0
  194. data/lib/middleman/version.rb +3 -0
  195. data/middleman-x86-mingw32.gemspec +78 -0
  196. data/middleman.gemspec +78 -0
  197. metadata +812 -0
@@ -0,0 +1,3 @@
1
+ root_path = File.dirname(File.dirname(File.dirname(__FILE__)))
2
+ require File.join(root_path, 'lib', 'middleman')
3
+ require "rack/test"
@@ -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,2 @@
1
+ activate :directory_indexes
2
+ page "/leave_me_alone.html", :directory_index => false
@@ -0,0 +1 @@
1
+ Stay away
@@ -0,0 +1 @@
1
+ Indexable
@@ -0,0 +1 @@
1
+ Regular
File without changes
@@ -0,0 +1,3 @@
1
+ @import "compass"
2
+ h1
3
+ background: image-url("blank.gif")
@@ -0,0 +1 @@
1
+ set :js_dir, "library/javascripts"
@@ -0,0 +1 @@
1
+ //= require "jquery"
@@ -0,0 +1,5 @@
1
+ //= require "sprockets_sub"
2
+
3
+ function base() {
4
+
5
+ }
@@ -0,0 +1,3 @@
1
+ function sprockets_sub_function() {
2
+
3
+ }
@@ -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,4 @@
1
+ -
2
+ title: "One"
3
+ -
4
+ title: "Two"
@@ -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,2 @@
1
+ = stylesheet_link_tag "site.css"
2
+ = javascript_include_tag "empty-with-include.js"
@@ -0,0 +1 @@
1
+ %h1 Welcome
@@ -0,0 +1 @@
1
+ <%= data.test.map { |r| r.title }.join(":") %>
@@ -0,0 +1,2 @@
1
+ {{data}}
2
+ {% for item in data.test %}{{item.title}}{% endfor %}
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: false
3
+ title: This is the title
4
+ ---
5
+
6
+ <h1><%= data.page.title %></h1>
@@ -0,0 +1,6 @@
1
+ %h1 Welcome
2
+
3
+ :markdown
4
+ ## H2
5
+
6
+ Paragraph
@@ -0,0 +1,3 @@
1
+ :coffeescript
2
+ race = (winner, runners...) ->
3
+ print winner, runners
@@ -0,0 +1,4 @@
1
+ :sass
2
+ body
3
+ test: style
4
+ good: deal
@@ -0,0 +1,7 @@
1
+ :javascript
2
+ ;(function() {
3
+ this;
4
+ should();
5
+ all.be();
6
+ on = { one: line };
7
+ })();
@@ -0,0 +1,3 @@
1
+ function test() {
2
+ hello
3
+ }
@@ -0,0 +1,3 @@
1
+ # Splats:
2
+ race = (winner, runners...) ->
3
+ print winner, runners
@@ -0,0 +1,5 @@
1
+ //= require "jquery-ui"
2
+
3
+ function then_do_stuff() {
4
+
5
+ }
@@ -0,0 +1 @@
1
+ alert "Hello <%= data.test[0].title %>"
@@ -0,0 +1,5 @@
1
+ //= require "sprockets_sub"
2
+
3
+ function base() {
4
+
5
+ }
@@ -0,0 +1,3 @@
1
+ function sprockets_sub_function() {
2
+
3
+ }
@@ -0,0 +1,6 @@
1
+ %html
2
+ %head
3
+ %title My Sample Site
4
+ / Comment in layout
5
+ %body
6
+ = yield
@@ -0,0 +1,5 @@
1
+ %html
2
+ %head
3
+ %title Custom Layout
4
+ %body
5
+ = yield
@@ -0,0 +1 @@
1
+ {% include "liquid_partial" %}
@@ -0,0 +1 @@
1
+ Hello World
@@ -0,0 +1 @@
1
+ Indexable
@@ -0,0 +1,5 @@
1
+ = stylesheet_link_tag "test1"
2
+ = javascript_include_tag "test1"
3
+ = image_tag "test2.png", :alt => "alt"
4
+
5
+ = link_to "Has param", "test2.com", :class => "test"
@@ -0,0 +1 @@
1
+ = page_classes
@@ -0,0 +1 @@
1
+ I am real
@@ -0,0 +1,5 @@
1
+ ---
2
+ layout: false
3
+ ---
4
+
5
+ I am real: <%= @num %>
@@ -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,7 @@
1
+ doctype 5
2
+ html lang='en'
3
+ head
4
+ meta charset="utf-8"
5
+
6
+ body
7
+ h1 Welcome to Slim
@@ -0,0 +1 @@
1
+ <%= "spaces" %>
@@ -0,0 +1 @@
1
+ Static, no code!
@@ -0,0 +1,3 @@
1
+ @import "compass"
2
+ h1
3
+ background: image-url("blank.gif")
@@ -0,0 +1,3 @@
1
+ auto {
2
+ css: 1;
3
+ }
@@ -0,0 +1,3 @@
1
+ auto {
2
+ css: 2;
3
+ }
@@ -0,0 +1,3 @@
1
+ auto {
2
+ css: 3;
3
+ }
@@ -0,0 +1,2 @@
1
+ html
2
+ test: value
@@ -0,0 +1,3 @@
1
+ @import "compass"
2
+ h1
3
+ background: image-url("blank.gif")
@@ -0,0 +1 @@
1
+ @import "compass/reset"
@@ -0,0 +1 @@
1
+ @import "compass/reset";
@@ -0,0 +1,2 @@
1
+ body {
2
+ font-size: 12px; }
@@ -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