1
0
Fork 0

Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Frank Celler 2013-07-26 22:53:02 +02:00
commit 37fdbd9413
13 changed files with 238 additions and 7 deletions

View File

@ -27,7 +27,8 @@ dist_man_MANS += \
Documentation/man/man1/arangosh.1 \
Documentation/man/man8/rcarangod.8 \
Documentation/man/man8/arangod.8 \
Documentation/man/man8/arango-dfdb.8
Documentation/man/man8/arango-dfdb.8 \
Documentation/man/man8/foxx-manager.8
################################################################################
### @brief JavaScript files
@ -172,6 +173,8 @@ Doxygen/.setup-directories:
@test -d Doxygen/js/common/modules/org/arangodb/aql || mkdir -p Doxygen/js/common/modules/org/arangodb/aql
@test -d Doxygen/js/server/modules/org/arangodb/graph || mkdir -p Doxygen/js/server/modules/org/arangodb/graph
@test -d Doxygen/js/client || mkdir -p Doxygen/js/client
@test -d Doxygen/man/man1 || mkdir -p Doxygen/man/man1
@test -d Doxygen/man/man8 || mkdir -p Doxygen/man/man8
@test -d Doxygen/latex/images || mkdir -p Doxygen/latex/images
@test -d Doxygen/wiki || mkdir -p Doxygen/wiki
@test -d Doxygen/xml || mkdir -p Doxygen/xml

View File

@ -19,5 +19,5 @@ s/\<ENDEXAMPLE\>/\n\.EE\n/g
i\
a\
Copyright 2012, triAGENS GmbH, Cologne, Germany
Copyright triAGENS GmbH, Cologne, Germany
}

View File

@ -0,0 +1,41 @@
.TH foxx-manager 8 "Fr 26. Jul 22:41:49 CEST 2013" "" "ArangoDB"
.SH NAME
foxx-manager - a Foxx application manager for ArangoDB
.SH SYNOPSIS
foxx-manager options
.SH DESCRIPTION
The foxx-manager binary can be used to manage Foxx applications in the
ArangoDB database server. Foxx applications can be installed and
uninstalled.
More specific instructions are displayed when the program is invoked.
.SH OPTIONS
.IP "--server.disable-authentication <boolean>"
disable the password prompt when connecting to the server
.SH EXAMPLES
.EX
shell> foxx-manager search "foobar"
searches the central repository for an application "foobar"
.EE
.EX
shell> foxx-manager update
updates the local repository with applications from the central repositoryENDEXAMPLE
.EX
shell> foxx-manager list
list all installed Foxx applicationsENDEXAMPLE
.EX
shell> foxx-manager install "hello-foxx" "/hello"
installs the "hello-foxx" application under the mount point "/hello"
.EE
.EX
shell> foxx-manager uninstall "/hello"
uninstalls the application that is mounted under "/hello"
.EE
.EX
shell> foxx-manager help
shows the help pageENDEXAMPLE
.SH AUTHOR
Copyright triAGENS GmbH, Cologne, Germany

View File

@ -25,6 +25,8 @@ OPTION "--server.username <string>"
username to use when connecting (default "root") ENDOPTION
OPTION "--server.password <string>"
password to use when connecting. Leave empty for a password prompt ENDOPTION
OPTION "--server.disable-authentication <boolean>"
turn off autpassword to use when connecting. Leave empty for a password prompt ENDOPTION
EXAMPLES
EXAMPLE COMMAND
starts COMMAND with the default user and server endpoint ENDEXAMPLE

View File

@ -30,6 +30,8 @@ OPTION "--log.level <string>"
set the log level (possible values: "fatal", "error", "warning", "info", "debug", "trace") ENDOPTION
OPTION "--server.endpoint <string>"
listen endpoint for client requests, consisting of protocol, ip address and port ENDOPTION
OPTION "--server.disable-authentication <boolean>"
disable the password prompt when connecting to the server ENDOPTION
OPTION "--database.directory <string>"
path to the database directory ENDOPTION
EXAMPLES

View File

@ -0,0 +1,27 @@
COMMAND SECTION "DATE" "" "ArangoDB"
NAME
COMMAND - a Foxx application manager for ArangoDB
SYNOPSIS
COMMAND options
DESCRIPTION
The COMMAND binary can be used to manage Foxx applications in the
ArangoDB database server. Foxx applications can be installed and
uninstalled.
More specific instructions are displayed when the program is invoked.
OPTIONS
OPTION "--server.disable-authentication <boolean>"
disable the password prompt when connecting to the server ENDOPTION
EXAMPLES
EXAMPLE COMMAND search "foobar"
searches the central repository for an application "foobar"ENDEXAMPLE
EXAMPLE COMMAND update
updates the local repository with applications from the central repositoryENDEXAMPLE
EXAMPLE COMMAND list
list all installed Foxx applicationsENDEXAMPLE
EXAMPLE COMMAND install "hello-foxx" "/hello"
installs the "hello-foxx" application under the mount point "/hello"ENDEXAMPLE
EXAMPLE COMMAND uninstall "/hello"
uninstalls the application that is mounted under "/hello"ENDEXAMPLE
EXAMPLE COMMAND help
shows the help pageENDEXAMPLE
AUTHOR

View File

