ridley 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -45,5 +45,5 @@ group :test do
45
45
  gem 'fuubar'
46
46
  gem 'json_spec'
47
47
  gem 'webmock'
48
- gem 'chef-zero'
48
+ gem 'chef-zero', '>= 0.9.9'
49
49
  end
@@ -118,7 +118,7 @@ module Ridley
118
118
  #
119
119
  # @return [nil]
120
120
  def download_file(filetype, path, destination)
121
- files = case filetype.to_sym
121
+ file_list = case filetype.to_sym
122
122
  when :attribute, :attributes; attributes
123
123
  when :definition, :definitions; definitions
124
124
  when :file, :files; files
@@ -132,7 +132,7 @@ module Ridley
132
132
  raise Errors::UnknownCookbookFileType.new(filetype)
133
133
  end
134
134
 
135
- file = files.find { |f| f[:path] == path }
135
+ file = file_list.find { |f| f[:path] == path }
136
136
  return nil if file.nil?
137
137
 
138
138
  destination = File.expand_path(destination)
@@ -99,8 +99,14 @@ module Ridley
99
99
  # we expect. Caught exceptions are re-raised with Celluloid#abort so we don't crash the connection.
100
100
  def run_request(*args)
101
101
  defer { super }
102
- rescue Errors::HTTPError, Faraday::Error => ex
103
- abort(ex)
102
+ rescue Errors::HTTPError => ex
103
+ abort ex
104
+ rescue Faraday::Error::ConnectionFailed => ex
105
+ abort Errors::ConnectionFailed.new(ex)
106
+ rescue Faraday::Error::TimeoutError => ex
107
+ abort Errors::TimeoutError.new(ex)
108
+ rescue Faraday::Error::ClientError => ex
109
+ abort Errors::ClientError.new(ex)
104
110
  end
105
111
 
106
112
  def server_url
@@ -5,6 +5,10 @@ module Ridley
5
5
  class InternalError < RidleyError; end
6
6
  class ArgumentError < InternalError; end
7
7
 
8
+ class ClientError < RidleyError; end
9
+ class ConnectionFailed < ClientError; end
10
+ class TimeoutError < ClientError; end
11
+
8
12
  class ResourceNotFound < RidleyError; end
9
13
  class ValidatorNotFound < RidleyError; end
10
14
 
@@ -111,7 +111,7 @@ module Ridley
111
111
  end
112
112
 
113
113
  defer { connection.send(method, *args) }
114
- rescue Errors::HTTPError => ex
114
+ rescue Errors::HTTPError, Errors::ClientError => ex
115
115
  abort(ex)
116
116
  end
117
117
  end
@@ -1,3 +1,3 @@
1
1
  module Ridley
2
- VERSION = "0.12.0"
2
+ VERSION = "0.12.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridley
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-13 00:00:00.000000000 Z
12
+ date: 2013-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -455,7 +455,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
455
455
  version: '0'
456
456
  segments:
457
457
  - 0
458
- hash: 1507028122842257977
458
+ hash: -3737954718774524860
459
459
  requirements: []
460
460
  rubyforge_project:
461
461
  rubygems_version: 1.8.23