Skip to content

Commit

Permalink
Cleanup App Engine samples and re-work tests. (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry authored and Ace Nassri committed Apr 24, 2017
1 parent a21f930 commit 2d5928f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 13 deletions.
34 changes: 28 additions & 6 deletions packages/google-cloud-resourcemanager/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,21 @@ programmatically manage these container resources.
* [Setup](#setup)
* [Samples](#samples)
* [Projects](#projects)
* [Running the tests](#running-the-tests)

## Setup

1. Read [Prerequisites][prereq] and [How to run a sample][run] first.
1. Install dependencies:
1. Read [Prerequisites][prereq] and [How to run a sample][run] first.
1. Install dependencies:

With `npm`:

npm install

With `yarn`:

yarn install

[prereq]: ../README.md#prerequisities
[run]: ../README.md#how-to-run-a-sample

Expand All @@ -37,16 +44,31 @@ __Usage:__ `node projects --help`

```
Commands:
list List all projects the authenticated user has access to.
list List all current projects.
Options:
--help Show help [boolean]
--help Show help [boolean]
Examples:
node projects list List projects.
node projects.js list Lists all current projects.
For more information, see https://cloud.google.com/resource-manager/docs/
For more information, see https://cloud.google.com/resource-manager/docs
```

[projects_docs]: https://cloud.google.com/resource-manager/docs/
[projects_code]: projects.js

## Running the tests

1. Set the `GCLOUD_PROJECT` and `GOOGLE_APPLICATION_CREDENTIALS` environment
variables.

1. Run the tests:

With `npm`:

npm test

With `yarn`:

yarn test
29 changes: 23 additions & 6 deletions packages/google-cloud-resourcemanager/samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,33 @@
"name": "nodejs-docs-samples-resource-manager",
"version": "0.0.1",
"private": true,
"license": "Apache Version 2.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"scripts": {
"test": "cd ..; npm run st -- --verbose resource/system-test/*.test.js"
"repository": {
"type": "git",
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git"
},
"dependencies": {
"@google-cloud/resource": "0.6.0",
"yargs": "6.6.0"
"cloud": {
"requiresKeyFile": true,
"requiresProjectId": true
},
"engines": {
"node": ">=4.3.2"
},
"scripts": {
"lint": "samples lint",
"pretest": "npm run lint",
"system-test": "ava -T 20s --verbose system-test/*.test.js",
"test": "npm run system-test"
},
"dependencies": {
"@google-cloud/resource": "0.7.1",
"yargs": "7.1.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.3.1",
"ava": "0.19.1",
"proxyquire": "1.7.11",
"sinon": "2.1.0"
}
}
5 changes: 4 additions & 1 deletion packages/google-cloud-resourcemanager/samples/quickstart.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2016, Google, Inc.
* Copyright 2017, Google, Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
Expand Down Expand Up @@ -34,5 +34,8 @@ resourceClient.getProjects()

console.log('Projects:');
projects.forEach((project) => console.log(project.id));
})
.catch((err) => {
console.error('ERROR:', err);
});
// [END resource_quickstart]

0 comments on commit 2d5928f

Please sign in to comment.