murlsh 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +1 -0
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/bin/murlsh +30 -1
- data/config.yaml +2 -1
- data/lib/murlsh/atom_feed.rb +5 -3
- data/lib/murlsh/url.rb +2 -9
- data/lib/murlsh/url_body.rb +1 -1
- data/murlsh.gemspec +21 -20
- data/plugins/{update_feed.rb → add_post_50_update_feed.rb} +3 -2
- data/plugins/add_post_60_notify_hubs.rb +36 -0
- data/plugins/{lookup_content_type_title.rb → add_pre_50_lookup_content_type_title.rb} +1 -1
- data/plugins/{hostrec_redundant.rb → hostrec_50_redundant.rb} +1 -1
- data/plugins/{hostrec_skip.rb → hostrec_60_skip.rb} +1 -1
- data/public/css/screen.css +6 -1
- data/public/js/jquery-1.4.2.min.js +154 -0
- data/public/js/js.js +24 -5
- data/spec/atom_feed_spec.rb +79 -0
- data/spec/auth_spec.rb +35 -0
- data/spec/markup_spec.rb +133 -0
- data/spec/uri_ask_spec.rb +93 -0
- data/spec/uri_spec.rb +16 -0
- data/spec/xhtml_response_spec.rb +112 -0
- metadata +86 -50
- data/public/js/jquery-1.4.min.js +0 -151
- data/test/atom_feed_test.rb +0 -101
- data/test/auth_test.rb +0 -34
- data/test/markup_test.rb +0 -144
- data/test/uri_ask_test.rb +0 -100
- data/test/uri_test.rb +0 -21
- data/test/xhtml_response_test.rb +0 -139
data/test/uri_ask_test.rb
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
|
3
|
-
require 'murlsh'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
require 'uri'
|
7
|
-
|
8
|
-
class UriAskTest < Test::Unit::TestCase
|
9
|
-
|
10
|
-
def asker(s)
|
11
|
-
URI(s).extend(Murlsh::UriAsk)
|
12
|
-
end
|
13
|
-
|
14
|
-
# content type
|
15
|
-
|
16
|
-
def content_type(s, options={})
|
17
|
-
asker(s).content_type(options)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_empty
|
21
|
-
assert_equal('', content_type(''))
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_bad_host
|
25
|
-
assert_equal('', content_type('http://a.b/test/'))
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_bad_path
|
29
|
-
assert_equal('', content_type(
|
30
|
-
'http://matthewm.boedicker.org/does_not_exist/'))
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_good
|
34
|
-
assert_match(/^text\/html/, content_type('http://www.google.com/'))
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_https
|
38
|
-
assert_match(/^text\/html/, content_type(
|
39
|
-
'https://msp.f-secure.com/web-test/common/test.html'))
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_303
|
43
|
-
# youtube returns a 303
|
44
|
-
assert_match(/^text\/html/, content_type(
|
45
|
-
'http://www.youtube.com/watch?v=Vxq9yj2pVWk'))
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_failproof_true
|
49
|
-
assert_equal('', content_type('http://x.boedicker.org/',
|
50
|
-
:failproof => true))
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_failproof_false
|
54
|
-
assert_raise SocketError do
|
55
|
-
content_type('http://x.boedicker.org/', :failproof => false)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_redirect_limit
|
60
|
-
assert_equal('text/html', content_type(
|
61
|
-
'http://matthewm.boedicker.org/redirect_test/'))
|
62
|
-
end
|
63
|
-
|
64
|
-
# title
|
65
|
-
|
66
|
-
def title(s, options={})
|
67
|
-
asker(s).title(options)
|
68
|
-
end
|
69
|
-
|
70
|
-
def noop(url)
|
71
|
-
assert_equal(url, title(url))
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_title_empty
|
75
|
-
noop('')
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_title_invalid_url
|
79
|
-
noop('foo')
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_title_invalid_host
|
83
|
-
noop('http://28fac7a1ac51976c90016509d97c89ba.edu/')
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_title_good
|
87
|
-
assert_equal('Google', title('http://www.google.com/'))
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_title_failproof_true
|
91
|
-
noop(title('http://x.boedicker.org/', :failproof => true))
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_title_failproof_false
|
95
|
-
assert_raise SocketError do
|
96
|
-
title('http://x.boedicker.org/', :failproof => false)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
data/test/uri_test.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
|
3
|
-
require 'murlsh'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class UriTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
def test_good
|
10
|
-
assert_equal('foo.com', URI('http://foo.com/').domain)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_invalid
|
14
|
-
assert_nil(URI('foo').domain)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_trailing_dot
|
18
|
-
assert_nil(URI('http://foo.com.').domain)
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/test/xhtml_response_test.rb
DELETED
@@ -1,139 +0,0 @@
|
|
1
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
|
3
|
-
require 'murlsh'
|
4
|
-
|
5
|
-
require 'test/unit'
|
6
|
-
|
7
|
-
class XhtmlResponseTest < Test::Unit::TestCase
|
8
|
-
|
9
|
-
Ie_ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'
|
10
|
-
|
11
|
-
Non_ie_ua = 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.10) Gecko/2009042523 Ubuntu/9.04 (jaunty) Firefox/3.0.10'
|
12
|
-
|
13
|
-
def get_content_type(accept, ua)
|
14
|
-
req = Murlsh::XhtmlResponse.new
|
15
|
-
req.set_content_type(accept, ua)
|
16
|
-
req['Content-Type']
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_star_star
|
20
|
-
assert_equal('application/xhtml+xml',
|
21
|
-
get_content_type('*/*', Non_ie_ua))
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_star_star_ie
|
25
|
-
assert_equal('text/html',
|
26
|
-
get_content_type('*/*', Ie_ua))
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_star_star_empty
|
30
|
-
assert_equal('application/xhtml+xml',
|
31
|
-
get_content_type('*/*', ''))
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_star_star_nil
|
35
|
-
assert_equal('application/xhtml+xml',
|
36
|
-
get_content_type('*/*', nil))
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_application_star
|
40
|
-
assert_equal('application/xhtml+xml',
|
41
|
-
get_content_type('application/*', Non_ie_ua))
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_application_star_ie
|
45
|
-
assert_equal('text/html',
|
46
|
-
get_content_type('application/*', Ie_ua))
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_application_star_empty
|
50
|
-
assert_equal('application/xhtml+xml',
|
51
|
-
get_content_type('application/*', ''))
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_application_star_nil
|
55
|
-
assert_equal('application/xhtml+xml',
|
56
|
-
get_content_type('application/*', nil))
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_application_xhtml_xml
|
60
|
-
assert_equal('application/xhtml+xml',
|
61
|
-
get_content_type('application/xhtml+xml', Non_ie_ua))
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_application_xhtml_xml_ie
|
65
|
-
assert_equal('text/html',
|
66
|
-
get_content_type('application/xhtml+xml', Ie_ua))
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_application_xhtml_xml_empty
|
70
|
-
assert_equal('application/xhtml+xml',
|
71
|
-
get_content_type('application/xhtml+xml', ''))
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_application_xhtml_xml_nil
|
75
|
-
assert_equal('application/xhtml+xml',
|
76
|
-
get_content_type('application/xhtml+xml', nil))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_text_html
|
80
|
-
assert_equal('text/html',
|
81
|
-
get_content_type('text/html', Non_ie_ua))
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_text_html_ie
|
85
|
-
assert_equal('text/html',
|
86
|
-
get_content_type('text/html', Ie_ua))
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_text_html_empty
|
90
|
-
assert_equal('text/html',
|
91
|
-
get_content_type('text/html', ''))
|
92
|
-
end
|
93
|
-
|
94
|
-
def test_text_html_nil
|
95
|
-
assert_equal('text/html',
|
96
|
-
get_content_type('text/html', nil))
|
97
|
-
end
|
98
|
-
|
99
|
-
def test_empty
|
100
|
-
assert_equal('text/html',
|
101
|
-
get_content_type('', Non_ie_ua))
|
102
|
-
end
|
103
|
-
|
104
|
-
def test_empty_ie
|
105
|
-
assert_equal('text/html',
|
106
|
-
get_content_type('', Ie_ua))
|
107
|
-
end
|
108
|
-
|
109
|
-
def test_empty_empty
|
110
|
-
assert_equal('text/html',
|
111
|
-
get_content_type('', ''))
|
112
|
-
end
|
113
|
-
|
114
|
-
def test_empty_nil
|
115
|
-
assert_equal('text/html',
|
116
|
-
get_content_type('', nil))
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_nil
|
120
|
-
assert_equal('text/html',
|
121
|
-
get_content_type(nil, Non_ie_ua))
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_nil_ie
|
125
|
-
assert_equal('text/html',
|
126
|
-
get_content_type(nil, Ie_ua))
|
127
|
-
end
|
128
|
-
|
129
|
-
def test_nil_empty
|
130
|
-
assert_equal('text/html',
|
131
|
-
get_content_type(nil, ''))
|
132
|
-
end
|
133
|
-
|
134
|
-
def test_nil_nil
|
135
|
-
assert_equal('text/html',
|
136
|
-
get_content_type(nil, nil))
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|