engineyard 1.3.21 → 1.3.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,6 +46,7 @@ module EY
46
46
 
47
47
  def self.request(path, opts={})
48
48
  require 'rest_client'
49
+ require 'engineyard/rest_client_ext'
49
50
  require 'json'
50
51
 
51
52
  url = EY.config.endpoint + "api/v2#{path}"
@@ -0,0 +1,9 @@
1
+ module RestClient
2
+ module AbstractResponse
3
+ private
4
+
5
+ def parse_cookie cookie_content
6
+ {}
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '1.3.21'
2
+ VERSION = '1.3.22'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
- - 21
10
- version: 1.3.21
9
+ - 22
10
+ version: 1.3.22
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-03 00:00:00 -07:00
18
+ date: 2011-08-09 00:00:00 -07:00
19
19
  default_executable: ey
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
23
  none: false
24
24
  requirements:
25
25
  - - ~>
@@ -30,12 +30,12 @@ dependencies:
30
30
  - 14
31
31
  - 6
32
32
  version: 0.14.6
33
+ type: :runtime
34
+ requirement: *id001
33
35
  name: thor
34
36
  prerelease: false
35
- type: :runtime
36
- version_requirements: *id001
37
37
  - !ruby/object:Gem::Dependency
38
- requirement: &id002 !ruby/object:Gem::Requirement
38
+ version_requirements: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -46,12 +46,12 @@ dependencies:
46
46
  - 6
47
47
  - 0
48
48
  version: 1.6.0
49
+ type: :runtime
50
+ requirement: *id002
49
51
  name: rest-client
50
52
  prerelease: false
51
- type: :runtime
52
- version_requirements: *id002
53
53
  - !ruby/object:Gem::Dependency
54
- requirement: &id003 !ruby/object:Gem::Requirement
54
+ version_requirements: &id003 !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements:
57
57
  - - ~>
@@ -62,12 +62,12 @@ dependencies:
62
62
  - 6
63
63
  - 1
64
64
  version: 1.6.1
65
+ type: :runtime
66
+ requirement: *id003
65
67
  name: highline
66
68
  prerelease: false
67
- type: :runtime
68
- version_requirements: *id003
69
69
  - !ruby/object:Gem::Dependency
70
- requirement: &id004 !ruby/object:Gem::Requirement
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
73
73
  - - ">="
@@ -76,12 +76,12 @@ dependencies:
76
76
  segments:
77
77
  - 0
78
78
  version: "0"
79
+ type: :runtime
80
+ requirement: *id004
79
81
  name: json_pure
80
82
  prerelease: false
81
- type: :runtime
82
- version_requirements: *id004
83
83
  - !ruby/object:Gem::Dependency
84
- requirement: &id005 !ruby/object:Gem::Requirement
84
+ version_requirements: &id005 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ~>
@@ -92,12 +92,12 @@ dependencies:
92
92
  - 0
93
93
  - 4
94
94
  version: 0.0.4
95
+ type: :runtime
96
+ requirement: *id005
95
97
  name: escape
96
98
  prerelease: false
97
- type: :runtime
98
- version_requirements: *id005
99
99
  - !ruby/object:Gem::Dependency
100
- requirement: &id006 !ruby/object:Gem::Requirement
100
+ version_requirements: &id006 !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
103
103
  - - "="
@@ -108,12 +108,12 @@ dependencies:
108
108
  - 4
109
109
  - 2
110
110
  version: 1.4.2
111
+ type: :runtime
112
+ requirement: *id006
111
113
  name: engineyard-serverside-adapter
112
114
  prerelease: false
113
- type: :runtime
114
- version_requirements: *id006
115
115
  - !ruby/object:Gem::Dependency
116
- requirement: &id007 !ruby/object:Gem::Requirement
116
+ version_requirements: &id007 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ~>
@@ -124,12 +124,12 @@ dependencies:
124
124
  - 1
125
125
  - 0
126
126
  version: 2.1.0
127
+ type: :runtime
128
+ requirement: *id007
127
129
  name: net-ssh
128
130
  prerelease: false
129
- type: :runtime
130
- version_requirements: *id007
131
131
  - !ruby/object:Gem::Dependency
132
- requirement: &id008 !ruby/object:Gem::Requirement
132
+ version_requirements: &id008 !ruby/object:Gem::Requirement
133
133
  none: false
134
134
  requirements:
135
135
  - - "="
@@ -140,12 +140,12 @@ dependencies:
140
140
  - 3
141
141
  - 0
142
142
  version: 1.3.0
143
+ type: :development
144
+ requirement: *id008
143
145
  name: rspec
144
146
  prerelease: false
145
- type: :development
146
- version_requirements: *id008
147
147
  - !ruby/object:Gem::Dependency
148
- requirement: &id009 !ruby/object:Gem::Requirement
148
+ version_requirements: &id009 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ">="
@@ -154,12 +154,12 @@ dependencies:
154
154
  segments:
