angular-material-npfixed
Version:
The Angular Material project is an implementation of Material Design in Angular.js. This project provides a set of reusable, well-tested, and accessible Material Design UI components. Angular Material is supported internally at Google by the Angular.js, M
60 lines (47 loc) • 1.37 kB
JavaScript
var buildConfig = require('../../../config/build.config');
var q = require('q');
var exec = require('child_process').exec;
module.exports = function buildConfigProcessor(log) {
return {
$runBefore: ['rendering-docs'],
$runAfter: ['indexPageProcessor'],
$process: process
};
function process(docs) {
docs.push({
template: 'build-config.js',
outputPath: 'js/build-config.js',
buildConfig: buildConfig
});
return q.all([ getSHA(), getCommitDate() ])
.then( function(){
return docs;
});
}
/**
* Git the SHA associated with the most recent commit on origin/master
* @param deferred
* @returns {*}
*/
function getSHA() {
var deferred = q.defer();
exec('git rev-parse HEAD', function(error, stdout, stderr) {
buildConfig.commit = stdout && stdout.toString().trim();
deferred.resolve(buildConfig.commit);
});
return deferred.promise;
}
/**
* Get the commit date for the most recent commit on origin/master
* @param deferred
* @returns {*}
*/
function getCommitDate() {
var deferred = q.defer();
exec('git show -s --format=%ci HEAD', function(error, stdout, stderr) {
buildConfig.date = stdout && stdout.toString().trim();
deferred.resolve(buildConfig.date);
});
return deferred.promise;
}
};