engineyard 1.4.29 → 1.7.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +139 -4
- data/bin/ey +1 -7
- data/lib/engineyard.rb +1 -22
- data/lib/engineyard/cli.rb +192 -94
- data/lib/engineyard/cli/#recipes.rb# +32 -0
- data/lib/engineyard/cli/api.rb +42 -28
- data/lib/engineyard/cli/recipes.rb +13 -6
- data/lib/engineyard/cli/ui.rb +103 -42
- data/lib/engineyard/cli/web.rb +16 -10
- data/lib/engineyard/config.rb +92 -18
- data/lib/engineyard/deploy_config.rb +66 -0
- data/lib/engineyard/deploy_config/migrate.rb +125 -0
- data/lib/engineyard/deploy_config/ref.rb +56 -0
- data/lib/engineyard/error.rb +38 -78
- data/lib/engineyard/repo.rb +75 -27
- data/lib/engineyard/serverside_runner.rb +133 -0
- data/lib/engineyard/thor.rb +110 -18
- data/lib/engineyard/version.rb +1 -1
- data/spec/engineyard/cli/api_spec.rb +10 -16
- data/spec/engineyard/cli_spec.rb +0 -11
- data/spec/engineyard/config_spec.rb +1 -8
- data/spec/engineyard/deploy_config_spec.rb +203 -0
- data/spec/engineyard/eyrc_spec.rb +2 -0
- data/spec/engineyard/repo_spec.rb +57 -34
- data/spec/ey/deploy_spec.rb +102 -52
- data/spec/ey/list_environments_spec.rb +69 -14
- data/spec/ey/login_spec.rb +11 -7
- data/spec/ey/logout_spec.rb +4 -4
- data/spec/ey/logs_spec.rb +6 -6
- data/spec/ey/recipes/apply_spec.rb +1 -1
- data/spec/ey/recipes/download_spec.rb +1 -1
- data/spec/ey/recipes/upload_spec.rb +6 -6
- data/spec/ey/rollback_spec.rb +3 -3
- data/spec/ey/ssh_spec.rb +9 -9
- data/spec/ey/status_spec.rb +2 -2
- data/spec/ey/whoami_spec.rb +9 -8
- data/spec/spec_helper.rb +18 -15
- data/spec/support/{fake_awsm.rb → git_repos.rb} +0 -14
- data/spec/support/helpers.rb +84 -28
- data/spec/support/matchers.rb +0 -16
- data/spec/support/shared_behavior.rb +83 -103
- metadata +65 -51
- data/lib/engineyard/api.rb +0 -117
- data/lib/engineyard/collection.rb +0 -7
- data/lib/engineyard/collection/abstract.rb +0 -71
- data/lib/engineyard/collection/apps.rb +0 -8
- data/lib/engineyard/collection/environments.rb +0 -8
- data/lib/engineyard/model.rb +0 -12
- data/lib/engineyard/model/account.rb +0 -8
- data/lib/engineyard/model/api_struct.rb +0 -33
- data/lib/engineyard/model/app.rb +0 -32
- data/lib/engineyard/model/deployment.rb +0 -90
- data/lib/engineyard/model/environment.rb +0 -194
- data/lib/engineyard/model/instance.rb +0 -166
- data/lib/engineyard/model/log.rb +0 -9
- data/lib/engineyard/model/user.rb +0 -6
- data/lib/engineyard/resolver.rb +0 -134
- data/lib/engineyard/rest_client_ext.rb +0 -9
- data/lib/engineyard/ruby_ext.rb +0 -9
- data/spec/engineyard/api_spec.rb +0 -39
- data/spec/engineyard/collection/apps_spec.rb +0 -16
- data/spec/engineyard/collection/environments_spec.rb +0 -16
- data/spec/engineyard/model/api_struct_spec.rb +0 -41
- data/spec/engineyard/model/environment_spec.rb +0 -198
- data/spec/engineyard/model/instance_spec.rb +0 -27
- data/spec/engineyard/resolver_spec.rb +0 -112
- data/spec/support/fake_awsm.ru +0 -245
- data/spec/support/scenarios.rb +0 -417
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.7.0.pre2
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- EY Cloud Team
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - '='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.
|
85
|
+
version: 1.7.0.pre2
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,23 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - '='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.
|
93
|
+
version: 1.7.0.pre2
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: engineyard-cloud-client
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.1.2
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.1.2
|
94
110
|
- !ruby/object:Gem::Dependency
|
95
111
|
name: net-ssh
|
96
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -251,6 +267,38 @@ dependencies:
|
|
251
267
|
- - ~>
|
252
268
|
- !ruby/object:Gem::Version
|
253
269
|
version: 1.0.1
|
270
|
+
- !ruby/object:Gem::Dependency
|
271
|
+
name: hashie
|
272
|
+
requirement: !ruby/object:Gem::Requirement
|
273
|
+
none: false
|
274
|
+
requirements:
|
275
|
+
- - ! '>='
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: '0'
|
278
|
+
type: :development
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
none: false
|
282
|
+
requirements:
|
283
|
+
- - ! '>='
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
- !ruby/object:Gem::Dependency
|
287
|
+
name: gitable
|
288
|
+
requirement: !ruby/object:Gem::Requirement
|
289
|
+
none: false
|
290
|
+
requirements:
|
291
|
+
- - ! '>='
|
292
|
+
- !ruby/object:Gem::Version
|
293
|
+
version: '0'
|
294
|
+
type: :development
|
295
|
+
prerelease: false
|
296
|
+
version_requirements: !ruby/object:Gem::Requirement
|
297
|
+
none: false
|
298
|
+
requirements:
|
299
|
+
- - ! '>='
|
300
|
+
- !ruby/object:Gem::Version
|
301
|
+
version: '0'
|
254
302
|
description: This gem allows you to deploy your rails application to the Engine Yard
|
255
303
|
cloud directly from the command line.
|
256
304
|
email: cloud@engineyard.com
|
@@ -260,32 +308,20 @@ extensions: []
|
|
260
308
|
extra_rdoc_files: []
|
261
309
|
files:
|
262
310
|
- bin/ey
|
263
|
-
- lib/engineyard/
|
311
|
+
- lib/engineyard/cli/#recipes.rb#
|
264
312
|
- lib/engineyard/cli/api.rb
|
265
313
|
- lib/engineyard/cli/recipes.rb
|
266
314
|
- lib/engineyard/cli/ui.rb
|
267
315
|
- lib/engineyard/cli/web.rb
|
268
316
|
- lib/engineyard/cli.rb
|
269
|
-
- lib/engineyard/collection/abstract.rb
|
270
|
-
- lib/engineyard/collection/apps.rb
|
271
|
-
- lib/engineyard/collection/environments.rb
|
272
|
-
- lib/engineyard/collection.rb
|
273
317
|
- lib/engineyard/config.rb
|
318
|
+
- lib/engineyard/deploy_config/migrate.rb
|
319
|
+
- lib/engineyard/deploy_config/ref.rb
|
320
|
+
- lib/engineyard/deploy_config.rb
|
274
321
|
- lib/engineyard/error.rb
|
275
322
|
- lib/engineyard/eyrc.rb
|
276
|
-
- lib/engineyard/model/account.rb
|
277
|
-
- lib/engineyard/model/api_struct.rb
|
278
|
-
- lib/engineyard/model/app.rb
|
279
|
-
- lib/engineyard/model/deployment.rb
|
280
|
-
- lib/engineyard/model/environment.rb
|
281
|
-
- lib/engineyard/model/instance.rb
|
282
|
-
- lib/engineyard/model/log.rb
|
283
|
-
- lib/engineyard/model/user.rb
|
284
|
-
- lib/engineyard/model.rb
|
285
323
|
- lib/engineyard/repo.rb
|
286
|
-
- lib/engineyard/
|
287
|
-
- lib/engineyard/rest_client_ext.rb
|
288
|
-
- lib/engineyard/ruby_ext.rb
|
324
|
+
- lib/engineyard/serverside_runner.rb
|
289
325
|
- lib/engineyard/thor.rb
|
290
326
|
- lib/engineyard/version.rb
|
291
327
|
- lib/engineyard.rb
|
@@ -322,18 +358,12 @@ files:
|
|
322
358
|
- lib/vendor/thor/README.md
|
323
359
|
- LICENSE
|
324
360
|
- README.rdoc
|
325
|
-
- spec/engineyard/api_spec.rb
|
326
361
|
- spec/engineyard/cli/api_spec.rb
|
327
362
|
- spec/engineyard/cli_spec.rb
|
328
|
-
- spec/engineyard/collection/apps_spec.rb
|
329
|
-
- spec/engineyard/collection/environments_spec.rb
|
330
363
|
- spec/engineyard/config_spec.rb
|
364
|
+
- spec/engineyard/deploy_config_spec.rb
|
331
365
|
- spec/engineyard/eyrc_spec.rb
|
332
|
-
- spec/engineyard/model/api_struct_spec.rb
|
333
|
-
- spec/engineyard/model/environment_spec.rb
|
334
|
-
- spec/engineyard/model/instance_spec.rb
|
335
366
|
- spec/engineyard/repo_spec.rb
|
336
|
-
- spec/engineyard/resolver_spec.rb
|
337
367
|
- spec/engineyard_spec.rb
|
338
368
|
- spec/ey/deploy_spec.rb
|
339
369
|
- spec/ey/ey_spec.rb
|
@@ -353,13 +383,11 @@ files:
|
|
353
383
|
- spec/ey/whoami_spec.rb
|
354
384
|
- spec/spec_helper.rb
|
355
385
|
- spec/support/bundled_ey
|
356
|
-
- spec/support/fake_awsm.rb
|
357
|
-
- spec/support/fake_awsm.ru
|
358
386
|
- spec/support/fixture_recipes.tgz
|
387
|
+
- spec/support/git_repos.rb
|
359
388
|
- spec/support/helpers.rb
|
360
389
|
- spec/support/matchers.rb
|
361
390
|
- spec/support/ruby_ext.rb
|
362
|
-
- spec/support/scenarios.rb
|
363
391
|
- spec/support/shared_behavior.rb
|
364
392
|
homepage: http://github.com/engineyard/engineyard
|
365
393
|
licenses: []
|
@@ -377,37 +405,25 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
377
405
|
- - ! '>='
|
378
406
|
- !ruby/object:Gem::Version
|
379
407
|
version: '0'
|
380
|
-
segments:
|
381
|
-
- 0
|
382
|
-
hash: -1428275579656453784
|
383
408
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
384
409
|
none: false
|
385
410
|
requirements:
|
386
|
-
- - ! '
|
411
|
+
- - ! '>'
|
387
412
|
- !ruby/object:Gem::Version
|
388
|
-
version:
|
389
|
-
segments:
|
390
|
-
- 0
|
391
|
-
hash: -1428275579656453784
|
413
|
+
version: 1.3.1
|
392
414
|
requirements: []
|
393
415
|
rubyforge_project:
|
394
|
-
rubygems_version: 1.8.
|
416
|
+
rubygems_version: 1.8.21
|
395
417
|
signing_key:
|
396
418
|
specification_version: 3
|
397
419
|
summary: Command-line deployment for the Engine Yard cloud
|
398
420
|
test_files:
|
399
|
-
- spec/engineyard/api_spec.rb
|
400
421
|
- spec/engineyard/cli/api_spec.rb
|
401
422
|
- spec/engineyard/cli_spec.rb
|
402
|
-
- spec/engineyard/collection/apps_spec.rb
|
403
|
-
- spec/engineyard/collection/environments_spec.rb
|
404
423
|
- spec/engineyard/config_spec.rb
|
424
|
+
- spec/engineyard/deploy_config_spec.rb
|
405
425
|
- spec/engineyard/eyrc_spec.rb
|
406
|
-
- spec/engineyard/model/api_struct_spec.rb
|
407
|
-
- spec/engineyard/model/environment_spec.rb
|
408
|
-
- spec/engineyard/model/instance_spec.rb
|
409
426
|
- spec/engineyard/repo_spec.rb
|
410
|
-
- spec/engineyard/resolver_spec.rb
|
411
427
|
- spec/engineyard_spec.rb
|
412
428
|
- spec/ey/deploy_spec.rb
|
413
429
|
- spec/ey/ey_spec.rb
|
@@ -427,11 +443,9 @@ test_files:
|
|
427
443
|
- spec/ey/whoami_spec.rb
|
428
444
|
- spec/spec_helper.rb
|
429
445
|
- spec/support/bundled_ey
|
430
|
-
- spec/support/fake_awsm.rb
|
431
|
-
- spec/support/fake_awsm.ru
|
432
446
|
- spec/support/fixture_recipes.tgz
|
447
|
+
- spec/support/git_repos.rb
|
433
448
|
- spec/support/helpers.rb
|
434
449
|
- spec/support/matchers.rb
|
435
450
|
- spec/support/ruby_ext.rb
|
436
|
-
- spec/support/scenarios.rb
|
437
451
|
- spec/support/shared_behavior.rb
|
data/lib/engineyard/api.rb
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
require 'engineyard/model'
|
2
|
-
require 'yaml'
|
3
|
-
require 'rest_client'
|
4
|
-
require 'engineyard/rest_client_ext'
|
5
|
-
require 'json'
|
6
|
-
require 'engineyard/eyrc'
|
7
|
-
|
8
|
-
module EY
|
9
|
-
class API
|
10
|
-
attr_reader :token
|
11
|
-
|
12
|
-
USER_AGENT_STRING = "EngineYardCLI/#{VERSION}"
|
13
|
-
|
14
|
-
def initialize(token = nil)
|
15
|
-
@token = token
|
16
|
-
@token ||= EY::EYRC.load.api_token
|
17
|
-
raise ArgumentError, "EY Cloud API token required" unless @token
|
18
|
-
end
|
19
|
-
|
20
|
-
def ==(other)
|
21
|
-
raise ArgumentError unless other.is_a?(self.class)
|
22
|
-
self.token == other.token
|
23
|
-
end
|
24
|
-
|
25
|
-
def request(url, opts={})
|
26
|
-
opts[:headers] ||= {}
|
27
|
-
opts[:headers]["X-EY-Cloud-Token"] = token
|
28
|
-
EY.ui.debug("Token", token)
|
29
|
-
self.class.request(url, opts)
|
30
|
-
end
|
31
|
-
|
32
|
-
def environments
|
33
|
-
@environments ||= EY::Model::Environment.from_array(request('/environments')["environments"], :api => self)
|
34
|
-
end
|
35
|
-
|
36
|
-
def apps
|
37
|
-
@apps ||= EY::Model::App.from_array(request('/apps')["apps"], :api => self)
|
38
|
-
end
|
39
|
-
|
40
|
-
def resolver
|
41
|
-
@resolver ||= Resolver.new(self)
|
42
|
-
end
|
43
|
-
|
44
|
-
def apps_for_repo(repo)
|
45
|
-
repo.fail_on_no_remotes!
|
46
|
-
apps.find_all {|a| repo.has_remote?(a.repository_uri) }
|
47
|
-
end
|
48
|
-
|
49
|
-
def user
|
50
|
-
EY::Model::User.from_hash(request('/current_user')['user'])
|
51
|
-
end
|
52
|
-
|
53
|
-
class InvalidCredentials < EY::Error; end
|
54
|
-
class RequestFailed < EY::Error; end
|
55
|
-
class ResourceNotFound < RequestFailed; end
|
56
|
-
|
57
|
-
def self.request(path, opts={})
|
58
|
-
require 'rest_client'
|
59
|
-
require 'engineyard/rest_client_ext'
|
60
|
-
require 'json'
|
61
|
-
|
62
|
-
url = EY.config.endpoint + "api/v2#{path}"
|
63
|
-
method = (opts.delete(:method) || 'get').to_s.downcase.to_sym
|
64
|
-
params = opts.delete(:params) || {}
|
65
|
-
headers = opts.delete(:headers) || {}
|
66
|
-
headers["Accept"] ||= "application/json"
|
67
|
-
headers["User-Agent"] = USER_AGENT_STRING
|
68
|
-
|
69
|
-
begin
|
70
|
-
EY.ui.debug("Request", "#{method.to_s.upcase} #{url}")
|
71
|
-
case method
|
72
|
-
when :get, :delete, :head
|
73
|
-
url.query = RestClient::Payload::UrlEncoded.new(params).to_s
|
74
|
-
resp = RestClient.send(method, url.to_s, headers)
|
75
|
-
else
|
76
|
-
resp = RestClient.send(method, url.to_s, params, headers)
|
77
|
-
end
|
78
|
-
rescue RestClient::Unauthorized
|
79
|
-
raise InvalidCredentials
|
80
|
-
rescue Errno::ECONNREFUSED
|
81
|
-
raise RequestFailed, "Could not reach the cloud API"
|
82
|
-
rescue RestClient::ResourceNotFound
|
83
|
-
raise ResourceNotFound, "The requested resource could not be found"
|
84
|
-
rescue RestClient::BadGateway
|
85
|
-
raise RequestFailed, "EY Cloud API is temporarily unavailable. Please try again soon."
|
86
|
-
rescue RestClient::RequestFailed => e
|
87
|
-
raise RequestFailed, "#{e.message} #{e.response}"
|
88
|
-
rescue OpenSSL::SSL::SSLError
|
89
|
-
raise RequestFailed, "SSL is misconfigured on your cloud"
|
90
|
-
end
|
91
|
-
|
92
|
-
if resp.body.empty?
|
93
|
-
data = ''
|
94
|
-
elsif resp.headers[:content_type] =~ /application\/json/
|
95
|
-
begin
|
96
|
-
data = JSON.parse(resp.body)
|
97
|
-
EY.ui.debug("Response", data)
|
98
|
-
rescue JSON::ParserError
|
99
|
-
EY.ui.debug("Raw response", resp.body)
|
100
|
-
raise RequestFailed, "Response was not valid JSON."
|
101
|
-
end
|
102
|
-
else
|
103
|
-
data = resp.body
|
104
|
-
end
|
105
|
-
|
106
|
-
data
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.fetch_token(email, password)
|
110
|
-
api_token = request("/authenticate", :method => "post",
|
111
|
-
:params => { :email => email, :password => password })["api_token"]
|
112
|
-
EY::EYRC.load.api_token = api_token
|
113
|
-
api_token
|
114
|
-
end
|
115
|
-
|
116
|
-
end # API
|
117
|
-
end # EY
|
@@ -1,71 +0,0 @@
|
|
1
|
-
require 'engineyard/error'
|
2
|
-
|
3
|
-
module EY
|
4
|
-
module Collection
|
5
|
-
class Abstract
|
6
|
-
COLLAB_MESSAGE = <<-MSG
|
7
|
-
\nThis error is due to having access to another account's resources via the collaboration feature.
|
8
|
-
Specify --account ACCOUNT_NAME to resolve this ambiguity.
|
9
|
-
MSG
|
10
|
-
|
11
|
-
include Enumerable
|
12
|
-
|
13
|
-
def initialize(contents)
|
14
|
-
@contents = contents ? contents.dup.flatten : []
|
15
|
-
end
|
16
|
-
|
17
|
-
def each(&block)
|
18
|
-
@contents.each(&block)
|
19
|
-
end
|
20
|
-
|
21
|
-
def to_a
|
22
|
-
@contents
|
23
|
-
end
|
24
|
-
|
25
|
-
def named(name, account_name=nil)
|
26
|
-
candidates = @contents.find_all do |x|
|
27
|
-
if account_name
|
28
|
-
x.name.downcase == name.downcase && x.account.name.downcase == account_name.downcase
|
29
|
-
else
|
30
|
-
x.name.downcase == name.downcase
|
31
|
-
end
|
32
|
-
end
|
33
|
-
if candidates.size > 1
|
34
|
-
raise ambiguous_error(name, candidates.map {|e| e.name}, COLLAB_MESSAGE )
|
35
|
-
end
|
36
|
-
candidates.first
|
37
|
-
end
|
38
|
-
|
39
|
-
def match_one(name_part)
|
40
|
-
named(name_part) || find_by_unambiguous_substring(name_part)
|
41
|
-
end
|
42
|
-
|
43
|
-
def match_one!(name_part)
|
44
|
-
match_one(name_part) or raise invalid_error(name_part)
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def find_by_unambiguous_substring(name_part)
|
50
|
-
candidates = @contents.find_all{|e| e.name.downcase[name_part.downcase] }
|
51
|
-
if candidates.size > 1
|
52
|
-
raise ambiguous_error(name_part, candidates.map {|e| e.name})
|
53
|
-
end
|
54
|
-
candidates.first
|
55
|
-
end
|
56
|
-
|
57
|
-
class << self
|
58
|
-
attr_accessor :invalid_error, :ambiguous_error
|
59
|
-
end
|
60
|
-
|
61
|
-
def invalid_error(*args, &blk)
|
62
|
-
self.class.invalid_error.new(*args, &blk)
|
63
|
-
end
|
64
|
-
|
65
|
-
def ambiguous_error(*args, &blk)
|
66
|
-
self.class.ambiguous_error.new(*args, &blk)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/lib/engineyard/model.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
module EY
|
2
|
-
module Model
|
3
|
-
require 'engineyard/model/api_struct'
|
4
|
-
require 'engineyard/model/account'
|
5
|
-
require 'engineyard/model/app'
|
6
|
-
require 'engineyard/model/deployment'
|
7
|
-
require 'engineyard/model/environment'
|
8
|
-
require 'engineyard/model/log'
|
9
|
-
require 'engineyard/model/instance'
|
10
|
-
require 'engineyard/model/user'
|
11
|
-
end
|
12
|
-
end
|