rack-plastic 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/LICENSE +21 -0
- data/README.rdoc +55 -0
- data/Rakefile +42 -0
- data/lib/plastic.rb +85 -0
- data/lib/plastic_helper.rb +81 -0
- data/test/middlewares/initial.rb +35 -0
- data/test/middlewares/intro.rb +18 -0
- data/test/middlewares/l337.rb +23 -0
- data/test/middlewares/stylizer.rb +17 -0
- data/test/rackapp/app.rb +105 -0
- data/test/rackapp/config.ru +16 -0
- data/test/railsapp/README +243 -0
- data/test/railsapp/Rakefile +10 -0
- data/test/railsapp/app/controllers/application_controller.rb +10 -0
- data/test/railsapp/app/controllers/tommy_boy_controller.rb +9 -0
- data/test/railsapp/app/helpers/application_helper.rb +3 -0
- data/test/railsapp/app/helpers/tommy_boy_helper.rb +2 -0
- data/test/railsapp/app/views/layouts/application.html.erb +13 -0
- data/test/railsapp/app/views/tommy_boy/index.html.erb +44 -0
- data/test/railsapp/app/views/tommy_boy/more.html.erb +12 -0
- data/test/railsapp/config/boot.rb +110 -0
- data/test/railsapp/config/database.yml +22 -0
- data/test/railsapp/config/environment.rb +50 -0
- data/test/railsapp/config/environments/development.rb +17 -0
- data/test/railsapp/config/environments/production.rb +28 -0
- data/test/railsapp/config/environments/test.rb +28 -0
- data/test/railsapp/config/initializers/backtrace_silencers.rb +7 -0
- data/test/railsapp/config/initializers/inflections.rb +10 -0
- data/test/railsapp/config/initializers/mime_types.rb +5 -0
- data/test/railsapp/config/initializers/new_rails_defaults.rb +21 -0
- data/test/railsapp/config/initializers/session_store.rb +15 -0
- data/test/railsapp/config/locales/en.yml +5 -0
- data/test/railsapp/config/routes.rb +4 -0
- data/test/railsapp/db/development.sqlite3 +0 -0
- data/test/railsapp/db/seeds.rb +7 -0
- data/test/railsapp/doc/README_FOR_APP +2 -0
- data/test/railsapp/log/development.log +108 -0
- data/test/railsapp/log/production.log +0 -0
- data/test/railsapp/log/server.log +0 -0
- data/test/railsapp/log/test.log +0 -0
- data/test/railsapp/public/404.html +30 -0
- data/test/railsapp/public/422.html +30 -0
- data/test/railsapp/public/500.html +30 -0
- data/test/railsapp/public/favicon.ico +0 -0
- data/test/railsapp/public/images/rails.png +0 -0
- data/test/railsapp/public/javascripts/application.js +2 -0
- data/test/railsapp/public/javascripts/controls.js +963 -0
- data/test/railsapp/public/javascripts/dragdrop.js +973 -0
- data/test/railsapp/public/javascripts/effects.js +1128 -0
- data/test/railsapp/public/javascripts/prototype.js +4320 -0
- data/test/railsapp/public/robots.txt +5 -0
- data/test/railsapp/script/about +4 -0
- data/test/railsapp/script/console +3 -0
- data/test/railsapp/script/dbconsole +3 -0
- data/test/railsapp/script/destroy +3 -0
- data/test/railsapp/script/generate +3 -0
- data/test/railsapp/script/performance/benchmarker +3 -0
- data/test/railsapp/script/performance/profiler +3 -0
- data/test/railsapp/script/plugin +3 -0
- data/test/railsapp/script/runner +3 -0
- data/test/railsapp/script/server +3 -0
- data/test/railsapp/test/functional/tommy_boy_controller_test.rb +8 -0
- data/test/railsapp/test/performance/browsing_test.rb +9 -0
- data/test/railsapp/test/test_helper.rb +38 -0
- data/test/railsapp/test/unit/helpers/tommy_boy_helper_test.rb +4 -0
- data/test/sinatraapp/app.rb +105 -0
- metadata +141 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class ActiveSupport::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
#
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
22
|
+
self.use_transactional_fixtures = true
|
23
|
+
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
28
|
+
# then set this back to true.
|
29
|
+
self.use_instantiated_fixtures = false
|
30
|
+
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
+
#
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
+
# -- they do not yet inherit this setting
|
35
|
+
fixtures :all
|
36
|
+
|
37
|
+
# Add more helper methods to be used by all tests here...
|
38
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sinatra'
|
3
|
+
require File.join(File.dirname(__FILE__), '..', 'middlewares', 'initial')
|
4
|
+
require File.join(File.dirname(__FILE__), '..', 'middlewares', 'intro')
|
5
|
+
require File.join(File.dirname(__FILE__), '..', 'middlewares', 'l337')
|
6
|
+
require File.join(File.dirname(__FILE__), '..', 'middlewares', 'stylizer')
|
7
|
+
|
8
|
+
# Note that these middlewares will seem to be applied in backwards order.
|
9
|
+
# In other words, Rack::Stylizer parses the resulting HTML first, then
|
10
|
+
# passes it to Rack::Initial, then to Rack::L337, and finally to Rack::Intro.
|
11
|
+
|
12
|
+
use Rack::Intro
|
13
|
+
use Rack::L337
|
14
|
+
use Rack::Initial
|
15
|
+
use Rack::Stylizer
|
16
|
+
|
17
|
+
get '/' do
|
18
|
+
%Q{
|
19
|
+
<!DOCTYPE html
|
20
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
21
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
22
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
23
|
+
<head>
|
24
|
+
<title>The Greatest Movie of All Time</title>
|
25
|
+
</head>
|
26
|
+
<body>
|
27
|
+
<div id="container">
|
28
|
+
<p>
|
29
|
+
What my associate is trying to say is that our new brake pads are really cool.
|
30
|
+
You're not even gonna believe it.
|
31
|
+
</p>
|
32
|
+
<p>
|
33
|
+
Like, um, let's say you're driving along
|
34
|
+
the road, with your family.<br />
|
35
|
+
And you're driving along...la de da...woo...<br />
|
36
|
+
And then all of a sudden
|
37
|
+
there's a truck tire
|
38
|
+
in the middle of the road
|
39
|
+
and you hit the brakes.<br />
|
40
|
+
Screeeee!
|
41
|
+
</p>
|
42
|
+
<p>
|
43
|
+
Woah, that was close.
|
44
|
+
</p>
|
45
|
+
<p>
|
46
|
+
Now let's see what happens when you're
|
47
|
+
driving with "the other guy's brake pads".
|
48
|
+
</p>
|
49
|
+
<p>
|
50
|
+
You're driving along,<br />
|
51
|
+
you're driving along,<br />
|
52
|
+
and all of a sudden your kids are
|
53
|
+
yelling from the back seat:<br />
|
54
|
+
"I gotta go to the bathroom, daddy!"<br />
|
55
|
+
"Not now, dammit!"<br />
|
56
|
+
"Truck tire! I can't stop! Aaaaa! Help!"<br />
|
57
|
+
"There's a cliff! Aaaaa!"<br />
|
58
|
+
And your family screaming:<br />
|
59
|
+
"Oh my God, we're burning alive!"<br />
|
60
|
+
"No! I can't feel my legs!"<br />
|
61
|
+
Here comes the meat-wagon! Woo woo woo!<br />
|
62
|
+
And the medic gets out and says:<br />
|
63
|
+
"Oh! My! God!"<br />
|
64
|
+
New guy's in the corner puking his guts out:<br />
|
65
|
+
Blllleeeeeeeaaaaaaaaaaah!<br />
|
66
|
+
Blllleeeeeeeaaaaaaaaaaah!<br />
|
67
|
+
</p>
|
68
|
+
<p>
|
69
|
+
All because you wanna save a coupla extra pennies.
|
70
|
+
</p>
|
71
|
+
<a href="/more">« inflict me with more »</a>
|
72
|
+
</div>
|
73
|
+
</body>
|
74
|
+
</html>
|
75
|
+
}
|
76
|
+
end
|
77
|
+
|
78
|
+
get '/more' do
|
79
|
+
%Q{
|
80
|
+
<!DOCTYPE html
|
81
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
82
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
83
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
84
|
+
<head>
|
85
|
+
<title>More of the Greatest Movie of All Time</title>
|
86
|
+
</head>
|
87
|
+
<body>
|
88
|
+
<div id="container">
|
89
|
+
<p>
|
90
|
+
D+? Oh my God! I passed! I passed! Oh, man i got a D+! I'm gonna graduate!
|
91
|
+
I'm gonna graduate! D+!
|
92
|
+
</p>
|
93
|
+
<p>
|
94
|
+
Hey guys, do i look different now that i'm a college grad?
|
95
|
+
</p>
|
96
|
+
<p>
|
97
|
+
Apparently they give a lot fewer D+'s than D-'s.
|
98
|
+
It's not a grade they like to give out, i'll tell ya that right now.
|
99
|
+
</p>
|
100
|
+
<a href="/">« take me back »</a>
|
101
|
+
</div>
|
102
|
+
</body>
|
103
|
+
</html>
|
104
|
+
}
|
105
|
+
end
|
metadata
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-plastic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wyatt Greene
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-03 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rack
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: nokogiri
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.0
|
34
|
+
version:
|
35
|
+
description: "\n If you are creating Rack middleware that changes the HTML response, use\n Plastic to get a head start. Plastic takes care of the\n boilerplate Rack glue so that you can focus on simply changing the HTML.\n "
|
36
|
+
email: techiferous@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
files:
|
45
|
+
- CHANGELOG
|
46
|
+
- LICENSE
|
47
|
+
- README.rdoc
|
48
|
+
- Rakefile
|
49
|
+
- lib/plastic.rb
|
50
|
+
- lib/plastic_helper.rb
|
51
|
+
- test/middlewares/initial.rb
|
52
|
+
- test/middlewares/intro.rb
|
53
|
+
- test/middlewares/l337.rb
|
54
|
+
- test/middlewares/stylizer.rb
|
55
|
+
- test/rackapp/app.rb
|
56
|
+
- test/rackapp/config.ru
|
57
|
+
- test/railsapp/README
|
58
|
+
- test/railsapp/Rakefile
|
59
|
+
- test/railsapp/app/controllers/application_controller.rb
|
60
|
+
- test/railsapp/app/controllers/tommy_boy_controller.rb
|
61
|
+
- test/railsapp/app/helpers/application_helper.rb
|
62
|
+
- test/railsapp/app/helpers/tommy_boy_helper.rb
|
63
|
+
- test/railsapp/app/views/layouts/application.html.erb
|
64
|
+
- test/railsapp/app/views/tommy_boy/index.html.erb
|
65
|
+
- test/railsapp/app/views/tommy_boy/more.html.erb
|
66
|
+
- test/railsapp/config/boot.rb
|
67
|
+
- test/railsapp/config/database.yml
|
68
|
+
- test/railsapp/config/environment.rb
|
69
|
+
- test/railsapp/config/environments/development.rb
|
70
|
+
- test/railsapp/config/environments/production.rb
|
71
|
+
- test/railsapp/config/environments/test.rb
|
72
|
+
- test/railsapp/config/initializers/backtrace_silencers.rb
|
73
|
+
- test/railsapp/config/initializers/inflections.rb
|
74
|
+
- test/railsapp/config/initializers/mime_types.rb
|
75
|
+
- test/railsapp/config/initializers/new_rails_defaults.rb
|
76
|
+
- test/railsapp/config/initializers/session_store.rb
|
77
|
+
- test/railsapp/config/locales/en.yml
|
78
|
+
- test/railsapp/config/routes.rb
|
79
|
+
- test/railsapp/db/development.sqlite3
|
80
|
+
- test/railsapp/db/seeds.rb
|
81
|
+
- test/railsapp/doc/README_FOR_APP
|
82
|
+
- test/railsapp/log/development.log
|
83
|
+
- test/railsapp/log/production.log
|
84
|
+
- test/railsapp/log/server.log
|
85
|
+
- test/railsapp/log/test.log
|
86
|
+
- test/railsapp/public/404.html
|
87
|
+
- test/railsapp/public/422.html
|
88
|
+
- test/railsapp/public/500.html
|
89
|
+
- test/railsapp/public/favicon.ico
|
90
|
+
- test/railsapp/public/images/rails.png
|
91
|
+
- test/railsapp/public/javascripts/application.js
|
92
|
+
- test/railsapp/public/javascripts/controls.js
|
93
|
+
- test/railsapp/public/javascripts/dragdrop.js
|
94
|
+
- test/railsapp/public/javascripts/effects.js
|
95
|
+
- test/railsapp/public/javascripts/prototype.js
|
96
|
+
- test/railsapp/public/robots.txt
|
97
|
+
- test/railsapp/script/about
|
98
|
+
- test/railsapp/script/console
|
99
|
+
- test/railsapp/script/dbconsole
|
100
|
+
- test/railsapp/script/destroy
|
101
|
+
- test/railsapp/script/generate
|
102
|
+
- test/railsapp/script/performance/benchmarker
|
103
|
+
- test/railsapp/script/performance/profiler
|
104
|
+
- test/railsapp/script/plugin
|
105
|
+
- test/railsapp/script/runner
|
106
|
+
- test/railsapp/script/server
|
107
|
+
- test/railsapp/test/functional/tommy_boy_controller_test.rb
|
108
|
+
- test/railsapp/test/performance/browsing_test.rb
|
109
|
+
- test/railsapp/test/test_helper.rb
|
110
|
+
- test/railsapp/test/unit/helpers/tommy_boy_helper_test.rb
|
111
|
+
- test/sinatraapp/app.rb
|
112
|
+
has_rdoc: true
|
113
|
+
homepage: http://github.com/techiferous/rack-plastic
|
114
|
+
licenses: []
|
115
|
+
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options:
|
118
|
+
- --charset=UTF-8
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: "0"
|
126
|
+
version:
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: "0"
|
132
|
+
version:
|
133
|
+
requirements:
|
134
|
+
- none
|
135
|
+
rubyforge_project:
|
136
|
+
rubygems_version: 1.3.5
|
137
|
+
signing_key:
|
138
|
+
specification_version: 3
|
139
|
+
summary: Helps you write Rack middleware using Nokogiri.
|
140
|
+
test_files: []
|
141
|
+
|