mechanize 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of mechanize might be problematic. Click here for more details.

Files changed (45) hide show
  1. data/{CHANGELOG → CHANGELOG.txt} +17 -0
  2. data/{EXAMPLES → EXAMPLES.txt} +0 -0
  3. data/{GUIDE → GUIDE.txt} +0 -0
  4. data/{LICENSE → LICENSE.txt} +0 -0
  5. data/Manifest.txt +31 -0
  6. data/{NOTES → NOTES.txt} +14 -0
  7. data/{README → README.txt} +7 -3
  8. data/Rakefile +64 -0
  9. data/eg/flickr_upload.rb +23 -0
  10. data/eg/mech-dump.rb +7 -0
  11. data/eg/proxy_req.rb +9 -0
  12. data/eg/rubyforge.rb +21 -0
  13. data/eg/spider.rb +11 -0
  14. data/lib/mechanize/cookie.rb +15 -3
  15. data/lib/mechanize/errors.rb +1 -3
  16. data/lib/mechanize/form.rb +3 -1
  17. data/lib/mechanize/form_elements.rb +1 -1
  18. data/lib/mechanize/mech_version.rb +1 -1
  19. data/lib/mechanize/net-overrides/net/http.rb +1 -1
  20. data/lib/mechanize/page.rb +7 -10
  21. data/lib/mechanize/page_elements.rb +1 -0
  22. data/lib/mechanize/parsers/rexml_page.rb +8 -10
  23. data/lib/mechanize.rb +59 -37
  24. data/setup.rb +1585 -0
  25. data/test/htdocs/relative/tc_relative_links.html +19 -0
  26. data/test/htdocs/tc_relative_links.html +19 -0
  27. data/test/tc_checkboxes.rb +1 -1
  28. data/test/tc_cookie_class.rb +18 -2
  29. data/test/tc_form_as_hash.rb +6 -8
  30. data/test/tc_form_button.rb +36 -0
  31. data/test/tc_form_no_inputname.rb +2 -2
  32. data/test/tc_forms.rb +12 -0
  33. data/test/tc_no_attributes.rb +1 -1
  34. data/test/tc_relative_links.rb +40 -0
  35. data/test/tc_response_code.rb +20 -0
  36. data/test/tc_subclass.rb +28 -0
  37. data/test/tc_upload.rb +11 -11
  38. data/test/{ts_mech.rb → test_all.rb} +24 -34
  39. data/test/test_includes.rb +112 -0
  40. data/test/{servlets.rb → test_servlets.rb} +4 -6
  41. metadata +55 -59
  42. data/test/README +0 -7
  43. data/test/proxy.rb +0 -30
  44. data/test/server.rb +0 -43
  45. data/test/ssl_server.rb +0 -48
metadata CHANGED
@@ -3,15 +3,18 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: mechanize
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.3
7
- date: 2006-11-05 00:00:00 -08:00
6
+ version: 0.6.4
7
+ date: 2006-12-20 00:00:00 -08:00
8
8
  summary: Mechanize provides automated web-browsing
9
9
  require_paths:
10
10
  - lib
11
11
  email: aaronp@rubyforge.org
12
- homepage: mechanize.rubyforge.org
12
+ homepage: http://mechanize.rubyforge.org/
13
13
  rubyforge_project: mechanize
14
- description:
14
+ description: "The Mechanize library is used for automating interaction with websites.
15
+ Mechanize automatically stores and sends cookies, follows redirects, can follow
16
+ links, and submit forms. Form fields can be populated and submitted. Mechanize
17
+ also keeps track of the sites that you have visited as a history."
15
18
  autorequire:
16
19
  default_executable:
17
20
  bindir: bin
@@ -30,13 +33,41 @@ post_install_message:
30
33
  authors:
31
34
  - Aaron Patterson
32
35
  files:
33
- - test/data
34
- - test/htdocs
35
- - test/proxy.rb
36
- - test/README
37
- - test/server.rb
38
- - test/servlets.rb
39
- - test/ssl_server.rb
36
+ - CHANGELOG.txt
37
+ - EXAMPLES.txt
38
+ - GUIDE.txt
39
+ - LICENSE.txt
40
+ - Manifest.txt
41
+ - NOTES.txt
42
+ - README.txt
43
+ - Rakefile
44
+ - eg/flickr_upload.rb
45
+ - eg/mech-dump.rb
46
+ - eg/proxy_req.rb
47
+ - eg/rubyforge.rb
48
+ - eg/spider.rb
49
+ - lib/mechanize.rb
50
+ - lib/mechanize/cookie.rb
51
+ - lib/mechanize/errors.rb
52
+ - lib/mechanize/form.rb
53
+ - lib/mechanize/form_elements.rb
54
+ - lib/mechanize/hpricot.rb
55
+ - lib/mechanize/inspect.rb
56
+ - lib/mechanize/list.rb
57
+ - lib/mechanize/mech_version.rb
58
+ - lib/mechanize/net-overrides/net/http.rb
59
+ - lib/mechanize/net-overrides/net/https.rb
60
+ - lib/mechanize/net-overrides/net/protocol.rb
61
+ - lib/mechanize/page.rb
62
+ - lib/mechanize/page_elements.rb
63
+ - lib/mechanize/parsers/rexml_page.rb
64
+ - lib/mechanize/pluggable_parsers.rb
65
+ - lib/mechanize/rexml.rb
66
+ - setup.rb
67
+ test_files:
68
+ - test/test_all.rb
69
+ - test/test_includes.rb
70
+ - test/test_servlets.rb
40
71
  - test/tc_authenticate.rb