155
155
  - 0
156
156
  version: "0"
157
+ type: :development
158
+ requirement: *id009
157
159
  name: rake
158
160
  prerelease: false
159
- type: :development
160
- version_requirements: *id009
161
161
  - !ruby/object:Gem::Dependency
162
- requirement: &id010 !ruby/object:Gem::Requirement
162
+ version_requirements: &id010 !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements:
165
165
  - - ">="
@@ -168,12 +168,12 @@ dependencies:
168
168
  segments:
169
169
  - 0
170
170
  version: "0"
171
+ type: :development
172
+ requirement: *id010
171
173
  name: fakeweb
172
174
  prerelease: false
173
- type: :development
174
- version_requirements: *id010
175
175
  - !ruby/object:Gem::Dependency
176
- requirement: &id011 !ruby/object:Gem::Requirement
176
+ version_requirements: &id011 !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements:
179
179
  - - ">="
@@ -182,12 +182,12 @@ dependencies:
182
182
  segments:
183
183
  - 0
184
184
  version: "0"
185
+ type: :development
186
+ requirement: *id011
185
187
  name: fakeweb-matcher
186
188
  prerelease: false
187
- type: :development
188
- version_requirements: *id011
189
189
  - !ruby/object:Gem::Dependency
190
- requirement: &id012 !ruby/object:Gem::Requirement
190
+ version_requirements: &id012 !ruby/object:Gem::Requirement
191
191
  none: false
192
192
  requirements:
193
193
  - - ">="
@@ -196,28 +196,12 @@ dependencies:
196
196
  segments:
197
197
  - 0
198
198
  version: "0"
199
- name: fakefs
200
- prerelease: false
201
199
  type: :development
202
- version_requirements: *id012
203
- - !ruby/object:Gem::Dependency
204
- requirement: &id013 !ruby/object:Gem::Requirement
205
- none: false
206
- requirements:
207
- - - ~>
208
- - !ruby/object:Gem::Version
209
- hash: 23
210
- segments:
211
- - 1
212
- - 0
213
- - 0
214
- version: 1.0.0
215
- name: bundler
200
+ requirement: *id012
201
+ name: fakefs
216
202
  prerelease: false
217
- type: :development
218
- version_requirements: *id013
219
203
  - !ruby/object:Gem::Dependency
220
- requirement: &id014 !ruby/object:Gem::Requirement
204
+ version_requirements: &id013 !ruby/object:Gem::Requirement
221
205
  none: false
222
206
  requirements:
223
207
  - - ">="
@@ -226,12 +210,12 @@ dependencies:
226
210
  segments:
227
211
  - 0
228
212
  version: "0"
213
+ type: :development
214
+ requirement: *id013
229
215
  name: sinatra
230
216
  prerelease: false
231
- type: :development
232
- version_requirements: *id014
233
217
  - !ruby/object:Gem::Dependency
234
- requirement: &id015 !ruby/object:Gem::Requirement
218
+ version_requirements: &id014 !ruby/object:Gem::Requirement
235
219
  none: false
236
220
  requirements:
237
221
  - - ~>
@@ -242,12 +226,12 @@ dependencies:
242
226
  - 1
243
227
  - 6
244
228
  version: 0.1.6
229
+ type: :development
230
+ requirement: *id014
245
231
  name: realweb
246
232
  prerelease: false
247
- type: :development
248
- version_requirements: *id015
249
233
  - !ruby/object:Gem::Dependency
250
- requirement: &id016 !ruby/object:Gem::Requirement
234
+ version_requirements: &id015 !ruby/object:Gem::Requirement
251
235
  none: false
252
236
  requirements:
253
237
  - - ~>
@@ -258,10 +242,10 @@ dependencies:
258
242
  - 0
259
243
  - 1
260
244
  version: 1.0.1
245
+ type: :development
246
+ requirement: *id015
261
247
  name: open4
262
248
  prerelease: false
263
- type: :development
264
- version_requirements: *id016
265
249
  description: This gem allows you to deploy your rails application to the Engine Yard cloud directly from the command line.
266
250
  email: cloud@engineyard.com
267
251
  executables:
@@ -294,10 +278,10 @@ files:
294
278
  - lib/engineyard/model.rb
295
279
  - lib/engineyard/repo.rb
296
280
  - lib/engineyard/resolver.rb
281
+ - lib/engineyard/rest_client_ext.rb
297
282
  - lib/engineyard/ruby_ext.rb
298
283
  - lib/engineyard/thor.rb
299
284
  - lib/engineyard/version.rb
300
- - lib/engineyard-api-client.rb
301
285
  - lib/engineyard.rb
302
286
  - LICENSE
303
287
  - README.rdoc
@@ -377,7 +361,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
361
  requirements: []
378
362
 
379
363
  rubyforge_project:
380
- rubygems_version: 1.5.0
364
+ rubygems_version: 1.4.2
381
365
  signing_key:
382
366
  specification_version: 3
