#include <scriptserver.h>
Inheritance diagram for zeitgeist::ScriptServer:
Public Types | |
enum | EInitScriptType { IS_COMMON, IS_USERLOCAL } |
Public Member Functions | |
ScriptServer () | |
constructs the ScriptServer | |
virtual | ~ScriptServer () |
bool | Run (const std::string &fileName) |
loads and runs a ruby script, returns true on success | |
bool | Run (boost::shared_ptr< salt::RFile > file) |
loads and runs a ruby script from an RFile | |
void | SetInitRelPathPrefix (const std::string &relPathPrefix) |
sets the relative path prefix RunInitScript() searches for an InitScript. | |
bool | RunInitScript (const std::string &fileName, const std::string &relPath, EInitScriptType type=IS_USERLOCAL) |
searches in ~/<mDotName>/ if dotScript is true, PREFIX/share/PACKAGE_NAME/ and <mRelPathPrefix><relPath>/ for the script <fileName>. | |
void | SetDotName (const std::string &dotName) |
sets name of the dot directory | |
bool | Eval (const std::string &command) |
evaluates a ruby statement, returns true on success | |
bool | Eval (const std::string &command, GCValue &value) |
evaluates a ruby statement, returns true on success; | |
void | UpdateCachedAllNodes () |
bool | ExistsVariable (const std::string &varName) |
returns true if the variable varName exists | |
void | CreateVariable (const std::string &varName, int value) |
creates a ruby integer variable | |
void | CreateVariable (const std::string &varName, float value) |
creates a ruby float variable | |
void | CreateVariable (const std::string &varName, const std::string &value) |
creates a ruby string variable | |
bool | GetVariable (const std::string &varName, int &value) |
reads the value of a ruby integer, returns true on success | |
bool | GetVariable (const std::string &varName, bool &value) |
reads the value of a ruby boolean, returns true on success | |
bool | GetVariable (const std::string &varName, std::string &value) |
reads the value of a ruby string, returns true on success | |
bool | GetVariable (const std::string &varName, float &value) |
reads the value of a ruby float, returns true on success | |
boost::shared_ptr< CoreContext > | GetContext () const |
returns the context, the ScriptServer operates in | |
Static Public Member Functions | |
static GCValue | GetZeitgeistObject (boost::shared_ptr< Leaf > leaf) |
constructs the ZeitgeistObject corresponding to a given leaf | |
Protected Member Functions | |
virtual bool | ConstructInternal () |
initializes the ScriptServer and runs the default startup script 'sys/script/zeitgeist.rb', returning true on success. | |
bool | ParseVarName (const std::string &varName, std::string &nameSpace, std::string &name) |
parses a ruby variable into a namespace and variable name part. | |
GCValue | GetVariable (const std::string &varName) |
returns the content of a variable | |
bool | RunInitScriptInternal (const std::string &dir, const std::string &name, bool copy, const std::string &destDir="") |
private helper function | |
bool | GetDotDirName (std::string &dotDir) |
construct the path of the local dot directory that contains the users init scripts | |
bool | CreateDotDir (const std::string &dotDir) |
checks if the directory <dotDir> exists and if not creates it | |
Protected Attributes | |
std::string | mDotName |
the name of the users dot directory, used by RunInitScript to search for script files: ~/<mDotName> | |
std::string | mRelPathPrefix |
the prefix RunInitScript() prepends all relativ paths | |
Private Member Functions | |
ScriptServer (const ScriptServer &obj) | |
ScriptServer & | operator= (const ScriptServer &obj) |
Up to now is realized using Ruby, though the ScritpServer could easily be extended to support other script languages.
Definition at line 48 of file scriptserver.h.
|
Definition at line 54 of file scriptserver.h. |
|
constructs the ScriptServer
Definition at line 227 of file scriptserver.cpp. References deleteObject(), dirs(), getObject(), importBundle(), listObjects(), mRelPathPrefix, newObject(), popd(), pushd(), run(), selectCall(), selectObject(), and thisCall(). Here is the call graph for this function: ![]() |
|
Definition at line 248 of file scriptserver.cpp. |
|
|
|
initializes the ScriptServer and runs the default startup script 'sys/script/zeitgeist.rb', returning true on success.
Reimplemented from zeitgeist::Object. Definition at line 451 of file scriptserver.cpp. References zeitgeist::Object::ConstructInternal(), zeitgeist::Object::GetCore(), and gMyPrivateContext. Here is the call graph for this function: ![]() |
|
checks if the directory <dotDir> exists and if not creates it
|
|
creates a ruby string variable
|
|
creates a ruby float variable
|
|
creates a ruby integer variable
|
|
evaluates a ruby statement, returns true on success;
Definition at line 301 of file scriptserver.cpp. References zeitgeist::RbEvalStringWrap(). Here is the call graph for this function: ![]() |
|
evaluates a ruby statement, returns true on success
|
|
returns true if the variable varName exists
|
|
returns the context, the ScriptServer operates in
Definition at line 445 of file scriptserver.cpp. References gMyPrivateContext. |
|
construct the path of the local dot directory that contains the users init scripts
|
|
returns the content of a variable
|
|
reads the value of a ruby float, returns true on success
Definition at line 427 of file scriptserver.cpp. References GetVariable(). Here is the call graph for this function: ![]() |
|
reads the value of a ruby string, returns true on success
|
|
reads the value of a ruby boolean, returns true on success
|
|
reads the value of a ruby integer, returns true on success
Referenced by GetVariable(). |
|
constructs the ZeitgeistObject corresponding to a given leaf
Definition at line 91 of file scriptserver.cpp. References zeitgeist::RbEvalStringWrap(). Referenced by getObject(), newObject(), and selectObject(). Here is the call graph for this function: ![]() |
|
|
|
parses a ruby variable into a namespace and variable name part. Valid variable names are 'Namespace.Name'.
|
|
loads and runs a ruby script from an RFile
|
|
loads and runs a ruby script, returns true on success
|
|
searches in ~/<mDotName>/ if dotScript is true, PREFIX/share/PACKAGE_NAME/ and <mRelPathPrefix><relPath>/ for the script <fileName>. If found the script is run and if dotScript is true copied to ~/<dotName>/. If this directory is missing it is automatically created |
|
private helper function
|
|
sets name of the dot directory
Definition at line 97 of file scriptserver.h. References mDotName. |
|
sets the relative path prefix RunInitScript() searches for an InitScript. Default is '../../', suitable for all applications started from '/app' Definition at line 463 of file scriptserver.cpp. References mRelPathPrefix. |
|
Definition at line 253 of file scriptserver.cpp. References zeitgeist::Object::GetCore(), and zeitgeist::Object::GetLog(). Here is the call graph for this function: ![]() |
|
the name of the users dot directory, used by RunInitScript to search for script files: ~/<mDotName>
Definition at line 187 of file scriptserver.h. Referenced by SetDotName(). |
|
the prefix RunInitScript() prepends all relativ paths
Definition at line 191 of file scriptserver.h. Referenced by ScriptServer(), and SetInitRelPathPrefix(). |