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.
- data/.document +1 -2
- data/.gitignore +3 -2
- data/LICENSE +0 -0
- data/README.rdoc +4 -0
- data/Rakefile +28 -36
- data/VERSION +1 -1
- data/bin/mm-build +7 -113
- data/bin/mm-init +11 -5
- data/bin/mm-server +56 -3
- data/features/asset_host.feature +12 -0
- data/features/automatic_image_sizes.feature +14 -0
- data/features/cache_buster.feature +22 -0
- data/features/generator.feature +8 -0
- data/features/minify_css.feature +22 -0
- data/features/minify_javascript.feature +12 -0
- data/features/page_alias_and_layouts.feature +12 -0
- data/features/relative_assets.feature +12 -0
- data/features/step_definitions/asset_host_steps.rb +7 -0
- data/features/step_definitions/env.rb +3 -0
- data/features/step_definitions/generator_steps.rb +24 -0
- data/features/step_definitions/middleman_steps.rb +28 -0
- data/features/step_definitions/page_layout_steps.rb +13 -0
- data/lib/middleman.rb +6 -132
- data/lib/middleman/assets.rb +33 -0
- data/lib/middleman/base.rb +147 -0
- data/lib/middleman/builder.rb +59 -0
- data/lib/middleman/config.ru +2 -0
- data/lib/middleman/features.rb +39 -0
- data/lib/middleman/features/asset_host.rb +21 -0
- data/lib/middleman/features/automatic_image_sizes.rb +31 -0
- data/lib/middleman/features/automatic_image_sizes/fastimage.rb +282 -0
- data/lib/middleman/features/cache_buster.rb +43 -0
- data/lib/middleman/features/default_helpers.rb +68 -0
- data/lib/middleman/features/livereload.rb +19 -0
- data/lib/middleman/features/minify_css.rb +9 -0
- data/lib/middleman/features/minify_javascript.rb +20 -0
- data/lib/middleman/features/minify_javascript/rack.rb +31 -0
- data/lib/middleman/features/relative_assets.rb +35 -0
- data/lib/middleman/features/slickmap.rb +118 -0
- data/lib/middleman/features/smush_pngs.rb +38 -0
- data/lib/middleman/features/ugly_haml.rb +7 -0
- data/lib/middleman/renderers.rb +26 -0
- data/lib/middleman/renderers/coffee.rb +28 -0
- data/lib/middleman/renderers/haml.rb +47 -0
- data/lib/middleman/renderers/sass.rb +67 -0
- data/lib/middleman/template/init.rbt +57 -0
- data/lib/middleman/template/views/index.html.haml +4 -0
- data/lib/middleman/template/views/layout.haml +11 -4
- data/lib/middleman/template/views/stylesheets/site.css.sass +27 -0
- data/lib/middleman/templater+dynamic_renderer.rb +26 -0
- data/middleman.gemspec +121 -107
- data/spec/builder_spec.rb +17 -16
- data/spec/fixtures/sample/init.rb +28 -2
- data/spec/fixtures/sample/public/images/blank.gif +0 -0
- data/spec/fixtures/sample/public/static.html +0 -0
- data/{vendor/sinatra-maruku/examples/public/javascripts/application.js → spec/fixtures/sample/public/stylesheets/auto-css.css} +0 -0
- data/spec/fixtures/sample/public/stylesheets/static.css +0 -0
- data/{vendor/sinatra-maruku/examples/public/stylesheets/print.css → spec/fixtures/sample/public/stylesheets/sub1/auto-css.css} +0 -0
- data/spec/fixtures/sample/public/stylesheets/sub1/sub2/auto-css.css +0 -0
- data/spec/fixtures/sample/views/_partial.haml +0 -0
- data/spec/fixtures/sample/views/asset_host.html.haml +1 -0
- data/spec/fixtures/sample/views/auto-css.html.haml +1 -0
- data/spec/fixtures/sample/views/auto-image-sizes.html.haml +1 -0
- data/spec/fixtures/sample/views/cache-buster.html.haml +2 -0
- data/spec/fixtures/sample/views/{index.haml → custom-layout.html.haml} +0 -0
- data/spec/fixtures/sample/views/custom.haml +5 -0
- data/spec/fixtures/sample/views/index.html.haml +1 -0
- data/spec/fixtures/sample/views/inline-css.html.haml +4 -0
- data/spec/fixtures/sample/views/{inline-js.haml → inline-js.html.haml} +0 -0
- data/spec/fixtures/sample/views/layout.haml +1 -1
- data/spec/fixtures/sample/views/{maruku.maruku → maruku.html.maruku} +0 -0
- data/spec/fixtures/sample/views/page-classes.html.haml +1 -0
- data/spec/fixtures/sample/views/services/{index.haml → index.html.haml} +0 -0
- data/spec/fixtures/sample/views/stylesheets/asset_host.css.sass +3 -0
- data/spec/fixtures/sample/views/stylesheets/relative_assets.css.sass +3 -0
- data/spec/fixtures/sample/views/stylesheets/site.css.sass +1 -0
- data/spec/fixtures/sample/views/stylesheets/site_scss.css.scss +1 -0
- data/spec/fixtures/sample/views/stylesheets/test_less.css.less +5 -0
- data/spec/helpers_spec.rb +43 -0
- data/spec/spec_helper.rb +3 -5
- metadata +298 -127
- data/lib/middleman/helpers.rb +0 -131
- data/lib/middleman/markaby.rb +0 -4
- data/lib/middleman/maruku.rb +0 -4
- data/lib/middleman/sprockets_ext.rb +0 -29
- data/lib/middleman/template/init.rb +0 -22
- data/lib/middleman/template/views/index.haml +0 -1
- data/lib/middleman/template/views/stylesheets/site.sass +0 -1
- data/spec/fixtures/sample/views/markaby.mab +0 -5
- data/spec/fixtures/sample/views/stylesheets/site.sass +0 -1
- data/spec/generator_spec.rb +0 -34
- data/vendor/rack-test/History.txt +0 -64
- data/vendor/rack-test/MIT-LICENSE.txt +0 -19
- data/vendor/rack-test/README.rdoc +0 -57
- data/vendor/rack-test/Rakefile +0 -62
- data/vendor/rack-test/lib/rack/mock_session.rb +0 -57
- data/vendor/rack-test/lib/rack/test.rb +0 -246
- data/vendor/rack-test/lib/rack/test/cookie_jar.rb +0 -169
- data/vendor/rack-test/lib/rack/test/methods.rb +0 -73
- data/vendor/rack-test/lib/rack/test/mock_digest_request.rb +0 -27
- data/vendor/rack-test/lib/rack/test/uploaded_file.rb +0 -36
- data/vendor/rack-test/lib/rack/test/utils.rb +0 -75
- data/vendor/rack-test/spec/fixtures/config.ru +0 -3
- data/vendor/rack-test/spec/fixtures/fake_app.rb +0 -109
- data/vendor/rack-test/spec/fixtures/foo.txt +0 -1
- data/vendor/rack-test/spec/rack/test/cookie_spec.rb +0 -176
- data/vendor/rack-test/spec/rack/test/digest_auth_spec.rb +0 -48
- data/vendor/rack-test/spec/rack/test/multipart_spec.rb +0 -85
- data/vendor/rack-test/spec/rack/test/utils_spec.rb +0 -44
- data/vendor/rack-test/spec/rack/test_spec.rb +0 -363
- data/vendor/rack-test/spec/rcov.opts +0 -1
- data/vendor/rack-test/spec/spec.opts +0 -1
- data/vendor/rack-test/spec/spec_helper.rb +0 -48
- data/vendor/sinatra-content-for/LICENSE +0 -22
- data/vendor/sinatra-content-for/README.rdoc +0 -49
- data/vendor/sinatra-content-for/Rakefile +0 -33
- data/vendor/sinatra-content-for/lib/sinatra/content_for.rb +0 -58
- data/vendor/sinatra-content-for/sinatra-content-for.gemspec +0 -34
- data/vendor/sinatra-content-for/test/content_for_test.rb +0 -156
- data/vendor/sinatra-markaby/CHANGES +0 -7
- data/vendor/sinatra-markaby/LICENSE +0 -20
- data/vendor/sinatra-markaby/README.rdoc +0 -33
- data/vendor/sinatra-markaby/Rakefile +0 -45
- data/vendor/sinatra-markaby/TODO +0 -3
- data/vendor/sinatra-markaby/VERSION.yml +0 -4
- data/vendor/sinatra-markaby/lib/sinatra/markaby.rb +0 -31
- data/vendor/sinatra-markaby/sinatra-markaby.gemspec +0 -49
- data/vendor/sinatra-markaby/test/sinatra_markaby_test.rb +0 -72
- data/vendor/sinatra-markaby/test/test_helper.rb +0 -19
- data/vendor/sinatra-markaby/test/views/hello.mab +0 -1
- data/vendor/sinatra-markaby/test/views/html.mab +0 -4
- data/vendor/sinatra-maruku/LICENSE +0 -22
- data/vendor/sinatra-maruku/README.markdown +0 -85
- data/vendor/sinatra-maruku/Rakefile +0 -34
- data/vendor/sinatra-maruku/VERSION.yml +0 -4
- data/vendor/sinatra-maruku/examples/app.rb +0 -8
- data/vendor/sinatra-maruku/examples/config.ru +0 -4
- data/vendor/sinatra-maruku/examples/mapp.rb +0 -15
- data/vendor/sinatra-maruku/examples/public/stylesheets/application.css +0 -23
- data/vendor/sinatra-maruku/examples/views/index.maruku +0 -32
- data/vendor/sinatra-maruku/examples/views/layout.maruku +0 -9
- data/vendor/sinatra-maruku/lib/sinatra/maruku.rb +0 -25
- data/vendor/sinatra-maruku/sinatra-maruku.gemspec +0 -70
- data/vendor/sinatra-maruku/test/sinatra_maruku_test.rb +0 -91
- data/vendor/sinatra-maruku/test/test_helper.rb +0 -21
- data/vendor/sinatra-maruku/test/views/hello.maruku +0 -1
- data/vendor/sinatra-maruku/test/views/layout2.maruku +0 -2
data/lib/middleman/helpers.rb
DELETED
@@ -1,131 +0,0 @@
|
|
1
|
-
module Table
|
2
|
-
include Haml::Filters::Base
|
3
|
-
|
4
|
-
def render(text)
|
5
|
-
output = '<div class="table"><table cellspacing="0" cellpadding="0">'
|
6
|
-
line_num = 0
|
7
|
-
text.each_line do |line|
|
8
|
-
line_num += 1
|
9
|
-
next if line.strip.empty?
|
10
|
-
output << %Q{<tr class="#{(line_num % 2 == 0) ? "even" : "odd" }#{(line_num == 1) ? " first" : "" }">}
|
11
|
-
|
12
|
-
columns = line.split("|").map { |p| p.strip }
|
13
|
-
columns.each_with_index do |col, i|
|
14
|
-
output << %Q{<td class="col#{i+1}">#{col}</td>}
|
15
|
-
end
|
16
|
-
|
17
|
-
output << "</tr>"
|
18
|
-
end
|
19
|
-
output + "</table></div>"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def find_and_include_related_sass_file
|
24
|
-
path = request.path_info.dup
|
25
|
-
path << "index.html" if path.match(%r{/$})
|
26
|
-
path.gsub!(%r{^/}, '')
|
27
|
-
path.gsub!(File.extname(path), '')
|
28
|
-
path.gsub!('/', '-')
|
29
|
-
|
30
|
-
sass_file = File.join(File.basename(self.class.views), "stylesheets", "#{path}.sass")
|
31
|
-
if File.exists? sass_file
|
32
|
-
stylesheet_link_tag "stylesheets/#{path}.css"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def link_to(title, url="#", params={})
|
37
|
-
params.merge!(:href => url)
|
38
|
-
params = params.map { |k,v| %Q{#{k}="#{v}"}}.join(' ')
|
39
|
-
%Q{<a #{params}>#{title}</a>}
|
40
|
-
end
|
41
|
-
|
42
|
-
def page_classes(*additional)
|
43
|
-
path = request.path_info
|
44
|
-
path << "index.html" if path.match(%r{/$})
|
45
|
-
path.gsub!(%r{^/}, '')
|
46
|
-
|
47
|
-
classes = []
|
48
|
-
parts = path.split('.')[0].split('/')
|
49
|
-
parts.each_with_index { |path, i| classes << parts.first(i+1).join('_') }
|
50
|
-
|
51
|
-
classes << "index" if classes.empty?
|
52
|
-
classes += additional unless additional.empty?
|
53
|
-
classes.join(' ')
|
54
|
-
end
|
55
|
-
|
56
|
-
def haml_partial(name, options = {})
|
57
|
-
item_name = name.to_sym
|
58
|
-
counter_name = "#{name}_counter".to_sym
|
59
|
-
if collection = options.delete(:collection)
|
60
|
-
collection.enum_for(:each_with_index).collect do |item,index|
|
61
|
-
haml_partial name, options.merge(:locals => {item_name => item, counter_name => index+1})
|
62
|
-
end.join
|
63
|
-
elsif object = options.delete(:object)
|
64
|
-
haml_partial name, options.merge(:locals => {item_name => object, counter_name => nil})
|
65
|
-
else
|
66
|
-
haml "_#{name}".to_sym, options.merge(:layout => false)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def asset_url(path)
|
71
|
-
path.include?("://") ? path : "/#{path}"
|
72
|
-
end
|
73
|
-
|
74
|
-
def image_tag(path, options={})
|
75
|
-
options[:alt] ||= ""
|
76
|
-
capture_haml do
|
77
|
-
haml_tag :img, options.merge(:src => asset_url(path))
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def javascript_include_tag(path, options={})
|
82
|
-
capture_haml do
|
83
|
-
haml_tag :script, options.merge(:src => asset_url(path), :type => "text/javascript")
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def stylesheet_link_tag(path, options={})
|
88
|
-
options[:rel] ||= "stylesheet"
|
89
|
-
capture_haml do
|
90
|
-
haml_tag :link, options.merge(:href => asset_url(path), :type => "text/css")
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
# Handle Sass errors
|
95
|
-
def sass_exception_string(e)
|
96
|
-
e_string = "#{e.class}: #{e.message}"
|
97
|
-
|
98
|
-
if e.is_a? Sass::SyntaxError
|
99
|
-
e_string << "\non line #{e.sass_line}"
|
100
|
-
|
101
|
-
if e.sass_filename
|
102
|
-
e_string << " of #{e.sass_filename}"
|
103
|
-
|
104
|
-
if File.exists?(e.sass_filename)
|
105
|
-
e_string << "\n\n"
|
106
|
-
|
107
|
-
min = [e.sass_line - 5, 0].max
|
108
|
-
begin
|
109
|
-
File.read(e.sass_filename).rstrip.split("\n")[
|
110
|
-
min .. e.sass_line + 5
|
111
|
-
].each_with_index do |line, i|
|
112
|
-
e_string << "#{min + i + 1}: #{line}\n"
|
113
|
-
end
|
114
|
-
rescue
|
115
|
-
e_string << "Couldn't read sass file: #{e.sass_filename}"
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
<<END
|
121
|
-
/*
|
122
|
-
#{e_string}
|
123
|
-
|
124
|
-
Backtrace:\n#{e.backtrace.join("\n")}
|
125
|
-
*/
|
126
|
-
body:before {
|
127
|
-
white-space: pre;
|
128
|
-
font-family: monospace;
|
129
|
-
content: "#{e_string.gsub('"', '\"').gsub("\n", '\\A ')}"; }
|
130
|
-
END
|
131
|
-
end
|
data/lib/middleman/markaby.rb
DELETED
data/lib/middleman/maruku.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Sprockets
|
2
|
-
class SourceFile
|
3
|
-
def source_lines
|
4
|
-
@lines ||= begin
|
5
|
-
lines = []
|
6
|
-
|
7
|
-
comments = []
|
8
|
-
File.open(pathname.absolute_location, 'rb') do |file|
|
9
|
-
file.each do |line|
|
10
|
-
lines << line = SourceLine.new(self, line, file.lineno)
|
11
|
-
|
12
|
-
if line.begins_pdoc_comment? || comments.any?
|
13
|
-
comments << line
|
14
|
-
end
|
15
|
-
|
16
|
-
if line.ends_multiline_comment?
|
17
|
-
if line.ends_pdoc_comment?
|
18
|
-
comments.each { |l| l.comment! }
|
19
|
-
end
|
20
|
-
comments.clear
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
lines
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Helpers
|
2
|
-
helpers do
|
3
|
-
end
|
4
|
-
|
5
|
-
# Or inject more templating languages
|
6
|
-
# helpers Sinatra::Markdown
|
7
|
-
|
8
|
-
# Build-specific configuration
|
9
|
-
configure :build do
|
10
|
-
Compass.configuration do |config|
|
11
|
-
# For example, change the Compass output style for deployment
|
12
|
-
# config.output_style = :compressed
|
13
|
-
|
14
|
-
# Or use a different image path
|
15
|
-
# config.http_images_path = "/Content/images/"
|
16
|
-
|
17
|
-
# Disable cache buster
|
18
|
-
# config.asset_cache_buster do
|
19
|
-
# false
|
20
|
-
# end
|
21
|
-
end
|
22
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
%h1 The Middleman is watching.
|
@@ -1 +0,0 @@
|
|
1
|
-
@import compass/reset.sass
|
@@ -1 +0,0 @@
|
|
1
|
-
@import compass/reset.sass
|
data/spec/generator_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
describe "Generator" do
|
4
|
-
def project_file(*parts)
|
5
|
-
File.expand_path(File.join(File.dirname(__FILE__), "..", *parts))
|
6
|
-
end
|
7
|
-
|
8
|
-
before :all do
|
9
|
-
@root_dir = project_file("spec", "fixtures", "generator-test")
|
10
|
-
end
|
11
|
-
|
12
|
-
before :each do
|
13
|
-
init_cmd = project_file("bin", "mm-init")
|
14
|
-
`cd #{File.dirname(@root_dir)} && #{init_cmd} #{File.basename(@root_dir)}`
|
15
|
-
end
|
16
|
-
|
17
|
-
after :each do
|
18
|
-
FileUtils.rm_rf(@root_dir)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should copy template files" do
|
22
|
-
template_dir = project_file("lib", "template", "**/*")
|
23
|
-
Dir[template_dir].each do |f|
|
24
|
-
next if File.directory?(f)
|
25
|
-
File.exists?("#{@root_dir}/#{f.split('template/')[1]}").should be_true
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should create empty directories" do
|
30
|
-
%w(views/stylesheets public/stylesheets public/javascripts public/images).each do |d|
|
31
|
-
File.exists?("#{@root_dir}/#{d}").should be_true
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
== Git
|
2
|
-
|
3
|
-
* Minor enhancements
|
4
|
-
|
5
|
-
* Support initializing a Rack::Test::Session with an app in addition to
|
6
|
-
a Rack::MockSession
|
7
|
-
* Allow CONTENT_TYPE to be specified in the env and not overwritten when
|
8
|
-
sending a POST or PUT
|
9
|
-
|
10
|
-
== 0.4.0 / 2009-06-25
|
11
|
-
|
12
|
-
* Minor enhancements
|
13
|
-
|
14
|
-
* Expose hook for building Rack::MockSessions for frameworks that need
|
15
|
-
to configure them before use
|
16
|
-
* Support passing in arrays of raw cookies in addition to a newline
|
17
|
-
separated string
|
18
|
-
* Support after_request callbacks in MockSession for things like running
|
19
|
-
background jobs
|
20
|
-
* Allow multiple named sessions using with_session
|
21
|
-
* Initialize Rack::Test::Sessions with Rack::MockSessions instead of apps.
|
22
|
-
This change should help integration with other Ruby web frameworks
|
23
|
-
(like Merb).
|
24
|
-
* Support sending bodies for PUT requests (Larry Diehl)
|
25
|
-
|
26
|
-
== 0.3.0 / 2009-05-17
|
27
|
-
|
28
|
-
* Major enhancements
|
29
|
-
|
30
|
-
* Ruby 1.9 compatible (Simon Rozet, Michael Fellinger)
|
31
|
-
|
32
|
-
* Minor enhancements
|
33
|
-
|
34
|
-
* Add CookieJar#[] and CookieJar#[]= methods
|
35
|
-
* Make the default host configurable
|
36
|
-
* Use Rack::Lint and fix errors (Simon Rozet)
|
37
|
-
* Extract Rack::MockSession from Rack::Test::Session to handle tracking
|
38
|
-
the last request and response and the cookie jar
|
39
|
-
* Add #set_cookie and #clear_cookies methods
|
40
|
-
* Rename #authorize to #basic_authorize (#authorize remains as an alias)
|
41
|
-
(Simon Rozet)
|
42
|
-
|
43
|
-
== 0.2.0 / 2009-04-26
|
44
|
-
|
45
|
-
Because #last_response is now a MockResponse instead of a Rack::Response,
|
46
|
-
#last_response.body now returns a string instead of an array.
|
47
|
-
|
48
|
-
* Major enhancements
|
49
|
-
|
50
|
-
* Support multipart requests via the UploadedFile class (thanks, Rails)
|
51
|
-
|
52
|
-
* Minor enhancements
|
53
|
-
|
54
|
-
* Updated for Rack 1.0
|
55
|
-
* Don't require rubygems (See http://gist.github.com/54177)
|
56
|
-
* Support HTTP Digest authentication with the #digest_authorize method
|
57
|
-
* #last_response returns a MockResponse instead of a Response
|
58
|
-
(Michael Fellinger)
|
59
|
-
|
60
|
-
== 0.1.0 / 2009-03-02
|
61
|
-
|
62
|
-
* 1 major enhancement
|
63
|
-
|
64
|
-
* Birthday!
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Copyright (c) 2008-2009 Bryan Helmkamp, Engine Yard Inc.
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
8
|
-
furnished to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
11
|
-
all copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
@@ -1,57 +0,0 @@
|
|
1
|
-
= Rack::Test
|
2
|
-
|
3
|
-
- http://gitrdoc.com/brynary/rack-test
|
4
|
-
- http://github.com/brynary/rack-test
|
5
|
-
|
6
|
-
== Description
|
7
|
-
|
8
|
-
Rack::Test is a small, simple testing API for Rack apps. It can be used on its
|
9
|
-
own or as a reusable starting point for Web frameworks and testing libraries
|
10
|
-
to build on. Most of its initial functionality is an extraction of Merb 1.0's
|
11
|
-
request helpers feature.
|
12
|
-
|
13
|
-
== Features
|
14
|
-
|
15
|
-
* Maintains a cookie jar across requests
|
16
|
-
* Easily follow redirects when desired
|
17
|
-
* Set request headers to be used by all subsequent requests
|
18
|
-
* Small footprint. Approximately 200 LOC
|
19
|
-
|
20
|
-
== Example
|
21
|
-
|
22
|
-
require "rack/test"
|
23
|
-
|
24
|
-
class HomepageTest < Test::Unit::TestCase
|
25
|
-
include Rack::Test::Methods
|
26
|
-
|
27
|
-
def app
|
28
|
-
MyApp.new
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_redirect_logged_in_users_to_dashboard
|
32
|
-
authorize "bryan", "secret"
|
33
|
-
get "/"
|
34
|
-
follow_redirect!
|
35
|
-
|
36
|
-
assert_equal "http://example.org/redirected", last_request.url
|
37
|
-
assert last_response.ok?
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
== Install
|
43
|
-
|
44
|
-
To install the latest release as a gem:
|
45
|
-
|
46
|
-
sudo gem install rack-test
|
47
|
-
|
48
|
-
== Authors
|
49
|
-
|
50
|
-
- Maintained by {Bryan Helmkamp}[mailto:bryan@brynary.com]
|
51
|
-
- Contributions from Simon Rozet and Pat Nakajima
|
52
|
-
- Much of the original code was extracted from Merb 1.0's request helper
|
53
|
-
|
54
|
-
== License
|
55
|
-
|
56
|
-
Copyright (c) 2008-2009 Bryan Helmkamp, Engine Yard Inc.
|
57
|
-
See MIT-LICENSE.txt in this directory.
|
data/vendor/rack-test/Rakefile
DELETED
@@ -1,62 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require "rake/rdoctask"
|
3
|
-
require "rake/gempackagetask"
|
4
|
-
require "rake/clean"
|
5
|
-
require "spec/rake/spectask"
|
6
|
-
require File.expand_path("./lib/rack/test")
|
7
|
-
|
8
|
-
Spec::Rake::SpecTask.new do |t|
|
9
|
-
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "Run all specs in spec directory with RCov"
|
13
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
14
|
-
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
15
|
-
t.rcov = true
|
16
|
-
t.rcov_opts = lambda do
|
17
|
-
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
desc "Run the specs"
|
22
|
-
task :default => :spec
|
23
|
-
|
24
|
-
spec = Gem::Specification.new do |s|
|
25
|
-
s.name = "rack-test"
|
26
|
-
s.version = Rack::Test::VERSION
|
27
|
-
s.author = "Bryan Helmkamp"
|
28
|
-
s.email = "bryan" + "@" + "brynary.com"
|
29
|
-
s.homepage = "http://github.com/brynary/rack-test"
|
30
|
-
s.summary = "Simple testing API built on Rack"
|
31
|
-
s.description = s.summary
|
32
|
-
s.files = %w[History.txt Rakefile README.rdoc] + Dir["lib/**/*"]
|
33
|
-
|
34
|
-
# rdoc
|
35
|
-
s.has_rdoc = true
|
36
|
-
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
37
|
-
end
|
38
|
-
|
39
|
-
Rake::GemPackageTask.new(spec) do |package|
|
40
|
-
package.gem_spec = spec
|
41
|
-
end
|
42
|
-
|
43
|
-
desc "Delete generated RDoc"
|
44
|
-
task :clobber_docs do
|
45
|
-
FileUtils.rm_rf("doc")
|
46
|
-
end
|
47
|
-
|
48
|
-
desc "Generate RDoc"
|
49
|
-
task :docs => :clobber_docs do
|
50
|
-
system "hanna --title 'Rack::Test #{Rack::Test::VERSION} API Documentation'"
|
51
|
-
end
|
52
|
-
|
53
|
-
desc 'Install the package as a gem.'
|
54
|
-
task :install => [:clean, :package] do
|
55
|
-
gem = Dir['pkg/*.gem'].first
|
56
|
-
sh "sudo gem install --no-rdoc --no-ri --local #{gem}"
|
57
|
-
end
|
58
|
-
|
59
|
-
desc 'Removes trailing whitespace'
|
60
|
-
task :whitespace do
|
61
|
-
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
62
|
-
end
|