Skip to content

Commit

Permalink
Merge pull request rubocop#73 from koic/assert_manual_synchronized_fo…
Browse files Browse the repository at this point in the history
…r_ci

Assert manual synchronized for CI
  • Loading branch information
koic authored Jun 13, 2019
2 parents 4451089 + df910a0 commit 65429d9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tasks/cops_documentation.rake
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ task generate_cops_documentation: :yard_for_generate_documentation do
.join("\n")
end

def assert_manual_synchronized
# Do not print diff and yield whether exit code was zero
sh('git diff --quiet manual') do |outcome, _|
return if outcome

# Output diff before raising error
sh('GIT_PAGER=cat git diff manual')

warn 'The manual directory is out of sync. ' \
'Run `rake generate_cops_documentation` and commit the results.'
exit!
end
end

def main
cops = RuboCop::Cop::Cop.registry
config = RuboCop::ConfigLoader.load_file('config/default.yml')
Expand All @@ -255,6 +269,8 @@ task generate_cops_documentation: :yard_for_generate_documentation do
end

print_table_of_contents(cops)

assert_manual_synchronized if ENV['CI'] == 'true'
ensure
RuboCop::ConfigLoader.default_configuration = nil
end
Expand Down

0 comments on commit 65429d9

Please sign in to comment.