Skip to content

Commit d150c16

Browse files
committed
Add gx-pull-check
1 parent b77ba42 commit d150c16

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

Manifest.txt

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Manifest.txt
33
README.txt
44
Rakefile
55
bin/gx-publish
6+
bin/gx-pull-check
67
bin/gx-update
78
lib/gx.rb
89
lib/gx/enhance.rb

bin/gx-pull-check

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env ruby
2+
3+
require 'pathname'
4+
5+
require 'gx/enhance'
6+
7+
STDOUT.sync = true
8+
9+
repo = Grit::Repo.current
10+
11+
head = Grit::Head.current(repo)
12+
13+
current_branch = head.name
14+
15+
url = ARGV.shift
16+
cmd = ARGV.shift || "rake"
17+
18+
repo.git.branch({}, "gx-pull-check")
19+
repo.git.checkout({}, "gx-pull-check")
20+
21+
puts "Performing pull check on '#{url}'"
22+
23+
puts "Step 1: Apply the pull request..."
24+
system "hub am '#{url}'"
25+
26+
if $?.exitstatus != 0
27+
puts "Error applying the pull request, leaving you in the branch"
28+
exit 1
29+
end
30+
31+
puts "Step 2: run '#{cmd}'..."
32+
33+
system cmd
34+
35+
if $?.exitstatus != 0
36+
puts "Error running test command, leaving you in the branch"
37+
exit 1
38+
end
39+
40+
puts "========================================="
41+
puts "Everything ran fine, feel free to merge the pull request!"
42+
43+
repo.git.checkout({}, current_branch)
44+
repo.git.branch({:D => true}, "gx-pull-check")
45+

lib/gx.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Gx
2-
VERSION = '1.1.0'
2+
VERSION = '1.2.0'
33
end

0 commit comments

Comments
 (0)