383
367
  summary: Command-line deployment for the Engine Yard cloud
@@ -1,135 +0,0 @@
1
- require 'engineyard/model'
2
-
3
- module EngineYard
4
- class APIClient
5
- attr_reader :token
6
-
7
- USER_AGENT_STRING = "EngineYardAPIClient/#{VERSION}"
8
-
9
- def initialize(token = nil)
10
- @token ||= token
11
- @token ||= self.class.read_token
12
- raise ArgumentError, "EY Cloud API token required" unless @token
13
- end
14
-
15
- def ==(other)
16
- raise ArgumentError unless other.is_a?(self.class)
17
- self.token == other.token
18
- end
19
-
20
- def request(url, opts={})
21
- opts[:headers] ||= {}
22
- opts[:headers]["X-EY-Cloud-Token"] = token
23
- EY.ui.debug("Token", token)
24
- self.class.request(url, opts)
25
- end
26
-
27
- def environments
28
- @environments ||= Environment.from_array(request('/environments')["environments"], :api => self)
29
- end
30
-
31
- def apps
32
- @apps ||= App.from_array(request('/apps')["apps"], :api => self)
33
- end
34
-
35
- def resolver
36
- @resolver ||= Resolver.new(self)
37
- end
38
-
39
- def apps_for_repo(repo)
40
- repo.fail_on_no_remotes!
41
- apps.find_all {|a| repo.has_remote?(a.repository_uri) }
42
- end
43
-
44
- class InvalidCredentials < EY::AppCloudClient::Error; end
45
- class RequestFailed < EY::AppCloudClient::Error; end
46
-
47
- def self.request(path, opts={})
48
- require 'rest_client'
49
- require 'json'
50
-
51
- url = EY.config.endpoint + "api/v2#{path}"
52
- method = (opts.delete(:method) || 'get').to_s.downcase.to_sym
53
- params = opts.delete(:params) || {}
54
- headers = opts.delete(:headers) || {}
55
- headers["Accept"] ||= "application/json"
56
- headers["User-Agent"] = USER_AGENT_STRING
57
-
58
- begin
59
- EY.ui.debug("Request", "#{method.to_s.upcase} #{url}")
60
- case method
61
- when :get, :delete, :head
62
- url.query = RestClient::Payload::UrlEncoded.new(params).to_s
63
- resp = RestClient.send(method, url.to_s, headers)
64
- else
65
- resp = RestClient.send(method, url.to_s, params, headers)
66
- end
67
- rescue RestClient::Unauthorized
68
- raise InvalidCredentials
69
- rescue Errno::ECONNREFUSED
70
- raise RequestFailed, "Could not reach the cloud API"
71
- rescue RestClient::ResourceNotFound
72
- raise RequestFailed, "The requested resource could not be found"
73
- rescue RestClient::BadGateway
74
- raise RequestFailed, "AppCloud API is temporarily unavailable. Please try again soon."
75
- rescue RestClient::RequestFailed => e
76
- raise RequestFailed, "#{e.message} #{e.response}"
77
- rescue OpenSSL::SSL::SSLError
78
- raise RequestFailed, "SSL is misconfigured on your cloud"
79
- end
80
-
81
- if resp.body.empty?
82
- data = ''
83
- elsif resp.headers[:content_type] =~ /application\/json/
84
- begin
85
- data = JSON.parse(resp.body)
86
- EY.ui.debug("Response", data)
87
- rescue JSON::ParserError
88
- EY.ui.debug("Raw response", resp.body)
89
- raise RequestFailed, "Response was not valid JSON."
90
- end
91
- else
92
- data = resp.body
93
- end
94
-
95
- data
96
- end
97
-
98
- def self.fetch_token(email, password)
99
- api_token = request("/authenticate", :method => "post",
100
- :params => { :email => email, :password => password })["api_token"]
101
- save_token(api_token)
102
- api_token
103
- end
104
-
105
- def self.read_token(file = nil)
106
- file ||= ENV['EYRC'] || File.expand_path("~/.eyrc")
107
- return false unless File.exists?(file)
108
-
109
- require 'yaml'
110
-
111
- data = YAML.load_file(file)
112
- if EY.config.default_endpoint?
113
- data["api_token"]
114
- else
115
- (data[EY.config.endpoint.to_s] || {})["api_token"]
116
- end
117
- end
118
-
119
- def self.save_token(token, file = nil)
120
- file ||= ENV['EYRC'] || File.expand_path("~/.eyrc")
121
- require 'yaml'
122
-
123
- data = File.exists?(file) ? YAML.load_file(file) : {}
124
- if EY.config.default_endpoint?
125
- data.merge!("api_token" => token)
126
- else
127
- data.merge!(EY.config.endpoint.to_s => {"api_token" => token})
128
- end
129
-
130
- File.open(file, "w"){|f| YAML.dump(data, f) }
131
- true
132
- end
133
-
134
- end # API
135
- end # EY