rhc 1.2.7 → 1.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/rhc +6 -8
- data/bin/rhc-chk +23 -10
- data/features/domain.feature +1 -1
- data/features/lib/rhc_helper.rb +3 -2
- data/features/lib/rhc_helper/api.rb +7 -0
- data/features/lib/rhc_helper/app.rb +8 -10
- data/features/lib/rhc_helper/domain.rb +2 -1
- data/features/lib/rhc_helper/runnable.rb +2 -24
- data/features/sshkey.feature +3 -3
- data/features/step_definitions/cartridge_steps.rb +6 -6
- data/features/step_definitions/client_steps.rb +0 -1
- data/features/step_definitions/sshkey_steps.rb +2 -2
- data/features/support/before_hooks.rb +0 -1
- data/features/support/env.rb +5 -3
- data/lib/rhc-common.rb +1 -1
- data/lib/rhc.rb +9 -8
- data/lib/rhc/auth.rb +3 -0
- data/lib/rhc/auth/basic.rb +54 -0
- data/lib/rhc/cartridge_helpers.rb +11 -5
- data/lib/rhc/cli.rb +4 -2
- data/lib/rhc/command_runner.rb +35 -30
- data/lib/rhc/commands.rb +127 -18
- data/lib/rhc/commands/account.rb +24 -0
- data/lib/rhc/commands/alias.rb +1 -1
- data/lib/rhc/commands/app.rb +210 -209
- data/lib/rhc/commands/apps.rb +22 -0
- data/lib/rhc/commands/base.rb +10 -77
- data/lib/rhc/commands/cartridge.rb +35 -35
- data/lib/rhc/commands/domain.rb +20 -13
- data/lib/rhc/commands/git_clone.rb +30 -0
- data/lib/rhc/commands/{port-forward.rb → port_forward.rb} +3 -3
- data/lib/rhc/commands/server.rb +28 -16
- data/lib/rhc/commands/setup.rb +18 -1
- data/lib/rhc/commands/snapshot.rb +4 -4
- data/lib/rhc/commands/sshkey.rb +4 -18
- data/lib/rhc/commands/tail.rb +32 -9
- data/lib/rhc/config.rb +168 -99
- data/lib/rhc/context_helper.rb +22 -9
- data/lib/rhc/core_ext.rb +41 -1
- data/lib/rhc/exceptions.rb +21 -5
- data/lib/rhc/git_helpers.rb +81 -0
- data/lib/rhc/help_formatter.rb +21 -1
- data/lib/rhc/helpers.rb +222 -87
- data/lib/rhc/output_helpers.rb +94 -110
- data/lib/rhc/rest.rb +15 -198
- data/lib/rhc/rest/api.rb +88 -0
- data/lib/rhc/rest/application.rb +29 -30
- data/lib/rhc/rest/attributes.rb +27 -0
- data/lib/rhc/rest/base.rb +29 -33
- data/lib/rhc/rest/cartridge.rb +42 -20
- data/lib/rhc/rest/client.rb +351 -89
- data/lib/rhc/rest/domain.rb +7 -13
- data/lib/rhc/rest/gear_group.rb +1 -1
- data/lib/rhc/rest/key.rb +7 -2
- data/lib/rhc/rest/mock.rb +609 -0
- data/lib/rhc/rest/user.rb +6 -2
- data/lib/rhc/{ssh_key_helpers.rb → ssh_helpers.rb} +58 -28
- data/lib/rhc/{targz.rb → tar_gz.rb} +0 -0
- data/lib/rhc/usage_templates/command_help.erb +4 -1
- data/lib/rhc/usage_templates/help.erb +24 -11
- data/lib/rhc/usage_templates/options_help.erb +14 -0
- data/lib/rhc/wizard.rb +283 -213
- data/spec/keys/example.pem +23 -0
- data/spec/keys/example_private.pem +27 -0
- data/spec/keys/server.pem +19 -0
- data/spec/rest_spec_helper.rb +3 -371
- data/spec/rhc/auth_spec.rb +226 -0
- data/spec/rhc/cli_spec.rb +41 -14
- data/spec/rhc/command_spec.rb +44 -15
- data/spec/rhc/commands/account_spec.rb +41 -0
- data/spec/rhc/commands/alias_spec.rb +16 -15
- data/spec/rhc/commands/app_spec.rb +115 -92
- data/spec/rhc/commands/apps_spec.rb +39 -0
- data/spec/rhc/commands/cartridge_spec.rb +134 -112
- data/spec/rhc/commands/domain_spec.rb +31 -86
- data/spec/rhc/commands/git_clone_spec.rb +56 -0
- data/spec/rhc/commands/{port-forward_spec.rb → port_forward_spec.rb} +27 -32
- data/spec/rhc/commands/server_spec.rb +28 -3
- data/spec/rhc/commands/setup_spec.rb +29 -11
- data/spec/rhc/commands/snapshot_spec.rb +4 -3
- data/spec/rhc/commands/sshkey_spec.rb +24 -56
- data/spec/rhc/commands/tail_spec.rb +26 -9
- data/spec/rhc/commands/threaddump_spec.rb +12 -11
- data/spec/rhc/config_spec.rb +211 -164
- data/spec/rhc/context_spec.rb +2 -0
- data/spec/rhc/helpers_spec.rb +242 -46
- data/spec/rhc/rest_application_spec.rb +42 -28
- data/spec/rhc/rest_client_spec.rb +110 -93
- data/spec/rhc/rest_spec.rb +220 -131
- data/spec/rhc/targz_spec.rb +1 -1
- data/spec/rhc/wizard_spec.rb +435 -624
- data/spec/spec.opts +1 -1
- data/spec/spec_helper.rb +140 -6
- data/spec/wizard_spec_helper.rb +326 -0
- metadata +163 -143
- data/lib/rhc/client.rb +0 -17
- data/lib/rhc/git_helper.rb +0 -59
data/lib/rhc/git_helper.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'open4'
|
2
|
-
|
3
|
-
module RHC
|
4
|
-
module GitHelpers
|
5
|
-
# :nocov: These all call external binaries so test them in cucumber
|
6
|
-
def git_config_get(key)
|
7
|
-
config_get_cmd = "git config --get #{key}"
|
8
|
-
debug "Running #{config_get_cmd}"
|
9
|
-
uuid = %x[#{config_get_cmd}].strip
|
10
|
-
debug "UUID = '#{uuid}'"
|
11
|
-
uuid = nil if $?.exitstatus != 0 or uuid.empty?
|
12
|
-
|
13
|
-
uuid
|
14
|
-
end
|
15
|
-
|
16
|
-
def git_config_set(key, value)
|
17
|
-
unset_cmd = "git config --unset-all #{key}"
|
18
|
-
config_cmd = "git config --add #{key} #{value}"
|
19
|
-
debug "Adding #{key} = #{value} to git config"
|
20
|
-
commands = [unset_cmd, config_cmd]
|
21
|
-
commands.each do |cmd|
|
22
|
-
debug "Running #{cmd} 2>&1"
|
23
|
-
output = %x[#{cmd} 2>&1]
|
24
|
-
raise RHC::GitException, "Error while adding config values to git - #{output}" unless output.empty?
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def git_clone_repo(git_url, repo_dir)
|
29
|
-
# quote the repo to avoid input injection risk
|
30
|
-
repo_dir = (repo_dir ? " \"#{repo_dir}\"" : "")
|
31
|
-
clone_cmd = "git clone #{git_url}#{repo_dir}"
|
32
|
-
debug "Running #{clone_cmd}"
|
33
|
-
|
34
|
-
err = nil
|
35
|
-
if RHC::Helpers.windows?
|
36
|
-
# windows does not support Open4 so redirect stderr to stdin
|
37
|
-
# and print the whole output which is not as clean
|
38
|
-
output = %x[#{clone_cmd} 2>&1]
|
39
|
-
if $?.exitstatus != 0
|
40
|
-
err = output + " - Check to make sure you have correctly installed git and it is added to your path."
|
41
|
-
else
|
42
|
-
say output
|
43
|
-
end
|
44
|
-
else
|
45
|
-
paragraph do
|
46
|
-
Open4.popen4(clone_cmd) do |pid, stdin, stdout, stderr|
|
47
|
-
stdin.close
|
48
|
-
say stdout.read
|
49
|
-
err = stderr.read
|
50
|
-
end
|
51
|
-
say "done"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
raise RHC::GitException, "Error in git clone - #{err}" if $?.exitstatus != 0
|
56
|
-
end
|
57
|
-
# :nocov:
|
58
|
-
end
|
59
|
-
end
|