mirror of https://gitee.com/bigwinds/arangodb
new name convention
This commit is contained in:
parent
9bc0f82583
commit
1b6dfad627
|
@ -1,25 +0,0 @@
|
|||
COMMAND SECTION "DATE" "" "ArangoDB"
|
||||
NAME
|
||||
COMMAND - user setup utility for the ArangoDB database server
|
||||
SYNOPSIS
|
||||
COMMAND database-directory username [password]
|
||||
DESCRIPTION
|
||||
The COMMAND utility can be used to create additional users in an
|
||||
ArangoDB database server.
|
||||
The utility must be run with exclusive access to the server's data directory,
|
||||
meaning the ArangoDB server must not be running and accessing the
|
||||
datafiles in the specified data directory.
|
||||
OPTIONS
|
||||
The options of the COMMAND utility are:
|
||||
OPTION "--database.directory <string>"
|
||||
path to the database directory ENDOPTION
|
||||
OPTION "username"
|
||||
name of the user to add ENDOPTION
|
||||
OPTION "password"
|
||||
password for the user. Leave empty for a password prompt ENDOPTION
|
||||
EXAMPLES
|
||||
EXAMPLE COMMAND --database.directory /data/arangodb fuchsia
|
||||
creates a new user "fuchsia". Password prompt will follow ENDEXAMPLE
|
||||
EXAMPLE COMMAND --database.directory /data/arangodb fuchsia "1234@ab"
|
||||
creates a new user "fuchsia" with the specified password ENDEXAMPLE
|
||||
AUTHOR
|
|
@ -71,6 +71,7 @@ TRI_DATABASEDIR =
|
|||
TRI_LOGDIR = /tmp
|
||||
TRI_PKGDATADIR = .
|
||||
TRI_SBINDIR = ${abs_builddir}/bin
|
||||
TRI_BINDIR = ${abs_builddir}/bin
|
||||
|
||||
else
|
||||
|
||||
|
@ -78,6 +79,7 @@ TRI_DATABASEDIR = ${localstatedir}/lib/${PACKAGE_TARNAME}
|
|||
TRI_LOGDIR = ${localstatedir}/log/${PACKAGE_TARNAME}
|
||||
TRI_PKGDATADIR = ${pkgdatadir}
|
||||
TRI_SBINDIR = ${sbindir}
|
||||
TRI_BINDIR = ${bindir}
|
||||
|
||||
endif
|
||||
|
||||
|
|
|
@ -54,11 +54,6 @@ size_t const ArangoClient::DEFAULT_RETRIES = 2;
|
|||
// --SECTION-- public constants
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoShell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ignore sequence used for prompt length calculation (starting point)
|
||||
///
|
||||
|
@ -75,19 +70,10 @@ char const * ArangoClient::PROMPT_IGNORE_START = "\001";
|
|||
|
||||
char const * ArangoClient::PROMPT_IGNORE_END = "\002";
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- constructors and destructors
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoShell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief constructor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -133,19 +119,10 @@ ArangoClient::ArangoClient ()
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public methods
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoShell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets up the general and logging options
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -347,9 +324,9 @@ void ArangoClient::parse (ProgramOptions& options,
|
|||
}
|
||||
|
||||
// check if have a password
|
||||
_hasPassword = options.has("server.password") ||
|
||||
_disableAuthentication ||
|
||||
options.has("jslint");
|
||||
_hasPassword = options.has("server.password")
|
||||
|| _disableAuthentication
|
||||
|| options.has("jslint");
|
||||
|
||||
// set colors
|
||||
if (options.has("colors")) {
|
||||
|
@ -745,10 +722,6 @@ double ArangoClient::requestTimeout () const {
|
|||
return _requestTimeout;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -74,11 +74,6 @@ using namespace triagens::arango;
|
|||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup V8Shell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief base class for clients
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -133,6 +128,12 @@ static string StartupPath = "";
|
|||
|
||||
static vector<string> ExecuteScripts;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief javascript string to execute
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static string ExecuteString;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief javascript files to syntax check
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -151,19 +152,10 @@ static vector<string> UnitTests;
|
|||
|
||||
static vector<string> JsLint;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- JavaScript functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup V8Shell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief outputs the arguments
|
||||
///
|
||||
|
@ -222,19 +214,10 @@ static v8::Handle<v8::Value> JS_StopOutputPager (v8::Arguments const& ) {
|
|||
return v8::Undefined();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- import function
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup V8Shell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief imports a CSV file
|
||||
///
|
||||
|
@ -362,11 +345,6 @@ static v8::Handle<v8::Value> JS_ImportJsonFile (v8::Arguments const& argv) {
|
|||
TRI_V8_EXCEPTION_MESSAGE(scope, TRI_ERROR_FAILED, ih.getErrorMessage().c_str());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief normalize UTF 16 strings
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -404,11 +382,6 @@ static v8::Handle<v8::Value> JS_compare_string (v8::Arguments const& argv) {
|
|||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup V8Shell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief return a new client connection instance
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -427,12 +400,13 @@ static V8ClientConnection* CreateConnection () {
|
|||
/// @brief parses the program options
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void ParseProgramOptions (int argc, char* argv[]) {
|
||||
static vector<string> ParseProgramOptions (int argc, char* argv[]) {
|
||||
ProgramOptionsDescription description("STANDARD options");
|
||||
ProgramOptionsDescription javascript("JAVASCRIPT options");
|
||||
|
||||
javascript
|
||||
("javascript.execute", &ExecuteScripts, "execute Javascript code from file")
|
||||
("javascript.execute-string", &ExecuteString, "execute Javascript code from string")
|
||||
("javascript.check", &CheckScripts, "syntax check code Javascript code from file")
|
||||
("javascript.modules-path", &StartupModules, "one or more directories separated by semi-colons")
|
||||
("javascript.package-path", &StartupPackages, "one or more directories separated by semi-colons")
|
||||
|
@ -446,6 +420,10 @@ static void ParseProgramOptions (int argc, char* argv[]) {
|
|||
(javascript, false)
|
||||
;
|
||||
|
||||
vector<string> arguments;
|
||||
|
||||
description.arguments(&arguments);
|
||||
|
||||
// fill in used options
|
||||
BaseClient.setupGeneral(description);
|
||||
BaseClient.setupColors(description);
|
||||
|
@ -473,9 +451,12 @@ static void ParseProgramOptions (int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
// disable excessive output in non-interactive mode
|
||||
if (! ExecuteScripts.empty() || ! CheckScripts.empty() || ! UnitTests.empty() || ! JsLint.empty()) {
|
||||
if (! ExecuteScripts.empty() || ! ExecuteString.empty() || ! CheckScripts.empty() || ! UnitTests.empty() || ! JsLint.empty()) {
|
||||
BaseClient.shutup();
|
||||
}
|
||||
|
||||
// return the positional arguments
|
||||
return arguments;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1211,20 +1192,27 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
|
|||
string badPrompt;
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
// ........................................................................................
|
||||
// MacOS uses libedit, which does not support ignoring of non-printable characters in the prompt
|
||||
// using non-printable characters in the prompt will lead to wrong prompt lengths being calculated
|
||||
// we will therefore disable colorful prompts for MacOS.
|
||||
// ........................................................................................
|
||||
|
||||
goodPrompt = badPrompt = string("arangosh> ");
|
||||
|
||||
#elif _WIN32
|
||||
|
||||
// ........................................................................................
|
||||
// Windows console is not coloured by escape sequences. So the method given below will not
|
||||
// work. For now we simply ignore the colours until we move the windows version into
|
||||
// a GUI Window.
|
||||
// ........................................................................................
|
||||
goodPrompt = string("arangosh> ");
|
||||
badPrompt = string("arangosh> ");
|
||||
|
||||
goodPrompt = badPrompt = string("arangosh> ");
|
||||
|
||||
#else
|
||||
|
||||
if (BaseClient.colors()) {
|
||||
goodPrompt = string(ArangoClient::PROMPT_IGNORE_START) + string(TRI_SHELL_COLOR_BOLD_GREEN) + string(ArangoClient::PROMPT_IGNORE_END) +
|
||||
string("arangosh>") +
|
||||
|
@ -1239,6 +1227,7 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
|
|||
else {
|
||||
goodPrompt = badPrompt = string("arangosh> ");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
cout << endl;
|
||||
|
@ -1392,6 +1381,35 @@ static bool RunScripts (v8::Handle<v8::Context> context,
|
|||
return ok;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes the Javascript string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static bool RunString (v8::Handle<v8::Context> context,
|
||||
const string& script) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::TryCatch tryCatch;
|
||||
bool ok = true;
|
||||
|
||||
TRI_ExecuteJavaScriptString(context,
|
||||
v8::String::New(script.c_str()),
|
||||
v8::String::New("(command-line)"),
|
||||
false);
|
||||
|
||||
if (tryCatch.HasCaught()) {
|
||||
string exception(TRI_StringifyV8Exception(&tryCatch));
|
||||
|
||||
cerr << exception << endl;
|
||||
BaseClient.log("%s\n", exception.c_str());
|
||||
ok = false;
|
||||
}
|
||||
|
||||
BaseClient.flushLog();
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief runs the jslint tests
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1428,20 +1446,10 @@ static bool RunJsLint (v8::Handle<v8::Context> context) {
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup V8Shell
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief startup and exit functions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1535,7 +1543,7 @@ int main (int argc, char* argv[]) {
|
|||
// parse the program options
|
||||
// .............................................................................
|
||||
|
||||
ParseProgramOptions(argc, argv);
|
||||
vector<string> positionals = ParseProgramOptions(argc, argv);
|
||||
|
||||
// .............................................................................
|
||||
// set-up client connection
|
||||
|
@ -1550,7 +1558,6 @@ int main (int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
if (useServer) {
|
||||
|
||||
BaseClient.createEndpoint();
|
||||
|
||||
if (BaseClient.endpointServer() == 0) {
|
||||
|
@ -1558,7 +1565,6 @@ int main (int argc, char* argv[]) {
|
|||
TRI_EXIT_FUNCTION(EXIT_FAILURE,NULL);
|
||||
}
|
||||
|
||||
|
||||
ClientConnection = CreateConnection();
|
||||
}
|
||||
|
||||
|
@ -1665,7 +1671,6 @@ int main (int argc, char* argv[]) {
|
|||
// Quick hack for windows
|
||||
// .............................................................................
|
||||
|
||||
|
||||
if (BaseClient.colors()) {
|
||||
int greenColour = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
|
||||
int redColour = FOREGROUND_RED | FOREGROUND_INTENSITY;
|
||||
|
@ -1716,10 +1721,10 @@ int main (int argc, char* argv[]) {
|
|||
printf(" ");
|
||||
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), defaultColour);
|
||||
printf("\n");
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
char const* g = TRI_SHELL_COLOR_GREEN;
|
||||
char const* r = TRI_SHELL_COLOR_RED;
|
||||
char const* z = TRI_SHELL_COLOR_RESET;
|
||||
|
@ -1738,6 +1743,7 @@ int main (int argc, char* argv[]) {
|
|||
printf("%s| (_| | | | (_| | | | | (_| | (_) %s\\__ \\ | | |%s\n", g, r, z);
|
||||
printf("%s \\__,_|_| \\__,_|_| |_|\\__, |\\___/%s|___/_| |_|%s\n", g, r, z);
|
||||
printf("%s |___/ %s %s\n", g, r, z);
|
||||
|
||||
#endif
|
||||
|
||||
cout << endl << "Welcome to arangosh " << TRIAGENS_VERSION << ". Copyright (c) triAGENS GmbH" << endl;
|
||||
|
@ -1795,6 +1801,7 @@ int main (int argc, char* argv[]) {
|
|||
TRI_AddGlobalVariableVocbase(context, "VALGRIND", v8::Boolean::New((RUNNING_ON_VALGRIND) > 0));
|
||||
|
||||
bool isExecuteScript = false;
|
||||
bool isExecuteString = false;
|
||||
bool isCheckScripts = false;
|
||||
bool isUnitTests = false;
|
||||
bool isJsLint = false;
|
||||
|
@ -1802,6 +1809,9 @@ int main (int argc, char* argv[]) {
|
|||
if (! ExecuteScripts.empty()) {
|
||||
isExecuteScript = true;
|
||||
}
|
||||
else if (! ExecuteString.empty()) {
|
||||
isExecuteString = true;
|
||||
}
|
||||
else if (! CheckScripts.empty()) {
|
||||
isCheckScripts = true;
|
||||
}
|
||||
|
@ -1813,6 +1823,7 @@ int main (int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
TRI_AddGlobalVariableVocbase(context, "IS_EXECUTE_SCRIPT", v8::Boolean::New(isExecuteScript));
|
||||
TRI_AddGlobalVariableVocbase(context, "IS_EXECUTE_STRING", v8::Boolean::New(isExecuteString));
|
||||
TRI_AddGlobalVariableVocbase(context, "IS_CHECK_SCRIPT", v8::Boolean::New(isCheckScripts));
|
||||
TRI_AddGlobalVariableVocbase(context, "IS_UNIT_TESTS", v8::Boolean::New(isUnitTests));
|
||||
TRI_AddGlobalVariableVocbase(context, "IS_JS_LINT", v8::Boolean::New(isJsLint));
|
||||
|
@ -1844,13 +1855,29 @@ int main (int argc, char* argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// create arguments
|
||||
// .............................................................................
|
||||
|
||||
v8::Handle<v8::Array> p = v8::Array::New(positionals.size());
|
||||
|
||||
for (size_t i = 0; i < positionals.size(); ++i) {
|
||||
p->Set(i, v8::String::New(positionals[i].c_str()));
|
||||
}
|
||||
|
||||
TRI_AddGlobalVariableVocbase(context, "ARGUMENTS", p);
|
||||
|
||||
// .............................................................................
|
||||
// start logging
|
||||
// .............................................................................
|
||||
|
||||
BaseClient.openLog();
|
||||
|
||||
// .............................................................................
|
||||
// run normal shell
|
||||
// .............................................................................
|
||||
|
||||
if (! (isExecuteScript || isCheckScripts || isUnitTests || isJsLint)) {
|
||||
if (! (isExecuteScript || isExecuteString || isCheckScripts || isUnitTests || isJsLint)) {
|
||||
RunShell(context, promptError);
|
||||
}
|
||||
|
||||
|
@ -1862,9 +1889,13 @@ int main (int argc, char* argv[]) {
|
|||
bool ok = false;
|
||||
|
||||
if (isExecuteScript) {
|
||||
// we have scripts to execute or syntax check
|
||||
// we have scripts to execute
|
||||
ok = RunScripts(context, ExecuteScripts, true);
|
||||
}
|
||||
else if (isExecuteString) {
|
||||
// we have string to execute
|
||||
ok = RunString(context, ExecuteString);
|
||||
}
|
||||
else if (isCheckScripts) {
|
||||
// we have scripts to syntax check
|
||||
ok = RunScripts(context, CheckScripts, false);
|
||||
|
@ -1902,10 +1933,6 @@ int main (int argc, char* argv[]) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[server]
|
||||
password =
|
||||
|
||||
[javascript]
|
||||
startup-directory = ./js
|
||||
modules-path = ./js/client/modules;./js/common/modules;./js/node
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true, nonpropdel: true, white: true, plusplus: true, evil: true */
|
||||
/*global require, IS_EXECUTE_SCRIPT, IS_CHECK_SCRIPT, IS_UNIT_TESTS, IS_JS_LINT */
|
||||
/*global require, IS_EXECUTE_SCRIPT, IS_EXECUTE_STRING, IS_CHECK_SCRIPT, IS_UNIT_TESTS, IS_JS_LINT */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoShell client API
|
||||
|
@ -94,12 +94,6 @@ var db = require("org/arangodb").db;
|
|||
|
||||
var arango = require("org/arangodb").arango;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global 'aal'
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var aal = require("org/arangodb/aal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global 'Buffer'
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -129,7 +123,7 @@ var Buffer = require("buffer").Buffer;
|
|||
|
||||
try {
|
||||
// these variables don't exist in the browser context
|
||||
special = IS_EXECUTE_SCRIPT || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
special = IS_EXECUTE_SCRIPT || IS_EXECUTE_STRING || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
}
|
||||
catch (err2) {
|
||||
special = false;
|
||||
|
@ -153,7 +147,7 @@ var Buffer = require("buffer").Buffer;
|
|||
|
||||
try {
|
||||
// these variables are not defined in the browser context
|
||||
__special__ = IS_EXECUTE_SCRIPT || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
__special__ = IS_EXECUTE_SCRIPT || IS_EXECUTE_STRING || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
}
|
||||
catch (err) {
|
||||
__special__ = true;
|
||||
|
@ -177,6 +171,7 @@ var Buffer = require("buffer").Buffer;
|
|||
|
||||
try {
|
||||
delete IS_EXECUTE_SCRIPT;
|
||||
delete IS_EXECUTE_STRING;
|
||||
delete IS_CHECK_SCRIPT;
|
||||
delete IS_UNIT_TESTS;
|
||||
delete IS_JS_LINT;
|
||||
|
|
|
@ -45,39 +45,6 @@ var foxxManager = require("org/arangodb/foxx-manager");
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief installs a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/foxx/install",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
|
||||
callback : function (req, res) {
|
||||
'use strict';
|
||||
|
||||
var result;
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var appId = body.appId;
|
||||
var mount = body.mount;
|
||||
var options = body.options || {};
|
||||
|
||||
try {
|
||||
result = foxxManager.installApp(appId, mount, options);
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets up a FOXX dev application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -141,42 +108,11 @@ actions.defineHttp({
|
|||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief uninstalls a FOXX application
|
||||
/// @brief fetches a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/foxx/uninstall",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
|
||||
callback : function (req, res) {
|
||||
'use strict';
|
||||
|
||||
var result;
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = body.key;
|
||||
|
||||
try {
|
||||
result = foxxManager.uninstallApp(key);
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief loads a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/foxx/load",
|
||||
url : "_admin/foxx/fetch",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
|
||||
|
@ -245,6 +181,68 @@ actions.defineHttp({
|
|||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief mounts a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/foxx/mount",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
|
||||
callback : function (req, res) {
|
||||
'use strict';
|
||||
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var appId = body.appId;
|
||||
var mount = body.mount;
|
||||
var options = body.options || {};
|
||||
|
||||
try {
|
||||
var result = foxxManager.mount(appId, mount, options);
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief unmounts a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/foxx/unmount",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
|
||||
callback : function (req, res) {
|
||||
'use strict';
|
||||
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = body.key;
|
||||
|
||||
try {
|
||||
var result = foxxManager.unmount(key);
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -67,12 +67,12 @@
|
|||
},
|
||||
|
||||
install: function (name, mount, version) {
|
||||
return foxxmanager.installApp(name, mount, version);
|
||||
return foxxmanager.mount(name, mount, version);
|
||||
},
|
||||
|
||||
// Define the functionality to uninstall an installed foxx
|
||||
uninstall: function (key) {
|
||||
return foxxmanager.uninstallApp(key);
|
||||
return foxxmanager.unmount(key);
|
||||
},
|
||||
|
||||
// Define the functionality to deactivate an installed foxx.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*jslint indent: 2, nomen: true, maxlen: 120, sloppy: true, vars: true, nonpropdel: true, white: true, plusplus: true, evil: true */
|
||||
/*global require, IS_EXECUTE_SCRIPT, IS_CHECK_SCRIPT, IS_UNIT_TESTS, IS_JS_LINT */
|
||||
/*global require, IS_EXECUTE_SCRIPT, IS_EXECUTE_STRING, IS_CHECK_SCRIPT, IS_UNIT_TESTS, IS_JS_LINT */
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief ArangoShell client API
|
||||
|
@ -94,12 +94,6 @@ var db = require("org/arangodb").db;
|
|||
|
||||
var arango = require("org/arangodb").arango;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global 'aal'
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var aal = require("org/arangodb/aal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief global 'Buffer'
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -129,7 +123,7 @@ var Buffer = require("buffer").Buffer;
|
|||
|
||||
try {
|
||||
// these variables don't exist in the browser context
|
||||
special = IS_EXECUTE_SCRIPT || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
special = IS_EXECUTE_SCRIPT || IS_EXECUTE_STRING || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
}
|
||||
catch (err2) {
|
||||
special = false;
|
||||
|
@ -153,7 +147,7 @@ var Buffer = require("buffer").Buffer;
|
|||
|
||||
try {
|
||||
// these variables are not defined in the browser context
|
||||
__special__ = IS_EXECUTE_SCRIPT || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
__special__ = IS_EXECUTE_SCRIPT || IS_EXECUTE_STRING || IS_CHECK_SCRIPT || IS_UNIT_TESTS || IS_JS_LINT;
|
||||
}
|
||||
catch (err) {
|
||||
__special__ = true;
|
||||
|
@ -177,6 +171,7 @@ var Buffer = require("buffer").Buffer;
|
|||
|
||||
try {
|
||||
delete IS_EXECUTE_SCRIPT;
|
||||
delete IS_EXECUTE_STRING;
|
||||
delete IS_CHECK_SCRIPT;
|
||||
delete IS_UNIT_TESTS;
|
||||
delete IS_JS_LINT;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -815,10 +815,10 @@ function require (path) {
|
|||
return module.exports;
|
||||
}
|
||||
|
||||
throw "cannot locate module '" + unormalizedPath + "'"
|
||||
throw new Error("cannot locate module '" + unormalizedPath + "'"
|
||||
+ " for package '" + this._package.id + "'"
|
||||
+ " using module path '" + modulesPath + "'"
|
||||
+ " and package path '" + this._package._paths + "'";
|
||||
+ " and package path '" + this._package._paths + "'");
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
var found = aal.firstExample({ type: "mount", mount: "/_admin/aardvark" });
|
||||
|
||||
if (found === null) {
|
||||
fm.installApp("aardvark", "/_admin/aardvark", {reload: false});
|
||||
fm.mount("aardvark", "/_admin/aardvark", {reload: false});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -537,21 +537,13 @@ exports.scanAppDirectory = function () {
|
|||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief installs a FOXX application
|
||||
/// @brief mounts a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.installApp = function (appId, mount, options) {
|
||||
exports.mount = function (appId, mount, options) {
|
||||
'use strict';
|
||||
|
||||
var aal;
|
||||
var app;
|
||||
var desc;
|
||||
var doc;
|
||||
var prefix;
|
||||
var routes;
|
||||
var version;
|
||||
|
||||
aal = getStorage();
|
||||
var aal = getStorage();
|
||||
|
||||
// .............................................................................
|
||||
// locate the application
|
||||
|
@ -561,7 +553,7 @@ exports.installApp = function (appId, mount, options) {
|
|||
appId = "app:" + appId + ":latest";
|
||||
}
|
||||
|
||||
app = module.createApp(appId);
|
||||
var app = module.createApp(appId);
|
||||
|
||||
if (app === null) {
|
||||
throw new Error("cannot find application '" + appId + "'");
|
||||
|
@ -571,8 +563,8 @@ exports.installApp = function (appId, mount, options) {
|
|||
// compute the routing information
|
||||
// .............................................................................
|
||||
|
||||
prefix = options && options.collectionPrefix;
|
||||
routes = routingAalApp(app, mount, prefix, false);
|
||||
var prefix = options && options.collectionPrefix;
|
||||
var routes = routingAalApp(app, mount, prefix, false);
|
||||
|
||||
if (routes === null) {
|
||||
throw new Error("cannot compute the routing table for fox application '"
|
||||
|
@ -583,6 +575,9 @@ exports.installApp = function (appId, mount, options) {
|
|||
// install the application
|
||||
// .............................................................................
|
||||
|
||||
var doc;
|
||||
var desc;
|
||||
|
||||
try {
|
||||
doc = installAalApp(app, mount, prefix, false);
|
||||
}
|
||||
|
@ -609,21 +604,14 @@ exports.installApp = function (appId, mount, options) {
|
|||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief uninstalls a FOXX application
|
||||
/// @brief unmounts a FOXX application
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
exports.uninstallApp = function (key) {
|
||||
exports.unmount = function (key) {
|
||||
'use strict';
|
||||
|
||||
var aal;
|
||||
var app;
|
||||
var appDoc;
|
||||
var context;
|
||||
var doc;
|
||||
var routing;
|
||||
|
||||
aal = getStorage();
|
||||
doc = aal.firstExample({ type: "mount", _key: key });
|
||||
var aal = getStorage();
|
||||
var doc = aal.firstExample({ type: "mount", _key: key });
|
||||
|
||||
if (doc === null) {
|
||||
doc = aal.firstExample({ type: "mount", mount: key });
|
||||
|
@ -637,23 +625,20 @@ exports.uninstallApp = function (key) {
|
|||
|
||||
try {
|
||||
if (appId.substr(0,4) === "app:") {
|
||||
appDoc = aal.firstExample({ app: appId, type: "app" });
|
||||
var appDoc = aal.firstExample({ app: appId, type: "app" });
|
||||
|
||||
if (appDoc === null) {
|
||||
throw new Error("cannot find app '" + appId + "' in _aal collection");
|
||||
}
|
||||
}
|
||||
|
||||
app = module.createApp(appId);
|
||||
var app = module.createApp(appId);
|
||||
teardownApp(app, doc.mount, doc.collectionPrefix);
|
||||
}
|
||||
catch (err) {
|
||||
console.error("teardown not possible for application '%s': %s", appId, String(err));
|
||||
}
|
||||
|
||||
routing = arangodb.db._collection("_routing");
|
||||
|
||||
routing.removeByExample({ foxxMount: doc._key });
|
||||
aal.remove(doc);
|
||||
|
||||
internal.executeGlobalContextFunction("require(\"org/arangodb/actions\").reloadRouting()");
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
bin_SCRIPTS += \
|
||||
bin/arango-dfdb \
|
||||
bin/arango-password
|
||||
bin/foxx-manager
|
||||
|
||||
CLEANUP += $(bin_SCRIPTS)
|
||||
|
||||
|
@ -27,15 +27,14 @@ bin/arango-dfdb: utils/arango-dfdb.in
|
|||
chmod 755 $@
|
||||
|
||||
################################################################################
|
||||
### @brief arango password: this create a file with a warning message only
|
||||
### as arango-password is deprecated
|
||||
### @brief foxx manager
|
||||
################################################################################
|
||||
|
||||
.PHONY: bin/arango-password
|
||||
|
||||
bin/arango-password:
|
||||
@echo "echo \"arango-password is not part of this ArangoDB release.\"; exit 1" > $@
|
||||
@chmod 755 $@
|
||||
bin/foxx-manager: utils/foxx-manager.in
|
||||
sed \
|
||||
-e 's%@BINDIR@%${TRI_BINDIR}%g' \
|
||||
$< > $@
|
||||
chmod 755 $@
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
## --SECTION-- END-OF-FILE
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Placeholders starting with @ will be replaced by make
|
||||
|
||||
ARANGOSH="@BINDIR@/arangosh"
|
||||
RCFILE=""
|
||||
|
||||
if [ "$1" == "--relative" ] ; then
|
||||
shift
|
||||
ARANGOSH="./bin/arangosh"
|
||||
RCFILE="-c etc/relative/arangosh.conf"
|
||||
fi
|
||||
|
||||
$ARANGOSH \
|
||||
$RCFILE \
|
||||
--javascript.execute-string 'require("org/arangodb/foxx-manager").run(ARGUMENTS);' \
|
||||
$*
|
Loading…
Reference in New Issue