git_test 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/bin/git_test CHANGED
@@ -72,6 +72,7 @@ command :fetch do |c|
72
72
  ensure
73
73
  runner.clean_test_dir!
74
74
  end
75
+ exit!(runner.test_exit_status)
75
76
  end
76
77
  end
77
78
 
@@ -87,29 +88,37 @@ command :run do |c|
87
88
  ensure
88
89
  runner.clean_test_dir!
89
90
  end
91
+ exit!(runner.test_exit_status)
90
92
  end
91
93
  end
92
94
 
93
95
  desc "runs your tests, saves them in git then pushes to origin"
94
96
  command :push do |c|
95
- c.desc 'if true will push code to repo after running tests instead of before'
97
+ c.desc 'if true will push code to repo before running tests'
96
98
  c.default_value true
97
- c.arg_name 'push_after_test'
98
- c.switch [:pat,:push_after_test]
99
+ c.arg_name 'push_before_test'
100
+ c.switch [:b,:before]
101
+
99
102
 
100
103
  c.action do |global_options,options,args|
101
104
  begin
102
105
  global_options.merge! options
103
106
  runner = GitTest::Runner.new(global_options)
104
107
  runner.fetch!
105
- runner.push! unless options[:push_after_test]
108
+ runner.push! unless options[:before]
106
109
  runner.test!
107
110
  runner.write_report!
108
- runner.push!
111
+ if runner.test_failed?
112
+ runner.notify.write("skipping push due to test failure", :red)
113
+ else
114
+ runner.push!
115
+ end
109
116
  runner.notify.write("to view test report run `git_test show last`", :green)
110
117
  ensure
111
118
  runner.clean_test_dir!
112
119
  end
120
+ # return test result
121
+ exit!(runner.test_exit_status)
113
122
  end
114
123
  end
115
124
 
@@ -16,6 +16,18 @@ module GitTest
16
16
  clone_to_test!
17
17
  end
18
18
 
19
+ def test_failed?
20
+ test.failed?
21
+ end
22
+
23
+ def test_exit_status
24
+ if test_failed?
25
+ return -1
26
+ else
27
+ return 0
28
+ end
29
+ end
30
+
19
31
  def prepare_proj_for_test!
20
32
  proj.check_repo_status!
21
33
  proj.branch(report_branch) unless proj.is_branch? report_branch
@@ -1,3 +1,3 @@
1
1
  module GitTest
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_test
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 11
10
- version: 0.0.11
9
+ - 12
10
+ version: 0.0.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Richard Schneeman