rhc 0.97.17 → 0.98.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/bin/rhc +9 -9
  2. data/bin/rhc-port-forward +3 -0
  3. data/bin/rhc-sshkey +3 -0
  4. data/features/README.md +163 -35
  5. data/features/application.feature +24 -0
  6. data/features/cartridge.feature +24 -0
  7. data/features/client.feature +11 -0
  8. data/features/domain.feature +29 -0
  9. data/features/lib/rhc_helper.rb +14 -0
  10. data/features/lib/rhc_helper/app.rb +2 -8
  11. data/features/lib/rhc_helper/cartridge.rb +1 -7
  12. data/features/lib/rhc_helper/commandify.rb +37 -6
  13. data/features/lib/rhc_helper/domain.rb +5 -1
  14. data/features/lib/rhc_helper/httpify.rb +124 -60
  15. data/features/lib/rhc_helper/loggable.rb +0 -2
  16. data/features/lib/rhc_helper/persistable.rb +12 -2
  17. data/features/lib/rhc_helper/sshkey.rb +29 -0
  18. data/features/multiple_cartridge.feature +17 -0
  19. data/features/sshkey.feature +58 -0
  20. data/features/step_definitions/application_steps.rb +60 -52
  21. data/features/step_definitions/cartridge_steps.rb +22 -24
  22. data/features/step_definitions/client_steps.rb +9 -2
  23. data/features/step_definitions/domain_steps.rb +4 -0
  24. data/features/step_definitions/sshkey_steps.rb +56 -0
  25. data/features/support/assumptions.rb +37 -0
  26. data/features/support/before_hooks.rb +25 -0
  27. data/features/support/env.rb +84 -39
  28. data/features/support/key1 +27 -0
  29. data/features/support/key1.pub +1 -0
  30. data/features/support/key2 +27 -0
  31. data/features/support/key2.pub +1 -0
  32. data/features/support/key3.pub +1 -0
  33. data/features/support/ssh.sh +2 -0
  34. data/features/verify.feature +18 -159
  35. data/lib/rhc-common.rb +8 -21
  36. data/lib/rhc.rb +9 -5
  37. data/lib/rhc/autocomplete.rb +68 -0
  38. data/lib/rhc/autocomplete_templates/rhc.erb +33 -0
  39. data/lib/rhc/cli.rb +9 -6
  40. data/lib/rhc/command_runner.rb +108 -0
  41. data/lib/rhc/commands.rb +66 -132
  42. data/lib/rhc/commands/base.rb +95 -24
  43. data/lib/rhc/commands/domain.rb +33 -50
  44. data/lib/rhc/commands/port-forward.rb +81 -0
  45. data/lib/rhc/commands/setup.rb +1 -1
  46. data/lib/rhc/commands/sshkey.rb +95 -0
  47. data/lib/rhc/config.rb +108 -103
  48. data/lib/rhc/context_helper.rb +19 -0
  49. data/lib/rhc/coverage_helper.rb +1 -1
  50. data/lib/rhc/exceptions.rb +55 -4
  51. data/lib/rhc/help_formatter.rb +2 -3
  52. data/lib/rhc/helpers.rb +31 -23
  53. data/lib/{rhc-rest.rb → rhc/rest.rb} +95 -23
  54. data/lib/{rhc-rest → rhc/rest}/application.rb +1 -1
  55. data/lib/{rhc-rest → rhc/rest}/cartridge.rb +1 -1
  56. data/lib/{rhc-rest → rhc/rest}/client.rb +40 -9
  57. data/lib/{rhc-rest → rhc/rest}/domain.rb +1 -1
  58. data/lib/{rhc-rest → rhc/rest}/key.rb +11 -1
  59. data/lib/{rhc-rest → rhc/rest}/user.rb +1 -1
  60. data/lib/rhc/ssh_key_helpers.rb +10 -1
  61. data/lib/rhc/targz.rb +7 -8
  62. data/lib/rhc/usage_templates/command_help.erb +7 -6
  63. data/lib/rhc/usage_templates/help.erb +6 -9
  64. data/lib/rhc/usage_templates/missing_help.erb +1 -0
  65. data/lib/rhc/version.rb +2 -2
  66. data/lib/rhc/wizard.rb +4 -9
  67. data/spec/coverage_helper.rb +2 -2
  68. data/spec/rest_spec_helper.rb +66 -16
  69. data/spec/rhc/cli_spec.rb +16 -5
  70. data/spec/rhc/command_spec.rb +61 -6
  71. data/spec/rhc/commands/domain_spec.rb +50 -27
  72. data/spec/rhc/commands/port-forward_spec.rb +133 -0
  73. data/spec/rhc/commands/setup_spec.rb +2 -2
  74. data/spec/rhc/commands/sshkey_spec.rb +141 -0
  75. data/spec/rhc/common_spec.rb +1 -1
  76. data/spec/rhc/config_spec.rb +6 -4
  77. data/spec/rhc/helpers_spec.rb +0 -21
  78. data/spec/rhc/rest_application_spec.rb +7 -7
  79. data/spec/rhc/rest_client_spec.rb +87 -24
  80. data/spec/rhc/rest_spec.rb +36 -36
  81. data/spec/rhc/wizard_spec.rb +3 -3
  82. data/spec/spec.opts +1 -0
  83. data/spec/spec_helper.rb +3 -3
  84. metadata +61 -31
  85. data/lib/rhc-rest/exceptions/exceptions.rb +0 -75
  86. data/test/functional/application_test.rb +0 -71
  87. data/test/functional/domain_test.rb +0 -123
  88. data/test/functional/test_credentials.rb +0 -5
  89. data/test/sample-usage.rb +0 -122
  90. data/test/support/server.rb +0 -14
  91. data/test/support/testcase.rb +0 -3
  92. data/test/test_helper.rb +0 -4
  93. data/test/unit/command_test.rb +0 -19
