|
11 | 11 |
|
12 | 12 | Dir.chdir('doc') do
|
13 | 13 | system 'git checkout gh-pages'
|
| 14 | + exit 1 unless $?.success? |
14 | 15 | system 'git pull --rebase origin gh-pages'
|
| 16 | + exit 1 unless $?.success? |
15 | 17 | end
|
16 | 18 | else
|
17 | 19 | git_uri = `git config --get remote.origin.url`.strip
|
|
20 | 22 | Dir.mkdir('doc')
|
21 | 23 | Dir.chdir('doc') do
|
22 | 24 | system 'git init'
|
| 25 | + exit 1 unless $?.success? |
23 | 26 | system "git remote add origin #{git_uri}"
|
| 27 | + exit 1 unless $?.success? |
24 | 28 | system 'git pull origin gh-pages'
|
| 29 | + exit 1 unless $?.success? |
25 | 30 | system 'git checkout -b gh-pages'
|
| 31 | + exit 1 unless $?.success? |
26 | 32 | end
|
27 | 33 | end
|
28 | 34 | end
|
|
35 | 41 | end
|
36 | 42 | end
|
37 | 43 |
|
38 |
| - task :push do |
| 44 | + # Task to push the gh-pages branch. Argument :msg_prefix is the beginning |
| 45 | + # of the message and the actual commit will have "at Revision <git_sha>" |
| 46 | + # appended. |
| 47 | + task :push, [:msg_prefix] do |_t, args| |
| 48 | + msg_prefix = args[:msg_prefix] || '[strings] Generated Documentation Update' |
| 49 | + |
39 | 50 | output = `git describe --long 2>/dev/null`
|
40 | 51 | # If a project has never been tagged, fall back to latest SHA
|
41 | 52 | git_sha = output.empty? ? `git log --pretty=format:'%H' -n 1` : output
|
42 | 53 |
|
43 | 54 | Dir.chdir('doc') do
|
44 | 55 | system 'git add .'
|
45 |
| - system "git commit -m '[strings] Generated Documentation Update at Revision #{git_sha}'" |
| 56 | + exit 1 unless $?.success? |
| 57 | + system "git commit -m '#{msg_prefix} at Revision #{git_sha}'" |
| 58 | + # Do not check status of commit, as it will error if there are no changes. |
46 | 59 | system 'git push origin gh-pages -f'
|
| 60 | + exit 1 unless $?.success? |
47 | 61 | end
|
48 | 62 | end
|
49 | 63 |
|
|
0 commit comments