41
72
  - test/tc_bad_links.rb
42
73
  - test/tc_checkboxes.rb
@@ -47,6 +78,7 @@ files:
47
78
  - test/tc_errors.rb
48
79
  - test/tc_form_action.rb
49
80
  - test/tc_form_as_hash.rb
81
+ - test/tc_form_button.rb
50
82
  - test/tc_form_no_inputname.rb
51
83
  - test/tc_forms.rb
52
84
  - test/tc_frames.rb
@@ -62,6 +94,7 @@ files:
62
94
  - test/tc_proxy.rb
63
95
  - test/tc_radiobutton.rb
64
96
  - test/tc_referer.rb
97
+ - test/tc_relative_links.rb
65
98
  - test/tc_response_code.rb
66
99
  - test/tc_save_file.rb
67
100
  - test/tc_select.rb
@@ -70,19 +103,12 @@ files:
70
103
  - test/tc_select_noopts.rb
71
104
  - test/tc_set_fields.rb
72
105
  - test/tc_ssl_server.rb
106
+ - test/tc_subclass.rb
73
107
  - test/tc_textarea.rb
74
108
  - test/tc_upload.rb
75
109
  - test/tc_watches.rb
76
- - test/test_includes.rb
77
- - test/ts_mech.rb
78
- - test/data/htpasswd
79
- - test/data/server.crt
80
- - test/data/server.csr
81
- - test/data/server.key
82
- - test/data/server.pem
83
110
  - test/htdocs/alt_text.html
84
111
  - test/htdocs/bad_form_test.html
85
- - test/htdocs/button.jpg
86
112
  - test/htdocs/empty_form.html
87
113
  - test/htdocs/file_upload.html
88
114
  - test/htdocs/find_link.html
@@ -111,47 +137,17 @@ files:
111
137
  - test/htdocs/tc_pretty_print.html
112
138
  - test/htdocs/tc_radiobuttons.html
113
139
  - test/htdocs/tc_referer.html
140
+ - test/htdocs/tc_relative_links.html
114
141
  - test/htdocs/tc_textarea.html
115
- - lib/mechanize
116
- - lib/mechanize.rb
117
- - lib/mechanize/cookie.rb
118
- - lib/mechanize/errors.rb
119
- - lib/mechanize/form.rb
120
- - lib/mechanize/form_elements.rb
121
- - lib/mechanize/hpricot.rb
122
- - lib/mechanize/inspect.rb
123
- - lib/mechanize/list.rb
124
- - lib/mechanize/mech_version.rb
125
- - lib/mechanize/net-overrides
126
- - lib/mechanize/page.rb
127
- - lib/mechanize/page_elements.rb
128
- - lib/mechanize/parsers
129
- - lib/mechanize/pluggable_parsers.rb
130
- - lib/mechanize/rexml.rb
131
- - lib/mechanize/net-overrides/net
132
- - lib/mechanize/net-overrides/net/http.rb
133
- - lib/mechanize/net-overrides/net/https.rb
134
- - lib/mechanize/net-overrides/net/protocol.rb
135
- - lib/mechanize/parsers/rexml_page.rb
136
- - README
137
- - EXAMPLES
138
- - CHANGELOG
139
- - LICENSE
140
- - NOTES
141
- - GUIDE
142
- test_files: []
143
- rdoc_options:
144
- - "--main"
145
- - README
146
- - "--title"
147
- - "'WWW::Mechanize RDoc'"
148
- extra_rdoc_files:
149
- - README
150
- - EXAMPLES
151
- - CHANGELOG
152
- - LICENSE
153
- - NOTES
154
- - GUIDE
142
+ - test/htdocs/relative/tc_relative_links.html
143
+ - test/htdocs/button.jpg
144
+ - test/data/server.crt
145
+ - test/data/server.csr
146
+ - test/data/server.key
147
+ - test/data/server.pem
148
+ - test/data/htpasswd
149
+ rdoc_options: []
150
+ extra_rdoc_files: []
155
151
  executables: []
156
152
  extensions: []
157
153
  requirements: []
