Skip to content

Commit 3b005fe

Browse files
committed
Merge pull request #88 from essamjoubori/master
Delete Makefile, update version, clean up code
2 parents 51e0779 + 451b8e3 commit 3b005fe

5 files changed

Lines changed: 45 additions & 38 deletions

File tree

Makefile

Lines changed: 0 additions & 4 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ Our [PersonifyApp](http://personify.mybluemix.net/) grabs tweets based on a keyw
332332

333333

334334
## Release History
335+
- 1.0.3 Cleaned up code, added geoList file, and updated README.md
335336
- 1.0.2 Personify logo added
336337
- 1.0.1 README.md updated
337338
- 1.0.0 Initial release

package.json

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
{
22
"name": "personify",
33
"description": "A JavaScript based library that allows easy access to IBM Watson features utilizing Twitter data",
4-
"version": "1.0.2",
4+
"version": "1.0.3",
55
"main": "./util/twitter",
6-
"author": {
7-
"name": "Essam Al Joubori, Phil Elauria, Rohan Agrawal"
8-
},
6+
"contributors": [
7+
{
8+
"name" : "Essam Al Joubori",
9+
"email" : "essam.joubori@gmail.com",
10+
"url" : "https://github.com/essamjoubori"
11+
},
12+
{
13+
"name" : "Phil Elauria",
14+
"email" : "phil.elauria@gmail.com",
15+
"url" : "https://github.com/philelauria"
16+
},
17+
{
18+
"name" : "Rohan Agrawal",
19+
"email" : "rohankargrawal@gmail.com",
20+
"url" : "https://github.com/rohanagrawal"
21+
}
22+
],
923
"repository": {
1024
"type": "git",
1125
"url": "https://github.com/PersonifyJS/personify.js"
@@ -38,6 +52,6 @@
3852
},
3953
"homepage": "http://personifyjs.github.io/",
4054
"scripts": {
41-
"test": "make test"
55+
"test": "./node_modules/.bin/mocha tests/* -t 70000 -R spec --bail"
4256
}
4357
}

util/translate.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,34 @@ var querystring = require('querystring');
1010

1111
module.exports.translate = function(authenticate, data, language, outputType, callback){
1212

13-
// defaults for dev outside bluemix
14-
var service_url = authenticate.translateConfig.service_url;
15-
var service_username = authenticate.translateConfig.service_username;
16-
var service_password = authenticate.translateConfig.service_password;
13+
// defaults for dev outside bluemix
14+
var service_url = authenticate.translateConfig.service_url;
15+
var service_username = authenticate.translateConfig.service_username;
16+
var service_password = authenticate.translateConfig.service_password;
17+
18+
// VCAP_SERVICES contains all the credentials of services bound to
19+
// this application. For details of its content, please refer to
20+
// the document or sample of each service.
21+
if (process.env.VCAP_SERVICES) {
22+
console.log('Parsing VCAP_SERVICES');
23+
var services = JSON.parse(process.env.VCAP_SERVICES);
24+
//service name, check the VCAP_SERVICES in bluemix to get the name of the services you have
25+
var service_name = 'machine_translation';
26+
27+
if (services[service_name]) {
28+
var svc = services[service_name][0].credentials;
29+
service_url = svc.url;
30+
service_username = svc.username;
31+
service_password = svc.password;
32+
} else {
33+
console.log('The service '+service_name+' is not in the VCAP_SERVICES, did you forget to bind it?');
34+
}
1735

18-
// VCAP_SERVICES contains all the credentials of services bound to
19-
// this application. For details of its content, please refer to
20-
// the document or sample of each service.
21-
if (process.env.VCAP_SERVICES) {
22-
console.log('Parsing VCAP_SERVICES');
23-
var services = JSON.parse(process.env.VCAP_SERVICES);
24-
//service name, check the VCAP_SERVICES in bluemix to get the name of the services you have
25-
var service_name = 'machine_translation';
26-
27-
if (services[service_name]) {
28-
var svc = services[service_name][0].credentials;
29-
service_url = svc.url;
30-
service_username = svc.username;
31-
service_password = svc.password;
3236
} else {
33-
console.log('The service '+service_name+' is not in the VCAP_SERVICES, did you forget to bind it?');
37+
console.log('No VCAP_SERVICES found in ENV, using defaults for local development');
3438
}
3539

36-
} else {
37-
console.log('No VCAP_SERVICES found in ENV, using defaults for local development');
38-
}
39-
40-
var auth = 'Basic ' + new Buffer(service_username + ':' + service_password).toString('base64');
40+
var auth = 'Basic ' + new Buffer(service_username + ':' + service_password).toString('base64');
4141

4242
var request_data = {
4343
'txt': data,

util/watson.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ var querystring = require('querystring');
44
var extend = require('util')._extend;
55
var flatten = require('../lib/flatten');
66

7-
var appInfo = JSON.parse(process.env.VCAP_APPLICATION || "{}");
8-
97
// exporting the watson module to be required by the end user
108
module.exports.watson = function(authenticate, data, callback) {
119

@@ -96,12 +94,10 @@ var create_profile_request = function(options, content, res) {
9694
});
9795

9896
result.on('end', function() {
99-
10097
if (result.statusCode != 200) {
10198
var error = JSON.parse(response_string);
10299
// render error if the results are less than 100 words
103-
// res.send({"error" : "Watson: Oh, dear. It looks like there aren't enough tweets to conduct an analysis. Kindly send me another search query."});
104-
callback({'message': error.user_message}, null);
100+
callback({'message': error.user_message}, null);
105101
} else
106102
callback(null,response_string);
107103
});

0 commit comments

Comments
 (0)