rack-validate 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -5
- data/VERSION +1 -1
- data/lib/rack-validate.rb +2 -0
- data/lib/rack-validate/response_file.rb +14 -0
- data/lib/rack-validate/validator.rb +3 -1
- data/rack-validate.gemspec +3 -3
- data/spec/fixtures/long_response.html +130 -0
- data/spec/response_file_spec.rb +16 -0
- data/spec/spec.opts +1 -0
- data/{test/test_helper.rb → spec/spec_helper.rb} +6 -7
- data/spec/validator_spec.rb +18 -0
- metadata +11 -6
- data/test/rack-validate_test.rb +0 -7
data/Rakefile
CHANGED
@@ -17,11 +17,10 @@ rescue LoadError
|
|
17
17
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
18
18
|
end
|
19
19
|
|
20
|
-
require 'rake/
|
21
|
-
Rake::
|
22
|
-
|
23
|
-
|
24
|
-
test.verbose = true
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
24
|
end
|
26
25
|
|
27
26
|
begin
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/lib/rack-validate.rb
CHANGED
@@ -8,7 +8,9 @@ module Rack
|
|
8
8
|
|
9
9
|
def self.validate( response )
|
10
10
|
validator = MarkupValidator.new
|
11
|
-
|
11
|
+
# Wrap response in ResponseFile class so that we can use #validate_file
|
12
|
+
# this ensures that long responses won't error out
|
13
|
+
validator.validate_file( ResponseFile.new(response) )
|
12
14
|
end
|
13
15
|
|
14
16
|
def self.generate_report( issues )
|
data/rack-validate.gemspec
CHANGED
@@ -44,14 +44,14 @@ Gem::Specification.new do |s|
|
|
44
44
|
s.specification_version = 3
|
45
45
|
|
46
46
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
|
-
s.add_development_dependency(%q<
|
47
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
48
48
|
s.add_development_dependency(%q<w3c_validator>, [">= 0.9.3]"])
|
49
49
|
else
|
50
|
-
s.
|
50
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
51
51
|
s.add_dependency(%q<w3c_validator>, [">= 0.9.3]"])
|
52
52
|
end
|
53
53
|
else
|
54
|
-
s.
|
54
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
55
55
|
s.add_dependency(%q<w3c_validator>, [">= 0.9.3]"])
|
56
56
|
end
|
57
57
|
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
|
3
|
+
<head profile="http://gmpg.org/xfn/11">
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
5
|
+
<title>Ed Schmalzle </title>
|
6
|
+
<link rel="stylesheet" href="http://www.edschmalzle.com/wp-content/themes/shallowgrunge/shallowgrunge/style.css" type="text/css" media="screen" />
|
7
|
+
<link rel="alternate" type="application/rss+xml" title="Ed Schmalzle RSS Feed" href="http://www.edschmalzle.com/feed/" />
|
8
|
+
<link rel="pingback" href="http://www.edschmalzle.com/xmlrpc.php" />
|
9
|
+
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.edschmalzle.com/xmlrpc.php?rsd" />
|
10
|
+
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.edschmalzle.com/wp-includes/wlwmanifest.xml" />
|
11
|
+
<link rel='index' title='Ed Schmalzle' href='http://www.edschmalzle.com' />
|
12
|
+
<meta name="generator" content="WordPress 2.8.6" />
|
13
|
+
</head>
|
14
|
+
<body>
|
15
|
+
<div id="wrapper">
|
16
|
+
<div id="wrapper2">
|
17
|
+
|
18
|
+
<div id="header">
|
19
|
+
<div id="logo">
|
20
|
+
<h1><a href="http://www.edschmalzle.com/">Ed Schmalzle</a></h1>
|
21
|
+
<p></p>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
<!-- end #header -->
|
25
|
+
<div id="menu">
|
26
|
+
<ul>
|
27
|
+
<li class="page_item current_page_item"><a href="http://www.edschmalzle.com/">Blog</a></li>
|
28
|
+
<li class="page_item page-item-60"><a href="http://www.edschmalzle.com/projects/" title="Projects">Projects</a></li>
|
29
|
+
<li class="page_item page-item-5"><a href="http://www.edschmalzle.com/resume/" title="Resume">Resume</a></li>
|
30
|
+
<li class="page_item page-item-6"><a href="http://www.edschmalzle.com/contact/" title="Contact">Contact</a></li>
|
31
|
+
<li class="page_item page-item-75"><a href="http://www.edschmalzle.com/archives/" title="Archives">Archives</a></li>
|
32
|
+
</ul>
|
33
|
+
</div>
|
34
|
+
<!-- end #menu -->
|
35
|
+
</div>
|
36
|
+
<hr />
|
37
|
+
|
38
|
+
<div id="page">
|
39
|
+
<div id="content">
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
<div class="post" id="post-97">
|
44
|
+
<h1 class="title"><a href="http://www.edschmalzle.com/2009/11/25/readability-for-sane-online-reading/" rel="bookmark" title="Permanent Link to Readability for sane online reading">Readability for sane online reading</a></h1>
|
45
|
+
<p class="meta">Posted by Ed on November 25th, 2009 under <a href="http://www.edschmalzle.com/category/web/" title="View all posts in Web" rel="category tag">Web</a> •
|
46
|
+
<a class="post-edit-link" href="http://www.edschmalzle.com/wp-admin/post.php?action=edit&post=97" title="Edit post">Edit</a> • <a href="http://www.edschmalzle.com/2009/11/25/readability-for-sane-online-reading/#respond" title="Comment on Readability for sane online reading">No Comments</a></p>
|
47
|
+
<div class="entry">
|
48
|
+
<p>If Readability isn’t in your bookmark menu bar, then there is something missing. I’ve been using arc90’s <a href="http://lab.arc90.com/experiments/readability">Readbility bookmarklet</a> for a while now and thought it was probably a well known thing, maybe I was wrong. Last night I showed it to some people at the B’more on Rails Open Source Hack Night and no one had heard of it before. So, if you’re ever bothered by reading news online surrounded by ads and extraneous content check it out. Here is a sample of what it can do…</p>
|
49
|
+
<p>Before & After Readability:</p>
|
50
|
+
<div class="iPhoneScreenhotContainer">
|
51
|
+
<img src="http://www.edschmalzle.com/wp-content/uploads/2009/11/BeforeReadbility.jpg" alt="BeforeReadbility.jpg" border="0" width="400" height="252" /><img src="http://www.edschmalzle.com/wp-content/uploads/2009/11/AfterReadability.jpg" alt="AfterReadability.jpg" border="0" width="400" height="258" />
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
<div class="post" id="post-12">
|
58
|
+
<h1 class="title"><a href="http://www.edschmalzle.com/2009/06/29/deploying-sinatra-with-passenger-on-dreamhost/" rel="bookmark" title="Permanent Link to Deploying Sinatra with Passenger on Dreamhost">Deploying Sinatra with Passenger on Dreamhost</a></h1>
|
59
|
+
<p class="meta">Posted by Ed on June 29th, 2009 under <a href="http://www.edschmalzle.com/category/dreamhost/" title="View all posts in Dreamhost" rel="category tag">Dreamhost</a>, <a href="http://www.edschmalzle.com/category/passenger/" title="View all posts in Passenger" rel="category tag">Passenger</a>, <a href="http://www.edschmalzle.com/category/ruby/" title="View all posts in Ruby" rel="category tag">Ruby</a>, <a href="http://www.edschmalzle.com/category/sinatra/" title="View all posts in Sinatra" rel="category tag">Sinatra</a> •
|
60
|
+
<a class="post-edit-link" href="http://www.edschmalzle.com/wp-admin/post.php?action=edit&post=12" title="Edit post">Edit</a> • <a href="http://www.edschmalzle.com/2009/06/29/deploying-sinatra-with-passenger-on-dreamhost/#respond" title="Comment on Deploying Sinatra with Passenger on Dreamhost">No Comments</a></p>
|
61
|
+
<div class="entry">
|
62
|
+
<p>If the following is true:</p>
|
63
|
+
<ol class="circle">
|
64
|
+
<li>You want to deploy a Sinatra application with Passenger on Dreamhost</li>
|
65
|
+
<li>You’re using a Dreamhost shared hosting account</li>
|
66
|
+
<li>You’re application relies on gems that aren’t installed globally on Dreamhost</li>
|
67
|
+
<li>You’ve got the gems you need installed locally like <a href="http://wiki.dreamhost.com/index.php/RubyGems">this</a></li>
|
68
|
+
</ol>
|
69
|
+
<p style="margin-top: 15px;">Then you’ll want to include something like this in your rackup file:</p>
|
70
|
+
<p><script src="http://gist.github.com/137958.js"></script></p>
|
71
|
+
<p>This will make sure your locally installed gems will be available to your application. Maybe my google skills are getting rusty, but it took me a while to find this solution. <a href="http://groups.google.com/group/phusion-passenger/browse_thread/thread/8bad6d58f88fdbe2">Here’s</a> the original source.</p>
|
72
|
+
</div>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
|
76
|
+
<div class="post" id="post-59">
|
77
|
+
<h1 class="title"><a href="http://www.edschmalzle.com/2009/05/20/os-x-full-keyboard-access-and-web-forms/" rel="bookmark" title="Permanent Link to OS X, Full Keyboard Access, and Web Forms">OS X, Full Keyboard Access, and Web Forms</a></h1>
|
78
|
+
<p class="meta">Posted by Ed on May 20th, 2009 under <a href="http://www.edschmalzle.com/category/os-x/" title="View all posts in OS X" rel="category tag">OS X</a> •
|
79
|
+
<a class="post-edit-link" href="http://www.edschmalzle.com/wp-admin/post.php?action=edit&post=59" title="Edit post">Edit</a> • <a href="http://www.edschmalzle.com/2009/05/20/os-x-full-keyboard-access-and-web-forms/#respond" title="Comment on OS X, Full Keyboard Access, and Web Forms">No Comments</a></p>
|
80
|
+
<div class="entry">
|
81
|
+
<p>For a while now I’ve been frustrated to find that when tabbing through a web form in Firefox select inputs don’t gain focus. I sat down today to research what it was that they were doing wrong so that I could avoid making the same mistake, and write a post describing the issue. What I found though was that it wasn’t the sites fault or the browsers. It turns out that what I was experiencing was merely a result of an OS X setting which determines what elements on the screen are able to get focus via tabbing. The default functionality is for OS X to only let you tab onto text inputs and lists. To change this you need to go to System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts and then turn on “Full Keyboard Access”. What’s more is that Safari ignores this setting entirely so while browsing in Safari you can tab onto select inputs whether full keyboard access is turned on or not. Who knew?</p>
|
82
|
+
</div>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
|
86
|
+
<div class="post" id="post-57">
|
87
|
+
<h1 class="title"><a href="http://www.edschmalzle.com/2009/03/23/cross-browser-css-inspector-xray/" rel="bookmark" title="Permanent Link to Cross browser CSS inspector –> XRAY">Cross browser CSS inspector –> XRAY</a></h1>
|
88
|
+
<p class="meta">Posted by Ed on March 23rd, 2009 under <a href="http://www.edschmalzle.com/category/css/" title="View all posts in CSS" rel="category tag">CSS</a>, <a href="http://www.edschmalzle.com/category/web-development/" title="View all posts in Web Development" rel="category tag">Web Development</a> •
|
89
|
+
<a class="post-edit-link" href="http://www.edschmalzle.com/wp-admin/post.php?action=edit&post=57" title="Edit post">Edit</a> • <a href="http://www.edschmalzle.com/2009/03/23/cross-browser-css-inspector-xray/#respond" title="Comment on Cross browser CSS inspector –> XRAY">No Comments</a></p>
|
90
|
+
<div class="entry">
|
91
|
+
<p>I may be a little late to the game on this one, but I just came across <a href="http://westciv.com/xray/">XRAY</a>. XRAY is a bookmarklet that lets you inspect all of the CSS properties associated with any element in the web page you’re currently viewing. Best of all, it works in all of the browsers I use for testing plus some (Internet Explorer 6+, and Webkit and Mozilla based browsers – including Safari, Firefox, Camino or Mozilla). I’m still going to use Firebug and the IE Developer Toolbar for digging deep into a page and tweaking properties to get things just right, but having a common user interface across browsers for simple CSS inspection is great.</p>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<div class="post" id="post-55">
|
97
|
+
<h1 class="title"><a href="http://www.edschmalzle.com/2009/02/07/dvd-backup-file-cleanup/" rel="bookmark" title="Permanent Link to DVD backup file cleanup">DVD backup file cleanup</a></h1>
|
98
|
+
<p class="meta">Posted by Ed on February 7th, 2009 under <a href="http://www.edschmalzle.com/category/ruby/" title="View all posts in Ruby" rel="category tag">Ruby</a> •
|
99
|
+
<a class="post-edit-link" href="http://www.edschmalzle.com/wp-admin/post.php?action=edit&post=55" title="Edit post">Edit</a> • <a href="http://www.edschmalzle.com/2009/02/07/dvd-backup-file-cleanup/#respond" title="Comment on DVD backup file cleanup">No Comments</a></p>
|
100
|
+
<div class="entry">
|
101
|
+
<p>I wanted to clean up my file share of dvd backups and move to use one file type. I chose iso because it makes it easy to burn them without using anything special, and <a href="http://www.boxee.tv">boxee</a> recognizes iso files. So in a couple minutes I came up with this quick and dirty ruby script…</p>
|
102
|
+
<p><script src="http://gist.github.com/60182.js"></script></p>
|
103
|
+
<p>Assumptions… 1) The scripts working directory is the directory you have all your movie files in. 2) You’ve added the .dvdmedia extension to folders containing the ‘VIDEO_TS’ folder.</p>
|
104
|
+
<p>It wouldn’t be hard to make this a little more user friendly and not dependent on the .dvdmedia file extension, but I already had manually added it on all those folders to make them play nice with OS X.</p>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
<!-- end #content -->
|
112
|
+
|
113
|
+
|
114
|
+
<div style="clear: both;"> </div>
|
115
|
+
</div>
|
116
|
+
<!-- end #page -->
|
117
|
+
<hr />
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
<!-- end #footer -->
|
121
|
+
<div id="footer">
|
122
|
+
<div>
|
123
|
+
<p>Copyright (c) 2008
|
124
|
+
Ed Schmalzle All rights reserved. Design by <a href="http://www.freewpthemes.net/">Free WordPress Themes</a> •
|
125
|
+
Powered by <a href="http://wordpress.org/">WordPress</a></p>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
</body></html>
|
129
|
+
<!-- Dynamic page generated in 1.327 seconds. -->
|
130
|
+
<!-- Cached page generated by WP-Super-Cache on 2010-01-02 17:31:47 -->
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Rack::Validate::ResponseFile do
|
4
|
+
before(:each) do
|
5
|
+
@initialization_string = "Some String"
|
6
|
+
@response_file = Rack::Validate::ResponseFile.new(@initialization_string)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should respond to the read method" do
|
10
|
+
@response_file.respond_to?(:read).should be_true
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should return the string it was initialized with from the read method" do
|
14
|
+
@response_file.read.should == @initialization_string
|
15
|
+
end
|
16
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
@@ -1,10 +1,9 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
|
-
|
5
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
3
|
require 'rack-validate'
|
4
|
+
require 'spec'
|
5
|
+
require 'spec/autorun'
|
8
6
|
|
9
|
-
|
10
|
-
|
7
|
+
Spec::Runner.configure do |config|
|
8
|
+
|
9
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Rack::Validate::Validator do
|
4
|
+
|
5
|
+
# Note: Both of these tests require an internet connection to run...
|
6
|
+
# not sure how to properly mock out the validator without making them pointless.
|
7
|
+
it "should validate a simple response" do
|
8
|
+
issues = Rack::Validate::Validator.validate('<html></html>')
|
9
|
+
issues.should_not be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should validate a really long response" do
|
13
|
+
File.open(File.expand_path(File.dirname(__FILE__) + '/fixtures/long_response.html')) do |f|
|
14
|
+
issues = Rack::Validate::Validator.validate(f.read)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-validate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Schmalzle
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-02 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,10 +39,14 @@ files:
|
|
39
39
|
- Rakefile
|
40
40
|
- VERSION
|
41
41
|
- lib/rack-validate.rb
|
42
|
+
- lib/rack-validate/response_file.rb
|
42
43
|
- lib/rack-validate/validator.rb
|
43
44
|
- rack-validate.gemspec
|
44
|
-
-
|
45
|
-
-
|
45
|
+
- spec/fixtures/long_response.html
|
46
|
+
- spec/response_file_spec.rb
|
47
|
+
- spec/spec.opts
|
48
|
+
- spec/spec_helper.rb
|
49
|
+
- spec/validator_spec.rb
|
46
50
|
has_rdoc: true
|
47
51
|
homepage: http://github.com/nerdEd/rack-validate
|
48
52
|
licenses: []
|
@@ -72,5 +76,6 @@ signing_key:
|
|
72
76
|
specification_version: 3
|
73
77
|
summary: Rack middleware that validates HTML with w3c validator and displays result in page.
|
74
78
|
test_files:
|
75
|
-
-
|
76
|
-
-
|
79
|
+
- spec/response_file_spec.rb
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
- spec/validator_spec.rb
|
data/test/rack-validate_test.rb
DELETED