Commit 6cc09130 authored by Lucas Nussbaum's avatar Lucas Nussbaum

[dev/wiki] Improve footer (bug 9289)

parent 9182a0c2
......@@ -53,7 +53,7 @@ class CPUParametersGenerator < WikiGenerator
#Table construction
table_options = 'class="wikitable sortable"'
@generated_content = MW.generate_table(table_options, table_columns, table_data)
@generated_content += MW.italic(MW.small("Generated from the Grid5000 APIs on " + Time.now.strftime("%Y-%m-%d")))
@generated_content += MW.italic(MW.small(generated_date_string))
@generated_content += MW::LINE_FEED
end
end
......
......@@ -42,7 +42,7 @@ class DiskReservationGenerator < WikiGenerator
# Table construction
table_options = 'class="wikitable sortable"'
@generated_content = MW.generate_table(table_options, table_columns, table_data)
@generated_content += MW.italic(MW.small("Generated from the Grid5000 APIs on " + Time.now.strftime("%Y-%m-%d")))
@generated_content += MW.italic(MW.small(generated_date_string))
@generated_content += MW::LINE_FEED
end
......
......@@ -17,7 +17,7 @@ class G5KHardwareGenerator < WikiGenerator
@generated_content += "\n= Clusters =\n"
@generated_content += SiteHardwareGenerator.generate_all_clusters
@generated_content += generate_totals
@generated_content += MW.italic(MW.small("Generated from the Grid5000 APIs on " + Time.now.strftime("%Y-%m-%d")))
@generated_content += MW.italic(MW.small(generated_date_string))
@generated_content += MW::LINE_FEED
end
......
......@@ -219,6 +219,8 @@ class OarPropertiesGenerator < WikiGenerator
@generated_content += MW::LIST_ITEM + " Possible values: " + MW::code(@@properties[property]["possible_values"]) + MW::LINE_FEED
}
}
@generated_content += MW.italic(MW.small(generated_date_string))
@generated_content += MW::LINE_FEED
end
end
......
......@@ -16,7 +16,7 @@ class SiteHardwareGenerator < WikiGenerator
@generated_content += "'''#{generate_oneline_summary}'''\n"
@generated_content += self.class.generate_summary(@site, false)
@generated_content += self.class.generate_description(@site)
@generated_content += MW.italic(MW.small('Generated from the Grid5000 APIs on ' + Time.now.strftime('%Y-%m-%d')))
@generated_content += MW.italic(MW.small(generated_date_string))
@generated_content += MW::LINE_FEED
end
......
......@@ -42,6 +42,16 @@ class WikiGenerator
raise "To be implemented in actual generators"
end
def remove_page_creation_date(content)
return content.gsub(/''<small>Last generated from the Grid5000 API on .+<\/small>''/, '')
end
def generated_date_string
commit = `git show --oneline -s`.split(' ').first
date = Time.now.strftime("%Y-%m-%d")
return "Last generated from the Grid5000 Reference API on #{date} ([https://github.com/grid5000/reference-repository/commit/#{commit} commit #{commit}])"
end
#Actually edit the mediawiki page with the new generated content
def update_page
@mw_client.edit({"title" => @page_name, "text" => @generated_content })
......@@ -64,10 +74,6 @@ class WikiGenerator
return false
end
def remove_page_creation_date(content)
return content.gsub(/''<small>Generated from the Grid5000 APIs on .+<\/small>''/, '')
end
def update_files
@files.each { |file|
@mw_client.update_file(file['filename'], file['path'], file['content_type'], file['comment'], true)
......@@ -112,7 +118,7 @@ class WikiGenerator
options = {
:generators => [],
:sites => G5K::SITES,
:sites => ['global'] + G5K::SITES,
:diff => false,
:print => false,
:update => false,
......
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