middleman 0.5.5 → 0.9.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. data/.document +1 -2
  2. data/.gitignore +3 -2
  3. data/LICENSE +0 -0
  4. data/README.rdoc +4 -0
  5. data/Rakefile +28 -36
  6. data/VERSION +1 -1
  7. data/bin/mm-build +7 -113
  8. data/bin/mm-init +11 -5
  9. data/bin/mm-server +56 -3
  10. data/features/asset_host.feature +12 -0
  11. data/features/automatic_image_sizes.feature +14 -0
  12. data/features/cache_buster.feature +22 -0
  13. data/features/generator.feature +8 -0
  14. data/features/minify_css.feature +22 -0
  15. data/features/minify_javascript.feature +12 -0
  16. data/features/page_alias_and_layouts.feature +12 -0
  17. data/features/relative_assets.feature +12 -0
  18. data/features/step_definitions/asset_host_steps.rb +7 -0
  19. data/features/step_definitions/env.rb +3 -0
  20. data/features/step_definitions/generator_steps.rb +24 -0
  21. data/features/step_definitions/middleman_steps.rb +28 -0
  22. data/features/step_definitions/page_layout_steps.rb +13 -0
  23. data/lib/middleman.rb +6 -132
  24. data/lib/middleman/assets.rb +33 -0
  25. data/lib/middleman/base.rb +147 -0
  26. data/lib/middleman/builder.rb +59 -0
  27. data/lib/middleman/config.ru +2 -0
  28. data/lib/middleman/features.rb +39 -0
  29. data/lib/middleman/features/asset_host.rb +21 -0
  30. data/lib/middleman/features/automatic_image_sizes.rb +31 -0
  31. data/lib/middleman/features/automatic_image_sizes/fastimage.rb +282 -0
  32. data/lib/middleman/features/cache_buster.rb +43 -0
  33. data/lib/middleman/features/default_helpers.rb +68 -0
  34. data/lib/middleman/features/livereload.rb +19 -0
  35. data/lib/middleman/features/minify_css.rb +9 -0
  36. data/lib/middleman/features/minify_javascript.rb +20 -0
  37. data/lib/middleman/features/minify_javascript/rack.rb +31 -0
  38. data/lib/middleman/features/relative_assets.rb +35 -0
  39. data/lib/middleman/features/slickmap.rb +118 -0
  40. data/lib/middleman/features/smush_pngs.rb +38 -0
  41. data/lib/middleman/features/ugly_haml.rb +7 -0
  42. data/lib/middleman/renderers.rb +26 -0
  43. data/lib/middleman/renderers/coffee.rb +28 -0
  44. data/lib/middleman/renderers/haml.rb +47 -0
  45. data/lib/middleman/renderers/sass.rb +67 -0
  46. data/lib/middleman/template/init.rbt +57 -0
  47. data/lib/middleman/template/views/index.html.haml +4 -0
  48. data/lib/middleman/template/views/layout.haml +11 -4
  49. data/lib/middleman/template/views/stylesheets/site.css.sass +27 -0
  50. data/lib/middleman/templater+dynamic_renderer.rb +26 -0
  51. data/middleman.gemspec +121 -107
  52. data/spec/builder_spec.rb +17 -16
  53. data/spec/fixtures/sample/init.rb +28 -2
  54. data/spec/fixtures/sample/public/images/blank.gif +0 -0
  55. data/spec/fixtures/sample/public/static.html +0 -0
  56. data/{vendor/sinatra-maruku/examples/public/javascripts/application.js → spec/fixtures/sample/public/stylesheets/auto-css.css} +0 -0
  57. data/spec/fixtures/sample/public/stylesheets/static.css +0 -0
  58. data/{vendor/sinatra-maruku/examples/public/stylesheets/print.css → spec/fixtures/sample/public/stylesheets/sub1/auto-css.css} +0 -0
  59. data/spec/fixtures/sample/public/stylesheets/sub1/sub2/auto-css.css +0 -0
  60. data/spec/fixtures/sample/views/_partial.haml +0 -0
  61. data/spec/fixtures/sample/views/asset_host.html.haml +1 -0
  62. data/spec/fixtures/sample/views/auto-css.html.haml +1 -0
  63. data/spec/fixtures/sample/views/auto-image-sizes.html.haml +1 -0
  64. data/spec/fixtures/sample/views/cache-buster.html.haml +2 -0
  65. data/spec/fixtures/sample/views/{index.haml → custom-layout.html.haml} +0 -0
  66. data/spec/fixtures/sample/views/custom.haml +5 -0
  67. data/spec/fixtures/sample/views/index.html.haml +1 -0
  68. data/spec/fixtures/sample/views/inline-css.html.haml +4 -0
  69. data/spec/fixtures/sample/views/{inline-js.haml → inline-js.html.haml} +0 -0
  70. data/spec/fixtures/sample/views/layout.haml +1 -1
  71. data/spec/fixtures/sample/views/{maruku.maruku → maruku.html.maruku} +0 -0
  72. data/spec/fixtures/sample/views/page-classes.html.haml +1 -0
  73. data/spec/fixtures/sample/views/services/{index.haml → index.html.haml} +0 -0
  74. data/spec/fixtures/sample/views/stylesheets/asset_host.css.sass +3 -0
  75. data/spec/fixtures/sample/views/stylesheets/relative_assets.css.sass +3 -0
  76. data/spec/fixtures/sample/views/stylesheets/site.css.sass +1 -0
  77. data/spec/fixtures/sample/views/stylesheets/site_scss.css.scss +1 -0
  78. data/spec/fixtures/sample/views/stylesheets/test_less.css.less +5 -0
  79. data/spec/helpers_spec.rb +43 -0
  80. data/spec/spec_helper.rb +3 -5
  81. metadata +298 -127
  82. data/lib/middleman/helpers.rb +0 -131
  83. data/lib/middleman/markaby.rb +0 -4
  84. data/lib/middleman/maruku.rb +0 -4
  85. data/lib/middleman/sprockets_ext.rb +0 -29
  86. data/lib/middleman/template/init.rb +0 -22
  87. data/lib/middleman/template/views/index.haml +0 -1
  88. data/lib/middleman/template/views/stylesheets/site.sass +0 -1
  89. data/spec/fixtures/sample/views/markaby.mab +0 -5
  90. data/spec/fixtures/sample/views/stylesheets/site.sass +0 -1
  91. data/spec/generator_spec.rb +0 -34
  92. data/vendor/rack-test/History.txt +0 -64
  93. data/vendor/rack-test/MIT-LICENSE.txt +0 -19
  94. data/vendor/rack-test/README.rdoc +0 -57
  95. data/vendor/rack-test/Rakefile +0 -62
  96. data/vendor/rack-test/lib/rack/mock_session.rb +0 -57
  97. data/vendor/rack-test/lib/rack/test.rb +0 -246
  98. data/vendor/rack-test/lib/rack/test/cookie_jar.rb +0 -169
  99. data/vendor/rack-test/lib/rack/test/methods.rb +0 -73
  100. data/vendor/rack-test/lib/rack/test/mock_digest_request.rb +0 -27
  101. data/vendor/rack-test/lib/rack/test/uploaded_file.rb +0 -36
  102. data/vendor/rack-test/lib/rack/test/utils.rb +0 -75
  103. data/vendor/rack-test/spec/fixtures/config.ru +0 -3
  104. data/vendor/rack-test/spec/fixtures/fake_app.rb +0 -109
  105. data/vendor/rack-test/spec/fixtures/foo.txt +0 -1
  106. data/vendor/rack-test/spec/rack/test/cookie_spec.rb +0 -176
  107. data/vendor/rack-test/spec/rack/test/digest_auth_spec.rb +0 -48
  108. data/vendor/rack-test/spec/rack/test/multipart_spec.rb +0 -85
  109. data/vendor/rack-test/spec/rack/test/utils_spec.rb +0 -44
  110. data/vendor/rack-test/spec/rack/test_spec.rb +0 -363
  111. data/vendor/rack-test/spec/rcov.opts +0 -1
  112. data/vendor/rack-test/spec/spec.opts +0 -1
  113. data/vendor/rack-test/spec/spec_helper.rb +0 -48
  114. data/vendor/sinatra-content-for/LICENSE +0 -22
  115. data/vendor/sinatra-content-for/README.rdoc +0 -49
  116. data/vendor/sinatra-content-for/Rakefile +0 -33
  117. data/vendor/sinatra-content-for/lib/sinatra/content_for.rb +0 -58
  118. data/vendor/sinatra-content-for/sinatra-content-for.gemspec +0 -34
  119. data/vendor/sinatra-content-for/test/content_for_test.rb +0 -156
  120. data/vendor/sinatra-markaby/CHANGES +0 -7
  121. data/vendor/sinatra-markaby/LICENSE +0 -20
  122. data/vendor/sinatra-markaby/README.rdoc +0 -33
  123. data/vendor/sinatra-markaby/Rakefile +0 -45
  124. data/vendor/sinatra-markaby/TODO +0 -3
  125. data/vendor/sinatra-markaby/VERSION.yml +0 -4
  126. data/vendor/sinatra-markaby/lib/sinatra/markaby.rb +0 -31
  127. data/vendor/sinatra-markaby/sinatra-markaby.gemspec +0 -49
  128. data/vendor/sinatra-markaby/test/sinatra_markaby_test.rb +0 -72
  129. data/vendor/sinatra-markaby/test/test_helper.rb +0 -19
  130. data/vendor/sinatra-markaby/test/views/hello.mab +0 -1
  131. data/vendor/sinatra-markaby/test/views/html.mab +0 -4
  132. data/vendor/sinatra-maruku/LICENSE +0 -22
  133. data/vendor/sinatra-maruku/README.markdown +0 -85
  134. data/vendor/sinatra-maruku/Rakefile +0 -34
  135. data/vendor/sinatra-maruku/VERSION.yml +0 -4
  136. data/vendor/sinatra-maruku/examples/app.rb +0 -8
  137. data/vendor/sinatra-maruku/examples/config.ru +0 -4
  138. data/vendor/sinatra-maruku/examples/mapp.rb +0 -15
  139. data/vendor/sinatra-maruku/examples/public/stylesheets/application.css +0 -23
  140. data/vendor/sinatra-maruku/examples/views/index.maruku +0 -32
  141. data/vendor/sinatra-maruku/examples/views/layout.maruku +0 -9
  142. data/vendor/sinatra-maruku/lib/sinatra/maruku.rb +0 -25
  143. data/vendor/sinatra-maruku/sinatra-maruku.gemspec +0 -70
  144. data/vendor/sinatra-maruku/test/sinatra_maruku_test.rb +0 -91
  145. data/vendor/sinatra-maruku/test/test_helper.rb +0 -21
  146. data/vendor/sinatra-maruku/test/views/hello.maruku +0 -1
  147. data/vendor/sinatra-maruku/test/views/layout2.maruku +0 -2
