diff --git a/js/client/bootstrap/module-internal.js b/js/client/bootstrap/module-internal.js
index 356ec759c5..ed4f28617a 100644
--- a/js/client/bootstrap/module-internal.js
+++ b/js/client/bootstrap/module-internal.js
@@ -67,7 +67,7 @@
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
-// --SECTION-- private methods
+// --SECTION-- private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
@@ -124,7 +124,7 @@
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
-// --SECTION-- public methods
+// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
diff --git a/js/common/bootstrap/module-console.js b/js/common/bootstrap/module-console.js
index 235200b599..32598996cb 100644
--- a/js/common/bootstrap/module-console.js
+++ b/js/common/bootstrap/module-console.js
@@ -33,7 +33,7 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-// --SECTION-- public methods
+// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
diff --git a/js/common/bootstrap/module-fs.js b/js/common/bootstrap/module-fs.js
index e803d88085..55cb4c37c8 100644
--- a/js/common/bootstrap/module-fs.js
+++ b/js/common/bootstrap/module-fs.js
@@ -33,7 +33,7 @@
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-// --SECTION-- MODULE EXPORTS
+// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
@@ -41,18 +41,38 @@
/// @{
////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/// @brief exports
-////////////////////////////////////////////////////////////////////////////////
-
(function () {
var internal = require("internal");
var fs = require("fs");
+////////////////////////////////////////////////////////////////////////////////
+/// @brief tests if a file exists
+////////////////////////////////////////////////////////////////////////////////
+
fs.exists = internal.exists;
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief tests if path points to a directory
+////////////////////////////////////////////////////////////////////////////////
+
fs.isDirectory = internal.isDirectory;
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief lists all files and directory under a given path
+////////////////////////////////////////////////////////////////////////////////
+
fs.listTree = internal.listTree;
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief moves a file or directory
+////////////////////////////////////////////////////////////////////////////////
+
fs.move = internal.move;
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief removes a file
+////////////////////////////////////////////////////////////////////////////////
+
fs.remove = internal.remove;
}());
diff --git a/js/common/bootstrap/module-internal.js b/js/common/bootstrap/module-internal.js
index 065441be2a..e28532766b 100644
--- a/js/common/bootstrap/module-internal.js
+++ b/js/common/bootstrap/module-internal.js
@@ -44,13 +44,13 @@
/// @{
////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/// @brief internal module
-////////////////////////////////////////////////////////////////////////////////
-
(function () {
var internal = require("internal");
+////////////////////////////////////////////////////////////////////////////////
+/// @brief hide global variables
+////////////////////////////////////////////////////////////////////////////////
+
// system functions
if (typeof SYS_EXECUTE !== "undefined") {
internal.execute = SYS_EXECUTE;
diff --git a/js/common/bootstrap/modules.js b/js/common/bootstrap/modules.js
index 6ee0c60db7..ee4380254d 100644
--- a/js/common/bootstrap/modules.js
+++ b/js/common/bootstrap/modules.js
@@ -47,6 +47,123 @@ module = null;
/// @}
////////////////////////////////////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
+// --SECTION-- global functions
+// -----------------------------------------------------------------------------
+
+////////////////////////////////////////////////////////////////////////////////
+/// @addtogroup ArangoShell
+/// @{
+////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief global require function
+///
+/// @FUN{require(@FA{path})}
+///
+/// @FN{require} checks if the file specified by @FA{path} has already been
+/// loaded. If not, the content of the file is executed in a new
+/// context. Within the context you can use the global variable @LIT{exports}
+/// in order to export variables and functions. This variable is returned by
+/// @FN{require}.
+///
+/// Assume that your module file is @LIT{test1.js} and contains
+///
+/// @verbinclude modules-require-1
+///
+/// Then you can use @FN{require} to load the file and access the exports.
+///
+/// @verbinclude modules-require-2
+///
+/// @FN{require} follows the specification
+/// Modules/1.1.1.
+////////////////////////////////////////////////////////////////////////////////
+
+function require (path) {
+ return module.require(path);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief global print function
+////////////////////////////////////////////////////////////////////////////////
+
+function print () {
+ var internal = require("internal");
+ internal.print.apply(internal.print, arguments);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief global printf function
+////////////////////////////////////////////////////////////////////////////////
+
+function printf () {
+ var internal = require("internal");
+ internal.printf.apply(internal.printf, arguments);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief turn off pretty printing
+////////////////////////////////////////////////////////////////////////////////
+
+function print_plain () {
+ var internal = require("internal");
+
+ var p = internal.PRETTY_PRINT;
+ internal.PRETTY_PRINT = false;
+
+ var c = internal.COLOR_OUTPUT;
+ internal.COLOR_OUTPUT = false;
+
+ try {
+ internal.print.apply(internal.print, arguments);
+
+ internal.PRETTY_PRINT = p;
+ internal.COLOR_OUTPUT = c;
+ }
+ catch (e) {
+ internal.PRETTY_PRINT = p;
+ internal.COLOR_OUTPUT = c;
+
+ throw e.message;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief start pretty printing
+////////////////////////////////////////////////////////////////////////////////
+
+function start_pretty_print () {
+ require("internal").startPrettyPrint();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief stop pretty printing
+////////////////////////////////////////////////////////////////////////////////
+
+function stop_pretty_print () {
+ require("internal").stopPrettyPrint();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief start pretty printing with optional color
+////////////////////////////////////////////////////////////////////////////////
+
+function start_color_print (color) {
+ require("internal").startColorPrint();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief stop pretty printing
+////////////////////////////////////////////////////////////////////////////////
+
+function stop_color_print () {
+ require("internal").stopColorPrint();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+/// @}
+////////////////////////////////////////////////////////////////////////////////
+
// -----------------------------------------------------------------------------
// --SECTION-- constructors and destructors
// -----------------------------------------------------------------------------
@@ -300,123 +417,6 @@ module = null;
}());
-// -----------------------------------------------------------------------------
-// --SECTION-- global functions
-// -----------------------------------------------------------------------------
-
-////////////////////////////////////////////////////////////////////////////////
-/// @addtogroup ArangoShell
-/// @{
-////////////////////////////////////////////////////////////////////////////////
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief global require function
-///
-/// @FUN{require(@FA{path})}
-///
-/// @FN{require} checks if the file specified by @FA{path} has already been
-/// loaded. If not, the content of the file is executed in a new
-/// context. Within the context you can use the global variable @LIT{exports}
-/// in order to export variables and functions. This variable is returned by
-/// @FN{require}.
-///
-/// Assume that your module file is @LIT{test1.js} and contains
-///
-/// @verbinclude modules-require-1
-///
-/// Then you can use @FN{require} to load the file and access the exports.
-///
-/// @verbinclude modules-require-2
-///
-/// @FN{require} follows the specification
-/// Modules/1.1.1.
-////////////////////////////////////////////////////////////////////////////////
-
-function require (path) {
- return module.require(path);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief global print function
-////////////////////////////////////////////////////////////////////////////////
-
-function print () {
- var internal = require("internal");
- internal.print.apply(internal.print, arguments);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief global printf function
-////////////////////////////////////////////////////////////////////////////////
-
-function printf () {
- var internal = require("internal");
- internal.printf.apply(internal.printf, arguments);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief turn off pretty printing
-////////////////////////////////////////////////////////////////////////////////
-
-function print_plain () {
- var internal = require("internal");
-
- var p = internal.PRETTY_PRINT;
- internal.PRETTY_PRINT = false;
-
- var c = internal.COLOR_OUTPUT;
- internal.COLOR_OUTPUT = false;
-
- try {
- internal.print.apply(internal.print, arguments);
-
- internal.PRETTY_PRINT = p;
- internal.COLOR_OUTPUT = c;
- }
- catch (e) {
- internal.PRETTY_PRINT = p;
- internal.COLOR_OUTPUT = c;
-
- throw e.message;
- }
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief start pretty printing
-////////////////////////////////////////////////////////////////////////////////
-
-function start_pretty_print () {
- require("internal").startPrettyPrint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief stop pretty printing
-////////////////////////////////////////////////////////////////////////////////
-
-function stop_pretty_print () {
- require("internal").stopPrettyPrint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief start pretty printing with optional color
-////////////////////////////////////////////////////////////////////////////////
-
-function start_color_print (color) {
- require("internal").startColorPrint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @brief stop pretty printing
-////////////////////////////////////////////////////////////////////////////////
-
-function stop_color_print () {
- require("internal").stopColorPrint();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-/// @}
-////////////////////////////////////////////////////////////////////////////////
-
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
diff --git a/js/common/bootstrap/monkeypatches.js b/js/common/bootstrap/monkeypatches.js
index 103e6c2831..a4238d8112 100644
--- a/js/common/bootstrap/monkeypatches.js
+++ b/js/common/bootstrap/monkeypatches.js
@@ -32,6 +32,10 @@
// --SECTION-- monkey-patches
// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// --SECTION-- public functions
+// -----------------------------------------------------------------------------
+
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ArangoShell
/// @{
diff --git a/js/server/bootstrap/module-internal.js b/js/server/bootstrap/module-internal.js
index 434894bdd5..d5ec353dbd 100644
--- a/js/server/bootstrap/module-internal.js
+++ b/js/server/bootstrap/module-internal.js
@@ -39,14 +39,14 @@
/// @{
////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-/// @brief exports
-////////////////////////////////////////////////////////////////////////////////
-
(function () {
var internal = require("internal");
var console = require("console");
+////////////////////////////////////////////////////////////////////////////////
+/// @brief hide global variables
+////////////////////////////////////////////////////////////////////////////////
+
internal.db = db;
delete db;
@@ -65,9 +65,30 @@
internal.ShapedJson = ShapedJson;
delete ShapedJson;
+////////////////////////////////////////////////////////////////////////////////
+/// @}
+////////////////////////////////////////////////////////////////////////////////
+
+// -----------------------------------------------------------------------------
+// --SECTION-- private variables
+// -----------------------------------------------------------------------------
+
+////////////////////////////////////////////////////////////////////////////////
+/// @addtogroup ArangoShell
+/// @{
+////////////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////////////
+/// @brief database path
+////////////////////////////////////////////////////////////////////////////////
+
internal.DATABASEPATH = DATABASEPATH;
delete DATABASEPATH;
+////////////////////////////////////////////////////////////////////////////////
+/// @brief internal thread number
+////////////////////////////////////////////////////////////////////////////////
+
internal.THREAD_NUMBER = THREAD_NUMBER;
delete THREAD_NUMBER;
@@ -76,7 +97,7 @@
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
-// --SECTION-- private methods
+// --SECTION-- private functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////