data/test/README DELETED
@@ -1,7 +0,0 @@
1
- = Mechanize Testing
2
-
3
- To run the tests, execute ts_mech.rb
4
-
5
- ts_mech.rb spawns a thread that has a WEBrick server in it to test against.
6
- The WEBrick server can be found in server.rb.
7
-
data/test/proxy.rb DELETED
@@ -1,30 +0,0 @@
1
- # This is a simple proxy that assumes the destination server will
2
- # close the connection after sending data, otherwise it will get blocked
3
- # on reads.
4
-
5
- require 'rubygems'
6
- require 'eventmachine'
7
- require 'socket'
8
-
9
- module HttpProxy
10
- include Socket::Constants
11
-
12
- def receive_data(data)
13
- if data =~ /Host: (.*)$/
14
- (host, port) = $1.chomp.split(/:/)
15
- port ||= 80
16
- socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
17
- puts port.to_i
18
- puts host
19
- sockaddr = Socket.pack_sockaddr_in( port.to_i, host )
20
- socket.connect(sockaddr)
21
- socket.write(data)
22
- results = socket.read
23
- send_data results
24
- end
25
- end
26
- end
27
-
28
- EventMachine::run {
29
- EventMachine::start_server "127.0.0.1", 2001, HttpProxy
30
- }
data/test/server.rb DELETED
@@ -1,43 +0,0 @@
1
- require 'webrick'
2
- require 'base64'
3
- require 'servlets'
4
- require 'logger'
5
-
6
- base_dir = FileTest.exists?(Dir::pwd + '/test') ? Dir::pwd + '/test' : Dir::pwd
7
-
8
- s = WEBrick::HTTPServer.new(
9
- :Port => 2000,
10
- :DocumentRoot => base_dir + "/htdocs",
11
- :Logger => Logger.new(nil),
12
- :AccessLog => Logger.new(nil)
13
- )
14
- s.mount("/one_cookie", OneCookieTest)
15
- s.mount("/one_cookie_no_space", OneCookieNoSpacesTest)
16
- s.mount("/many_cookies", ManyCookiesTest)
17
- s.mount("/many_cookies_as_string", ManyCookiesAsStringTest)
18
- s.mount("/send_cookies", SendCookiesTest)
19
- s.mount("/form_post", FormTest)
20
- s.mount("/form post", FormTest)
21
- s.mount("/response_code", ResponseCodeTest)
22
- s.mount("/file_upload", FileUploadTest)
23
- s.mount("/bad_content_type", BadContentTypeTest)
24
- s.mount("/content_type_test", ContentTypeTest)
25
- s.mount("/gzip", GzipServlet)
26
- s.mount("/referer", RefererServlet)
27
-
28
- htpasswd = WEBrick::HTTPAuth::Htpasswd.new(base_dir + '/data/htpasswd')
29
- auth = WEBrick::HTTPAuth::BasicAuth.new(
30
- :UserDB => htpasswd,
31
- :Realm => 'mechanize',
32
- :Logger => Logger.new(nil),
33
- :AccessLog => Logger.new(nil)
34
- )
35
- s.mount_proc('/htpasswd_auth') { |req, res|
36
- auth.authenticate(req, res)
37
- res.body = "You are authenticated"
38
- }
39
-
40
- trap("INT") { s.stop }
41
-
42
- s.start
43
-
data/test/ssl_server.rb DELETED
@@ -1,48 +0,0 @@
1
- require 'webrick'
2
- require 'webrick/https'
3
- require 'servlets'
4
- require 'logger'
5
-
6
- base_dir = FileTest.exists?(Dir::pwd + '/test') ? Dir::pwd + '/test' : Dir::pwd
7
-
8
- s = WEBrick::HTTPServer.new(
9
- :Port => 2002,
10
- :DocumentRoot => base_dir + "/htdocs",
11
- :SSLEnable => true,
12
- :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE,
13
- :SSLCertificate => OpenSSL::X509::Certificate.new(
14
- File.read("data/server.crt")
15
- ),
16
- :SSLPrivateKey => OpenSSL::PKey::RSA.new(
17
- File.read("data/server.pem")
18
- ),
19
- :Logger => Logger.new(nil),
20
- :AccessLog => Logger.new(nil)
21
- )
22
- s.mount("/one_cookie", OneCookieTest)
23
- s.mount("/one_cookie_no_space", OneCookieNoSpacesTest)
24
- s.mount("/many_cookies", ManyCookiesTest)
25
- s.mount("/many_cookies_as_string", ManyCookiesAsStringTest)
26
- s.mount("/send_cookies", SendCookiesTest)
27
- s.mount("/form_post", FormTest)
28
- s.mount("/form post", FormTest)
29
- s.mount("/response_code", ResponseCodeTest)
30
- s.mount("/file_upload", FileUploadTest)
31
- s.mount("/bad_content_type", BadContentTypeTest)
32
- s.mount("/content_type_test", ContentTypeTest)
33
-
34
- htpasswd = WEBrick::HTTPAuth::Htpasswd.new(base_dir + '/data/htpasswd')
35
- auth = WEBrick::HTTPAuth::BasicAuth.new(
36
- :UserDB => htpasswd,
37
- :Realm => 'mechanize',
38
- :Logger => Logger.new(nil),
39
- :AccessLog => Logger.new(nil)
40
- )
41
- s.mount_proc('/htpasswd_auth') { |req, res|
42
- auth.authenticate(req, res)
43
- res.body = "You are authenticated"
44
- }
45
-
46
- trap("INT") { s.stop }
47
-
48
- s.start