Skip to content
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
2 changes: 1 addition & 1 deletion packages/bigtable/src/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function Instance(bigtable, name) {
* instance.create().then(function(data) {
* var instance = data[0];
* var operation = data[1];
* var apiResponse = data[2]
* var apiResponse = data[2];
* });
*/
create: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/bigtable/src/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ Row.prototype.getMetadata = function(options, callback) {
* }
* };
*
* row.increment('follows:gwashington', callback)
* row.increment('follows:gwashington', callback);
*
* //-
* // Specify a custom amount to increment the column by.
Expand Down
2 changes: 1 addition & 1 deletion packages/bigtable/src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ Table.prototype.insert = function(entries, callback) {
* }
* ];
*
* table.mutate(entries, callback)
* table.mutate(entries, callback);
*
* //-
* // Delete entities. See {module:bigtable/row#deleteCells}
Expand Down
2 changes: 1 addition & 1 deletion packages/compute/src/instance-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function InstanceGroup(zone, name) {
* instanceGroup.create().then(function(data) {
* var instanceGroup = data[0];
* var operation = data[1];
* var apiResponse = data[2]
* var apiResponse = data[2];
* });
*/
create: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/datastore/src/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ DatastoreRequest.prototype.runQueryStream = function(query, options) {
* name: 'DonutShack',
* rating: 8
* }
* }
* };
*
* datastore.save(entity, function(err) {
* console.log(key.path); // ['Company', 'donutshack']
Expand Down
20 changes: 12 additions & 8 deletions scripts/docs/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Builder(name, version, cwd) {
this.version = version || config.DEFAULT_VERSION;
this.dir = path.join(cwd || '', DOCS_ROOT, name, this.version);
this.isUmbrella = name === UMBRELLA_PACKAGE;
this.isMaster = this.version === config.DEFAULT_VERSION;
this.isRelease = !!semver.valid(this.version);
}

/**
Expand Down Expand Up @@ -112,7 +112,7 @@ Builder.prototype.build = function() {
* var tagName = builder.getTagName(); // bigtable-0.2.0
*/
Builder.prototype.getTagName = function() {
if (this.isMaster) {
if (!semver.valid(this.version)) {
return this.version;
}

Expand Down Expand Up @@ -233,7 +233,7 @@ function Bundler(builder) {
* Bundler.updateDep(builder);
*/
Bundler.updateDep = function(builder) {
if (builder.isMaster) {
if (!builder.isRelease) {
throw new Error('Must supply valid version to update bundles with.');
}

Expand All @@ -252,7 +252,7 @@ Bundler.updateDep = function(builder) {
bundleTag = bundler.builder.getTagName();
git.checkout(bundleTag);

dep = findWhere(bundler.getDeps(), { name: builder.name });
dep = findWhere(bundler.getDeps(), { name: builder.name }) || {};
git.checkout('-');

if (semver.maxSatisfying(versions, dep.version) !== builder.version) {
Expand Down Expand Up @@ -440,10 +440,13 @@ function build(name, version) {
git.checkout(builder.getTagName());
builder.build();
git.checkout('-');
builder.updateManifest();

if (!builder.isUmbrella && !builder.isMaster) {
Bundler.updateDep(builder);
if (builder.isRelease) {
builder.updateManifest();

if (!builder.isUmbrella) {
Bundler.updateDep(builder);
}
}
}

Expand All @@ -456,13 +459,14 @@ module.exports.build = build;
* builder.buildAll();
*/
function buildAll() {
var currentBranch = git.branch.current;
var modules = globby.sync('*', {
cwd: PACKAGES_ROOT,
ignore: config.IGNORE
});

modules.forEach(function(name) {
build(name, config.DEFAULT_VERSION);
build(name, currentBranch);
});
}

Expand Down
32 changes: 30 additions & 2 deletions test/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var createErrorClass = require('create-error-class');
var format = require('string-format-obj');
var fs = require('fs');
var glob = require('glob');
var jshint = require('jshint').JSHINT;
var mitm = require('mitm');
var multiline = require('multiline');
var overviews = require('../scripts/docs/config').OVERVIEW;
Expand All @@ -41,7 +42,19 @@ var DocsError = createErrorClass('DocsError', function(err, code) {
})
.join('\n');

this.message = '\n' + lines + '\n\n' + err.message;
this.message = format('\n{lines}\n\n{message}', {
lines: lines,
message: err.message
});
});

var JSHintError = createErrorClass('JSHintError', function(err) {
this.message = format('"{evidence}" - {reason}', {
evidence: err.evidence.trim(),
reason: err.reason
});

this.code = err.code;
});

var FakeConsole = Object.keys(console)
Expand Down Expand Up @@ -144,6 +157,21 @@ modules.forEach(function(mod) {
var snippet = createSnippet(mod, moduleInstantationCode, method);

it('should run ' + name + ' examples without errors', function() {
jshint(snippet, {
// in several snippets we give an example as to how to access
// a property (like metadata) without doing anything with it
// e.g. `list[0].metadata`
expr: true,

// this allows us to redefine variables, generally it's bad, buuut
// for copy/paste purposes this is desirable within the docs
shadow: true
});

if (jshint.errors.length) {
throw new JSHintError(jshint.errors[0]);
}

runCodeInSandbox(snippet, sandbox);
});
});
Expand All @@ -153,7 +181,7 @@ modules.forEach(function(mod) {

function getDocs(mod) {
return glob
.sync('docs/json/' + mod + '/master/*.json', {
.sync('docs/json/' + mod + '/*/*.json', {
ignore: [
'**/toc.json',
'**/types.json'
Expand Down