diff --git a/.rubocop.yml b/.rubocop.yml index c73c846a..759c2570 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,8 +5,17 @@ inherit_gem: voxpupuli-rubocop: rubocop.yml # Disabled +Layout/LineLength: + Max: 200 + +Lint/RedundantCopDisableDirective: + Enabled: false + +Metrics/BlockLength: + Enabled: false + Style/ClassAndModuleChildren: Enabled: false -Layout/LineLength: - Max: 200 +Style/SpecialGlobalVars: + Enabled: false diff --git a/lib/openvox-strings/tasks/gh_pages.rb b/lib/openvox-strings/tasks/gh_pages.rb index 3f37770d..7d76ff72 100644 --- a/lib/openvox-strings/tasks/gh_pages.rb +++ b/lib/openvox-strings/tasks/gh_pages.rb @@ -11,7 +11,9 @@ Dir.chdir('doc') do system 'git checkout gh-pages' + exit 1 unless $?.success? system 'git pull --rebase origin gh-pages' + exit 1 unless $?.success? end else git_uri = `git config --get remote.origin.url`.strip @@ -20,9 +22,13 @@ Dir.mkdir('doc') Dir.chdir('doc') do system 'git init' + exit 1 unless $?.success? system "git remote add origin #{git_uri}" + exit 1 unless $?.success? system 'git pull origin gh-pages' + exit 1 unless $?.success? system 'git checkout -b gh-pages' + exit 1 unless $?.success? end end end @@ -35,15 +41,23 @@ end end - task :push do + # Task to push the gh-pages branch. Argument :msg_prefix is the beginning + # of the message and the actual commit will have "at Revision " + # appended. + task :push, [:msg_prefix] do |_t, args| + msg_prefix = args[:msg_prefix] || '[strings] Generated Documentation Update' + output = `git describe --long 2>/dev/null` # If a project has never been tagged, fall back to latest SHA git_sha = output.empty? ? `git log --pretty=format:'%H' -n 1` : output Dir.chdir('doc') do system 'git add .' - system "git commit -m '[strings] Generated Documentation Update at Revision #{git_sha}'" + exit 1 unless $?.success? + system "git commit -m '#{msg_prefix} at Revision #{git_sha}'" + # Do not check status of commit, as it will error if there are no changes. system 'git push origin gh-pages -f' + exit 1 unless $?.success? end end