Commit 68221a80 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Add a timestamp and Git commit to the dartdoc home page (#8046)

Fixes https://github.com/flutter/flutter/issues/7974
parent 5caeb3ff
......@@ -6,6 +6,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:intl/intl.dart';
import 'package:path/path.dart' as path;
const String kDocRoot = 'dev/docs/doc';
......@@ -61,11 +62,14 @@ dependencies:
if (code != 0)
exit(code);
createFooter('dev/docs/lib/footer.html');
// Generate the documentation.
List<String> args = <String>[
'global', 'run', 'dartdoc',
'--header', 'styles.html',
'--header', 'analytics.html',
'--footer', 'lib/footer.html',
'--exclude', 'temp_doc',
'--favicon=favicon.ico',
'--use-categories'
......@@ -90,6 +94,18 @@ dependencies:
createIndexAndCleanup();
}
void createFooter(String footerPath) {
ProcessResult gitResult = Process.runSync('git', <String>['rev-parse', 'HEAD']);
String gitHead = (gitResult.exitCode == 0) ? gitResult.stdout.trim() : 'unknown';
String timestamp = new DateFormat('yyyy-MM-dd HH:mm').format(new DateTime.now());
new File(footerPath).writeAsStringSync(
'<p class="text-center" style="font-size: 10px">'
'Generated on $timestamp - Version $gitHead</p>'
);
}
void sanityCheckDocs() {
List<String> canaries = <String>[
'$kDocRoot/api/dart-io/File-class.html',
......
......@@ -5,4 +5,5 @@ dependencies:
archive: ^1.0.20
args: ^0.13.4
http: ^0.11.3
intl: ^0.14.0
path: ^1.4.0
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