1
0
Fork 0

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

This commit is contained in:
Michael Hackstein 2014-06-18 17:01:32 +02:00
commit 791c3bb67e
6 changed files with 85 additions and 31 deletions

View File

@ -17,6 +17,8 @@ build-books: md-files
build-book:
@test -d books/$(NAME) || mkdir books/$(NAME)
python codeBlockReader.py
python bot.py
cd $(NAME) && gitbook build -o ../books/$(NAME)
cp Users/Arangodb_Logo.png books/Users/
@for file in $(basename $(MD_FILES)); do echo "remove $${file}.md";rm $${file}.md;done

View File

@ -23,9 +23,10 @@ def findStartCode(textFile,full_path):
def getTextFromSourceFile(searchText, full_path):
f=open("allComments.txt", 'rU')
s=f.read()
match = re.search(r'@startDocuBlock\s+'+re.escape(searchText)+'(.+?)@endDocuBlock', s,re.DOTALL)
match = re.search(r'@startDocuBlock\s+'+ searchText + "(?:\s+|$)" +'(.+?)@endDocuBlock', s,re.DOTALL)
if match:
textExtracted = match.group(1)
textExtracted = textExtracted.replace("<br />","\n")
replaceText(textExtracted, full_path, searchText)
def replaceText(text, pathOfFile, searchText):
@ -35,7 +36,7 @@ def replaceText(text, pathOfFile, searchText):
f.close()
f=open(pathOfFile,'w')
replaced=re.sub('@startDocuBlock\s+'+ searchText + "(?:\s+|$)",text,s)
replaced=re.sub("@startDocuBlock\s+"+ searchText + "(?:\s+|$)",text,s)
f.write(replaced)
f.close()

View File

