Comparing version 0.3.1 to 0.3.3
@@ -35,8 +35,16 @@ 'use strict'; | ||
}, | ||
bats: { | ||
all: ['tests/*.bats'] | ||
shell: { | ||
bats: { | ||
options: { | ||
}, | ||
command: [ | ||
'node_modules/bats/libexec/bats tests/sync.bats', | ||
'node_modules/bats/libexec/bats tests/login.bats', | ||
'node_modules/bats/libexec/bats tests/projects.bats' | ||
].join('&&') | ||
} | ||
} | ||
}); | ||
grunt.registerTask('default', ['jsonlint', 'jshint', 'vows', 'bats']); | ||
grunt.registerTask('default', ['jsonlint', 'jshint', 'vows', 'shell']); | ||
}; |
@@ -33,3 +33,3 @@ (function(){ | ||
$28.prototype.refreshTokens = function(email, token){ | ||
$28.prototype.refreshTokens = function(email, token){ | ||
return api.Auth.authenticate({ | ||
@@ -126,2 +126,2 @@ email: email, | ||
exports.$28 = $28; | ||
})(); | ||
})(); |
@@ -107,4 +107,6 @@ 'use strict'; | ||
console.error(error.stack.toString().red); | ||
} else if(error !== undefined) { | ||
console.error(error); | ||
} else { | ||
console.error(error); | ||
console.error('Command exited with errors.'.red); | ||
} | ||
@@ -111,0 +113,0 @@ process.exit(1); |
@@ -69,3 +69,18 @@ 'use strict'; | ||
var writeRemoteQuery = function(diff){ | ||
return vfs.writeRemoteQuery(diff.query).then(function(){ logDiff(diff); }); | ||
var defered = Q.defer(); | ||
vfs.writeRemoteQuery(diff.query) | ||
.then(function(compileError){ | ||
if(compileError) { | ||
var lineNumber = compileError.location['line-number']; | ||
var line = vfs.getLocalQuery(diff.query).split('\n')[lineNumber - 1]; | ||
console.error('Compilation error in ' + diff.query); | ||
console.error(lineNumber + ' |' + line.red); | ||
console.error(compileError.message.red); | ||
defered.reject(); | ||
} else { | ||
defered.resolve(); | ||
} | ||
logDiff(diff); | ||
}); | ||
return defered.promise; | ||
}; | ||
@@ -72,0 +87,0 @@ |
@@ -28,3 +28,7 @@ 'use strict'; | ||
localProjectPath = localProjectPath ? normalizeLocalProjectPath(localProjectPath) : ''; | ||
this.getLocalQuery = function(path){ | ||
return fs.readFileSync(path, 'utf-8'); | ||
}; | ||
this.getLocalQueries = function(){ | ||
@@ -58,6 +62,4 @@ ffs.mkdirRecursiveSync(localProjectPath + 'modules', 511); | ||
Q.all([ | ||
$28.Queries(projectName).listQueries({ | ||
visibility: '', | ||
token: projectToken | ||
}), | ||
//Modules need to be listed/uploaded first, | ||
//so compilation errors on main queries can make sense. | ||
$28.Modules(projectName).listModules({ | ||
@@ -68,7 +70,22 @@ includeSystem: false, | ||
token: projectToken | ||
}), | ||
$28.Queries(projectName).listQueries({ | ||
visibility: '', | ||
token: projectToken | ||
}) | ||
]).then(function(lists){ | ||
var queries = {}; | ||
lists[0].body.public.concat( | ||
lists[0].body.private | ||
//Modules need to be listed/uploaded first, | ||
//so compilation errors on main queries can make sense. | ||
var moduleIndex = 0; | ||
var queryIndex = 1; | ||
var modules = lists[moduleIndex].body; | ||
Object.keys(modules).forEach(function(module){ | ||
var path = 'modules' + module + '.' + modules[module].extension; | ||
queries[path] = { | ||
lastModified: modules[module].lastModified | ||
}; | ||
}); | ||
lists[queryIndex].body.public.concat( | ||
lists[queryIndex].body.private | ||
).forEach(function(query){ | ||
@@ -80,9 +97,2 @@ var path = query.href.substring('/v1/_queries/'.length); | ||
}); | ||
var modules = lists[1].body; | ||
Object.keys(modules).forEach(function(module){ | ||
var path = 'modules' + module + '.' + modules[module].extension; | ||
queries[path] = { | ||
lastModified: modules[module].lastModified | ||
}; | ||
}); | ||
defered.resolve(queries); | ||
@@ -133,3 +143,5 @@ }).catch(function(error){ | ||
}) | ||
.then(function(){ defered.resolve(); }) | ||
.then(function(){ | ||
defered.resolve(); | ||
}) | ||
.catch(function(error){ defered.reject(error); }); | ||
@@ -143,3 +155,5 @@ } else { | ||
}) | ||
.then(function(){ defered.resolve(); }) | ||
.then(function(result){ | ||
defered.resolve(result.body.compilationError); | ||
}) | ||
.catch(function(error){ defered.reject(error); }); | ||
@@ -146,0 +160,0 @@ } |
@@ -9,3 +9,3 @@ { | ||
"description": "Command line utility to download and upload 28.io queries.", | ||
"version": "0.3.1", | ||
"version": "0.3.3", | ||
"keywords": [ | ||
@@ -47,3 +47,4 @@ "jsoniq", | ||
"grunt-jsonlint": "~1.0.4", | ||
"grunt-bats": "0.0.4" | ||
"grunt-shell": "~0.7.0", | ||
"bats": "git+https://github.com/sstephenson/bats.git#master" | ||
}, | ||
@@ -50,0 +51,0 @@ "optionalDependencies": {}, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
28
945
157974
8