Mantid
Loading...
Searching...
No Matches
UpdateScriptRepository.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
10
11namespace Mantid::Algorithms {
12
13// Register the algorithm into the AlgorithmFactory
14DECLARE_ALGORITHM(UpdateScriptRepository)
15
16//----------------------------------------------------------------------------------------------
18const std::string UpdateScriptRepository::name() const { return "UpdateScriptRepository"; }
19
21int UpdateScriptRepository::version() const { return 1; }
22
24const std::string UpdateScriptRepository::category() const { return "Utility\\Python"; }
25
26//----------------------------------------------------------------------------------------------
27
28//----------------------------------------------------------------------------------------------
32
33//----------------------------------------------------------------------------------------------
37 // TODO Auto-generated execute stub
41 auto repo_ptr = ScriptRepositoryFactory::Instance().create("ScriptRepositoryImpl");
42
43 if (!repo_ptr->isValid())
44 return; // it means that the ScriptRepository was not installed.
45
46 std::vector<std::string> f_list = repo_ptr->check4Update();
47 if (!f_list.empty()) {
48 std::stringstream info;
49 info << "Information about ScriptRepository:\n"
50 << " A more recent version of the following files was installed:\n";
51 for (auto &file : f_list) {
52 info << " * " << file << "\n";
53 }
54 info << "Please check these files before using them. "
55 << "Note: These files were configured for AutoUpdate.";
56 g_log.warning() << info.str() << '\n';
57 }
58}
59
60} // namespace Mantid::Algorithms
#define DECLARE_ALGORITHM(classname)
Definition: Algorithm.h:576
Kernel::Logger & g_log
Definition: Algorithm.h:451
UpdateScriptRepository : Check the MantidWeb, for updates of the ScriptRepository.
void exec() override
Execute the algorithm.
int version() const override
Algorithm's version for identification.
void init() override
Initialize the algorithm's properties.
const std::string category() const override
Algorithm's category for identification.
void warning(const std::string &msg)
Logs at warning level.
Definition: Logger.cpp:86
Manage the lifetime of a class intended to be a singleton.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< ScriptRepository > ScriptRepository_sptr
shared pointer to the function base class
STL namespace.