engineyard 1.3.33 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -16,7 +16,7 @@ The ey.yml file allows options to be saved for each environment to which an appl
16
16
  migration_command: rake fancy:migrate
17
17
  branch: deploy
18
18
 
19
- This ey.yml file wile turn off default migrations, set the default command to "rake fancy:migrate" and set the default deploy branch to "deploy".
19
+ This ey.yml file will turn off default migrations, set the default command to "rake fancy:migrate" and set the default deploy branch to "deploy".
20
20
 
21
21
  == Commands
22
22
 
@@ -41,6 +41,10 @@ module EY
41
41
  apps.find_all {|a| repo.has_remote?(a.repository_uri) }
42
42
  end
43
43
 
44
+ def user
45
+ EY::Model::User.from_hash(request('/current_user')['user'])
46
+ end
47
+
44
48
  class InvalidCredentials < EY::Error; end
45
49
  class RequestFailed < EY::Error; end
46
50
 
@@ -345,5 +345,11 @@ module EY
345
345
  environment.launch
346
346
  end
347
347
 
348
+ desc "whoami", "Who am I logged in as?"
349
+ def whoami
350
+ user = api.user
351
+ EY.ui.say "#{user.name} (#{user.email})"
352
+ end
353
+
348
354
  end # CLI
349
355
  end # EY
@@ -7,5 +7,6 @@ module EY
7
7
  autoload :Environment, 'engineyard/model/environment'
8
8
  autoload :Log, 'engineyard/model/log'
9
9
  autoload :Instance, 'engineyard/model/instance'
10
+ autoload :User, 'engineyard/model/user'
10
11
  end
11
12
  end
@@ -0,0 +1,6 @@
1
+ module EY
2
+ module Model
3
+ class User < ApiStruct.new(:id, :name, :email)
4
+ end
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module EY
2
- VERSION = '1.3.33'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'net/ssh'
3
2
 
4
3
  describe "ey deploy without an eyrc file" do
5
4
 
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe "ey whoami" do
4
+ context "logged in" do
5
+ given "integration"
6
+
7
+ before(:all) do
8
+ api_scenario "empty"
9
+ end
10
+
11
+ it "outputs the currently logged in user" do
12
+ ey %w[whoami]
13
+ @out.should include("User (test@test.test)")
14
+ end
15
+ end
16
+
17
+ context "not logged in" do
18
+ given "integration without an eyrc file"
19
+
20
+ before(:each) do
21
+ FileUtils.rm_rf(ENV['EYRC'])
22
+ api_scenario "empty"
23
+ end
24
+
25
+ it "prompts for authentication before outputting the logged in user" do
26
+ ey(%w[whoami], :hide_err => true) do |input|
27
+ input.puts("test@test.test")
28
+ input.puts("test")
29
+ end
30
+
31
+ @out.should include("We need to fetch your API token; please log in.")
32
+ @out.should include("Email:")
33
+ @out.should include("Password:")
34
+
35
+ @out.should include("User (test@test.test)")
36
+ end
37
+ end
38
+ end
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,7 @@ EY_ROOT = File.expand_path("../..", __FILE__)
6
6
  require 'rubygems'
7
7
  require 'bundler/setup'
8
8
  require 'escape'
9
+ require 'net/ssh'
9
10
 
10
11
  # Bundled gems
11
12
  require 'fakeweb'
@@ -43,6 +43,10 @@ class FakeAwsm < Sinatra::Base
43
43
  {"ok" => "true"}.to_json
44
44
  end
45
45
 
46
+ get "/api/v2/current_user" do
47
+ { "user" => { "id" => 1, "name" => "User", "email" => "test@test.test" } }.to_json
48
+ end
49
+
46
50
  get "/api/v2/apps" do
47
51
  raise('No user agent header') unless env['HTTP_USER_AGENT'] =~ %r#^EngineYardCLI/#
