Commit 4cd376f0 authored by Lucas Nussbaum's avatar Lucas Nussbaum
Browse files

[dev/wiki] do not update if no changes to make

parent 0e2d3efa
......@@ -54,7 +54,13 @@ class WikiGenerator
#Actually edit the mediawiki page with the new generated content
def update_page
@mw_client.edit({"title" => @page_name, "text" => @generated_content })
wiki_content = remove_page_creation_date(@mw_client.get_page_content(@page_name)).strip # .strip removes potential '\n' at end of file
generated_content = remove_page_creation_date(@generated_content).strip
if wiki_content == generated_content
puts "No modification on #{@page_name}, skipping update"
else
@mw_client.edit({"title" => @page_name, "text" => @generated_content })
end
end
#Get the given page content and print a diff if any
......@@ -75,9 +81,15 @@ class WikiGenerator
end
def update_files
@files.each { |file|
@mw_client.update_file(file['filename'], file['path'], file['content_type'], file['comment'], true)
}
@files.each do |file|
file_content = @mw_client.get_file_content(file['filename'])
generated_content = File.read(file['path'])
if file_content == generated_content
puts "No modification on #{file['filename']}, skipping update"
else
@mw_client.update_file(file['filename'], file['path'], file['content_type'], file['comment'], true)
end
end
end
def diff_files
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment