Skip to content

Commit 1969dad

Browse files
authored
Merge pull request #4 from voxpupuli/backport
Rake task allows for a different commit message
2 parents 9e4f908 + 13c2693 commit 1969dad

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

.rubocop.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@ inherit_gem:
55
voxpupuli-rubocop: rubocop.yml
66

77
# Disabled
8+
Layout/LineLength:
9+
Max: 200
10+
11+
Lint/RedundantCopDisableDirective:
12+
Enabled: false
13+
14+
Metrics/BlockLength:
15+
Enabled: false
16+
817
Style/ClassAndModuleChildren:
918
Enabled: false
1019

11-
Layout/LineLength:
12-
Max: 200
20+
Style/SpecialGlobalVars:
21+
Enabled: false

lib/openvox-strings/tasks/gh_pages.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
Dir.chdir('doc') do
1313
system 'git checkout gh-pages'
14+
exit 1 unless $?.success?
1415
system 'git pull --rebase origin gh-pages'
16+
exit 1 unless $?.success?
1517
end
1618
else
1719
git_uri = `git config --get remote.origin.url`.strip
@@ -20,9 +22,13 @@
2022
Dir.mkdir('doc')
2123
Dir.chdir('doc') do
2224
system 'git init'
25+
exit 1 unless $?.success?
2326
system "git remote add origin #{git_uri}"
27+
exit 1 unless $?.success?
2428
system 'git pull origin gh-pages'
29+
exit 1 unless $?.success?
2530
system 'git checkout -b gh-pages'
31+
exit 1 unless $?.success?
2632
end
2733
end
2834
end
@@ -35,15 +41,23 @@
3541
end
3642
end
3743

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+
3950
output = `git describe --long 2>/dev/null`
4051
# If a project has never been tagged, fall back to latest SHA
4152
git_sha = output.empty? ? `git log --pretty=format:'%H' -n 1` : output
4253

4354
Dir.chdir('doc') do
4455
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.
4659
system 'git push origin gh-pages -f'
60+
exit 1 unless $?.success?
4761
end
4862
end
4963

0 commit comments

Comments
 (0)