engineyard 0.2.7 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/engineyard.rb +1 -1
  2. data/lib/engineyard/cli.rb +26 -21
  3. metadata +3 -3
data/lib/engineyard.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module EY
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.9"
3
3
 
4
4
  autoload :Account, 'engineyard/account'
5
5
  autoload :API, 'engineyard/api'
@@ -6,7 +6,7 @@ require 'engineyard/cli/error'
6
6
 
7
7
  module EY
8
8
  class CLI < Thor
9
- EYSD_VERSION = "~>0.2.4.pre1"
9
+ EYSD_VERSION = "~>0.2.4"
10
10
 
11
11
  autoload :API, 'engineyard/cli/api'
12
12
  autoload :UI, 'engineyard/cli/ui'
@@ -106,27 +106,15 @@ module EY
106
106
  desc "environments [--all]", "List cloud environments for this app, or all environments"
107
107
  method_option :all, :type => :boolean, :aliases => %(-a)
108
108
  def environments
109
- app = account.app_for_repo(repo)
110
- if options[:all] || !app
111
- envs = account.environments
112
- if envs.empty?
113
- EY.ui.say %|You do not have any cloud environments.|
114
- else
115
- EY.ui.say %|Cloud environments:|
116
- EY.ui.print_envs(envs, EY.config.default_environment)
117
- end
118
-
119
- EY.ui.warn(NoAppError.new(repo).message) unless app || options[:all]
109
+ app, envs = app_and_envs(options[:all])
110
+ if app
111
+ EY.ui.say %|Cloud environments for #{app.name}:|
112
+ EY.ui.print_envs(envs, EY.config.default_environment)
113
+ elsif envs
114
+ EY.ui.say %|Cloud environments:|
115
+ EY.ui.print_envs(envs, EY.config.default_environment)
120
116
  else
121
- app = account.app_for_repo(repo)
122
- envs = app.environments
123
- if envs.empty?
124
- EY.ui.warn %|You have no environments set up for the application "#{app.name}"|
125
- EY.ui.warn %|You can make one at #{EY.config.endpoint}|
126
- else
127
- EY.ui.say %|Cloud environments for #{app.name}:|
128
- EY.ui.print_envs(envs, EY.config.default_environment)
129
- end
117
+ EY.ui.say %|You do not have any cloud environments.|
130
118
  end
131
119
  end
132
120
  map "envs" => :environments
@@ -149,6 +137,23 @@ module EY
149
137
 
150
138
  private
151
139
 
140
+ def app_and_envs(all_envs = false)
141
+ app = account.app_for_repo(repo)
142
+
143
+ if all_envs || !app
144
+ envs = account.environments
145
+ EY.ui.warn(NoAppError.new(repo).message) unless app || all_envs
146
+ [nil, envs]
147
+ else
148
+ envs = app.environments
149
+ if envs.empty?
150
+ EY.ui.warn %|You have no environments set up for the application "#{app.name}"|
151
+ EY.ui.warn %|You can make one at #{EY.config.endpoint}|
152
+ end
153
+ envs.empty? ? [app, nil] : [app, envs]
154
+ end
155
+ end
156
+
152
157
  def account
153
158
  @account ||= EY::Account.new(API.new)
154
159
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 7
9
- version: 0.2.7
8
+ - 9
9
+ version: 0.2.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - EY Cloud Team
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-16 00:00:00 -07:00
17
+ date: 2010-04-19 00:00:00 -07:00
18
18
  default_executable: ey
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency