Comparing version 3.1.0 to 3.2.0
@@ -10,3 +10,4 @@ 'use strict'; | ||
options: { | ||
jshintrc: '.jshintrc' | ||
jshintrc: '.jshintrc', | ||
reporterOutput: '' | ||
}, | ||
@@ -13,0 +14,0 @@ all: [ |
@@ -5,4 +5,4 @@ 'use strict'; | ||
var request = require('request'); | ||
var _ = require('lodash'); | ||
require('colors'); | ||
var URL = require('url'); | ||
@@ -18,8 +18,19 @@ var Config = require('../config').Config; | ||
return Config.refreshTokens(projectName).then(function(){ | ||
var url = Config.getProjectEndpoint(projectName) + '/_queries'; | ||
path = path.indexOf('?') === -1 ? (path + '?') : path; | ||
path = path[0] === '/' ? path : ('/' + path); | ||
url += path + '&trace&_token=' + encodeURIComponent(Config.getProjectToken(projectName)); | ||
var u = URL.parse(path); | ||
if(u.protocol === null) { | ||
u = URL.parse(Config.getProjectEndpoint(projectName) + '/_queries' + (path[0] === '/' ? '' : '/') + path); | ||
} | ||
if(!u.path.endsWith('.jq') && !u.path.endsWith('.xq')) { | ||
//Assumes JSONiq then | ||
u.path += '.jq'; | ||
} | ||
if(u.search === null) { | ||
u.search = ''; | ||
} else { | ||
u.search += '&'; | ||
} | ||
u.search += '_token=' + encodeURIComponent(Config.getProjectToken(projectName)); | ||
var serializedURL = URL.format(u); | ||
request({ | ||
uri: url, | ||
uri: serializedURL, | ||
method: 'GET' | ||
@@ -31,22 +42,5 @@ }, function(error, response, body){ | ||
} | ||
_.forEach(response.headers, function(value, name){ | ||
console.log((name + ': ' + value).grey); | ||
}); | ||
try { | ||
body = JSON.stringify(JSON.parse(body), null, 2); | ||
} catch(e) {} | ||
console.log(body); | ||
var traceFile = response.headers['x-28msec-trace']; | ||
setTimeout(function(){ | ||
request({ | ||
uri: traceFile, | ||
method: 'GET' | ||
}, function(error, response, body){ | ||
if(body) { | ||
console.log(body.green); | ||
} | ||
}); | ||
}, 1000); | ||
console.log(body.green); | ||
}); | ||
}); | ||
}); |
@@ -9,3 +9,3 @@ { | ||
"description": "Command line utility to download and upload 28.io queries.", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"keywords": [ | ||
@@ -47,2 +47,3 @@ "jsoniq", | ||
"grunt": "~0.4.2", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-contrib-jshint": "0.10.0", | ||
@@ -49,0 +50,0 @@ "grunt-jsonlint": "~1.0.4", |
@@ -104,3 +104,3 @@ 'use strict'; | ||
var promise = new EventEmitter(); | ||
var projectName = 'vows-project'; | ||
var projectName = 'vows-project2'; | ||
var projectToken = session.project_tokens['project_' + projectName]; | ||
@@ -113,3 +113,3 @@ if(!projectToken) { | ||
$28 | ||
.upload('http://vows-project.28.io/v1', projectToken, projectPath, overwrite, deleteOrphaned, simulate, function(list){ return list; }) | ||
.upload('http://vows-project2.28.io/v1', projectToken, projectPath, overwrite, deleteOrphaned, simulate, function(list){ return list; }) | ||
.then(function(success){ | ||
@@ -130,2 +130,2 @@ promise.emit('success', success); | ||
} | ||
}).export(module); | ||
}).export(module); |
{ | ||
"protocol": "https", | ||
"protocol": "http", | ||
"project_name": "portal", | ||
@@ -7,2 +7,2 @@ "project_domain": "28.io", | ||
"prefix": "/api" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
422107
10
1271