|
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.
virtual std::vector< std::string > Mantid::API::ScriptRepository::check4Update |
( |
| ) |
|
|
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.
- Attention
- The responsibility of executing this method periodically, is not of the ScriptRepository it self. The others methods may not respond propperly, if this method is not executed.
- Note
- This operation requires internet connection.
- Exceptions
-
ScriptRepoException | notifies mainly connection failure, but, may eventually, notify that the local repository may not be created. |
- Returns
- List with all the files automatically downloaded.
Referenced by export_ScriptRepository().
virtual void Mantid::API::ScriptRepository::download |
( |
const std::string & |
file_path | ) |
|
|
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 (
- See also
- ScriptRepository::fileStatus) the download will make a copy of the remote file, but will preserve a backup of the local file. This incident will be reported through throwing an exception.
For folders, the exception will also list all the files that a backup was created.
- Parameters
-
file_path | of a file or folder to be downloaded. |
- Exceptions
-
ScriptRepoException | to indicate file is not available at remotely or to indicate that a conflict was found. |
Referenced by export_ScriptRepository().
virtual void Mantid::API::ScriptRepository::install |
( |
const std::string & |
local_path | ) |
|
|
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.
- Parameters
-
local_path | path where the folder (having the same name given) will be created. |
- Exceptions
-
Referenced by export_ScriptRepository().
virtual std::vector< std::string > Mantid::API::ScriptRepository::listFiles |
( |
| ) |
|
|
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.
- Note
- The path used a normal slash to separate folders.
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
- Returns
- List of all the files available inside the repository as a file system path relative to the local repository.
- Exceptions
-
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). |
virtual void Mantid::API::ScriptRepository::remove |
( |
const std::string & |
file_path, |
|
|
const std::string & |
comment, |
|
|
const std::string & |
author, |
|
|
const std::string & |
email |
|
) |
| |
|
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)
- Note
- This operation requires internet connection.
- Parameters
-
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. |
email | An string that identifies the email of the author. |
- Exceptions
-
ScriptRepoException | may be triggered for an attempt to delete folders, or a non existent file, or not allowed operation, or any network erros. |
virtual void Mantid::API::ScriptRepository::setIgnorePatterns |
( |
const std::string & |
patterns | ) |
|
|
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\.*"
- Parameters
-
patterns | : csv regex patterns to be ignored when listing files. |
This settings must be preserved, and be available after trough the configure system.
virtual void Mantid::API::ScriptRepository::upload |
( |
const std::string & |
file_path, |
|
|
const std::string & |
comment, |
|
|
const std::string & |
author, |
|
|
const std::string & |
email |
|
) |
| |
|
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.
- Note
- This operation requires internet connection.
- Parameters
-
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. |
email | An string that identifies the email of the author. |
- Exceptions
-
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. |