diff --git a/packages/google-cloud/src/index.js b/packages/google-cloud/src/index.js index a6f56447a65e..682af7cd867a 100644 --- a/packages/google-cloud/src/index.js +++ b/packages/google-cloud/src/index.js @@ -204,7 +204,7 @@ var apis = { * keyFilename: '/path/to/keyfile.json' * }); */ - prediction: require('./prediction'), + prediction: require('@google-cloud/prediction'), /** * [Google Cloud Pub/Sub](https://developers.google.com/pubsub/overview) is a diff --git a/packages/google-cloud/test/index.js b/packages/google-cloud/test/index.js index 55b53974dd61..c9f609f8c3d2 100644 --- a/packages/google-cloud/test/index.js +++ b/packages/google-cloud/test/index.js @@ -57,6 +57,7 @@ describe('gcloud', function() { '@google-cloud/datastore': FakeDatastore, '@google-cloud/dns': FakeDNS, '@google-cloud/language': FakeLanguage, + '@google-cloud/logging': FakeLogging, '@google-cloud/prediction': FakePrediction, '@google-cloud/pubsub': FakePubSub, '@google-cloud/resource': FakeResource, diff --git a/packages/language/package.json b/packages/language/package.json new file mode 100644 index 000000000000..e1da14738aff --- /dev/null +++ b/packages/language/package.json @@ -0,0 +1,76 @@ +{ + "name": "@google-cloud/language", + "version": "0.1.0", + "author": "Google Inc.", + "description": "Google Cloud Natural Language Client Library for Node.js", + "contributors": [ + { + "name": "Burcu Dogan", + "email": "jbd@google.com" + }, + { + "name": "Johan Euphrosine", + "email": "proppy@google.com" + }, + { + "name": "Patrick Costello", + "email": "pcostell@google.com" + }, + { + "name": "Ryan Seys", + "email": "ryan@ryanseys.com" + }, + { + "name": "Silvano Luciani", + "email": "silvano@google.com" + }, + { + "name": "Stephen Sawchuk", + "email": "sawchuk@gmail.com" + } + ], + "main": "./src/index.js", + "files": [ + "./src/*", + "AUTHORS", + "CONTRIBUTORS", + "COPYING" + ], + "repository": "googlecloudplatform/gcloud-node", + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google cloud natural language", + "google cloud language", + "natural language", + "language" + ], + "dependencies": { + "@google-cloud/common": "^0.1.0", + "@google-cloud/storage": "^0.1.0", + "extend": "^3.0.0", + "google-proto-files": "^0.4.0", + "is": "^3.0.1", + "propprop": "^0.3.1", + "string-format-obj": "^1.0.0" + }, + "devDependencies": { + "mocha": "^2.1.0", + "proxyquire": "^1.7.10" + }, + "scripts": { + "publish": "../../scripts/publish.sh", + "test": "mocha test/*.js", + "system-test": "mocha system-test/*.js --no-timeouts --bail" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=0.12.0" + } +} diff --git a/lib/language/document.js b/packages/language/src/document.js similarity index 99% rename from lib/language/document.js rename to packages/language/src/document.js index 1c12d3f08b5b..dc31a5fdcb2c 100644 --- a/lib/language/document.js +++ b/packages/language/src/document.js @@ -22,16 +22,11 @@ var arrify = require('arrify'); var extend = require('extend'); +var File = require('@google-cloud/storage').File; var format = require('string-format-obj'); var is = require('is'); var prop = require('propprop'); -/** - * @type {module:storage/file} - * @private - */ -var File = require('../storage/file.js'); - /*! Developer Documentation * * @param {module:language} language - The parent Language object. @@ -45,7 +40,7 @@ var File = require('../storage/file.js'); * @alias module:language/document * * @example - * var gcloud = require('gcloud'); + * var gcloud = require('google-cloud'); * * var language = gcloud.language({ * projectId: 'grape-spaceship-123' diff --git a/lib/language/index.js b/packages/language/src/index.js similarity index 98% rename from lib/language/index.js rename to packages/language/src/index.js index aa2d4ff60d44..e37b8ce6a820 100644 --- a/lib/language/index.js +++ b/packages/language/src/index.js @@ -22,8 +22,10 @@ var extend = require('extend'); var is = require('is'); +var GrpcService = require('@google-cloud/common').GrpcService; var googleProtoFiles = require('google-proto-files'); var nodeutil = require('util'); +var util = require('@google-cloud/common').util; /** * @type {module:language/document} @@ -31,18 +33,6 @@ var nodeutil = require('util'); */ var Document = require('./document.js'); -/** - * @type {module:common/grpc-service} - * @private - */ -var GrpcService = require('../common/grpc-service.js'); - -/** - * @type {module:common/util} - * @private - */ -var util = require('../common/util.js'); - /** * The [Google Cloud Natural Language](https://cloud.google.com/natural-language/docs) * API provides natural language understanding technologies to developers, @@ -69,7 +59,7 @@ var util = require('../common/util.js'); * @param {object} options - [Configuration object](#/docs). * * @example - * var gcloud = require('gcloud')({ + * var gcloud = require('google-cloud')({ * keyFilename: '/path/to/keyfile.json', * projectId: 'grape-spaceship-123' * }); diff --git a/system-test/language.js b/packages/language/system-test/language.js similarity index 98% rename from system-test/language.js rename to packages/language/system-test/language.js index e5dda50d1947..969763ae63cc 100644 --- a/system-test/language.js +++ b/packages/language/system-test/language.js @@ -18,14 +18,14 @@ var assert = require('assert'); var is = require('is'); +var Storage = require('@google-cloud/storage'); var through = require('through2'); var uuid = require('node-uuid'); -var env = require('./env.js'); -var Language = require('../lib/language/index.js'); -var Storage = require('../lib/storage/index.js'); +var env = require('../../../system-test/env.js'); +var Language = require('../'); -describe.only('Language', function() { +describe('Language', function() { var language; var TESTS_PREFIX = 'gcloud-tests-language-'; diff --git a/test/language/document.js b/packages/language/test/document.js similarity index 98% rename from test/language/document.js rename to packages/language/test/document.js index fb5add7b7a94..ae7cc790d531 100644 --- a/test/language/document.js +++ b/packages/language/test/document.js @@ -18,10 +18,9 @@ var assert = require('assert'); var extend = require('extend'); -var mockery = require('mockery-next'); var prop = require('propprop'); - -var util = require('../../lib/common/util.js'); +var proxyquire = require('proxyquire'); +var util = require('@google-cloud/common').util; function FakeFile() {} @@ -36,22 +35,15 @@ describe('Document', function() { var CONFIG = 'inline content'; before(function() { - mockery.registerMock('../../lib/storage/file.js', FakeFile); - - mockery.enable({ - useCleanCache: true, - warnOnUnregistered: false + Document = proxyquire('../src/document.js', { + '@google-cloud/storage': { + File: FakeFile + } }); - Document = require('../../lib/language/document.js'); DocumentCache = extend(true, {}, Document); }); - after(function() { - mockery.deregisterAll(); - mockery.disable(); - }); - beforeEach(function() { for (var property in DocumentCache) { if (DocumentCache.hasOwnProperty(property)) { diff --git a/test/language/index.js b/packages/language/test/index.js similarity index 93% rename from test/language/index.js rename to packages/language/test/index.js index 3c93d232516e..5c5f6fb6e22c 100644 --- a/test/language/index.js +++ b/packages/language/test/index.js @@ -19,9 +19,8 @@ var assert = require('assert'); var extend = require('extend'); var googleProtoFiles = require('google-proto-files'); -var mockery = require('mockery-next'); - -var util = require('../../lib/common/util.js'); +var proxyquire = require('proxyquire'); +var util = require('@google-cloud/common').util; var fakeUtil = extend(true, {}, util); @@ -40,21 +39,13 @@ describe('Language', function() { var OPTIONS = {}; before(function() { - mockery.registerMock('../../lib/common/grpc-service.js', FakeGrpcService); - mockery.registerMock('../../lib/common/util.js', fakeUtil); - mockery.registerMock('../../lib/language/document.js', FakeDocument); - - mockery.enable({ - useCleanCache: true, - warnOnUnregistered: false + Language = proxyquire('../src/index.js', { + '@google-cloud/common': { + util: fakeUtil, + GrpcService: FakeGrpcService + }, + './document.js': FakeDocument }); - - Language = require('../../lib/language/index.js'); - }); - - after(function() { - mockery.deregisterAll(); - mockery.disable(); }); beforeEach(function() { diff --git a/scripts/link.sh b/scripts/link.sh index ee50ba19db9a..814f1898dc35 100755 --- a/scripts/link.sh +++ b/scripts/link.sh @@ -29,6 +29,7 @@ # Depends on @google-cloud/common, @google-cloud/storage (cd ./packages/bigquery; npm link @google-cloud/common; npm link @google-cloud/storage; npm link) +(cd ./packages/language; npm link @google-cloud/common; npm link @google-cloud/storage; npm link) (cd ./packages/vision; npm link @google-cloud/common; npm link @google-cloud/storage; npm link) (cd ./packages/prediction; npm link @google-cloud/common; npm link @google-cloud/storage; npm link) @@ -41,6 +42,7 @@ npm link @google-cloud/bigtable npm link @google-cloud/compute npm link @google-cloud/datastore npm link @google-cloud/dns +npm link @google-cloud/language npm link @google-cloud/logging npm link @google-cloud/prediction npm link @google-cloud/pubsub