Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
feat:(docs) add version.json generation to build process
Browse files Browse the repository at this point in the history
closes #235

fixes for wip-sha docs
  • Loading branch information
rschmukler committed Sep 4, 2014
1 parent db6a5bb commit 54c6043
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions config/build.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {

docsDist: 'dist/docs',
docsLib: 'dist/docs/lib',
docsVersionFile: './dist/docs/version.json', // Writing to dist/ to avoid version-managed docs
docsAssets: {
js: [
'bower_components/angularytics/dist/angularytics.js',
Expand Down
7 changes: 3 additions & 4 deletions docs/app/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"sha" : "",
"url" : "https://github.com/angular/material/commit/",

"_comment" : "Gulp tool should use command `git git rev-parse 'HEAD'` and inject SHA value above"
"sha":"",
"url":"https://github.com/angular/material/tree/",
"_comment": "see gulp task 'docs-version' for usage"
}
14 changes: 13 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ var glob = require('glob').sync;
var gulp = require('gulp');
var karma = require('karma').server;
var pkg = require('./package.json');
var exec = require('child_process').exec;
var writeFile = require('fs').writeFile;

var argv = require('minimist')(process.argv.slice(2));

Expand Down Expand Up @@ -48,7 +50,17 @@ gulp.task('watch', ['docs'], function() {
/**
* Docs
*/
gulp.task('docs', ['docs-scripts', 'docs-html2js', 'docs-css', 'docs-html', 'docs-app'], function() {
gulp.task('docs', ['docs-scripts', 'docs-html2js', 'docs-css', 'docs-html', 'docs-app', 'docs-version'], function() {
});

gulp.task('docs-version', ['docs-app'], function(done) {
exec('git rev-parse HEAD', { env: process.env }, function(err, stdout) {
if(err) throw err;
var sha = stdout.trim();
var json = require(buildConfig.docsVersionFile);
json.sha = sha;
writeFile(buildConfig.docsVersionFile, JSON.stringify(json), 'utf8', done);
});
});

gulp.task('docs-scripts', ['demo-scripts'], function() {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"conventional-changelog": "0.0.9",
"dgeni": "~0.3.0",
"dgeni-packages": "~0.9.2",
"esprima": "^1.2.2",
"event-stream": "^3.1.5",
"glob": "~4.0.2",
"gulp": "^3.6.2",
Expand All @@ -18,6 +19,7 @@
"gulp-if": "^1.2.0",
"gulp-jshint": "^1.5.5",
"gulp-minify-css": "^0.3.4",
"gulp-ng-html2js": "^0.1.8",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.3.0",
"gulp-sass": "^0.7.1",
Expand All @@ -29,14 +31,12 @@
"jshint-summary": "^0.3.0",
"karma": "^0.12.16",
"karma-chrome-launcher": "^0.1.4",
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "^0.1.5",
"karma-phantomjs-launcher": "~0.1.4",
"karma-firefox-launcher": "^0.1.3",
"karma-safari-launcher": "^0.1.1",
"karma-sauce-launcher": "^0.2.10",
"lodash": "^2.4.1",
"minimist": "^0.1.0",
"esprima": "^1.2.2",
"gulp-ng-html2js": "^0.1.8"
"minimist": "^0.1.0"
}
}

0 comments on commit 54c6043

Please sign in to comment.