rhc 1.31.5 → 1.32.2
Sign up to get free protection for your applications and to get access to all the features.
- data/autocomplete/rhc_bash +1 -1
- data/lib/rhc/commands/app.rb +5 -3
- data/lib/rhc/commands/apps.rb +9 -4
- data/lib/rhc/output_helpers.rb +15 -0
- data/spec/rhc/commands/apps_spec.rb +12 -0
- metadata +5 -5
data/autocomplete/rhc_bash
CHANGED
data/lib/rhc/commands/app.rb
CHANGED
@@ -108,12 +108,14 @@ module RHC::Commands
|
|
108
108
|
|
109
109
|
scaling = options.scaling
|
110
110
|
region = options.region
|
111
|
+
gear_profile = options.gear_size
|
111
112
|
|
112
113
|
raise RHC::RegionsAndZonesNotSupportedException if region.present? && !rest_client.supports_regions_and_zones?
|
113
114
|
|
114
115
|
if from_app
|
115
116
|
scaling = from_app.scalable if scaling.nil?
|
116
117
|
region = from_app.region if region.nil?
|
118
|
+
gear_profile = from_app.gear_profile if gear_profile.nil?
|
117
119
|
|
118
120
|
if region.present? && !rest_client.allows_region_selection?
|
119
121
|
region = nil
|
@@ -150,7 +152,7 @@ module RHC::Commands
|
|
150
152
|
say "Creating application '#{name}' ... "
|
151
153
|
|
152
154
|
# create the main app
|
153
|
-
rest_app = create_app(name, cartridges, rest_domain,
|
155
|
+
rest_app = create_app(name, cartridges, rest_domain, gear_profile, scaling, options.from_code, env, options.auto_deploy, options.keep_deployments, options.deployment_branch, options.deployment_type, region)
|
154
156
|
success "done"
|
155
157
|
|
156
158
|
paragraph{ indent{ success rest_app.messages.map(&:strip) } }
|
@@ -588,9 +590,9 @@ module RHC::Commands
|
|
588
590
|
result
|
589
591
|
end
|
590
592
|
|
591
|
-
def create_app(name, cartridges, rest_domain,
|
593
|
+
def create_app(name, cartridges, rest_domain, gear_profile=nil, scale=nil, from_code=nil, environment_variables=nil, auto_deploy=nil, keep_deployments=nil, deployment_branch=nil, deployment_type=nil, region=nil)
|
592
594
|
app_options = {:cartridges => Array(cartridges)}
|
593
|
-
app_options[:gear_profile] =
|
595
|
+
app_options[:gear_profile] = gear_profile if gear_profile
|
594
596
|
app_options[:scale] = scale if scale
|
595
597
|
app_options[:initial_git_url] = from_code if from_code
|
596
598
|
app_options[:debug] = true if @debug
|
data/lib/rhc/commands/apps.rb
CHANGED
@@ -5,17 +5,22 @@ module RHC::Commands
|
|
5
5
|
summary "List all your applications"
|
6
6
|
description "Display the list of applications that you own. Includes information about each application."
|
7
7
|
option ['--mine'], "Display only applications you own"
|
8
|
-
option ["-
|
8
|
+
option ["-s", "--summary"], "Display a summary about the applications you own."
|
9
|
+
option ["-v", "--verbose"], "Display additional details about the application's cartridges."
|
10
|
+
|
9
11
|
def run
|
10
12
|
applications = (options.mine ?
|
11
13
|
rest_client.owned_applications(:include => :cartridges) :
|
12
14
|
rest_client.applications(:include => :cartridges)).sort
|
13
15
|
|
14
16
|
info "In order to deploy applications, you must create a domain with 'rhc setup' or 'rhc create-domain'." and return 1 if applications.empty? && rest_client.domains.empty?
|
17
|
+
info "No applications. Use 'rhc create-app'." and return 1 if applications.nil? || applications.empty?
|
15
18
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
+
if options.summary
|
20
|
+
display_app_summary(applications)
|
21
|
+
else
|
22
|
+
applications.each{|a| display_app(a, a.cartridges, nil, options.verbose) }
|
23
|
+
end
|
19
24
|
|
20
25
|
success "You have#{options.mine ? '' : ' access to'} #{pluralize(applications.length, 'application')}."
|
21
26
|
0
|
data/lib/rhc/output_helpers.rb
CHANGED
@@ -66,6 +66,21 @@ module RHC
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
69
|
+
|
70
|
+
def display_app_summary(applications)
|
71
|
+
section do
|
72
|
+
if !applications.nil? and !applications.empty?
|
73
|
+
paragraph do
|
74
|
+
indent do
|
75
|
+
say table(applications.map do |app|
|
76
|
+
[app.name, app.app_url]
|
77
|
+
end)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
69
84
|
|
70
85
|
def display_app_configurations(rest_app)
|
71
86
|
display_app(rest_app, nil, [:auto_deploy, :keep_deployments, :deployment_type, :deployment_branch])
|
@@ -32,6 +32,18 @@ describe RHC::Commands::Apps do
|
|
32
32
|
output.should match(/scaled.*\-\-.*php.*Scaling:.*x2 \(minimum/m)
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
context 'with apps in summary mode' do
|
37
|
+
let(:arguments) { ['apps', '--summary' ] }
|
38
|
+
before{ domain.add_application('scaled', 'php', true) }
|
39
|
+
|
40
|
+
it { expect { run }.to exit_with_code(0) }
|
41
|
+
it "should match output" do
|
42
|
+
output = run_output
|
43
|
+
output.should match("You have access to 1 application\\.")
|
44
|
+
output.should match(/scaled.*https.*/m)
|
45
|
+
end
|
46
|
+
end
|
35
47
|
|
36
48
|
context 'with one owned app' do
|
37
49
|
let(:arguments) { ['apps', '--mine'] }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 147
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 32
|
9
|
+
- 2
|
10
|
+
version: 1.32.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Hat
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2014-11-
|
18
|
+
date: 2014-11-13 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: net-ssh
|