Commit 5b936614 authored by Ash McKenzie's avatar Ash McKenzie

Use run() to execute commands

- Adds debug ability
- Returns output
- run_and_redact_credentials() not required any longer as the credentials are no longer in the URL
parent 609bea29
...@@ -53,11 +53,11 @@ module QA ...@@ -53,11 +53,11 @@ module QA
end end
def checkout(branch_name) def checkout(branch_name)
`git checkout "#{branch_name}"` run(%Q{git checkout "#{branch_name}"})
end end
def checkout_new_branch(branch_name) def checkout_new_branch(branch_name)
`git checkout -b "#{branch_name}"` run(%Q{git checkout -b "#{branch_name}"})
end end
def shallow_clone def shallow_clone
...@@ -79,11 +79,11 @@ module QA ...@@ -79,11 +79,11 @@ module QA
def add_file(name, contents) def add_file(name, contents)
::File.write(name, contents) ::File.write(name, contents)
`git add #{name}` run(%Q{git add #{name}})
end end
def commit(message) def commit(message)
`git commit -m "#{message}"` run(%Q{git commit -m "#{message}"})
end end
def push_changes(branch = 'master') def push_changes(branch = 'master')
...@@ -91,7 +91,7 @@ module QA ...@@ -91,7 +91,7 @@ module QA
end end
def commits def commits
`git log --oneline`.split("\n") run('git log --oneline').split("\n")
end end
def use_ssh_key(key) def use_ssh_key(key)
...@@ -103,7 +103,7 @@ module QA ...@@ -103,7 +103,7 @@ module QA
keyscan_params = ['-H'] keyscan_params = ['-H']
keyscan_params << "-p #{uri.port}" if uri.port keyscan_params << "-p #{uri.port}" if uri.port
keyscan_params << uri.host keyscan_params << uri.host
run_and_redact_credentials("ssh-keyscan #{keyscan_params.join(' ')} >> #{known_hosts_file.path}") run("ssh-keyscan #{keyscan_params.join(' ')} >> #{known_hosts_file.path}")
self.env_vars << %Q{GIT_SSH_COMMAND="ssh -i #{private_key_file.path} -o UserKnownHostsFile=#{known_hosts_file.path}"} self.env_vars << %Q{GIT_SSH_COMMAND="ssh -i #{private_key_file.path} -o UserKnownHostsFile=#{known_hosts_file.path}"}
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment