Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ var regularPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/regularPl
var embeddedPlunker = require(path.resolve(TOOLS_PATH, 'plunker-builder/embeddedPlunker'));
var fsUtils = require(path.resolve(TOOLS_PATH, 'fs-utils/fsUtils'));

const WWW = argv.page ? 'www-pages' : 'www'

const isSilent = !!argv.silent;
if (isSilent) gutil.log = gutil.noop;
const _dgeniLogLevel = argv.dgeniLog || (isSilent ? 'error' : 'info');
Expand Down Expand Up @@ -747,7 +749,7 @@ gulp.task('harp-serve', () => {

gulp.task('serve-www', () => {
// Serve generated site.
return execPromise('npm run live-server ./www');
return execPromise(`npm run live-server ${WWW}`);
});

gulp.task('build-compile', ['build-docs'], function() {
Expand All @@ -758,7 +760,7 @@ gulp.task('check-deploy', ['build-docs'], function() {
return harpCompile().then(function() {
gutil.log('compile ok');
gutil.log('running live server ...');
execPromise('npm run live-server ./www');
execPromise(`npm run live-server ${WWW}`);
return askDeploy();
}).then(function(shouldDeploy) {
if (shouldDeploy) {
Expand Down Expand Up @@ -902,11 +904,13 @@ function harpCompile() {
env({ vars: { NODE_ENV: "production" } });
gutil.log("NODE_ENV: " + process.env.NODE_ENV);

if(skipLangs && fs.existsSync('www') && backupApiHtmlFilesExist('www')) {
if(argv.page) harpJsonSetJade2NgTo(true);

if(skipLangs && fs.existsSync(WWW) && backupApiHtmlFilesExist(WWW)) {
gutil.log(`Harp site recompile: skipping recompilation of API docs for [${skipLangs}]`);
gutil.log(`API docs will be copied from existing www folder.`)
del.sync('www-backup'); // remove existing backup if it exists
renameIfExistsSync('www', 'www-backup');
gutil.log(`API docs will be copied from existing ${WWW} folder.`)
del.sync(`${WWW}-backup`); // remove existing backup if it exists
renameIfExistsSync(WWW, `${WWW}-backup`);
} else {
gutil.log(`Harp full site compile, including API docs for all languages.`);
if (skipLangs)
Expand All @@ -918,11 +922,12 @@ function harpCompile() {
gutil.log('running harp compile...');
showHideExampleNodeModules('hide');
showHideApiDir('hide');
var spawnInfo = spawnExt('npm',['run','harp', '--', 'compile', '.', './www' ]);
var spawnInfo = spawnExt('npm',['run','harp', '--', 'compile', '.', WWW ]);
spawnInfo.promise.then(function(x) {
gutil.log("NODE_ENV: " + process.env.NODE_ENV);
showHideExampleNodeModules('show');
showHideApiDir('show');
harpJsonSetJade2NgTo(false);
if (x !== 0) {
deferred.reject(x)
} else {
Expand All @@ -933,6 +938,7 @@ function harpCompile() {
gutil.log("NODE_ENV: " + process.env.NODE_ENV);
showHideExampleNodeModules('show');
showHideApiDir('show');
harpJsonSetJade2NgTo(false);
deferred.reject(e);
});
return deferred.promise;
Expand Down Expand Up @@ -1050,21 +1056,21 @@ function _showHideApiDir(lang, showOrHide) {
renameIfExistsSync(...args);
}

// For each lang in skipLangs, copy the API dir from www-backup to www.
// For each lang in skipLangs, copy the API dir from ${WWW}-backup to WWW.
function restoreApiHtml() {
const vers = 'latest';
skipLangs.forEach(lang => {
const relApiDir = path.join('docs', lang, vers, 'api');
const wwwApiSubdir = path.join('www', relApiDir);
const backupApiSubdir = path.join('www-backup', relApiDir);
const apiSubdir = path.join(WWW, relApiDir);
const backupApiSubdir = path.join(`${WWW}-backup`, relApiDir);
if (fs.existsSync(backupApiSubdir) || argv.forceSkipApi !== true) {
gutil.log(`cp ${backupApiSubdir} ${wwwApiSubdir}`)
fs.copySync(backupApiSubdir, wwwApiSubdir);
gutil.log(`cp ${backupApiSubdir} ${apiSubdir}`)
fs.copySync(backupApiSubdir, apiSubdir);
}
});
}

// For each lang in skipLangs, ensure API dir exists in www-backup
// For each lang in skipLangs, ensure API dir exists in folderName
function backupApiHtmlFilesExist(folderName) {
const vers = 'latest';
var result = 1;
Expand All @@ -1079,6 +1085,14 @@ function backupApiHtmlFilesExist(folderName) {
return result;
}

function harpJsonSetJade2NgTo(v) {
const execSync = require('child_process').execSync;
const harpJsonPath = path.join(ANGULAR_IO_PROJECT_PATH, 'harp.json');
execSync(`perl -pi -e 's/("jade2ng": *)\\w+/$1${v}/' ${harpJsonPath}`);
const harpJson = require(harpJsonPath);
gutil.log(`jade2ng: ${harpJson.globals.jade2ng}`);
}

// Copies fileNames into destPaths, setting the mode of the
// files at the destination as optional_destFileMode if given.
// returns a promise
Expand Down
1 change: 1 addition & 0 deletions harp.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"siteURL": "http://angular.io",
"jsLatest": "2.0.0-beta.02",
"dartLatest": "2.0.0-beta.02",
"jade2ng": false,

"bios": {
"misko": {
Expand Down
10 changes: 4 additions & 6 deletions public/_includes/_hero.jade
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// template: public/_includes/_hero
//- template: public/_includes/_hero
//- Refer to jade.template.html and addJadeDataDocsProcessor to figure out where the context of this jade file originates
- var textFormat = '';
- var headerTitle = title + (typeof varType !== 'undefined' ? (': ' + varType) : '');
Expand All @@ -24,16 +24,14 @@ header.hero.background-sky
span(class="badge is-deprecated").
Security Risk

//CLEAR FLOAT ELEMENTS
//- CLEAR FLOAT ELEMENTS
.clear

if subtitle
h2.hero-subtitle #{subtitle}

else if docType
h2.hero-subtitle #{renamer(capitalize(docType))}


if current.path[3] == 'api' && current.path[1] == 'dart'
block breadcrumbs
if current.path[3] == 'api' && current.path[1] == 'dart'
block breadcrumbs

2 changes: 1 addition & 1 deletion public/_includes/_util-fns.jade
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ if !jade2ng
- } else {
- // ``` gets translated to <pre><code>.....</code></pre> and we need
- // to remove this from the fragment prefix is 11 long and suffix is 13 long
- frag = jade2ng ? frag : frag.substring(11, frag.length-13);
- frag = frag.substring(11, frag.length-13);
- // Uncomment next line for debugging.
- // frag = "FileName: " + fullFileName + " Current path: " + current.path + " PathToDocs: " + getPathToDocs() + "\n" + frag;
- return frag;
Expand Down
75 changes: 43 additions & 32 deletions public/docs/_layout-dart-api.jade
Original file line number Diff line number Diff line change
@@ -1,40 +1,51 @@
//- WARNING: _layout.jade and _layout-dart-api.jade should match in terms of content
//- except that one uses Harp partial/yield and the other uses Jade extends/include.
doctype
html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Framework")
// template: public/docs/_layout-dart-api
head
include ../_includes/_head-include
block head-extra

block var-def
body(class="l-offset-nav l-offset-side-nav" ng-controller="AppCtrl as appCtrl")
include ../_includes/_main-nav
if current.path[2]
include _includes/_side-nav
if jade2ng
.side-nav--offset
link(rel="stylesheet" href="/assets/css/vendor/dartdoc/bootstrap.min.css")
link(rel="stylesheet" href="/assets/css/vendor/dartdoc/styles.css")
include ../_includes/_hero
include ../_includes/_banner

if current.path[3] == 'api'
if current.path[4] == 'index'
block main-content
else
article(class="l-content-small grid-fluid docs-content")
block main-content
else if current.path.indexOf('cheatsheet') > 0
.l-content-small.grid-fluid.docs-content
block main-content
else
if current.path[3] == 'index' || current.path[3] == 'styleguide'
article(class="l-content-small grid-fluid docs-content")
else
doctype
html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Framework")
// template: public/docs/_layout-dart-api
head
include ../_includes/_head-include
link(rel="stylesheet" href="/resources/css/vendor/dartdoc/bootstrap.min.css")
link(rel="stylesheet" href="/resources/css/vendor/dartdoc/styles.css")
block head-extra

block var-def
body(class="l-offset-nav l-offset-side-nav" ng-controller="AppCtrl as appCtrl")
include ../_includes/_main-nav
if current.path[2]
include _includes/_side-nav
include ../_includes/_hero
include ../_includes/_banner

if current.path[3] == 'api'
if current.path[4] == 'index'
block main-content
else
article(class="l-content-small grid-fluid docs-content")
block main-content
else if current.path.indexOf('cheatsheet') > 0
block main-content
else
article(class="l-content-small grid-fluid docs-content")
div(class="c10")
.showcase
.showcase-content
block main-content
if (current.path[3] == 'guide' || current.path[3] == 'tutorial') && current.path[4]
include ../_includes/_next-item
if current.path[3] == 'index' || current.path[3] == 'styleguide'
article(class="l-content-small grid-fluid docs-content")
block main-content
else
article(class="l-content-small grid-fluid docs-content")
div(class="c10")
.showcase
.showcase-content
block main-content
if (current.path[3] == 'guide' || current.path[3] == 'tutorial') && current.path[4]
include ../_includes/_next-item

include ../_includes/_footer
include ../_includes/_scripts-include
include ../_includes/_footer
include ../_includes/_scripts-include
65 changes: 36 additions & 29 deletions public/docs/_layout.jade
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
//- WARNING: _layout.jade and _layout-dart-api.jade should match in terms of content
//- except that one uses Harp partial/yield and the other uses Jade extends/include.
doctype
html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Framework")
// template: public/docs/_layout
head
!= partial("../_includes/_head-include")
block head-extra

//-
body(class="l-offset-nav l-offset-side-nav" ng-controller="AppCtrl as appCtrl")
!= partial("../_includes/_main-nav")
if current.path[2]
!= partial("_includes/_side-nav")
if jade2ng
.side-nav--offset
!= partial("../_includes/_hero")
!= partial("../_includes/_banner")
.l-content-small.grid-fluid.docs-content
!= yield
else
doctype
html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Framework")
// template: public/docs/_layout
head
!= partial("../_includes/_head-include")
block head-extra

if current.path[3] == 'api'
if current.path[4] == 'index'
!= yield
else
article(class="l-content-small grid-fluid docs-content")
!= yield
else if current.path.indexOf('cheatsheet') > 0
!= yield
else
if current.path[3] == 'index' || current.path[3] == 'styleguide'
article(class="l-content-small grid-fluid docs-content")
//-
body(class="l-offset-nav l-offset-side-nav" ng-controller="AppCtrl as appCtrl")
!= partial("../_includes/_main-nav")
if current.path[2]
!= partial("_includes/_side-nav")
!= partial("../_includes/_hero")
!= partial("../_includes/_banner")

if current.path[3] == 'api'
if current.path[4] == 'index'
!= yield
else
article(class="l-content-small grid-fluid docs-content")
!= yield
else if current.path.indexOf('cheatsheet') > 0
!= yield
else
article(class="l-content-small grid-fluid docs-content")
!= yield
if (current.path[3] == 'guide' || current.path[3] == 'tutorial') && current.path[4]
!= partial("../_includes/_next-item")
if current.path[3] == 'index' || current.path[3] == 'styleguide'
article(class="l-content-small grid-fluid docs-content")
!= yield
else
article(class="l-content-small grid-fluid docs-content")
!= yield
if (current.path[3] == 'guide' || current.path[3] == 'tutorial') && current.path[4]
!= partial("../_includes/_next-item")

!= partial("../_includes/_footer")
!= partial("../_includes/_scripts-include")
!= partial("../_includes/_footer")
!= partial("../_includes/_scripts-include")
Loading