mechanize 2.2 → 2.2.1

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.

data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,12 @@
1
1
  = Mechanize CHANGELOG
2
2
 
3
+ === 2.2.1 / 2012-02-13
4
+
5
+ * Bug fixes
6
+ * Add missing file to the gem, ensure that missing files won't cause
7
+ failures again. Issue #201 by Alex
8
+ * Fix minor grammar issue in README. Issue #200 by Shane Becker.
9
+
3
10
  === 2.2 / 2012-02-12
4
11
 
5
12
  * API changes
@@ -16,6 +16,7 @@ lib/mechanize.rb
16
16
  lib/mechanize/content_type_error.rb
17
17
  lib/mechanize/cookie.rb
18
18
  lib/mechanize/cookie_jar.rb
19
+ lib/mechanize/directory_saver.rb
19
20
  lib/mechanize/download.rb
20
21
  lib/mechanize/element_matcher.rb
21
22
  lib/mechanize/file.rb
@@ -121,6 +122,7 @@ test/htdocs/unusual______.html
121
122
  test/test_mechanize.rb
122
123
  test/test_mechanize_cookie.rb
123
124
  test/test_mechanize_cookie_jar.rb
125
+ test/test_mechanize_directory_saver.rb
124
126
  test/test_mechanize_download.rb
125
127
  test/test_mechanize_file.rb
126
128
  test/test_mechanize_file_connection.rb
@@ -7,7 +7,7 @@
7
7
 
8
8
  The Mechanize library is used for automating interaction with websites.
9
9
  Mechanize automatically stores and sends cookies, follows redirects,
10
- can follow links, and submit forms. Form fields can be populated and
10
+ and can follow links and submit forms. Form fields can be populated and
11
11
  submitted. Mechanize also keeps track of the sites that you have visited as
12
12
  a history.
13
13
 
data/Rakefile CHANGED
@@ -27,6 +27,8 @@ hoe = Hoe.spec 'mechanize' do
27
27
  self.spec_extras[:required_ruby_version] = '>= 1.8.7'
28
28
  end
29
29
 
30
+ task :prerelease => [:clobber, :check_manifest, :test]
31
+
30
32
  desc "Update SSL Certificate"
31
33
  task('ssl_cert') do |p|
32
34
  sh "openssl genrsa -des3 -out server.key 1024"
@@ -73,7 +73,7 @@ class Mechanize
73
73
  ##
74
74
  # The version of Mechanize you are using.
75
75
 
76
- VERSION = '2.2'
76
+ VERSION = '2.2.1'
77
77
 
78
78
  ##
79
79
  # Base mechanize error class
@@ -0,0 +1,53 @@
1
+ ##
2
+ # Unlike Mechanize::FileSaver, the directory saver places all downloaded files
3
+ # in a single pre-specified directory.
4
+ #
5
+ # You must register the directory to save to before using the directory saver:
6
+ #
7
+ # agent.pluggable_parser['image'] = \
8
+ # Mechanize::DirectorySaver.save_to 'images'
9
+
10
+ class Mechanize::DirectorySaver < Mechanize::Download
11
+
12
+ @directory = nil
13
+
14
+ ##
15
+ # Creates a DirectorySaver subclass that will save responses to the given
16
+ # +directory+.
17
+
18
+ def self.save_to directory
19
+ directory = File.expand_path directory
20
+
21
+ Class.new self do |klass|
22
+ klass.instance_variable_set :@directory, directory
23
+ end
24
+ end
25
+
26
+ ##
27
+ # The directory downloaded files will be saved to.
28
+
29
+ def self.directory
30
+ @directory
31
+ end
32
+
33
+ ##
34
+ # Saves the +body_io+ into the directory specified for this DirectorySaver
35
+ # by save_to. The filename is chosen by Mechanize::Parser#extract_filename.
36
+
37
+ def initialize uri = nil, response = nil, body_io = nil, code = nil
38
+ directory = self.class.directory
39
+
40
+ raise Mechanize::Error,
41
+ 'no save directory specified - ' \
42
+ 'use Mechanize::DirectorySaver.save_to ' \
43
+ 'and register the resulting class' unless directory
44
+
45
+ super
46
+
47
+ path = File.join directory, @filename
48
+
49
+ save path
50
+ end
51
+
52
+ end
53
+
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mechanize
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- version: "2.2"
9
+ - 1
10
+ version: 2.2.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Eric Hodel
@@ -38,7 +39,7 @@ cert_chain:
38
39
  YJY7T/W2n+eWy8WuPhzVUkyzguj0bQe27NDeabgCh2mHd4Hynk2AkYh8MQ==
39
40
  -----END CERTIFICATE-----
40
41
 
41
- date: 2012-02-13 00:00:00 Z
42
+ date: 2012-02-14 00:00:00 Z
42
43
  dependencies:
43
44
  - !ruby/object:Gem::Dependency
44
45
  name: net-http-digest_auth
@@ -241,7 +242,7 @@ dependencies:
241
242
  description: |-
242
243
  The Mechanize library is used for automating interaction with websites.
243
244
  Mechanize automatically stores and sends cookies, follows redirects,
244
- can follow links, and submit forms. Form fields can be populated and
245
+ and can follow links and submit forms. Form fields can be populated and
245
246
  submitted. Mechanize also keeps track of the sites that you have visited as
246
247
  a history.
247
248
  email:
@@ -279,6 +280,7 @@ files:
279
280
  - lib/mechanize/content_type_error.rb
280
281
  - lib/mechanize/cookie.rb
281
282
  - lib/mechanize/cookie_jar.rb
283
+ - lib/mechanize/directory_saver.rb
282
284
  - lib/mechanize/download.rb
283
285
  - lib/mechanize/element_matcher.rb
284
286
  - lib/mechanize/file.rb
@@ -384,6 +386,7 @@ files:
384
386
  - test/test_mechanize.rb
385
387
  - test/test_mechanize_cookie.rb
386
388
  - test/test_mechanize_cookie_jar.rb
389
+ - test/test_mechanize_directory_saver.rb
387
390
  - test/test_mechanize_download.rb
388
391
  - test/test_mechanize_file.rb
389
392
  - test/test_mechanize_file_connection.rb
@@ -424,7 +427,6 @@ files:
424
427
  - test/test_mechanize_subclass.rb
425
428
  - test/test_mechanize_util.rb
426
429
  - test/test_multi_select.rb
427
- - test/test_mechanize_directory_saver.rb
428
430
  - .gemtest
429
431
  homepage: http://mechanize.rubyforge.org
430
432
  licenses: []
metadata.gz.sig CHANGED
Binary file