git-runner 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git-runner/base.rb +5 -0
- data/lib/git-runner/command.rb +18 -8
- data/lib/git-runner/version.rb +1 -1
- metadata +1 -1
data/lib/git-runner/base.rb
CHANGED
@@ -12,6 +12,7 @@ module GitRunner
|
|
12
12
|
Text.begin
|
13
13
|
|
14
14
|
load_git_runner_gems
|
15
|
+
prepare_environment
|
15
16
|
process_refs
|
16
17
|
|
17
18
|
|
@@ -37,6 +38,10 @@ module GitRunner
|
|
37
38
|
Gem::Specification._all.map(&:name).select { |gem| gem =~ /^git-runner-/ }.each { |name| require(name) }
|
38
39
|
end
|
39
40
|
|
41
|
+
def prepare_environment
|
42
|
+
GitRunner::Command.execute('unset GIT_DIR')
|
43
|
+
end
|
44
|
+
|
40
45
|
def process_refs
|
41
46
|
if refs && refs.is_a?(Array)
|
42
47
|
repository_path = Dir.pwd
|
data/lib/git-runner/command.rb
CHANGED
@@ -36,17 +36,27 @@ module GitRunner
|
|
36
36
|
private
|
37
37
|
def execute_commands(commands)
|
38
38
|
commands.each do |command|
|
39
|
-
|
39
|
+
begin
|
40
|
+
out = StringIO::new
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
# Run the command through the active shell session
|
43
|
+
session.execute(command, :stdout => out, :stderr => out)
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
# Construct result and store is as part of the command history
|
46
|
+
result = Result.new(command, out.string, session.exit_status)
|
47
|
+
history << result
|
47
48
|
|
48
|
-
|
49
|
-
|
49
|
+
# Bubble up a failure exception if the command failed
|
50
|
+
raise Failure.new(result) if result.failure?
|
51
|
+
|
52
|
+
|
53
|
+
rescue Exception => ex
|
54
|
+
unless ex.is_a?(GitRunner::Command::Failure)
|
55
|
+
history << (result = Result.new(command, 'EXCEPTION OCCURRED', '-1'))
|
56
|
+
end
|
57
|
+
|
58
|
+
raise ex
|
59
|
+
end
|
50
60
|
end
|
51
61
|
end
|
52
62
|
|
data/lib/git-runner/version.rb
CHANGED