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

Fixes https://github.com/flutter/flutter/issues/7974
This commit is contained in:
Jason Simmons 2017-02-10 09:55:58 -08:00 committed by GitHub
parent 5caeb3ff32
commit 68221a8023
2 changed files with 17 additions and 0 deletions

View File

@ -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',

View File

@ -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