@@ -1,5 +0,0 @@
1
- class TestCredentails
2
- @@aws_access_key_id = nil
3
- @@aws_secret_access_key = nil
4
- @@account_number = nil
5
- end
data/test/sample-usage.rb DELETED
@@ -1,122 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
-
16
- require 'rhc-rest'
17
-
18
-
19
- if __FILE__ == $0
20
-
21
- end_point = ARGV[0]
22
- username = ARGV[1]
23
- password = ARGV[2]
24
- domain_id = ARGV[3]
25
-
26
- if end_point.nil? or username.nil? or password.nil? or domain_id.nil?
27
- puts "Usage: https://<hostname>/broker/rest <username> <password> <domain_id>"
28
- exit 1
29
- end
30
- @mydebug =true
31
- client = Rhc::Rest::Client.new(end_point, username, password)
32
-
33
- client.domains.each do |domain|
34
- domain.applications.each do |app|
35
- app.delete
36
- end
37
- domain.delete
38
- end
39
- puts "Creating a domain"
40
- domain = client.add_domain(domain_id)
41
- puts "Domain created: #{domain.id}"
42
-
43
- puts "Getting all cartridges..."
44
- client.cartridges.each do |cart|
45
- puts " #{cart.name} (type: #{cart.type})"
46
- end
47
-
48
- puts "Creating application appone"
49
- carts = client.find_cartridge("php-5.3")
50
- domain.add_application("appone", {:cartridge => carts.first.name})
51
-
52
- puts "Try deleting domain with an application"
53
- begin
54
- domain.delete
55
- rescue Exception => e
56
- puts e.message
57
- end
58
-
59
- puts "Getting all domains and applications..."
60
- client.domains.each do |domain|
61
- puts " Domain: #{domain.id}"
62
- domain.applications.each do |app|
63
- puts " Application: #{app.name}"
64
- app.cartridges.each do |cart|
65
- puts " Cartridge #{cart.name} (#{cart.type})"
66
- end
67
- end
68
- end
69
-
70
- puts "Find application=appone and restart it..."
71
- apps = client.find_application("appone")
72
- apps.first.restart
73
-
74
- apps = client.find_application("appthree")
75
- if not apps.nil? and not apps.first.nil?
76
- apps.first.delete
77
- end
78
-
79
- puts "Create new application named appthree..."
80
- app = client.domains.first.add_application("appthree", {:cartridge =>"php-5.3"})
81
- puts "Adding MySQL cartridge to appthree"
82
- cartridge = app.add_cartridge("mysql-5.1")
83
- puts "Check to see if it was added"
84
- app.cartridges.each do |cart|
85
- puts "Cartridge #{cart.name} (#{cart.type})"
86
- end
87
-
88
- puts "Restart MySQL cartridge"
89
- cartridge.restart
90
- puts "Deleting MySQL cartridge"
91
- cartridge.delete
92
- puts "Check to see if it was deleted"
93
- if app.cartridges.size == 0
94
- puts "MySQL cartridge is deleted"
95
- end
96
- puts "Deleting appthree"
97
- app.delete
98
- end
99
-
100
- puts "Adding, updating and deleting keys"
101
- key = client.user.add_key("newkey", "NEWKEYCONTENT", "ssh-rsa")
102
-
103
- puts "Added key: #{key.name} updating key content"
104
- key.update(key.type, "NEWKEYCONTENT123")
105
-
106
- puts "Getting all keys..."
107
- client.user.keys.each do |key|
108
- puts " Key: #{key.name} (type: #{key.type}) #{key.content}"
109
- end
110
-
111
- puts "Deleting key"
112
- begin
113
- key.delete
114
- rescue Exception => e
115
- puts e.message
116
- end
117
-
118
- puts 'Clean up domains and apps by force deleting domain'
119
- client.domains.each do |domain|
120
- domain.delete(true)
121
- end
122
-
@@ -1,14 +0,0 @@
1
- class Test::Unit::TestCase
2
-
3
- def with_devenv
4
- omit("Cannot run unless a devenv is specified")
5
-
6
- @random = rand(1000)
7
- end_point = "https://ec2-23-20-154-157.compute-1.amazonaws.com/broker/rest"
8
- username = "rhc-rest-test-#{@random}"
9
- password = "xyz123"
10
- @client = Rhc::Rest::Client.new(end_point, username, password)
11
- @domains = []
12
- end
13
-
14
- end
@@ -1,3 +0,0 @@
1
- require 'test/unit'
2
- require 'test/unit/omission'
3
- require 'pp'
data/test/test_helper.rb DELETED
@@ -1,4 +0,0 @@
1
- $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
2
-
3
- # Load support files
4
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -1,19 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- class CommandTest < Test::Unit::TestCase
4
-
5
- def define_test_command
6
- Class.new(RHC::Commands::Base) do
7
- def run
8
- 1
9
- end
10
- end
11
-
12
- end
13
-
14
- test 'should register a command' do
15
- assert_difference('commands.length', 1) do
16
- define_test_command
17
- end
18
- end
19
- end