48
52
  {"apps" => @@cloud_mock.apps}.to_json
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: 89
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 3
9
- - 33
10
- version: 1.3.33
8
+ - 4
9
+ - 0
10
+ version: 1.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - EY Cloud Team
@@ -15,13 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-27 00:00:00 -04:00
18
+ date: 2011-10-07 00:00:00 -07:00
19
19
  default_executable: ey
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
+ name: thor
22
23
  prerelease: false
23
24
  type: :runtime
24
- name: thor
25
25
  version_requirements: &id001 !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
@@ -35,9 +35,9 @@ dependencies:
35
35
  version: 0.14.6
36
36
  requirement: *id001
37
37
  - !ruby/object:Gem::Dependency
38
+ name: rest-client
38
39
  prerelease: false
39
40
  type: :runtime
40
- name: rest-client
41
41
  version_requirements: &id002 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
@@ -51,9 +51,9 @@ dependencies:
51
51
  version: 1.6.0
52
52
  requirement: *id002
53
53
  - !ruby/object:Gem::Dependency
54
+ name: highline
54
55
  prerelease: false
55
56
  type: :runtime
56
- name: highline
57
57
  version_requirements: &id003 !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements:
@@ -67,9 +67,9 @@ dependencies:
67
67
  version: 1.6.1
68
68
  requirement: *id003
69
69
  - !ruby/object:Gem::Dependency
70
+ name: json_pure
70
71
  prerelease: false
71
72
  type: :runtime
72
- name: json_pure
73
73
  version_requirements: &id004 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
@@ -81,9 +81,9 @@ dependencies:
81
81
  version: "0"
82
82
  requirement: *id004
83
83
  - !ruby/object:Gem::Dependency
84
+ name: escape
84
85
  prerelease: false
85
86
  type: :runtime
86
- name: escape
87
87
  version_requirements: &id005 !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
@@ -97,25 +97,25 @@ dependencies:
97
97
  version: 0.0.4
98
98
  requirement: *id005
99
99
  - !ruby/object:Gem::Dependency
100
+ name: engineyard-serverside-adapter
100
101
  prerelease: false
101
102
  type: :runtime
102
- name: engineyard-serverside-adapter
103
103
  version_requirements: &id006 !ruby/object:Gem::Requirement
104
104
  none: false
105
105
  requirements:
106
106
  - - "="
107
107
  - !ruby/object:Gem::Version
108
- hash: 39
108
+ hash: 3
109
109
  segments:
110
110
  - 1
111
- - 4
112
- - 16
113
- version: 1.4.16
111
+ - 5
112
+ - 0
113
+ version: 1.5.0
114
114
  requirement: *id006
115
115
  - !ruby/object:Gem::Dependency
116
+ name: net-ssh
116
117
  prerelease: false
117
118
  type: :runtime
118
- name: net-ssh
119
119
  version_requirements: &id007 !ruby/object:Gem::Requirement
120
120
  none: false
121
121
  requirements:
@@ -129,9 +129,9 @@ dependencies:
129
129
  version: 2.1.0
130
130
  requirement: *id007
131
131
  - !ruby/object:Gem::Dependency
132
+ name: launchy
132
133
  prerelease: false
133
134
  type: :runtime
134
- name: launchy
135
135
  version_requirements: &id008 !ruby/object:Gem::Requirement
136
136
  none: false
137
137
  requirements:
@@ -145,9 +145,9 @@ dependencies:
145
145
  version: 2.0.5
146
146
  requirement: *id008
147
147
  - !ruby/object:Gem::Dependency
148
+ name: rspec
148
149
  prerelease: false
149
150
  type: :development
150
- name: rspec
151
151
  version_requirements: &id009 !ruby/object:Gem::Requirement
152
152
  none: false
153
153
  requirements:
@@ -161,9 +161,9 @@ dependencies:
161
161
  version: 1.3.0
162
162
  requirement: *id009
163
163
  - !ruby/object:Gem::Dependency
164
+ name: rake
164
165
  prerelease: false
165
166
  type: :development
166
- name: rake
167
167
  version_requirements: &id010 !ruby/object:Gem::Requirement