@@ -1,32 +0,0 @@
1
- Maruku features
2
- ===============
3
-
4
- Maruku allows you to write in an easy-to-read-and-write syntax, like this:
5
-
6
- > [This document in Markdown][this_md]
7
-
8
- Then it can be translated to HTML:
9
-
10
- > [This document in HTML][this_html]
11
-
12
- or LaTeX, which is then converted to PDF:
13
-
14
- > [This document in PDF][this_pdf]
15
-
16
- Maruku implements:
17
-
18
- * the original [Markdown syntax][markdown_html]
19
- ([HTML][markdown_html] or [PDF][markdown_pdf]), translated by Maruku).
20
-
21
- * all the improvements in PHP Markdown Extra.
22
-
23
- * a new [meta-data syntax][meta_data_proposal]
24
-
25
- [markdown_html]: http://maruku.rubyforge.org/markdown_syntax.html
26
- [markdown_pdf]: http://maruku.rubyforge.org/markdown_syntax.pdf
27
- [this_md]: http://maruku.rubyforge.org/maruku.md
28
- [this_html]: http://maruku.rubyforge.org/maruku.html
29
- [this_pdf]: http://maruku.rubyforge.org/maruku.pdf
30
- [Andrea Censi]: http://www.dis.uniroma1.it/~acensi/
31
-
32
- [meta_data_proposal]: http://maruku.rubyforge.org/proposal.html
@@ -1,9 +0,0 @@
1
- CSS: /stylesheets/application.css /stylesheets/print.css
2
- Javascript: /javascriprs/application.js
3
- Lang: pl
4
- Title: Hello Maruku
5
- LaTeX preamble: preamble.tex
6
-
7
- # Hello Maruku {.header}
8
-
9
- <%= yield %>
@@ -1,25 +0,0 @@
1
- require 'maruku'
2
- require 'sinatra/base'
3
-
4
- module Sinatra
5
- module Maruku
6
- def maruku(template, options={}, locals={})
7
- render :maruku, template, options, locals
8
- end
9
-
10
- private
11
- def render_maruku(template, data, options, locals, &block)
12
- maruku_src = render_erb(template, data, options, locals, &block)
13
- instance = ::Maruku.new(maruku_src, options)
14
- if block_given?
15
- # render layout
16
- instance.to_html_document
17
- else
18
- # render template
19
- instance.to_html
20
- end
21
- end
22
- end
23
-
24
- helpers Maruku
25
- end
@@ -1,70 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{sinatra-maruku}
5
- s.version = "0.10.1"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Wlodek Bzyl"]
9
- s.date = %q{2009-07-26}
10
- s.description = %q{}
11
- s.email = %q{matwb@univ.gda.pl}
12
- s.extra_rdoc_files = [
13
- "LICENSE",
14
- "README.markdown"
15
- ]
16
- s.files = [
17
- ".gitignore",
18
- "LICENSE",
19
- "README.markdown",
20
- "Rakefile",
21
- "VERSION.yml",
22
- "examples/app.rb",
23
- "examples/config.ru",
24
- "examples/mapp.rb",
25
- "examples/public/javascripts/application.js",
26
- "examples/public/stylesheets/application.css",
27
- "examples/public/stylesheets/print.css",
28
- "examples/views/index.maruku",
29
- "examples/views/layout.maruku",
30
- "lib/sinatra/maruku.rb",
31
- "sinatra-maruku.gemspec",
32
- "test/sinatra_maruku_test.rb",
33
- "test/test_helper.rb",
34
- "test/views/hello.maruku",
35
- "test/views/layout2.maruku"
36
- ]
37
- s.homepage = %q{http://github.com/wbzyl/sinatra-maruku}
38
- s.rdoc_options = ["--charset=UTF-8"]
39
- s.require_paths = ["lib"]
40
- s.rubygems_version = %q{1.3.5}
41
- s.summary = %q{An extension providing Maruku templates for Sinatra applications.}
42
- s.test_files = [
43
- "test/test_helper.rb",
44
- "test/sinatra_maruku_test.rb",
45
- "examples/mapp.rb",
46
- "examples/app.rb"
47
- ]
48
-
49
- if s.respond_to? :specification_version then
50
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
51
- s.specification_version = 3
52
-
53
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
- s.add_runtime_dependency(%q<sinatra>, [">= 0.10.1"])
55
- s.add_runtime_dependency(%q<maruku>, [">= 0.6.0"])
56
- s.add_development_dependency(%q<rack>, [">= 1.0.0"])
57
- s.add_development_dependency(%q<rack-test>, [">= 0.3.0"])
58
- else
59
- s.add_dependency(%q<sinatra>, [">= 0.10.1"])
60
- s.add_dependency(%q<maruku>, [">= 0.6.0"])
61
- s.add_dependency(%q<rack>, [">= 1.0.0"])
62
- s.add_dependency(%q<rack-test>, [">= 0.3.0"])
63
- end
64
- else
65
- s.add_dependency(%q<sinatra>, [">= 0.10.1"])
66
- s.add_dependency(%q<maruku>, [">= 0.6.0"])
67
- s.add_dependency(%q<rack>, [">= 1.0.0"])
68
- s.add_dependency(%q<rack-test>, [">= 0.3.0"])
69
- end
70
- end
@@ -1,91 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper'
2
-
3
- class SinatraMarukuTest < Test::Unit::TestCase
4
- include Rack::Test::Methods
5
-
6
- def maruku_app(&block)
7
- mock_app {
8
- set :views, File.dirname(__FILE__) + '/views'
9
- helpers Sinatra::Maruku
10
- set :show_exceptions, false
11
- get '/', &block
12
- }
13
- get '/'
14
- end
15
-
16
- def test_renders_inline_strings
17
- maruku_app { maruku 'hello world' }
18
- assert last_response.ok?
19
- assert_equal "<p>hello world</p>", last_response.body
20
- end
21
-
22
- def test_renders_inline_erb_string
23
- maruku_app { maruku '<%= 1 + 1 %>' }
24
- assert last_response.ok?
25
- assert_equal "<p>2</p>", last_response.body
26
- end
27
-
28
- def test_renders_files_in_views_path
29
- maruku_app { maruku :hello }
30
- assert last_response.ok?
31
- assert_equal "<h1 id='hello_world'>hello world</h1>", last_response.body
32
- end
33
-
34
- def test_takes_locals_option
35
- maruku_app {
36
- locals = {:foo => 'Bar'}
37
- maruku "<%= foo %>", :locals => locals
38
- }
39
- assert last_response.ok?
40
- assert_equal "<p>Bar</p>", last_response.body
41
- end
42
-
43
- def test_renders_with_inline_layouts
44
- maruku_app {
45
- maruku 'Sparta', :layout => 'THIS. IS. <%= yield.upcase %>'
46
- }
47
- assert last_response.ok?
48
- assert_equal "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC\n \"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\"\n \"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd\">\n<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>\n<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>\n<body>\n<p>THIS. IS. <P>SPARTA</P></p>\n</body></html>", last_response.body
49
- end
50
-
51
- def test_renders_with_file_layouts
52
- maruku_app {
53
- maruku 'hello world', :layout => :layout2
54
- }
55
- assert last_response.ok?
56
- assert_equal "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC\n \"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\"\n \"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd\">\n<html xmlns:svg='http://www.w3.org/2000/svg' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>\n<head><meta content='application/xhtml+xml;charset=utf-8' http-equiv='Content-type' /><title></title></head>\n<body>\n<p>erb layout <p>hello world</p></p>\n</body></html>", last_response.body
57
- end
58
-
59
- def test_renders_erb_with_blocks
60
- mock_app {
61
- set :views, File.dirname(__FILE__) + '/views'
62
- helpers Sinatra::Maruku
63
-
64
- def container
65
- yield
66
- end
67
- def is
68
- "THIS. IS. SPARTA!"
69
- end
70
-
71
- get '/' do
72
- maruku '<% container do %> <%= is %> <% end %>'
73
- end
74
- }
75
-
76
- get '/'
77
- assert last_response.ok?
78
- assert_equal "<p>THIS. IS. SPARTA!</p>", last_response.body
79
- end
80
-
81
- def test_raises_error_if_template_not_found
82
- mock_app {
83
- set :views, File.dirname(__FILE__) + '/views'
84
- helpers Sinatra::Maruku
85
- set :show_exceptions, false
86
-
87
- get('/') { maruku :no_such_template }
88
- }
89
- assert_raise(Errno::ENOENT) { get('/') }
90
- end
91
- end
@@ -1,21 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'rack/test'
4
-
5
- path = File.expand_path("../lib" + File.dirname(__FILE__))
6
- $:.unshift(path) unless $:.include?(path)
7
-
8
- require 'sinatra/maruku'
9
-
10
- class Test::Unit::TestCase
11
- include Rack::Test::Methods
12
-
13
- attr_reader :app
14
-
15
- # Sets up a Sinatra::Base subclass defined with the block
16
- # given. Used in setup or individual spec methods to establish
17
- # the application.
18
- def mock_app(base=Sinatra::Base, &block)
19
- @app = Sinatra.new(base, &block)
20
- end
21
- end
@@ -1 +0,0 @@
1
- # hello world
@@ -1,2 +0,0 @@
1
- erb layout
2
- <%= yield %>