ramaze 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -259
- data/bin/ramaze +52 -25
- data/doc/AUTHORS +6 -0
- data/doc/CHANGELOG +1363 -42
- data/doc/INSTALL +1 -1
- data/doc/README +48 -35
- data/doc/README.html +637 -0
- data/doc/TODO +7 -16
- data/doc/allison/allison.css +6 -7
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/cache/STYLE +1 -2
- data/doc/changes.txt +3375 -0
- data/doc/changes.xml +3378 -0
- data/doc/meta/announcement.txt +47 -0
- data/doc/meta/configuration.txt +179 -0
- data/doc/meta/internals.txt +111 -0
- data/doc/readme_chunks/features.txt +8 -16
- data/doc/readme_chunks/installing.txt +7 -1
- data/doc/tutorial/todolist.txt +2 -3
- data/examples/blog/main.rb +9 -8
- data/examples/blog/public/styles/blog.css +132 -0
- data/examples/blog/src/controller.rb +14 -41
- data/examples/blog/src/model.rb +12 -13
- data/examples/blog/src/view.rb +16 -0
- data/examples/blog/template/edit.xhtml +19 -8
- data/examples/blog/template/index.xhtml +14 -22
- data/examples/blog/template/new.xhtml +18 -5
- data/examples/caching.rb +5 -8
- data/examples/element.rb +3 -3
- data/examples/hello.rb +3 -5
- data/examples/simple.rb +4 -7
- data/examples/templates/template/external.haml +8 -7
- data/examples/templates/template/external.mab +11 -8
- data/examples/templates/template_amrita2.rb +4 -4
- data/examples/templates/template_erubis.rb +3 -3
- data/examples/templates/template_ezamar.rb +1 -2
- data/examples/templates/template_haml.rb +24 -23
- data/examples/templates/template_liquid.rb +3 -1
- data/examples/templates/template_markaby.rb +15 -9
- data/examples/todolist/src/element/page.rb +1 -1
- data/lib/proto/conf/benchmark.yaml +6 -20
- data/lib/proto/conf/debug.yaml +6 -19
- data/lib/proto/conf/live.yaml +7 -19
- data/lib/proto/conf/silent.yaml +6 -16
- data/lib/proto/conf/stage.yaml +6 -18
- data/lib/proto/public/error.zmr +2 -2
- data/lib/ramaze.rb +34 -72
- data/lib/ramaze/adapter.rb +21 -18
- data/lib/ramaze/adapter/mongrel.rb +0 -3
- data/lib/ramaze/adapter/webrick.rb +6 -6
- data/lib/ramaze/cache/memcached.rb +3 -0
- data/lib/ramaze/controller.rb +227 -183
- data/lib/ramaze/dispatcher.rb +34 -129
- data/lib/ramaze/dispatcher/action.rb +28 -0
- data/lib/ramaze/dispatcher/error.rb +43 -0
- data/lib/ramaze/dispatcher/file.rb +34 -0
- data/lib/ramaze/global.rb +89 -48
- data/lib/ramaze/helper/aspect.rb +8 -6
- data/lib/ramaze/helper/auth.rb +3 -3
- data/lib/ramaze/helper/cache.rb +2 -2
- data/lib/ramaze/helper/file.rb +14 -0
- data/lib/ramaze/helper/inform.rb +36 -0
- data/lib/ramaze/helper/link.rb +7 -3
- data/lib/ramaze/helper/markaby.rb +30 -0
- data/lib/ramaze/helper/redirect.rb +2 -0
- data/lib/ramaze/inform.rb +8 -182
- data/lib/ramaze/inform/analogger.rb +19 -0
- data/lib/ramaze/inform/growl.rb +28 -0
- data/lib/ramaze/inform/hub.rb +26 -0
- data/lib/ramaze/inform/informer.rb +92 -0
- data/lib/ramaze/inform/informing.rb +44 -0
- data/lib/ramaze/inform/syslog.rb +27 -0
- data/lib/ramaze/inform/xosd.rb +42 -0
- data/lib/ramaze/snippets.rb +6 -2
- data/lib/ramaze/snippets/object/traits.rb +13 -1
- data/lib/ramaze/snippets/ramaze/autoreload.rb +58 -2
- data/lib/ramaze/snippets/string/color.rb +27 -0
- data/lib/ramaze/snippets/string/each.rb +6 -0
- data/lib/ramaze/snippets/struct/fill.rb +15 -0
- data/lib/ramaze/template/ezamar.rb +13 -22
- data/lib/ramaze/template/ezamar/element.rb +12 -12
- data/lib/ramaze/template/liquid.rb +19 -18
- data/lib/ramaze/template/markaby.rb +37 -58
- data/lib/ramaze/tool/localize.rb +128 -0
- data/lib/ramaze/tool/tidy.rb +51 -21
- data/lib/ramaze/trinity.rb +3 -3
- data/lib/ramaze/trinity/request.rb +41 -23
- data/lib/ramaze/trinity/response.rb +10 -5
- data/lib/ramaze/trinity/session.rb +17 -3
- data/lib/ramaze/version.rb +2 -2
- data/rake_tasks/conf.rake +56 -0
- data/rake_tasks/gem.rake +44 -0
- data/rake_tasks/maintaince.rake +187 -0
- data/spec/all.rb +32 -0
- data/spec/examples/caching.rb +19 -0
- data/spec/examples/element.rb +15 -0
- data/spec/examples/hello.rb +11 -0
- data/spec/examples/simple.rb +51 -0
- data/spec/examples/templates/template_amrita2.rb +14 -0
- data/spec/examples/templates/template_erubis.rb +21 -0
- data/spec/examples/templates/template_ezamar.rb +22 -0
- data/spec/examples/templates/template_haml.rb +23 -0
- data/spec/examples/templates/template_liquid.rb +24 -0
- data/spec/examples/templates/template_markaby.rb +21 -0
- data/spec/helper.rb +81 -0
- data/spec/{spec_helper_context.rb → helper/context.rb} +1 -1
- data/spec/helper/layout.rb +55 -0
- data/spec/helper/mock_http.rb +66 -0
- data/spec/{spec_helper_requester.rb → helper/requester.rb} +0 -6
- data/spec/{spec_helper_simple_http.rb → helper/simple_http.rb} +57 -57
- data/spec/helper/wrap.rb +193 -0
- data/spec/{adapter_spec.rb → ramaze/adapter.rb} +7 -5
- data/spec/{tc_adapter_mongrel.rb → ramaze/adapter/mongrel.rb} +2 -2
- data/spec/{tc_adapter_webrick.rb → ramaze/adapter/webrick.rb} +2 -2
- data/spec/{tc_cache.rb → ramaze/cache.rb} +16 -16
- data/spec/ramaze/conf/locale_de.yaml +6 -0
- data/spec/ramaze/conf/locale_en.yaml +6 -0
- data/spec/ramaze/controller.rb +184 -0
- data/spec/ramaze/controller/template/greet.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +54 -0
- data/spec/ramaze/dependencies.rb +16 -0
- data/spec/{tc_element.rb → ramaze/element.rb} +21 -19
- data/spec/ramaze/error.rb +64 -0
- data/spec/{tc_gestalt.rb → ramaze/gestalt.rb} +10 -10
- data/spec/{tc_global.rb → ramaze/global.rb} +7 -7
- data/spec/{tc_helper_aspect.rb → ramaze/helper/aspect.rb} +22 -14
- data/spec/{tc_helper_auth.rb → ramaze/helper/auth.rb} +9 -7
- data/spec/{tc_helper_cache.rb → ramaze/helper/cache.rb} +14 -24
- data/spec/{tc_helper_feed.rb → ramaze/helper/feed.rb} +12 -12
- data/spec/ramaze/helper/file.rb +17 -0
- data/spec/{tc_helper_flash.rb → ramaze/helper/flash.rb} +16 -17
- data/spec/{tc_helper_form.rb → ramaze/helper/form.rb} +25 -26
- data/spec/{tc_helper_link.rb → ramaze/helper/link.rb} +9 -9
- data/spec/{tc_helper_redirect.rb → ramaze/helper/redirect.rb} +11 -10
- data/spec/{tc_helper_stack.rb → ramaze/helper/stack.rb} +10 -11
- data/spec/ramaze/inform/informer.rb +40 -0
- data/spec/ramaze/inform/syslog.rb +10 -0
- data/spec/ramaze/localize.rb +40 -0
- data/spec/ramaze/morpher.rb +82 -0
- data/spec/ramaze/params.rb +124 -0
- data/spec/{public → ramaze/public}/error404.xhtml +0 -0
- data/spec/{public → ramaze/public}/favicon.ico +0 -0
- data/spec/{public → ramaze/public}/ramaze.png +0 -0
- data/spec/{public → ramaze/public}/test_download.css +0 -0
- data/spec/ramaze/request.rb +129 -0
- data/spec/{tc_request_mongrel.rb → ramaze/request/mongrel.rb} +2 -2
- data/spec/{tc_request_webrick.rb → ramaze/request/webrick.rb} +1 -1
- data/spec/{tc_session.rb → ramaze/session.rb} +18 -18
- data/spec/{tc_store.rb → ramaze/store/default.rb} +10 -10
- data/spec/{tc_store_yaml.rb → ramaze/store/yaml.rb} +9 -9
- data/spec/ramaze/template.rb +86 -0
- data/spec/{tc_template_amrita2.rb → ramaze/template/amrita2.rb} +5 -5
- data/spec/{template → ramaze/template}/amrita2/data.amrita +0 -0
- data/spec/{template → ramaze/template}/amrita2/index.amrita +0 -0
- data/spec/{template → ramaze/template}/amrita2/sum.amrita +0 -0
- data/spec/{tc_template_erubis.rb → ramaze/template/erubis.rb} +9 -9
- data/spec/{template → ramaze/template}/erubis/sum.rhtml +0 -0
- data/spec/ramaze/template/ezamar.rb +62 -0
- data/spec/{template → ramaze/template}/ezamar/another/long/action.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/combined.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/file_only.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/index.zmr +0 -0
- data/spec/ramaze/template/ezamar/nested.zmr +1 -0
- data/spec/{template → ramaze/template}/ezamar/some__long__action.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/sum.zmr +0 -0
- data/spec/{tc_template_haml.rb → ramaze/template/haml.rb} +7 -7
- data/spec/{template → ramaze/template}/haml/index.haml +0 -0
- data/spec/{template → ramaze/template}/haml/with_vars.haml +0 -0
- data/spec/{tc_template_liquid.rb → ramaze/template/liquid.rb} +7 -7
- data/spec/{template → ramaze/template}/liquid/index.liquid +0 -0
- data/spec/{template → ramaze/template}/liquid/products.liquid +0 -0
- data/spec/ramaze/template/markaby.rb +59 -0
- data/spec/{template → ramaze/template}/markaby/external.mab +0 -0
- data/spec/{template → ramaze/template}/markaby/sum.mab +0 -0
- data/spec/ramaze/template/ramaze/external.test +1 -0
- data/spec/{tc_tidy.rb → ramaze/tidy.rb} +3 -3
- metadata +145 -81
- data/examples/blog/public/screen.css +0 -106
- data/examples/blog/src/element.rb +0 -58
- data/examples/blog/template/view.xhtml +0 -15
- data/examples/blog/test/tc_entry.rb +0 -18
- data/lib/proto/public/404.jpg +0 -0
- data/spec/request_tc_helper.rb +0 -135
- data/spec/spec_all.rb +0 -118
- data/spec/spec_helper.rb +0 -66
- data/spec/tc_controller.rb +0 -49
- data/spec/tc_dependencies.rb +0 -13
- data/spec/tc_error.rb +0 -43
- data/spec/tc_morpher.rb +0 -88
- data/spec/tc_params.rb +0 -125
- data/spec/tc_template_ezamar.rb +0 -64
- data/spec/tc_template_markaby.rb +0 -72
- data/spec/template/ezamar/nested.zmr +0 -1
@@ -1,106 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background: #111;
|
3
|
-
margin: auto;
|
4
|
-
padding: 1em;
|
5
|
-
color: #fff;
|
6
|
-
}
|
7
|
-
|
8
|
-
span#title {
|
9
|
-
font-size: 1.5em;
|
10
|
-
text-align: right;
|
11
|
-
}
|
12
|
-
|
13
|
-
span#login {
|
14
|
-
font-size: 0.5em;
|
15
|
-
float: right;
|
16
|
-
margin-top: -2em;
|
17
|
-
}
|
18
|
-
|
19
|
-
a {
|
20
|
-
text-decoration: none;
|
21
|
-
color: #afa;
|
22
|
-
}
|
23
|
-
|
24
|
-
div#menu {
|
25
|
-
text-align: center;
|
26
|
-
padding: 0.2em;
|
27
|
-
margin-top: -0.5em;
|
28
|
-
margin-right: -0.5em;
|
29
|
-
margin-left: -0.5em;
|
30
|
-
margin-bottom: 0.5em;
|
31
|
-
background: #222;
|
32
|
-
font-size: 2em;
|
33
|
-
}
|
34
|
-
|
35
|
-
div#sidebar {
|
36
|
-
width: 12%;
|
37
|
-
height: 50%;
|
38
|
-
float: right;
|
39
|
-
margin-right: -0.3em;
|
40
|
-
background: #222;
|
41
|
-
padding: 0.5em;
|
42
|
-
border: #333 1px solid;
|
43
|
-
text-align: center;
|
44
|
-
}
|
45
|
-
|
46
|
-
div#sidebar h1 {
|
47
|
-
font-size: 1.1em;
|
48
|
-
color: #0da;
|
49
|
-
background: #011;
|
50
|
-
margin: -0.4em;
|
51
|
-
margin-bottom: 0.4em;
|
52
|
-
text-align: center;
|
53
|
-
}
|
54
|
-
|
55
|
-
div.blog_entry {
|
56
|
-
background: #222;
|
57
|
-
width: 80%;
|
58
|
-
padding: 0.4em;
|
59
|
-
margin-bottom: 1em;
|
60
|
-
margin-left: 5%;
|
61
|
-
margin-right: 15%;
|
62
|
-
border: #333 1px solid;
|
63
|
-
}
|
64
|
-
|
65
|
-
div.blog_entry div.title {
|
66
|
-
background: #111;
|
67
|
-
text-align: center;
|
68
|
-
}
|
69
|
-
|
70
|
-
div.blog_entry div.title div.date {
|
71
|
-
color: #aaa;
|
72
|
-
text-align: right;
|
73
|
-
font-size: 0.8em;
|
74
|
-
}
|
75
|
-
|
76
|
-
div.blog_entry div.title div.title {
|
77
|
-
font-size: 1.5em;
|
78
|
-
}
|
79
|
-
|
80
|
-
div.blog_entry div.text {
|
81
|
-
background: #111;
|
82
|
-
margin: 0.4em;
|
83
|
-
padding: 0.4em;
|
84
|
-
padding-top: 2em;
|
85
|
-
padding-bottom: 1.5em;
|
86
|
-
}
|
87
|
-
|
88
|
-
div.blog_entry div.menu {
|
89
|
-
background: #111;
|
90
|
-
text-align: center;
|
91
|
-
margin: 0.4em;
|
92
|
-
}
|
93
|
-
|
94
|
-
form {
|
95
|
-
margin: auto;
|
96
|
-
width: 70%;
|
97
|
-
}
|
98
|
-
|
99
|
-
form input {
|
100
|
-
width: 100%;
|
101
|
-
}
|
102
|
-
|
103
|
-
form textarea {
|
104
|
-
width: 100%;
|
105
|
-
height: 70%;
|
106
|
-
}
|
@@ -1,58 +0,0 @@
|
|
1
|
-
class Page < Controller
|
2
|
-
attr_accessor :content
|
3
|
-
helper :auth
|
4
|
-
|
5
|
-
def initialize content
|
6
|
-
@content = content
|
7
|
-
end
|
8
|
-
|
9
|
-
def render
|
10
|
-
p :render => content
|
11
|
-
%{
|
12
|
-
<html>
|
13
|
-
<head>
|
14
|
-
<title>#{@title}</title>
|
15
|
-
<link href="/screen.css" type="text/css" rel="stylesheet">
|
16
|
-
</head>
|
17
|
-
<body>
|
18
|
-
#{menu}
|
19
|
-
#{sidebar}
|
20
|
-
#{content}
|
21
|
-
</body>
|
22
|
-
</html>
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def menu
|
27
|
-
%{
|
28
|
-
<div id="menu">
|
29
|
-
<span id="title">
|
30
|
-
<a href="#{R :/}">#{@title || 'Blogging Ramaze'}</a>
|
31
|
-
</span>
|
32
|
-
<?r if logged_in? ?>
|
33
|
-
<span id="login"> #{link R(:logout), :title => 'logout'} </span>
|
34
|
-
<?r else ?>
|
35
|
-
<span id="login"> #{link R(:login), :title => 'login'} </span>
|
36
|
-
<?r end ?>
|
37
|
-
</div>
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def sidebar
|
42
|
-
entries =
|
43
|
-
Entry.all.map do |eid, e|
|
44
|
-
%{
|
45
|
-
<div>
|
46
|
-
#{link R(:/, :view, eid), :title => e.title}
|
47
|
-
</div>
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
%{
|
52
|
-
<div id="sidebar">
|
53
|
-
<h1>Recent Entries</h1>
|
54
|
-
#{entries}
|
55
|
-
</div>
|
56
|
-
}
|
57
|
-
end
|
58
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<Page>
|
2
|
-
<div class="blog_entry">
|
3
|
-
<div class="title">
|
4
|
-
<div class="title">#{link self, :view, @entry.oid, :title => @entry.title}</div>
|
5
|
-
<div class="date">#{@entry.time}</div>
|
6
|
-
</div>
|
7
|
-
<div class="text">
|
8
|
-
#{@entry.text}
|
9
|
-
</div>
|
10
|
-
<div class="menu">
|
11
|
-
#{link self, :delete, @entry.oid, :title => 'Delete'}
|
12
|
-
#{link self, :edit, @entry.oid, :title => 'Edit'}<br />
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
</Page>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'ramaze'
|
2
|
-
require 'ramaze/../test/test_helper'
|
3
|
-
|
4
|
-
require 'main'
|
5
|
-
|
6
|
-
ramaze do
|
7
|
-
context "Entry" do
|
8
|
-
specify "list" do
|
9
|
-
get('/entry').should =~ %r(<h1>Entry list</h1>)
|
10
|
-
end
|
11
|
-
|
12
|
-
specify "add" do
|
13
|
-
new = get('/entry/new')
|
14
|
-
new.should =~ %r(<input type="text")
|
15
|
-
new.should =~ %r(<textarea name="text")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/proto/public/404.jpg
DELETED
Binary file
|
data/spec/request_tc_helper.rb
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
require 'spec/spec_helper'
|
5
|
-
|
6
|
-
class TCRequestController < Ramaze::Controller
|
7
|
-
trait :public => 'spec/public'
|
8
|
-
|
9
|
-
def is_post() request.post?.to_s end
|
10
|
-
def is_get() request.get?.to_s end
|
11
|
-
def is_put() request.put?.to_s end
|
12
|
-
def is_delete() request.delete?.to_s end
|
13
|
-
|
14
|
-
def request_inspect
|
15
|
-
request.params.inspect
|
16
|
-
end
|
17
|
-
|
18
|
-
def post_inspect
|
19
|
-
request.params.inspect
|
20
|
-
end
|
21
|
-
|
22
|
-
def put_inspect(file)
|
23
|
-
request.body.read.inspect
|
24
|
-
end
|
25
|
-
|
26
|
-
def get_inspect
|
27
|
-
request.params.inspect
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_get
|
31
|
-
request['foo']
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_headers
|
35
|
-
end
|
36
|
-
|
37
|
-
def my_ip
|
38
|
-
request.remote_addr
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context "Request" do
|
43
|
-
options = ramaze_options rescue {:adapter => :webrick}
|
44
|
-
ramaze options.merge( :mapping => {'/' => TCRequestController})
|
45
|
-
|
46
|
-
context "POST" do
|
47
|
-
specify "give me the result of request.post?" do
|
48
|
-
post("is_post").should == 'true'
|
49
|
-
end
|
50
|
-
|
51
|
-
specify "give me the result of request.get?" do
|
52
|
-
post("is_get").should == 'false'
|
53
|
-
end
|
54
|
-
|
55
|
-
# this here has shown some odd errors... keep an eye on it.
|
56
|
-
specify "give me back what i gave" do
|
57
|
-
post("post_inspect", 'this' => 'post').should == {"this" => "post"}.inspect
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "PUT" do
|
62
|
-
specify "put a ressource" do
|
63
|
-
image = 'favicon.ico'
|
64
|
-
image_path = File.join('spec', 'public', image)
|
65
|
-
address = "http://localhost:7007/put_inspect/#{image}"
|
66
|
-
response = `curl -S -s -T #{image_path} #{address}`
|
67
|
-
file = File.read(image_path)
|
68
|
-
|
69
|
-
response[1..-2].should == file
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "DELETE" do
|
74
|
-
specify "delete a ressource" do
|
75
|
-
# find a way to test this one, even curl doesn't support it
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
context "GET" do
|
80
|
-
specify "give me the result of request.post?" do
|
81
|
-
get("/is_post").should == 'false'
|
82
|
-
end
|
83
|
-
|
84
|
-
specify "give me the result of request.get?" do
|
85
|
-
get("/is_get").should == 'true'
|
86
|
-
end
|
87
|
-
|
88
|
-
specify "give me back what i gave" do
|
89
|
-
params = {'one' => 'two', 'three' => 'four'}
|
90
|
-
get("/get_inspect", params).should == params.inspect
|
91
|
-
end
|
92
|
-
|
93
|
-
specify "my ip" do
|
94
|
-
get("/my_ip").should == '127.0.0.1'
|
95
|
-
end
|
96
|
-
|
97
|
-
specify "request[key]" do
|
98
|
-
get('/test_get', 'foo' => 'bar').should == 'bar'
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
context "send files" do
|
103
|
-
specify "threaded concurrently" do
|
104
|
-
css_path = 'test_download.css'
|
105
|
-
image_path = 'favicon.ico'
|
106
|
-
static_css = File.read("spec/public/#{css_path}").strip
|
107
|
-
static_image = File.read("spec/public/#{image_path}").strip
|
108
|
-
|
109
|
-
images = []
|
110
|
-
csses = []
|
111
|
-
threads = []
|
112
|
-
|
113
|
-
times = 100
|
114
|
-
|
115
|
-
times.times do
|
116
|
-
threads << Thread.new do
|
117
|
-
csses << get(css_path)
|
118
|
-
images << get(image_path)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
threads.each do |t|
|
123
|
-
t.join
|
124
|
-
end
|
125
|
-
|
126
|
-
images.each do |image|
|
127
|
-
image.should == static_image
|
128
|
-
end
|
129
|
-
|
130
|
-
csses.each do |css|
|
131
|
-
css.should == static_css
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
data/spec/spec_all.rb
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
require 'pp'
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'rubygems'
|
8
|
-
rescue LoadError
|
9
|
-
end
|
10
|
-
|
11
|
-
begin
|
12
|
-
require 'systemu'
|
13
|
-
rescue LoadError
|
14
|
-
puts "Please install systemu for better-looking results"
|
15
|
-
|
16
|
-
# small drop-in replacement for systemu... far from perfect though, so please
|
17
|
-
# install the library
|
18
|
-
|
19
|
-
def systemu command
|
20
|
-
stdout = `#{command} 2>&1`
|
21
|
-
status, stdout, stderr = $?, stdout, ''
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class String
|
26
|
-
|
27
|
-
{
|
28
|
-
:red => 31,
|
29
|
-
:green => 32,
|
30
|
-
:yellow => 33,
|
31
|
-
}.each do |key, value|
|
32
|
-
define_method key do
|
33
|
-
"\e[#{value}m" + self + "\e[0m"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
$stdout.sync = true
|
39
|
-
|
40
|
-
total_specs = 0
|
41
|
-
total_fails = 0
|
42
|
-
failed = {}
|
43
|
-
specs = Dir[File.join('spec', 'tc_*.rb')].sort
|
44
|
-
width = specs.sort_by{|s| s.size }.last.size
|
45
|
-
|
46
|
-
result_format = lambda do |str|
|
47
|
-
str = " #{ str } ".center(22, '=')
|
48
|
-
"[ #{str} ]"
|
49
|
-
end
|
50
|
-
|
51
|
-
specs.each do |spec|
|
52
|
-
print "Running #{spec}... ".ljust(width + 20)
|
53
|
-
status, stdout, stderr = systemu("ruby #{spec}")
|
54
|
-
hash = {:status => status, :stdout => stdout, :stderr => stderr}
|
55
|
-
|
56
|
-
if stdout =~ /Usually you should not worry about this failure, just install the/
|
57
|
-
|
58
|
-
lib = stdout.scan(/^no such file to load -- (.*?)$/).flatten.first
|
59
|
-
print result_format["needs #{lib}"].red
|
60
|
-
|
61
|
-
elsif status.exitstatus.nonzero? or stdout.empty? or not stderr.empty?
|
62
|
-
|
63
|
-
failed[spec] = hash
|
64
|
-
print result_format['failed'].red
|
65
|
-
|
66
|
-
else
|
67
|
-
found = false
|
68
|
-
stdout.each do |line|
|
69
|
-
if line =~ /(\d+) specifications?, (\d+) failures?/
|
70
|
-
found = true
|
71
|
-
s, f = $1.to_i, $2.to_i
|
72
|
-
ss, sf = s.to_s.rjust(3), f.to_s.rjust(3)
|
73
|
-
|
74
|
-
total_specs += s
|
75
|
-
total_fails += f
|
76
|
-
|
77
|
-
message = "[ #{ss} specs - "
|
78
|
-
|
79
|
-
if f.nonzero?
|
80
|
-
failed[spec] = hash
|
81
|
-
print((message << "#{sf} failed ]").red)
|
82
|
-
else
|
83
|
-
print((message << "all passed ]").green)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
unless found
|
89
|
-
print("[ please test standalone ]".red)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
puts
|
93
|
-
end
|
94
|
-
|
95
|
-
failed.each do |name, hash|
|
96
|
-
status, stdout, stderr = hash.values_at(:status, :stdout, :stderr)
|
97
|
-
|
98
|
-
puts "[ #{name} ]".center(80, '-')
|
99
|
-
puts "ExitStatus:".yellow
|
100
|
-
pp status
|
101
|
-
puts
|
102
|
-
puts "StdOut:".yellow
|
103
|
-
puts stdout
|
104
|
-
puts
|
105
|
-
puts "StdErr:".yellow
|
106
|
-
puts stderr
|
107
|
-
end
|
108
|
-
|
109
|
-
puts
|
110
|
-
puts "#{total_specs} specifications, #{total_fails} failures"
|
111
|
-
puts
|
112
|
-
|
113
|
-
if failed.empty?
|
114
|
-
puts "No failing specifications, let's add some tests!"
|
115
|
-
puts
|
116
|
-
else
|
117
|
-
puts "These failed: #{failed.keys.join(', ')}"
|
118
|
-
end
|