@ -449,6 +449,7 @@ unittests-shell-server-ahuacatl:
################################################################################
SHELL_CLIENT_ONLY = \
@top_srcdir@/js/client/tests/shell-fm.js \
@top_srcdir@/js/client/tests/client.js
SHELL_CLIENT = $(SHELL_COMMON) $(SHELL_CLIENT_ONLY)

View File

@ -324,9 +324,10 @@ void ArangoClient::parse (ProgramOptions& options,
}
// check if have a password
_hasPassword = options.has("server.password")
_hasPassword = (options.has("server.password") && ! _password.empty())
|| _disableAuthentication
|| options.has("jslint");
|| options.has("jslint")
|| options.has("javascript.unit-tests");
// set colors
if (options.has("colors")) {

View File

@ -132,6 +132,7 @@ exports.HELP = exports.createHelpHeadline("Help") +
'Predefined objects: ' + "\n" +
' arango: ArangoConnection ' + "\n" +
' db: ArangoDatabase ' + "\n" +
' fm: FoxxManager ' + "\n" +
'Example: ' + "\n" +
' > db._collections(); list all collections ' + "\n" +
' > db.<coll_name>.all().toArray(); list all documents ' + "\n" +

View File

@ -137,6 +137,7 @@ exports.HELP = exports.createHelpHeadline("Help") +
'Predefined objects: ' + "\n" +
' arango: ArangoConnection ' + "\n" +
' db: ArangoDatabase ' + "\n" +
' fm: FoxxManager ' + "\n" +
'Example: ' + "\n" +
' > db._collections(); list all collections ' + "\n" +
' > db.<coll_name>.all().toArray(); list all documents ' + "\n" +

View File

@ -1130,10 +1130,10 @@ exports.info = function (name) {
};
////////////////////////////////////////////////////////////////////////////////
/// @brief searchs for an available FOXX applications
/// @brief returns the search result for FOXX applications
////////////////////////////////////////////////////////////////////////////////
exports.search = function (name) {
exports.searchJson = function (name) {
'use strict';
var fishbowl = getFishbowlStorage();
@ -1175,6 +1175,18 @@ exports.search = function (name) {
}
}
return docs;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief searchs for an available FOXX applications
////////////////////////////////////////////////////////////////////////////////
exports.search = function (name) {
'use strict';
var docs = exports.searchJson(name);
arangodb.printTable(
docs.sort(compareApps),
[ "name", "author", "description" ],

140
js/client/tests/shell-fm.js Normal file
View File

@ -0,0 +1,140 @@
////////////////////////////////////////////////////////////////////////////////
/// @brief test the foxx manager
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Copyright 2013, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var jsunity = require("jsunity");
var fm = require("org/arangodb/foxx-manager");
var arango = require("org/arangodb").arango;
// -----------------------------------------------------------------------------
// --SECTION-- foxx manager tests
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief test suite
////////////////////////////////////////////////////////////////////////////////
function FoxxManagerSuite () {
return {
////////////////////////////////////////////////////////////////////////////////
/// @brief test search
////////////////////////////////////////////////////////////////////////////////
testSearchEmpty : function () {
var result = fm.searchJson();
var i, j, n;
n = result.length;
assertTrue(n > 0);
// validate the results structure
for (i = 0; i < n; ++i) {
var entry = result[i];
assertTrue(entry.hasOwnProperty("_key"));
assertTrue(entry.hasOwnProperty("_rev"));
assertTrue(entry.hasOwnProperty("description"));
assertTrue(entry.hasOwnProperty("name"));
assertTrue(entry.hasOwnProperty("author"));
assertTrue(entry.hasOwnProperty("versions"));
versions = entry.versions;
for (version in entry.versions) {
if (entry.versions.hasOwnProperty(version)) {
assertMatch(/^\d+(\.\d+)*$/, version);
assertTrue(entry.versions[version].hasOwnProperty("type"));
assertTrue(entry.versions[version].hasOwnProperty("location"));
}
}
}
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test search existings
////////////////////////////////////////////////////////////////////////////////
testSearchAztec : function () {
var result = fm.searchJson("itzpapalotl");
var i, j, n;
n = result.length;
assertTrue(n > 0);
// validate the results structure, simply take the first match
var entry = result.pop();
assertEqual("jsteemann", entry.author);
assertEqual("itzpapalotl", entry.name);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test install
////////////////////////////////////////////////////////////////////////////////
testInstall : function () {
try {
fm.uninstall("/itz");
}
catch (err) {
}
fm.install("itzpapalotl", "/itz");
var endpoint = arango.getEndpoint();
endpoint = endpoint.replace(/^tcp:/g, 'http:').replace(/^ssl:/g, 'https:');
var url = endpoint + '/itz';
require("internal").print(arango.GET(url));
fm.uninstall("/itz");
}
};
}
// -----------------------------------------------------------------------------
// --SECTION-- main
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @brief executes the test suite
////////////////////////////////////////////////////////////////////////////////
jsunity.run(FoxxManagerSuite);
return jsunity.done();
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
// End:

View File

@ -14,4 +14,4 @@ fi
$ARANGOSH \
$RCFILE \
--javascript.execute-string 'require("org/arangodb/foxx-manager").run(ARGUMENTS);' \
$*
"$@"