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,42 @@
1
+ module Middleman::Features::CacheBuster
2
+ class << self
3
+ def registered(app)
4
+ app.register_asset_handler :cache_buster do |path, prefix, request|
5
+ http_path = app.before_asset_handler(:cache_buster, path, prefix, request)
6
+
7
+ if http_path.include?("://") || !%w(.css .png .jpg .js .gif).include?(File.extname(http_path))
8
+ http_path
9
+ else
10
+ begin
11
+ prefix = app.images_dir if prefix == app.http_images_path
12
+ rescue
13
+ end
14
+
15
+ real_path_static = File.join(app.views, prefix, path)
16
+
17
+ if File.readable?(real_path_static)
18
+ http_path << "?" + File.mtime(real_path_static).strftime("%s")
19
+ elsif app.build?
20
+ real_path_dynamic = File.join(app.root, app.build_dir, prefix, path)
21
+ http_path << "?" + File.mtime(real_path_dynamic).strftime("%s") if File.readable?(real_path_dynamic)
22
+ end
23
+
24
+ http_path
25
+ end
26
+ end
27
+
28
+ app.compass_config do |config|
29
+ config.asset_cache_buster do |path, real_path|
30
+ real_path = real_path.path if real_path.is_a? File
31
+ real_path = real_path.gsub(File.join(app.root, app.build_dir), app.views)
32
+ if File.readable?(real_path)
33
+ File.mtime(real_path).strftime("%s")
34
+ else
35
+ $stderr.puts "WARNING: '#{File.basename(path)}' was not found (or cannot be read) in #{File.dirname(real_path)}"
36
+ end
37
+ end
38
+ end
39
+ end
40
+ alias :included :registered
41
+ end
42
+ end
@@ -0,0 +1,56 @@
1
+ module Middleman::Features::DirectoryIndexes
2
+ class << self
3
+ def registered(app)
4
+ app.set :ignored_directory_indexes, []
5
+ app.extend ClassMethods
6
+
7
+ app.build_reroute do |destination, request_path|
8
+ index_ext = File.extname(app.settings.index_file)
9
+ new_index_path = "/#{app.settings.index_file}"
10
+
11
+ indexed_path = request_path.gsub(/\/$/, "") + index_ext
12
+
13
+ if app.settings.ignored_directory_indexes.include?(request_path)
14
+ false
15
+ elsif request_path =~ /#{new_index_path}$/
16
+ false
17
+ else
18
+ [
19
+ destination.gsub(/#{index_ext.gsub(".", "\\.")}$/, new_index_path),
20
+ request_path
21
+ ]
22
+ end
23
+ end
24
+
25
+ app.before do
26
+ indexed_path = request.path_info.gsub(/\/$/, "") + "/" + app.settings.index_file
27
+ indexed_exists = resolve_template(indexed_path, :raise_exceptions => false)
28
+
29
+ extensioned_path = request.path_info.gsub(/\/$/, "") + File.extname(app.settings.index_file)
30
+ is_ingored = settings.ignored_directory_indexes.include?(extensioned_path)
31
+
32
+ if !indexed_exists && !is_ingored
33
+ parts = request.path_info.split("/")
34
+ last_part = parts.last
35
+ last_part_ext = File.extname(last_part)
36
+
37
+ if last_part_ext.blank?
38
+ # This is a folder, redirect to index
39
+ request.path_info = extensioned_path
40
+ end
41
+ end
42
+ end
43
+ end
44
+ alias :included :registered
45
+ end
46
+
47
+ module ClassMethods
48
+ def page(url, options={}, &block)
49
+ if options.has_key?(:directory_index) && !options["directory_index"]
50
+ settings.ignored_directory_indexes << url
51
+ else
52
+ super
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,126 @@
1
+ module Middleman::Features::Lorem
2
+ class << self
3
+ def registered(app)
4
+ app.helpers Middleman::Features::Lorem::Helpers
5
+ end
6
+ alias :included :registered
7
+ end
8
+
9
+ module Helpers
10
+ def lorem
11
+ @@lorem ||= Middleman::Features::Lorem::LoremObject.new
12
+ end
13
+ end
14
+
15
+ # Adapted from Frank:
16
+ # https://github.com/blahed/frank/
17
+ # Copyright (c) 2010 Travis Dunn
18
+ #
19
+ # Permission is hereby granted, free of charge, to any person
20
+ # obtaining a copy of this software and associated documentation
21
+ # files (the "Software"), to deal in the Software without
22
+ # restriction, including without limitation the rights to use,
23
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ # copies of the Software, and to permit persons to whom the
25
+ # Software is furnished to do so, subject to the following
26
+ # conditions:
27
+ #
28
+ # The above copyright notice and this permission notice shall be
29
+ # included in all copies or substantial portions of the Software.
30
+ #
31
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
33
+ # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
35
+ # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
36
+ # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
37
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
38
+ # OTHER DEALINGS IN THE SOFTWARE.
39
+ class LoremObject
40
+ WORDS = %w(alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo aspernatur aut odit aut fugit sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt neque dolorem ipsum quia dolor sit amet consectetur adipisci velit sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem ut enim ad minima veniam quis nostrum exercitationem ullam corporis nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam nisi ut aliquid ex ea commodi consequatur quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi id est laborum et dolorum fuga et harum quidem rerum facilis est et expedita distinctio nam libero tempore cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est qui minus id quod maxime placeat facere possimus omnis voluptas assumenda est omnis dolor repellendus temporibus autem quibusdam et aut consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur at vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur a sapiente delectus ut aut reiciendis voluptatibus maiores doloribus asperiores repellat)
41
+
42
+ def word
43
+ words(1)
44
+ end
45
+
46
+ def words(total)
47
+ (1..total).map do
48
+ randm(WORDS)
49
+ end.join(' ')
50
+ end
51
+
52
+ def sentence
53
+ sentences(1)
54
+ end
55
+
56
+ def sentences(total)
57
+ (1..total).map do
58
+ words(randm(4..15)).capitalize
59
+ end.join('. ')
60
+ end
61
+
62
+ def paragraph
63
+ paragraphs(1)
64
+ end
65
+
66
+ def paragraphs(total)
67
+ (1..total).map do
68
+ sentences(randm(3..7)).capitalize
69
+ end.join("\n\n")
70
+ end
71
+
72
+ def date(fmt = '%a %b %d, %Y')
73
+ y = rand(20) + 1990
74
+ m = rand(12) + 1
75
+ d = rand(31) + 1
76
+ Time.local(y,m,d).strftime(fmt)
77
+ end
78
+
79
+ def name
80
+ "#{first_name} #{last_name}"
81
+ end
82
+
83
+ def first_name
84
+ names = "Judith Angelo Margarita Kerry Elaine Lorenzo Justice Doris Raul Liliana Kerry Elise Ciaran Johnny Moses Davion Penny Mohammed Harvey Sheryl Hudson Brendan Brooklynn Denis Sadie Trisha Jacquelyn Virgil Cindy Alexa Marianne Giselle Casey Alondra Angela Katherine Skyler Kyleigh Carly Abel Adrianna Luis Dominick Eoin Noel Ciara Roberto Skylar Brock Earl Dwayne Jackie Hamish Sienna Nolan Daren Jean Shirley Connor Geraldine Niall Kristi Monty Yvonne Tammie Zachariah Fatima Ruby Nadia Anahi Calum Peggy Alfredo Marybeth Bonnie Gordon Cara John Staci Samuel Carmen Rylee Yehudi Colm Beth Dulce Darius inley Javon Jason Perla Wayne Laila Kaleigh Maggie Don Quinn Collin Aniya Zoe Isabel Clint Leland Esmeralda Emma Madeline Byron Courtney Vanessa Terry Antoinette George Constance Preston Rolando Caleb Kenneth Lynette Carley Francesca Johnnie Jordyn Arturo Camila Skye Guy Ana Kaylin Nia Colton Bart Brendon Alvin Daryl Dirk Mya Pete Joann Uriel Alonzo Agnes Chris Alyson Paola Dora Elias Allen Jackie Eric Bonita Kelvin Emiliano Ashton Kyra Kailey Sonja Alberto Ty Summer Brayden Lori Kelly Tomas Joey Billie Katie Stephanie Danielle Alexis Jamal Kieran Lucinda Eliza Allyson Melinda Alma Piper Deana Harriet Bryce Eli Jadyn Rogelio Orlaith Janet Randal Toby Carla Lorie Caitlyn Annika Isabelle inn Ewan Maisie Michelle Grady Ida Reid Emely Tricia Beau Reese Vance Dalton Lexi Rafael Makenzie Mitzi Clinton Xena Angelina Kendrick Leslie Teddy Jerald Noelle Neil Marsha Gayle Omar Abigail Alexandra Phil Andre Billy Brenden Bianca Jared Gretchen Patrick Antonio Josephine Kyla Manuel Freya Kellie Tonia Jamie Sydney Andres Ruben Harrison Hector Clyde Wendell Kaden Ian Tracy Cathleen Shawn".split(" ")
85
+ names[rand(names.size)]
86
+ end
87
+
88
+ def last_name
89
+ names = "Chung Chen Melton Hill Puckett Song Hamilton Bender Wagner McLaughlin McNamara Raynor Moon Woodard Desai Wallace Lawrence Griffin Dougherty Powers May Steele Teague Vick Gallagher Solomon Walsh Monroe Connolly Hawkins Middleton Goldstein Watts Johnston Weeks Wilkerson Barton Walton Hall Ross Chung Bender Woods Mangum Joseph Rosenthal Bowden Barton Underwood Jones Baker Merritt Cross Cooper Holmes Sharpe Morgan Hoyle Allen Rich Rich Grant Proctor Diaz Graham Watkins Hinton Marsh Hewitt Branch Walton O'Brien Case Watts Christensen Parks Hardin Lucas Eason Davidson Whitehead Rose Sparks Moore Pearson Rodgers Graves Scarborough Sutton Sinclair Bowman Olsen Love McLean Christian Lamb James Chandler Stout Cowan Golden Bowling Beasley Clapp Abrams Tilley Morse Boykin Sumner Cassidy Davidson Heath Blanchard McAllister McKenzie Byrne Schroeder Griffin Gross Perkins Robertson Palmer Brady Rowe Zhang Hodge Li Bowling Justice Glass Willis Hester Floyd Graves Fischer Norman Chan Hunt Byrd Lane Kaplan Heller May Jennings Hanna Locklear Holloway Jones Glover Vick O'Donnell Goldman McKenna Starr Stone McClure Watson Monroe Abbott Singer Hall Farrell Lucas Norman Atkins Monroe Robertson Sykes Reid Chandler Finch Hobbs Adkins Kinney Whitaker Alexander Conner Waters Becker Rollins Love Adkins Black Fox Hatcher Wu Lloyd Joyce Welch Matthews Chappell MacDonald Kane Butler Pickett Bowman Barton Kennedy Branch Thornton McNeill Weinstein Middleton Moss Lucas Rich Carlton Brady Schultz Nichols Harvey Stevenson Houston Dunn West O'Brien Barr Snyder Cain Heath Boswell Olsen Pittman Weiner Petersen Davis Coleman Terrell Norman Burch Weiner Parrott Henry Gray Chang McLean Eason Weeks Siegel Puckett Heath Hoyle Garrett Neal Baker Goldman Shaffer Choi Carver".split(" ")
90
+ names[rand(names.size)]
91
+ end
92
+
93
+ def email
94
+ delimiters = [ '_', '-', '' ]
95
+ domains = %w(gmail.com yahoo.com hotmail.com email.com live.com me.com mac.com aol.com fastmail.com mail.com)
96
+ username = name.gsub(/[^\w]/, delimiters[rand(delimiters.size)])
97
+ "#{username}@#{domains[rand(domains.size)]}".downcase
98
+ end
99
+
100
+ def image(size, options={})
101
+ src = "http://placehold.it/#{size}"
102
+ hex = %w[a b c d e f 0 1 2 3 4 5 6 7 8 9]
103
+ background_color = options[:background_color]
104
+ color = options[:color]
105
+
106
+ if options[:random_color]
107
+ background_color = hex.shuffle[0...6].join
108
+ color = hex.shuffle[0...6].join
109
+ end
110
+
111
+ src << "/#{background_color.sub(/^#/, '')}" if background_color
112
+ src << "/ccc" if background_color.nil? && color
113
+ src << "/#{color.sub(/^#/, '')}" if color
114
+ src << "&text=#{Rack::Utils::escape(options[:text])}" if options[:text]
115
+
116
+ src
117
+ end
118
+
119
+ private
120
+
121
+ def randm(range)
122
+ a = range.to_a
123
+ a[rand(a.length)]
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,10 @@
1
+ module Middleman::Features::MinifyCss
2
+ class << self
3
+ def registered(app)
4
+ app.compass_config do |config|
5
+ config.output_style = :compressed
6
+ end
7
+ end
8
+ alias :included :registered
9
+ end
10
+ end
@@ -0,0 +1,43 @@
1
+ module Middleman::Features::MinifyJavascript
2
+ class << self
3
+ def registered(app)
4
+ require 'uglifier'
5
+ app.set :js_compressor, ::Uglifier.new
6
+ app.use InlineJavascriptRack
7
+ end
8
+ alias :included :registered
9
+ end
10
+
11
+ class InlineJavascriptRack
12
+ def initialize(app, options={})
13
+ @app = app
14
+ end
15
+
16
+ def call(env)
17
+ status, headers, response = @app.call(env)
18
+
19
+ if env["PATH_INFO"].match(/\.html$/)
20
+ compressor = ::Uglifier.new
21
+
22
+ if response.is_a?(::Rack::File) or response.is_a?(::Sinatra::Helpers::StaticFile)
23
+ uncompressed_source = File.read(response.path)
24
+ else
25
+ uncompressed_source = response.join
26
+ end
27
+
28
+ minified = uncompressed_source.gsub(/(<scri.*?\/\/<!\[CDATA\[\n)(.*?)(\/\/\]\].*?<\/script>)/m) do |m|
29
+ first = $1
30
+ uncompressed_source = $2
31
+ last = $3
32
+ minified_js = compressor.compile(uncompressed_source)
33
+
34
+ first << minified_js << "\n" << last
35
+ end
36
+ headers["Content-Length"] = ::Rack::Utils.bytesize(minified).to_s
37
+ response = [minified]
38
+ end
39
+
40
+ [status, headers, response]
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,38 @@
1
+ module Middleman::Features::RelativeAssets
2
+ class << self
3
+ def registered(app)
4
+ app.compass_config do |config|
5
+ config.relative_assets = true
6
+ end
7
+
8
+ app.register_asset_handler :relative_assets do |path, prefix, request|
9
+ begin
10
+ prefix = app.images_dir if prefix == app.http_images_path
11
+ rescue
12
+ end
13
+
14
+ if path.include?("://")
15
+ app.before_asset_handler(:relative_assets, path, prefix, request)
16
+ elsif path[0,1] == "/"
17
+ path
18
+ else
19
+ path = File.join(prefix, path) if prefix.length > 0
20
+ request_path = request.path_info.dup
21
+ request_path << app.index_file if path.match(%r{/$})
22
+ request_path.gsub!(%r{^/}, '')
23
+ parts = request_path.split('/')
24
+
25
+ if parts.length > 1
26
+ arry = []
27
+ (parts.length - 1).times { arry << ".." }
28
+ arry << path
29
+ File.join(*arry)
30
+ else
31
+ path
32
+ end
33
+ end
34
+ end
35
+ end
36
+ alias :included :registered
37
+ end
38
+ end
@@ -0,0 +1,11 @@
1
+ module Middleman::Features::TinySrc
2
+ class << self
3
+ def registered(app)
4
+ app.register_asset_handler :tiny_src do |path, prefix, request|
5
+ original_output = app.before_asset_handler(:tiny_src, path, prefix, request)
6
+ "http://i.tinysrc.mobi/#{original_output}"
7
+ end
8
+ end
9
+ alias :included :registered
10
+ end
11
+ end
@@ -0,0 +1,70 @@
1
+ require "guard"
2
+ require "guard/guard"
3
+ require "rbconfig"
4
+
5
+ if Config::CONFIG['host_os'].downcase =~ %r{mingw}
6
+ require "win32/process"
7
+ end
8
+
9
+ module Middleman
10
+ module Guard
11
+ def self.add_guard(&block)
12
+ @additional_guards ||= []
13
+ @additional_guards << block
14
+ end
15
+
16
+ def self.start(options={}, livereload={})
17
+ options_hash = ""
18
+ options.each do |k,v|
19
+ options_hash << ", :#{k} => '#{v}'"
20
+ end
21
+
22
+ guardfile_contents = %Q{
23
+ guard 'middleman'#{options_hash} do
24
+ watch("config.rb")
25
+ watch(%r{^lib/^[^\.](.*)\.rb$})
26
+ end
27
+ }
28
+
29
+ (@additional_guards || []).each do |block|
30
+ result = block.call(options, livereload)
31
+ guardfile_contents << result unless result.nil?
32
+ end
33
+
34
+ ::Guard.start({ :guardfile_contents => guardfile_contents })
35
+ end
36
+ end
37
+ end
38
+
39
+ module Guard
40
+ class Middleman < Guard
41
+ def initialize(watchers = [], options = {})
42
+ super
43
+ @options = options
44
+ end
45
+
46
+ def start
47
+ server_start
48
+ end
49
+
50
+ def run_on_change(paths)
51
+ server_stop
52
+ server_start
53
+ end
54
+
55
+ private
56
+ def server_start
57
+ @server_job = fork do
58
+ ::Middleman.start_server(@options)
59
+ end
60
+ end
61
+
62
+ def server_stop
63
+ puts "== The Middleman is shutting down"
64
+ Process.kill("KILL", @server_job)
65
+ Process.wait @server_job
66
+ @server_job = nil
67
+ # @server_options[:app] = nil
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,8 @@
1
+ module Middleman::Renderers::CoffeeScript
2
+ class << self
3
+ def registered(app)
4
+ require "coffee_script"
5
+ end
6
+ alias :included :registered
7
+ end
8
+ end
@@ -0,0 +1,31 @@
1
+ module Middleman::Renderers::Haml
2
+ class << self
3
+ def registered(app)
4
+ # Base library
5
+ require "haml"
6
+
7
+ # Coffee-script filter for Haml
8
+ begin
9
+ require "coffee-filter"
10
+ rescue LoadError
11
+ end
12
+
13
+ # Code-ray Syntax highlighting
14
+ begin
15
+ require 'haml-coderay'
16
+ rescue LoadError
17
+ end
18
+
19
+ app.helpers Helpers
20
+
21
+ #app.set :haml, app.settings.haml.merge({ :ugly_haml => true })
22
+ end
23
+ alias :included :registered
24
+ end
25
+
26
+ module Helpers
27
+ def haml_partial(name, options = {})
28
+ render(name, options)
29
+ end
30
+ end
31
+ end