ridley 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ridley/connection.rb +6 -0
- data/lib/ridley/errors.rb +2 -0
- data/lib/ridley/resources/sandbox.rb +17 -5
- data/lib/ridley/version.rb +1 -1
- data/spec/unit/ridley/connection_spec.rb +8 -0
- metadata +3 -3
data/lib/ridley/connection.rb
CHANGED
@@ -34,6 +34,8 @@ module Ridley
|
|
34
34
|
def_delegator :conn, :port
|
35
35
|
def_delegator :conn, :path_prefix
|
36
36
|
|
37
|
+
def_delegator :conn, :url_prefix=
|
38
|
+
|
37
39
|
def_delegator :conn, :get
|
38
40
|
def_delegator :conn, :put
|
39
41
|
def_delegator :conn, :post
|
@@ -79,6 +81,10 @@ module Ridley
|
|
79
81
|
@organization = options.fetch(:organization, nil)
|
80
82
|
@thread_count = options.fetch(:thread_count, DEFAULT_THREAD_COUNT)
|
81
83
|
|
84
|
+
unless @client_key.present? && File.exist?(@client_key)
|
85
|
+
raise Errors::ClientKeyFileNotFound, "client key not found at: '#{@client_key}'"
|
86
|
+
end
|
87
|
+
|
82
88
|
faraday_options = options.slice(:params, :headers, :request, :ssl, :proxy)
|
83
89
|
uri_hash = Addressable::URI.parse(options[:server_url]).to_hash.slice(:scheme, :host, :port)
|
84
90
|
|
data/lib/ridley/errors.rb
CHANGED
@@ -75,11 +75,23 @@ module Ridley
|
|
75
75
|
}
|
76
76
|
contents = File.open(path, 'rb') { |f| f.read }
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
# Hosted Chef returns Amazon S3 URLs for where to upload
|
79
|
+
# checksums to. OSS Chef Server and Hosted Chef return URLs
|
80
|
+
# to the same Chef API that the Sandbox creation request was
|
81
|
+
# sent to.
|
82
|
+
#
|
83
|
+
# The connection object is duplicated to ensure all of our connection
|
84
|
+
# settings persist, but the scheme, host, and port are set to the
|
85
|
+
# value of the given checksum.
|
86
|
+
conn = connection.send(:conn).dup
|
87
|
+
|
88
|
+
url = URI(checksum[:url])
|
89
|
+
upload_path = url.path
|
90
|
+
url.path = ""
|
91
|
+
|
92
|
+
conn.url_prefix = url.to_s
|
93
|
+
|
94
|
+
conn.put(upload_path, contents, headers)
|
83
95
|
end
|
84
96
|
|
85
97
|
def commit
|
data/lib/ridley/version.rb
CHANGED
@@ -88,6 +88,14 @@ describe Ridley::Connection do
|
|
88
88
|
)
|
89
89
|
}.should raise_error(ArgumentError, "Missing required option(s): 'client_key'")
|
90
90
|
end
|
91
|
+
|
92
|
+
it "raises a ClientKeyFileNotFound if the filepath for client_key is not found" do
|
93
|
+
config[:client_key] = "/tmp/nofile.xxsa"
|
94
|
+
|
95
|
+
lambda {
|
96
|
+
subject.new(config)
|
97
|
+
}.should raise_error(Ridley::Errors::ClientKeyFileNotFound)
|
98
|
+
end
|
91
99
|
end
|
92
100
|
|
93
101
|
describe "::sync" do
|
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.0.
|
4
|
+
version: 0.0.5
|
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: 2012-09-
|
12
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
@@ -418,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
418
|
version: '0'
|
419
419
|
segments:
|
420
420
|
- 0
|
421
|
-
hash:
|
421
|
+
hash: 3051717703450695836
|
422
422
|
requirements: []
|
423
423
|
rubyforge_project:
|
424
424
|
rubygems_version: 1.8.23
|