diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-12-12 17:59:15 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-12-12 17:59:15 +0200 |
commit | 4ef8a0142f8196336429879d0993f033ac8d0ce3 (patch) | |
tree | 8fea297a3996f7998c1861ad31f609b641a8417c /lib | |
parent | 9c4dc65a50fc202c3e8879e5ae6c8710de2917d3 (diff) | |
download | gitlab-ci-4ef8a0142f8196336429879d0993f033ac8d0ce3.tar.gz |
include git output to logs. make checkout of commit if
Diffstat (limited to 'lib')
-rw-r--r-- | lib/runner.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/runner.rb b/lib/runner.rb index 00f1423..b546250 100644 --- a/lib/runner.rb +++ b/lib/runner.rb @@ -23,15 +23,13 @@ class Runner def run path = project.path commands = project.scripts - - return if build.canceled? + commands = commands.lines.to_a + commands.unshift(prepare_project_cmd(path, build.sha)) build.run! - prepare_project(path, build.ref) - Dir.chdir(path) do - commands.each_line do |line| + commands.each do |line| status = command(line, path) build.write_trace(@output) @@ -92,12 +90,12 @@ class Runner @output << @tmp_file.read end - def prepare_project(path, ref) + def prepare_project_cmd(path, ref) cmd = [] cmd << "cd #{path}" cmd << "git fetch" cmd << "git reset --hard" - cmd << "git checkout origin/#{ref}" - `#{cmd.join("&&")}` + cmd << "git checkout #{ref}" + cmd.join(" && ") end end |