168
168
  none: false
169
169
  requirements:
@@ -175,9 +175,9 @@ dependencies:
175
175
  version: "0"
176
176
  requirement: *id010
177
177
  - !ruby/object:Gem::Dependency
178
+ name: fakeweb
178
179
  prerelease: false
179
180
  type: :development
180
- name: fakeweb
181
181
  version_requirements: &id011 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
@@ -189,9 +189,9 @@ dependencies:
189
189
  version: "0"
190
190
  requirement: *id011
191
191
  - !ruby/object:Gem::Dependency
192
+ name: fakeweb-matcher
192
193
  prerelease: false
193
194
  type: :development
194
- name: fakeweb-matcher
195
195
  version_requirements: &id012 !ruby/object:Gem::Requirement
196
196
  none: false
197
197
  requirements:
@@ -203,9 +203,9 @@ dependencies:
203
203
  version: "0"
204
204
  requirement: *id012
205
205
  - !ruby/object:Gem::Dependency
206
+ name: fakefs
206
207
  prerelease: false
207
208
  type: :development
208
- name: fakefs
209
209
  version_requirements: &id013 !ruby/object:Gem::Requirement
210
210
  none: false
211
211
  requirements:
@@ -217,9 +217,9 @@ dependencies:
217
217
  version: "0"
218
218
  requirement: *id013
219
219
  - !ruby/object:Gem::Dependency
220
+ name: sinatra
220
221
  prerelease: false
221
222
  type: :development
222
- name: sinatra
223
223
  version_requirements: &id014 !ruby/object:Gem::Requirement
224
224
  none: false
225
225
  requirements:
@@ -231,9 +231,9 @@ dependencies:
231
231
  version: "0"
232
232
  requirement: *id014
233
233
  - !ruby/object:Gem::Dependency
234
+ name: realweb
234
235
  prerelease: false
235
236
  type: :development
236
- name: realweb
237
237
  version_requirements: &id015 !ruby/object:Gem::Requirement
238
238
  none: false
239
239
  requirements:
@@ -247,9 +247,9 @@ dependencies:
247
247
  version: 0.1.6
248
248
  requirement: *id015
249
249
  - !ruby/object:Gem::Dependency
250
+ name: open4
250
251
  prerelease: false
251
252
  type: :development
252
- name: open4
253
253
  version_requirements: &id016 !ruby/object:Gem::Requirement
254
254
  none: false
255
255
  requirements:
@@ -291,6 +291,7 @@ files:
291
291
  - lib/engineyard/model/environment.rb
292
292
  - lib/engineyard/model/instance.rb
293
293
  - lib/engineyard/model/log.rb
294
+ - lib/engineyard/model/user.rb
294
295
  - lib/engineyard/model.rb
295
296
  - lib/engineyard/repo.rb
296
297
  - lib/engineyard/resolver.rb
@@ -326,6 +327,7 @@ files:
326
327
  - spec/ey/status_spec.rb
327
328
  - spec/ey/web/disable_spec.rb
328
329
  - spec/ey/web/enable_spec.rb
330
+ - spec/ey/whoami_spec.rb
329
331
  - spec/spec_helper.rb
330
332
  - spec/support/bundled_ey
331
333
  - spec/support/fake_awsm.ru
@@ -377,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
377
379
  requirements: []
378
380
 
379
381
  rubyforge_project:
380
- rubygems_version: 1.5.2
382
+ rubygems_version: 1.5.0
381
383
  signing_key:
382
384
  specification_version: 3
383
385
  summary: Command-line deployment for the Engine Yard cloud
@@ -407,6 +409,7 @@ test_files:
407
409
  - spec/ey/status_spec.rb
408
410
  - spec/ey/web/disable_spec.rb
409
411
  - spec/ey/web/enable_spec.rb
412
+ - spec/ey/whoami_spec.rb
410
413
  - spec/spec_helper.rb
411
414
  - spec/support/bundled_ey
412
415
  - spec/support/fake_awsm.ru