datacatalog-importer 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.15
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{datacatalog-importer}
8
- s.version = "0.1.14"
8
+ s.version = "0.1.15"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David James"]
12
- s.date = %q{2010-05-04}
12
+ s.date = %q{2010-05-05}
13
13
  s.description = %q{This framework makes it easier to write importers for the National Data Catalog.}
14
14
  s.email = %q{djames@sunlightfoundation.com}
15
15
  s.extra_rdoc_files = [
data/lib/utility.rb CHANGED
@@ -48,6 +48,9 @@ module DataCatalog
48
48
 
49
49
  # == Various ==
50
50
 
51
+ # For background on rescuing net/http errors, see:
52
+ # * http://jerith.livejournal.com/40063.html
53
+ # * http://lindsaar.net/2007/12/9/rbuf_filltimeout-error
51
54
  def self.fetch(uri, max_attempts=3)
52
55
  attempts = 0
53
56
  loop do
@@ -55,9 +58,10 @@ module DataCatalog
55
58
  puts "Fetching #{uri}..."
56
59
  io = open(uri, headers)
57
60
  return io.read
58
- rescue SocketError
61
+ rescue Timeout::Error, StandardError => e
59
62
  attempts += 1
60
63
  puts " Attempt ##{attempts} failed."
64
+ puts " Error: #{e.inspect}"
61
65
  break if attempts >= max_attempts
62
66
  end
63
67
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 14
9
- version: 0.1.14
8
+ - 15
9
+ version: 0.1.15
10
10
  platform: ruby
11
11
  authors:
12
12
  - David James
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-04 00:00:00 -04:00
17
+ date: 2010-05-05 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency