Mantid
|
#include <ScriptRepository.h>
Public Member Functions | |
virtual std::vector< std::string > | check4Update ()=0 |
Connects to the remote repository checking for updates. More... | |
virtual void | connect (const std::string &webserverurl="")=0 |
Allow the ScriptRepository to double check the connection with the web server. More... | |
virtual const std::string & | description (const std::string &path)=0 |
Provide the description of the file given the path. More... | |
virtual void | download (const std::string &file_path)=0 |
Create a copy of the remote file/folder inside the local repository. More... | |
ScriptInfo | fileInfo (const std::string &path) |
virtual SCRIPTSTATUS | fileStatus (const std::string &file_path)=0 |
Return the status of the file, according to the status defined in Mantid::API::SCRIPTSTATUS. More... | |
virtual std::string | ignorePatterns ()=0 |
Return the ignore patters that was defined through ScriptRepository::setIgnorePatterns. More... | |
virtual ScriptInfo | info (const std::string &path)=0 |
Return the information about the script through the Mantid::API::ScriptInfo struct. More... | |
virtual void | install (const std::string &local_path)=0 |
Install the necessary resources at the local_path given that allows the ScriptRepository to operate locally. More... | |
virtual bool | isValid ()=0 |
Check if the local repository exists. More... | |
virtual std::vector< std::string > | listFiles ()=0 |
Return the list of files inside the repository. More... | |
virtual void | remove (const std::string &file_path, const std::string &comment, const std::string &author, const std::string &email)=0 |
Delete the file from the remote repository (it does not touch the local copy). More... | |
virtual int | setAutoUpdate (const std::string &path, bool option=true)=0 |
Define the AutoUpdate option, which define if a file will be updated as soon as new versions are available at the central repository. More... | |
virtual void | setIgnorePatterns (const std::string &patterns)=0 |
Define the file patterns that will not be listed in listFiles. More... | |
virtual void | upload (const std::string &file_path, const std::string &comment, const std::string &author, const std::string &email)=0 |
Upload the local file/folder to be available at the remote repository. More... | |
virtual | ~ScriptRepository ()=default |
Virtual destructor (always needed for abstract classes) More... | |
Definition at line 291 of file ScriptRepository.h.
|
virtualdefault |
Virtual destructor (always needed for abstract classes)
|
pure virtual |
Connects to the remote repository checking for updates.
This method, needs to know the remote URL wich must be available to the object before calling the check4update.
It must check the state of the central repository and download all the files marked as AutoUpdate.
ScriptRepoException | notifies mainly connection failure, but, may eventually, notify that the local repository may not be created. |
Referenced by export_ScriptRepository().
|
pure virtual |
Allow the ScriptRepository to double check the connection with the web server.
An optional argument is allowed webserverurl, but, it may be taken from the settings defined for the ScriptRepository.
This method ensures that the network and the link is available.
webserverurl | : url of the mantid web server. |
ScriptRepoException | Failure to connect to the web server and the reason why. |
|
pure virtual |
Provide the description of the file given the path.
path | Script path related to the reposititory, or the operative system. |
|
pure virtual |
Create a copy of the remote file/folder inside the local repository.
For folder, it will copy all the files inside the folder as well.
If one file is reported to have local changes (
For folders, the exception will also list all the files that a backup was created.
file_path | of a file or folder to be downloaded. |
ScriptRepoException | to indicate file is not available at remotely or to indicate that a conflict was found. |
Referenced by export_ScriptRepository().
|
inline |
Definition at line 324 of file ScriptRepository.h.
|
pure virtual |
Return the status of the file, according to the status defined in Mantid::API::SCRIPTSTATUS.
file_path | for file/folder |
ScriptRepoException | to indicate that file is not available. |
|
pure virtual |
Return the ignore patters that was defined through ScriptRepository::setIgnorePatterns.
|
pure virtual |
Return the information about the script through the Mantid::API::ScriptInfo struct.
It may throw exception if the file is not presented locally, or even remotelly.
path | : Script path related to the repository, or to operate system. |
ScriptRepoException | Mainly for scripts not found. |
|
pure virtual |
Install the necessary resources at the local_path given that allows the ScriptRepository to operate locally.
It is allowed to create hidden files that would be necessary for the operation of this class.
At the end, a new folder is created (if it does not exists already), with the given local_path given.
local_path | path where the folder (having the same name given) will be created. |
ScriptRepoException | If the local_path may not be created (Permission issues). |
Referenced by export_ScriptRepository().
|
pure virtual |
Check if the local repository exists.
If there is no local repository, the repository was never installed, the isValid will return false, and the only method valid is ScriptRepository::install.
|
pure virtual |
Return the list of files inside the repository.
It provides a file-system like path for all the files, folders that are inside the local repository as well as remotely.
Consider the following repository:
README.md folderA folderA/fileB fileC
And the local repository folder containing these files:
README.md NewFile
List files, must show all the files:
README.md folderA folderA/fileB fileC NewFile
May | throw Invalid Repository if the local repository was not generated. In this case, it is necessary to execute the ScriptRepository::install (at least once). |
|
pure virtual |
Delete the file from the remote repository (it does not touch the local copy).
After this, the file will not be available for anyone among the users. As so, it is required a justification of why to remove (the comment), and the current rule accept that only the owner of the file (which is considered the last one to use the file) is allowed to remove it.
The file will be removed from the central repository (git)
file_path | for the file to be deleted. It will not accept deleting folders for security reason. |
comment | The reson of why deleting this entry. |
author | An string that may identify who is requesting to delete the file. It accept only the last author to remove it. |
An string that identifies the email of the author. |
ScriptRepoException | may be triggered for an attempt to delete folders, or a non existent file, or not allowed operation, or any network erros. |
|
pure virtual |
Define the AutoUpdate option, which define if a file will be updated as soon as new versions are available at the central repository.
This information will be kept in a property system, in order to be available afterwards.
path | : file or folder inside the local repository |
option | flag to set for auto-update, or not. If true, new versions of the path will replace the local file as soon as they are available at the central repository. |
ScriptRepoException | : Invalid entry. |
|
pure virtual |
Define the file patterns that will not be listed in listFiles.
This is important to force the ScriptRepository to not list hidden files, automatic generated files and so on. This helps to present to the user a clean presentation of the Repository
For example, there are the pyc files that are automatically generated, and should be discarded. We could set also to ignore files that end with ~, temporary files in linux. The patterns will be evaluated as a csv regex patterns.
To discard all pyc files, set: "*pyc".
To discard all pyc files and hidden files and folders: "*pyc;\b\.*"
patterns | : csv regex patterns to be ignored when listing files. |
This settings must be preserved, and be available after trough the configure system.
|
pure virtual |
Upload the local file/folder to be available at the remote repository.
After this, this file/folder will be available for every, being published as with the same license as the mantid framework itself.
The user is not allowed to upload files that are marked as BOTH_CHANGED. It must first download the file (wich will make a copy of the local one), than update the downloaded file with the user own changes. At this point, he may published his file.
file_path | for the file/folder to be published. For folders, it will publish all the files inside the folder. (Empty folders will not be accepted). |
comment | Allows to give information of the last changes, updates on a given file/folder. It differs from description, in the sense, that it may inform just what changed from the last version, while, the description must provide information about the scope of the file. |
author | An string that may identify who is the responsible for changing that file. It may be a nick name, or an e-mail, or even a code, but, it it necessary that it identifies who was responsible for changing the file. |
An string that identifies the email of the author. |
ScriptRepoException | may be triggered for an attempt to publish an empty folder, a file not present locally, because the file, or one of the files inside the folder are marked as BOTH_CHANGED, or even failure to connect to the remote repository. |