Skip to content
This repository has been archived by the owner on Jan 23, 2022. It is now read-only.

Commit

Permalink
feat(ngdocs): add commit {{rev}} in sourceLink
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin authored Jun 30, 2017
1 parent aa1d76a commit e7dcf87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tasks/grunt-ngdocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ module.exports = function(grunt) {

function makeLinkFn(tmpl, values) {
if (!tmpl || tmpl === true) { return false; }
if (/\{\{\s*sha\s*\}\}/.test(tmpl)) {
if (/\{\{\s*(sha|rev)\s*\}\}/.test(tmpl)) {
var shell = require('shelljs');
var sha = shell.exec('git rev-parse HEAD', { silent: true });
values.sha = ('' + sha.output).slice(0, 7);
values.rev = '' + sha.output;
values.sha = values.rev.slice(0, 7);
}
tmpl = _.template(tmpl, undefined, {'interpolate': /\{\{(.+?)\}\}/g});
return function(file, line, codeline) {
Expand Down

0 comments on commit e7dcf87

Please sign in to comment.