git-runner 0.1.1 → 0.1.2

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.
@@ -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
@@ -36,17 +36,27 @@ module GitRunner
36
36
  private
37
37
  def execute_commands(commands)
38
38
  commands.each do |command|
39
- out = StringIO::new
39
+ begin
40
+ out = StringIO::new
40
41
 
41
- # Run the command through the active shell session
42
- session.execute(command, :stdout => out, :stderr => out)
42
+ # Run the command through the active shell session
43
+ session.execute(command, :stdout => out, :stderr => out)
43
44
 
44
- # Construct result and store is as part of the command history
45
- result = Result.new(command, out.string, session.exit_status)
46
- history << result
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
- # Bubble up a failure exception if the command failed
49
- raise Failure.new(result) if result.failure?
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
 
@@ -1,3 +1,3 @@
1
1
  module GitRunner
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: