mirror of
https://github.com/QuasarApp/CQtDeployerServer.git
synced 2025-04-26 04:34:31 +00:00
added skeleton of the cqtdeployer server
This commit is contained in:
parent
abaddfcdf3
commit
b0f97c1ed3
@ -22,6 +22,8 @@ include(Heart/QuasarAppLib/CMake/ccache.cmake)
|
||||
include(Heart/QuasarAppLib/CMake/QuasarAppCITargets.cmake)
|
||||
|
||||
# Add sub directories
|
||||
set(HEART_BUILD_LVL 0)
|
||||
add_subdirectory(Heart)
|
||||
add_subdirectory(src)
|
||||
if (${QT_VERSION_MAJOR})
|
||||
add_subdirectory(tests)
|
||||
|
BIN
docs/ServerImplementation.png
Normal file
BIN
docs/ServerImplementation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
5420
docs/serverimplmodel.qmodel
Normal file
5420
docs/serverimplmodel.qmodel
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
add_definitions(-DCQtDeployerServer_LIBRARY)
|
||||
add_definitions(-DCQTSERVER_LIBRARY)
|
||||
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
|
||||
@ -26,9 +26,7 @@ set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/Private")
|
||||
|
||||
add_library(${PROJECT_NAME} ${SOURCE_CPP})
|
||||
|
||||
if (${QT_VERSION_MAJOR})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Qt::Core)
|
||||
endif()
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC Qt::Core Heart)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PUBLIC_INCUDE_DIR})
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${PRIVATE_INCUDE_DIR})
|
||||
|
@ -15,6 +15,6 @@ namespace CQT {
|
||||
* @note you should be invoke this method before using the cqt server library.
|
||||
* @return true if the initialize finished successful
|
||||
*/
|
||||
bool CQtDeployerServer_EXPORT init();
|
||||
bool CQTSERVER_EXPORT init();
|
||||
|
||||
};
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if defined(CQtDeployerServer_LIBRARY)
|
||||
# define CQtDeployerServer_EXPORT Q_DECL_EXPORT
|
||||
#if defined(CQTSERVER_LIBRARY)
|
||||
# define CQTSERVER_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
# define CQtDeployerServer_EXPORT Q_DECL_IMPORT
|
||||
# define CQTSERVER_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif //CQtDeployerServer_GLOBAL_H
|
||||
|
15
src/Library/src/Private/config.h
Normal file
15
src/Library/src/Private/config.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "CQtServer_global.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#define DEFAULT_LOCATION "/var/www/cqt"
|
||||
#endif
|
||||
|
||||
// fix me. for windows showl be selected a new default dirrectory.
|
||||
#ifdef Q_OS_WIN32
|
||||
#define DEFAULT_LOCATION "C:/cqt"
|
||||
#endif
|
||||
|
||||
#endif // CONFIG_H
|
25
src/Library/src/hostconfiguration.cpp
Normal file
25
src/Library/src/hostconfiguration.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "hostconfiguration.h"
|
||||
#include "config.h"
|
||||
namespace CQT {
|
||||
|
||||
HostConfiguration::HostConfiguration() {
|
||||
_location = DEFAULT_LOCATION;
|
||||
}
|
||||
|
||||
QString HostConfiguration::location() const
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
void HostConfiguration::setLocation(const QString &location)
|
||||
{
|
||||
_location = location;
|
||||
}
|
||||
}
|
40
src/Library/src/hostconfiguration.h
Normal file
40
src/Library/src/hostconfiguration.h
Normal file
@ -0,0 +1,40 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef HOSTCONFIGURATION_H
|
||||
#define HOSTCONFIGURATION_H
|
||||
|
||||
#include <QString>
|
||||
#include "CQtServer_global.h"
|
||||
|
||||
namespace CQT {
|
||||
|
||||
/**
|
||||
* @brief The HostConfiguration class This is host configuration of the ctdeployer server.
|
||||
*/
|
||||
class CQTSERVER_EXPORT HostConfiguration
|
||||
{
|
||||
public:
|
||||
HostConfiguration();
|
||||
|
||||
/**
|
||||
* @brief location This method return current value of the repsitories path.
|
||||
* @return path to location of the repositories.
|
||||
*/
|
||||
QString location() const;
|
||||
|
||||
/**
|
||||
* @brief setLocation This method sets a location of the repositories.
|
||||
* @param location This is a new value of the repository location.
|
||||
*/
|
||||
void setLocation(const QString &location);
|
||||
|
||||
private:
|
||||
QString _location;
|
||||
};
|
||||
}
|
||||
#endif // HOSTCONFIGURATION_H
|
24
src/Library/src/iconfiguration.cpp
Normal file
24
src/Library/src/iconfiguration.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#include "iconfiguration.h"
|
||||
namespace CQT {
|
||||
|
||||
|
||||
IConfiguration::IConfiguration(const HostConfiguration &hostConfig) {
|
||||
setHostConfig(hostConfig);
|
||||
}
|
||||
|
||||
const HostConfiguration &IConfiguration::hostConfig() const {
|
||||
return _hostConfig;
|
||||
}
|
||||
|
||||
void IConfiguration::setHostConfig(const HostConfiguration &hostConfig) {
|
||||
_hostConfig = hostConfig;
|
||||
}
|
||||
|
||||
}
|
41
src/Library/src/iconfiguration.h
Normal file
41
src/Library/src/iconfiguration.h
Normal file
@ -0,0 +1,41 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef ICONFIGURATION_H
|
||||
#define ICONFIGURATION_H
|
||||
#include "CQtServer_global.h"
|
||||
#include "hostconfiguration.h"
|
||||
|
||||
namespace CQT {
|
||||
|
||||
/**
|
||||
* @brief The IConfiguration class This is base interface of all configuration.
|
||||
* The configuratin received from the main CQtDeployer application.
|
||||
*/
|
||||
class CQTSERVER_EXPORT IConfiguration
|
||||
{
|
||||
public:
|
||||
IConfiguration(const HostConfiguration &hostConfig);
|
||||
|
||||
/**
|
||||
* @brief hostConfig This is host configuration of the cqtdeployer server.
|
||||
* This configuration received from the config file on the server host.
|
||||
* @return constant reference to the host configuration.
|
||||
*/
|
||||
const HostConfiguration& hostConfig() const;
|
||||
|
||||
/**
|
||||
* @brief setHostConfig This method sets a new values of the host configuratiun.
|
||||
* @param hostConfig This is new value of the host configuration.
|
||||
*/
|
||||
void setHostConfig(const HostConfiguration &hostConfig);
|
||||
|
||||
private:
|
||||
HostConfiguration _hostConfig;
|
||||
};
|
||||
}
|
||||
#endif // ICONFIGURATION_H
|
@ -1,6 +1,26 @@
|
||||
#include "idistributor.h"
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
iDistributor::iDistributor()
|
||||
{
|
||||
#include "idistributor.h"
|
||||
#include "iconfiguration.h"
|
||||
|
||||
namespace CQT {
|
||||
|
||||
iDistributor::~iDistributor() {
|
||||
delete _configuration;
|
||||
}
|
||||
|
||||
bool iDistributor::setConfiguraion(const IConfiguration *config) {
|
||||
if (!config)
|
||||
return false;
|
||||
|
||||
_configuration = config;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,44 @@
|
||||
//#
|
||||
//# Copyright (C) 2021-2021 QuasarApp.
|
||||
//# Distributed under the lgplv3 software license, see the accompanying
|
||||
//# Everyone is permitted to copy and distribute verbatim copies
|
||||
//# of this license document, but changing it is not allowed.
|
||||
//#
|
||||
|
||||
#ifndef IDISTRIBUTOR_H
|
||||
#define IDISTRIBUTOR_H
|
||||
|
||||
namespace CQT {
|
||||
|
||||
class IConfiguration;
|
||||
/**
|
||||
* @brief The iDistributor class This is main interface for deploy repositories on server.
|
||||
*/
|
||||
class iDistributor
|
||||
{
|
||||
public:
|
||||
iDistributor();
|
||||
virtual bool deploy();
|
||||
iDistributor() = default;
|
||||
virtual ~iDistributor();
|
||||
|
||||
|
||||
/**
|
||||
* @brief setConfiguraion This method sets confgura
|
||||
* @param config This is pointer to the new configuration
|
||||
* @return true if the configuration sets successfull.
|
||||
* @note The iDistributor object will delete the config object selfly when its will be destroyed
|
||||
* @note This method not check config object to compatibility with own implementation.
|
||||
* So you need to validate config object using dynamic_cast operator in a implementation of the deploy method.
|
||||
*/
|
||||
bool setConfiguraion(const IConfiguration* config);
|
||||
|
||||
/**
|
||||
* @brief deploy This method deploy new update or release of the deployament application on server.
|
||||
* @return true if the application deployed successful
|
||||
*/
|
||||
virtual bool deploy() = 0;
|
||||
|
||||
private:
|
||||
const IConfiguration* _configuration = nullptr;
|
||||
};
|
||||
}
|
||||
#endif // IDISTRIBUTOR_H
|
||||
|
8
src/Library/src/server.cpp
Normal file
8
src/Library/src/server.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "server.h"
|
||||
namespace CQT {
|
||||
|
||||
Server::Server()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
20
src/Library/src/server.h
Normal file
20
src/Library/src/server.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef SERVER_H
|
||||
#define SERVER_H
|
||||
|
||||
#include "abstractnode.h"
|
||||
namespace CQT {
|
||||
|
||||
/**
|
||||
* @brief The Server class This is implementation of the CQtDeployer Server.
|
||||
* Exmaple of the base implemnentation:
|
||||
*
|
||||
* \image html ServerImplementation.svg width=800px
|
||||
|
||||
*/
|
||||
class Server : public QH::AbstractNode
|
||||
{
|
||||
public:
|
||||
Server();
|
||||
};
|
||||
}
|
||||
#endif // SERVER_H
|
Loading…
x
Reference in New Issue
Block a user