reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit df042faf9e377f0943705d18ccd54130dab9e00f
parent 662c3af003784c3e8baedfe6b075c3d91039a219
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 26 Nov 2015 23:15:40 -0500

attach an optional changelog to each version

Diffstat:
Msrc/database_v1.cpp | 9+++++++++
Msrc/version.cpp | 5+++++
Msrc/version.hpp | 5+++++
Mtest/database_v1.cpp | 7+++++++
Atest/db/v1/changelog.xml | 12++++++++++++
5 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/src/database_v1.cpp b/src/database_v1.cpp @@ -89,5 +89,14 @@ VersionPtr LoadVersionV1(TiXmlElement *verNode) node = node->NextSiblingElement("source"); } + node = verNode->FirstChildElement("changelog"); + + if(node) { + const char *changelog = node->GetText(); + + if(changelog) + ver->setChangelog(changelog); + } + return ver; } diff --git a/src/version.cpp b/src/version.cpp @@ -62,6 +62,11 @@ void Version::addSource(SourcePtr source) m_sources.push_back(source); } +void Version::setChangelog(const std::string &changelog) +{ + m_changelog = changelog; +} + bool Version::operator<(const Version &o) { return m_code < o.code(); diff --git a/src/version.hpp b/src/version.hpp @@ -18,6 +18,9 @@ public: const std::string &name() const { return m_name; } int code() const { return m_code; } + void setChangelog(const std::string &); + const std::string &changelog() const { return m_changelog; } + void addSource(SourcePtr source); const std::vector<SourcePtr> &sources() const { return m_sources; } SourcePtr source(const int i) const { return m_sources[i]; } @@ -27,6 +30,8 @@ public: private: std::string m_name; int m_code; + + std::string m_changelog; std::vector<SourcePtr> m_sources; }; diff --git a/test/database_v1.cpp b/test/database_v1.cpp @@ -101,3 +101,10 @@ TEST_CASE("default platform", M) { REQUIRE(db->category(0)->package(0)->version(0)->source(0)->platform() == Source::GenericPlatform); } + +TEST_CASE("version changelog", M) { + DatabasePtr db = Database::load(DBPATH "changelog.xml"); + + REQUIRE(db->category(0)->package(0)->version(0)->changelog() + == "Hello\nWorld"); +} diff --git a/test/db/v1/changelog.xml b/test/db/v1/changelog.xml @@ -0,0 +1,12 @@ +<index version="1"> + <category name="hello"> + <reapack name="a" type="script" author="abc"> + <version name="1"> + <source platform="all">http://google.com</source> + <changelog><![CDATA[Hello +World]]> + </changelog> + </version> + </reapack> + </category> +</index>