Commit 82df60dd authored by Ash McKenzie's avatar Ash McKenzie

Return more output for Factory::Repository::Push

parent e806e264
...@@ -12,6 +12,10 @@ module QA ...@@ -12,6 +12,10 @@ module QA
attr_writer :remote_branch attr_writer :remote_branch
product :output do |factory|
factory.output
end
def initialize def initialize
@file_name = 'file.txt' @file_name = 'file.txt'
@file_content = '# This is test file' @file_content = '# This is test file'
...@@ -44,6 +48,8 @@ module QA ...@@ -44,6 +48,8 @@ module QA
def fabricate! def fabricate!
Git::Repository.perform do |repository| Git::Repository.perform do |repository|
@output = ''
if ssh_key if ssh_key
repository.uri = repository_ssh_uri repository.uri = repository_ssh_uri
repository.use_ssh_key(ssh_key) repository.use_ssh_key(ssh_key)
...@@ -62,29 +68,25 @@ module QA ...@@ -62,29 +68,25 @@ module QA
email = user.email email = user.email
end end
repository.clone @output += repository.clone
repository.configure_identity(username, email) repository.configure_identity(username, email)
if new_branch @output += repository.checkout(branch_name, new_branch: new_branch)
repository.checkout_new_branch(branch_name)
else
repository.checkout(branch_name)
end
if @directory if @directory
@directory.each_child do |f| @directory.each_child do |f|
repository.add_file(f.basename, f.read) if f.file? @output += repository.add_file(f.basename, f.read) if f.file?
end end
elsif @files elsif @files
@files.each do |f| @files.each do |f|
repository.add_file(f[:name], f[:content]) repository.add_file(f[:name], f[:content])
end end
else else
repository.add_file(file_name, file_content) @output += repository.add_file(file_name, file_content)
end end
repository.commit(commit_message) @output += repository.commit(commit_message)
@output = repository.push_changes("#{branch_name}:#{remote_branch}") @output += repository.push_changes("#{branch_name}:#{remote_branch}")
repository.delete_ssh_key repository.delete_ssh_key
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