From: Manolo Carrasco Date: Thu, 1 Oct 2015 05:52:14 +0000 (+0200) Subject: Add source src to meta info, so as website can figure out the github location of... X-Git-Tag: 0.3.0-beta10~2^2~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3d3811ffa554863c3b68b2f8dcb12d3c995afd8a;p=vaadin-core.git Add source src to meta info, so as website can figure out the github location of each file --- diff --git a/bower.json b/bower.json index f4b07a0..d385de0 100644 --- a/bower.json +++ b/bower.json @@ -18,7 +18,7 @@ "**/tests" ], "dependencies": { - "vaadin-grid": "vaadin/vaadin-grid#master" + "vaadin-grid": "vaadin/vaadin-grid#0.9.0-beta2" }, "devDependencies": { "iron-doc-viewer": "polymerelements/iron-doc-viewer#~1.0.3", diff --git a/package.json b/package.json index 6de4edd..682742a 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,8 @@ "gulp-util": "latest", "web-component-tester": "3.3.10", "yargs": "latest", - "gulp-git": "latest", + "gulp-modify": "^0.1.1", "gulp-add-src": "latest" - }, "devDependencies": { "chalk": "latest", diff --git a/tasks/cdn.js b/tasks/cdn.js index 6816ebf..fe48cec 100644 --- a/tasks/cdn.js +++ b/tasks/cdn.js @@ -18,7 +18,6 @@ var host = config.cdnHost; var permalink = config.permalink; var stagingPath = stagingBasePath + '/' + version; var testPath = process.cwd() + '/' + stagingPath + '/test'; -var docPath = stagingPath + '/docsite'; gulp.task('clean:cdn', function() { fs.removeSync(stagingBasePath); diff --git a/tasks/docsite.js b/tasks/docsite.js index 7e08169..c31683c 100644 --- a/tasks/docsite.js +++ b/tasks/docsite.js @@ -16,6 +16,7 @@ var version = config.version; var host = config.cdnHost; var permalink = config.permalink; var stagingPath = stagingBasePath + '/' + version; +var modify = require('gulp-modify'); gulp.task('cdn:docsite:bower_components', ['cdn:stage-bower_components'], function() { gutil.log('Copying bower components from ' + stagingPath + ' to ' + docPath + '/bower_components'); @@ -36,8 +37,15 @@ config.components.forEach(function (n) { // Remove bad tags .pipe(replace(/^.*<(!doctype|\/?html|\/?head|\/?body|meta|title).*>.*\n/img, '')) // Uncomment metainfo, and enclose all the example in {% raw %} ... {% endraw %} to avoid liquid conflicts - .pipe(replace(/^.*.*\n([\s\S]*)/img, '---\n$1\n---\n{% raw %}\n$2\n{% endraw %}')) - // Remove the section with table-of-contents + // We use gulp-modify instead of replace in order to handle the github url for this file + .pipe(modify({ + fileModifier: function(file, contents) { + var re = new RegExp(".*/" + n + "/"); + var gh = 'https://github.com/vaadin/' + n + '/edit/master/' + file.path.replace(re, ''); + return contents.replace(/^.*.*\n([\s\S]*)/img, + '---\n$1\nsourceurl: ' + gh + '\n---\n{% raw %}\n$2\n{% endraw %}'); + } + })) .pipe(replace(/^.*
[\s\S]*?table-of-contents[\s\S]*?<\/section>.*\n/im, '')) // Add ids to headers, so as site configures permalinks .pipe(replace(/(.*)(<\/h\d+>)/img, function($0, $1, $2, $3){