Skip to content

Commit 2af7ece

Browse files
committed
Merge pull request #173 from ryanseys/update-docs
Update documentation - CONTRIBUTING and README
2 parents 258150d + 2ec31fc commit 2af7ece

File tree

2 files changed

+57
-21
lines changed

2 files changed

+57
-21
lines changed

CONTRIBUTING.md

+36-10
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,56 @@
77

88
## Testing
99

10-
``` sh
11-
# Run the tests.
12-
$ npm test
10+
### Unit tests
1311

14-
# Run the regression tests.
15-
$ npm run regression-test
12+
To run the unit tests, simply run:
1613

17-
# See the test coverage report.
18-
$ npm run cover
14+
``` sh
15+
$ npm test
1916
```
2017

21-
To run the regression tests, first create and configure a project following the [instructions on how to run gcloud-node][elsewhere]. After that, set the following environment variables:
18+
### Regression Tests
19+
20+
To run the regression tests, first create and configure a project in the Google Developers Console following the [instructions on how to run gcloud-node][elsewhere]. After that, set the following environment variables:
2221

2322
- **GCLOUD_TESTS_PROJECT_ID**: Developers Console project's ID (e.g. bamboo-shift-455)
2423
- **GCLOUD_TESTS_BUCKET_NAME**: The name of the bucket to use for the Cloud Storage API tests
2524
- **GCLOUD_TESTS_KEY**: The path to the JSON key file.
2625

27-
Lastly, create the indexes used in the datastore regression tests using the [gcloud command-line tool][gcloudcli] and the indexes found in `regression/data/index/yaml`:
26+
Install the [gcloud command-line tool][gcloudcli] to your machine and use it to create the indexes used in the datastore regression tests with indexes found in `regression/data/index/yaml`:
27+
28+
From the project's root directory:
2829

2930
``` sh
30-
# From the project's root directory:
31+
# Install the app component
32+
$ gcloud components update app
33+
34+
# Set the default project in your env
35+
$ gcloud config set project $GCLOUD_TESTS_PROJECT_ID
36+
37+
# Authenticate the gcloud tool with your account
38+
$ gcloud auth login
39+
40+
# Create the indexes
3141
$ gcloud preview datastore create-indexes regression/data/
3242
```
3343

44+
You may now run the regression tests:
45+
46+
``` sh
47+
$ npm run regression-test
48+
```
49+
50+
### Test Coverage
51+
52+
Generate the coverage report:
53+
54+
``` sh
55+
$ npm run cover
56+
```
57+
58+
The test coverage report will be available in `coverage/`.
59+
3460
## Contributor License Agreements
3561

3662
Before we can accept your pull requests you'll need to sign a Contributor License Agreement (CLA):

README.md

+21-11
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
> Node idiomatic client for Google Cloud services.
33
44
[![NPM Version](https://img.shields.io/npm/v/gcloud.svg)](https://www.npmjs.org/package/gcloud)
5-
![Travis Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-node.svg)
5+
[![Travis Build Status](https://travis-ci.org/GoogleCloudPlatform/gcloud-node.svg)](https://travis-ci.org/GoogleCloudPlatform/gcloud-node/)
66
[![Coverage Status](https://img.shields.io/coveralls/GoogleCloudPlatform/gcloud-node.svg)](https://coveralls.io/r/GoogleCloudPlatform/gcloud-node?branch=master)
77

88
This client supports the following Google Cloud services:
@@ -42,25 +42,27 @@ If you are not running this client on Google Compute Engine, you need a Google D
4242

4343
See the [Google Cloud Datastore docs](https://developers.google.com/datastore/docs/activate) for more details on how to activate Cloud Datastore for your project.
4444

45-
See [the API documentation](https://googlecloudplatform.github.io/gcloud-node/module-datastore.html) to learn how to interact with the Cloud Datastore using this Client Library.
45+
See [the gcloud-node API documentation](https://googlecloudplatform.github.io/gcloud-node/#/docs/datastore) to learn how to interact with the Cloud Datastore using this Client Library.
4646

4747
```js
4848
var gcloud = require('gcloud');
4949
var datastore = gcloud.datastore;
5050
var dataset;
5151

52-
// From Google Compute Engine
52+
// From Google Compute Engine:
5353
dataset = new datastore.Dataset({
5454
projectId: 'my-project',
5555
});
5656

57-
// From elsewhere
57+
// Or from elsewhere:
5858
dataset = new datastore.Dataset({
5959
projectId: 'my-project',
60-
keyFilename: '/path/to/keyfile.json'
60+
keyFilename: '/path/to/keyfile.json'
6161
});
6262

63-
dataset.get(dataset.key('Product', 'Computer'), function(err, entity) {});
63+
dataset.get(dataset.key('Product', 'Computer'), function(err, entity) {
64+
console.log(err || entity);
65+
});
6466
```
6567

6668
## Google Cloud Storage
@@ -69,27 +71,35 @@ dataset.get(dataset.key('Product', 'Computer'), function(err, entity) {});
6971

7072
You need to create a Google Cloud Storage bucket to use this client library. Follow the steps on the [Google Cloud Storage docs](https://developers.google.com/storage/docs/cloud-console#_creatingbuckets) to learn how to create a bucket.
7173

72-
See [the API documentation](https://googlecloudplatform.github.io/gcloud-node/module-storage.html) to learn how to connect to the Cloud Storage using this Client Library.
74+
See [the gcloud-node API documentation](https://googlecloudplatform.github.io/gcloud-node/#/docs/storage) to learn how to connect to the Cloud Storage using this Client Library.
7375

7476
```js
7577
var gcloud = require('gcloud');
7678
var storage = gcloud.storage;
7779
var bucket;
7880

79-
// From Google Compute Engine
81+
// From Google Compute Engine:
8082
bucket = new storage.Bucket({
8183
bucketName: YOUR_BUCKET_NAME
8284
});
8385

84-
// From elsewhere
86+
// Or from elsewhere:
8587
bucket = new storage.Bucket({
8688
bucketName: YOUR_BUCKET_NAME,
8789
keyFilename: '/path/to/the/key.json'
8890
});
8991

90-
bucket.write('filename', 'Hello World', function(err) {});
92+
bucket.write('demo.txt', 'Hello World', function(err) {
93+
console.log(err || 'Created demo.txt');
94+
});
9195
```
9296

9397
## Contributing
9498

95-
See [CONTRIBUTING](CONTRIBUTING.md).
99+
Contributions to this library are always welcome and highly encouraged.
100+
101+
See [CONTRIBUTING](CONTRIBUTING.md) for more information on how to get started.
102+
103+
## License
104+
105+
Apache 2.0 - See [COPYING](COPYING) for more information.

0 commit comments

Comments
 (0)