@ -509,6 +509,12 @@ void ArangoServer::buildApplicationServer () {
#endif
#ifdef __APPLE__
additional[ApplicationServer::OPTIONS_CMDLINE + ":help-extended"]
("voice", "enable voice based welcome")
;
#endif
additional[ApplicationServer::OPTIONS_HIDDEN]
("development-mode", "start server in development mode")
;
@ -819,10 +825,6 @@ int ArangoServer::startupServer () {
if (startServer) {
++concurrency;
}
#ifdef __APPLE__
system("say -v hysterical 'welcome to ArangoDB'");
#endif
}
else if (mode == OperationMode::MODE_UNITTESTS || mode == OperationMode::MODE_SCRIPT) {
if (concurrency == 1) {
@ -975,8 +977,20 @@ int ArangoServer::runConsole (TRI_vocbase_t* vocbase) {
ConsoleThread console(_applicationServer, _applicationV8, vocbase);
console.start();
#ifdef __APPLE__
if (_applicationServer->programOptions().has("voice")) {
system("say -v zarvox 'welcome to ArangoDB' &");
}
#endif
_applicationServer->wait();
#ifdef __APPLE__
if (_applicationServer->programOptions().has("voice")) {
system("say -v zarvox 'good-bye' &");
}
#endif
// .............................................................................
// and cleanup
// .............................................................................

View File

@ -174,7 +174,13 @@ static uint64_t GcInterval = 10;
/// @brief console object
////////////////////////////////////////////////////////////////////////////////
static V8LineEditor* _console = 0;
static V8LineEditor* Console = 0;
////////////////////////////////////////////////////////////////////////////////
/// @brief voice mode
////////////////////////////////////////////////////////////////////////////////
static bool VoiceMode = false;
// -----------------------------------------------------------------------------
// --SECTION-- JavaScript functions
@ -441,6 +447,12 @@ static vector<string> ParseProgramOptions (int argc, char* argv[]) {
;
#endif
#ifdef __APPLE__
description
("voice", "enable voice based welcome")
;
#endif
description
("chunk-size", &ChunkSize, "maximum size for individual data batches (in bytes)")
("prompt", &Prompt, "command prompt")
@ -492,6 +504,11 @@ static vector<string> ParseProgramOptions (int argc, char* argv[]) {
BaseClient.shutup();
}
// voice mode
if (options.has("voice")) {
VoiceMode = true;
}
// return the positional arguments
return arguments;
}
@ -1346,9 +1363,9 @@ static std::string BuildPrompt () {
#else
static void SignalHandler (int signal) {
if (_console != 0) {
_console->close();
_console = 0;
if (Console != 0) {
Console->close();
Console = 0;
}
printf("\n");
@ -1364,8 +1381,8 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
v8::Context::Scope contextScope(context);
v8::Local<v8::String> name(v8::String::New("(shell)"));
_console = new V8LineEditor(context, ".arangosh.history");
_console->open(BaseClient.autoComplete());
Console = new V8LineEditor(context, ".arangosh.history");
Console->open(BaseClient.autoComplete());
// install signal handler for CTRL-C
#ifdef _WIN32
@ -1386,6 +1403,12 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
uint64_t nrCommands = 0;
#ifdef __APPLE__
if (VoiceMode) {
system("say -v zarvox 'welcome to Arango shell' &");
}
#endif
while (true) {
// set up prompts
string dynamicPrompt;
@ -1426,18 +1449,20 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
#ifdef TRI_HAVE_LINENOISE
// linenoise doesn't need escape sequences for escape sequences
goodPrompt = string(TRI_SHELL_COLOR_BOLD_GREEN) + dynamicPrompt + string(TRI_SHELL_COLOR_RESET);
badPrompt = string(TRI_SHELL_COLOR_BOLD_RED) + dynamicPrompt + string(TRI_SHELL_COLOR_RESET);
goodPrompt = TRI_SHELL_COLOR_BOLD_GREEN + dynamicPrompt + TRI_SHELL_COLOR_RESET;
badPrompt = TRI_SHELL_COLOR_BOLD_RED + dynamicPrompt + TRI_SHELL_COLOR_RESET;
#else
// readline does...
goodPrompt = string(ArangoClient::PROMPT_IGNORE_START) + string(TRI_SHELL_COLOR_BOLD_GREEN) + string(ArangoClient::PROMPT_IGNORE_END) +
dynamicPrompt +
string(ArangoClient::PROMPT_IGNORE_START) + string(TRI_SHELL_COLOR_RESET) + string(ArangoClient::PROMPT_IGNORE_END);
goodPrompt = string()
+ ArangoClient::PROMPT_IGNORE_START + TRI_SHELL_COLOR_BOLD_GREEN + ArangoClient::PROMPT_IGNORE_END
+ dynamicPrompt
+ ArangoClient::PROMPT_IGNORE_START + TRI_SHELL_COLOR_RESET + ArangoClient::PROMPT_IGNORE_END;
badPrompt = string(ArangoClient::PROMPT_IGNORE_START) + string(TRI_SHELL_COLOR_BOLD_RED) + string(ArangoClient::PROMPT_IGNORE_END) +
dynamicPrompt +
string(ArangoClient::PROMPT_IGNORE_START) + string(TRI_SHELL_COLOR_RESET) + string(ArangoClient::PROMPT_IGNORE_END);
badPrompt = string()
+ ArangoClient::PROMPT_IGNORE_START + TRI_SHELL_COLOR_BOLD_RED + ArangoClient::PROMPT_IGNORE_END
+ dynamicPrompt
+ ArangoClient::PROMPT_IGNORE_START + TRI_SHELL_COLOR_RESET + ArangoClient::PROMPT_IGNORE_END;
#endif
}
else {
@ -1455,7 +1480,13 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
}
}
char* input = _console->prompt(promptError ? badPrompt.c_str() : goodPrompt.c_str());
#ifdef __APPLE__
if (VoiceMode && promptError) {
system("say -v 'whisper' 'oh, no' &");
}
#endif
char* input = Console->prompt(promptError ? badPrompt.c_str() : goodPrompt.c_str());
if (input == 0) {
break;
@ -1484,7 +1515,7 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
}
}
_console->addHistory(input);
Console->addHistory(input);
v8::HandleScope scope;
v8::TryCatch tryCatch;
@ -1525,9 +1556,15 @@ static void RunShell (v8::Handle<v8::Context> context, bool promptError) {
BaseClient.flushLog();
}
_console->close();
delete _console;
_console = 0;
#ifdef __APPLE__
if (VoiceMode) {
system("say -v zarvox 'Good-Bye' &");
}
#endif
Console->close();
delete Console;
Console = 0;
BaseClient.printLine("");

View File

@ -66,7 +66,7 @@ function DatabaseSuite () {
////////////////////////////////////////////////////////////////////////////////
testVersion : function () {
assertMatch(/^2\.1/, internal.db._version());
assertMatch(/(^2\.2)|(-devel$)/, internal.db._version());
},
////////////////////////////////////////////////////////////////////////////////

View File

@ -62,13 +62,13 @@ extern "C" {
TRI_BYE_MESSAGE_EN " " \
TRI_BYE_MESSAGE_EO " " \
TRI_BYE_MESSAGE_ES " " \
TRI_BYE_MESSAGE_FR " " \
TRI_BYE_MESSAGE_GR " " \
TRI_BYE_MESSAGE_FR "\n" \
TRI_BYE_MESSAGE_IT " " \
TRI_BYE_MESSAGE_JP " " \
TRI_BYE_MESSAGE_NL " " \
TRI_BYE_MESSAGE_RU " " \
TRI_BYE_MESSAGE_SV
TRI_BYE_MESSAGE_SV " " \
TRI_BYE_MESSAGE_GR " " \
TRI_BYE_MESSAGE_JP " " \
TRI_BYE_MESSAGE_RU
#ifdef __cplusplus
}