reapack

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

commit 44926acc9bd070437d83a2095528e5c90019c670
parent f34a0552189b03eeee3369526d653231ee9ac9fa
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Mon,  7 Mar 2016 01:14:54 -0500

refactoring: rename RemoteIndex → Index

Diffstat:
Msrc/about.cpp | 6+++---
Msrc/about.hpp | 6+++---
Msrc/index.cpp | 20++++++++++----------
Msrc/index.hpp | 16++++++++--------
Msrc/index_v1.cpp | 16++++++++--------
Msrc/reapack.cpp | 10+++++-----
Msrc/reapack.hpp | 4++--
Msrc/registry.cpp | 4++--
Msrc/transaction.cpp | 14+++++++-------
Msrc/transaction.hpp | 4++--
Mtest/index.cpp | 60++++++++++++++++++++++++++++++------------------------------
Mtest/index_v1.cpp | 38+++++++++++++++++++-------------------
Mtest/package.cpp | 12++++++------
Mtest/registry.cpp | 4++--
Mtest/source.cpp | 8++++----
Mtest/version.cpp | 4++--
16 files changed, 113 insertions(+), 113 deletions(-)

diff --git a/src/about.cpp b/src/about.cpp @@ -36,7 +36,7 @@ using namespace std; enum { ACTION_HISTORY = 300 }; -About::About(const RemoteIndex *index) +About::About(const Index *index) : Dialog(IDD_ABOUT_DIALOG), m_index(index), m_currentCat(-255) { @@ -139,11 +139,11 @@ void About::populate() auto_snprintf(title, sizeof(title), AUTO_STR("About %s"), name.c_str()); SetWindowText(handle(), title); - m_websiteLinks = m_index->links(RemoteIndex::WebsiteLink); + m_websiteLinks = m_index->links(Index::WebsiteLink); if(m_websiteLinks.empty()) hide(getControl(IDC_WEBSITE)); - m_donationLinks = m_index->links(RemoteIndex::DonationLink); + m_donationLinks = m_index->links(Index::DonationLink); if(m_donationLinks.empty()) hide(getControl(IDC_DONATE)); diff --git a/src/about.hpp b/src/about.hpp @@ -24,9 +24,9 @@ #include "report.hpp" +class Index; class ListView; class Package; -class RemoteIndex; class ReportBase; class RichEdit; class TabBar; @@ -36,7 +36,7 @@ class About : public Dialog { public: enum { InstallResult = 100 }; - About(const RemoteIndex *); + About(const Index *); ~About(); protected: @@ -52,7 +52,7 @@ private: void openLink(const Link *); void packageHistory(); - const RemoteIndex *m_index; + const Index *m_index; int m_currentCat; TabBar *m_tabs; diff --git a/src/index.cpp b/src/index.cpp @@ -30,12 +30,12 @@ using namespace std; -Path RemoteIndex::pathFor(const string &name) +Path Index::pathFor(const string &name) { return Path::prefixCache(name + ".xml"); } -auto RemoteIndex::linkTypeFor(const char *rel) -> LinkType +auto Index::linkTypeFor(const char *rel) -> LinkType { if(!strcmp(rel, "donation")) return DonationLink; @@ -43,7 +43,7 @@ auto RemoteIndex::linkTypeFor(const char *rel) -> LinkType return WebsiteLink; } -const RemoteIndex *RemoteIndex::load(const string &name) +const Index *Index::load(const string &name) { TiXmlDocument doc; @@ -78,7 +78,7 @@ const RemoteIndex *RemoteIndex::load(const string &name) } } -Download *RemoteIndex::fetch(const Remote &remote, const bool stale) +Download *Index::fetch(const Remote &remote, const bool stale) { time_t mtime = 0, now = time(nullptr); @@ -92,20 +92,20 @@ Download *RemoteIndex::fetch(const Remote &remote, const bool stale) return new Download(remote.name() + ".xml", remote.url()); } -RemoteIndex::RemoteIndex(const string &name) +Index::Index(const string &name) : m_name(name) { if(m_name.empty()) throw reapack_error("empty index name"); } -RemoteIndex::~RemoteIndex() +Index::~Index() { for(const Category *cat : m_categories) delete cat; } -void RemoteIndex::addCategory(const Category *cat) +void Index::addCategory(const Category *cat) { if(cat->index() != this) throw reapack_error("category belongs to another index"); @@ -119,13 +119,13 @@ void RemoteIndex::addCategory(const Category *cat) cat->packages().begin(), cat->packages().end()); } -void RemoteIndex::addLink(const LinkType type, const Link &link) +void Index::addLink(const LinkType type, const Link &link) { if(boost::algorithm::starts_with(link.url, "http")) m_links.insert({type, link}); } -auto RemoteIndex::links(const LinkType type) const -> LinkList +auto Index::links(const LinkType type) const -> LinkList { const auto begin = m_links.lower_bound(type); const auto end = m_links.upper_bound(type); @@ -138,7 +138,7 @@ auto RemoteIndex::links(const LinkType type) const -> LinkList return list; } -Category::Category(const string &name, const RemoteIndex *ri) +Category::Category(const string &name, const Index *ri) : m_index(ri), m_name(name) { if(m_name.empty()) diff --git a/src/index.hpp b/src/index.hpp @@ -34,7 +34,7 @@ class TiXmlElement; struct Link { std::string name; std::string url; }; -class RemoteIndex { +class Index { public: enum LinkType { WebsiteLink, DonationLink }; typedef std::multimap<LinkType, Link> LinkMap; @@ -42,11 +42,11 @@ public: static Path pathFor(const std::string &name); static LinkType linkTypeFor(const char *rel); - static const RemoteIndex *load(const std::string &name); + static const Index *load(const std::string &name); static Download *fetch(const Remote &, bool stale = false); - RemoteIndex(const std::string &name); - ~RemoteIndex(); + Index(const std::string &name); + ~Index(); const std::string &name() const { return m_name; } @@ -62,7 +62,7 @@ public: const PackageList &packages() const { return m_packages; } private: - static RemoteIndex *loadV1(TiXmlElement *, const std::string &); + static Index *loadV1(TiXmlElement *, const std::string &); std::string m_name; std::string m_about; @@ -73,10 +73,10 @@ private: class Category { public: - Category(const std::string &name, const RemoteIndex * = nullptr); + Category(const std::string &name, const Index * = nullptr); ~Category(); - const RemoteIndex *index() const { return m_index; } + const Index *index() const { return m_index; } const std::string &name() const { return m_name; } std::string fullName() const; @@ -85,7 +85,7 @@ public: const Package *package(size_t i) const { return m_packages[i]; } private: - const RemoteIndex *m_index; + const Index *m_index; std::string m_name; PackageList m_packages; diff --git a/src/index_v1.cpp b/src/index_v1.cpp @@ -25,18 +25,18 @@ using namespace std; -static void LoadMetadataV1(TiXmlElement *, RemoteIndex *ri); -static void LoadCategoryV1(TiXmlElement *, RemoteIndex *ri); +static void LoadMetadataV1(TiXmlElement *, Index *ri); +static void LoadCategoryV1(TiXmlElement *, Index *ri); static void LoadPackageV1(TiXmlElement *, Category *cat); static void LoadVersionV1(TiXmlElement *, Package *pkg); -RemoteIndex *RemoteIndex::loadV1(TiXmlElement *root, const string &name) +Index *Index::loadV1(TiXmlElement *root, const string &name) { - RemoteIndex *ri = new RemoteIndex(name); + Index *ri = new Index(name); // ensure the memory is released if an exception is // thrown during the loading process - unique_ptr<RemoteIndex> ptr(ri); + unique_ptr<Index> ptr(ri); TiXmlElement *node = root->FirstChildElement("category"); @@ -55,7 +55,7 @@ RemoteIndex *RemoteIndex::loadV1(TiXmlElement *root, const string &name) return ri; } -void LoadMetadataV1(TiXmlElement *meta, RemoteIndex *ri) +void LoadMetadataV1(TiXmlElement *meta, Index *ri) { TiXmlElement *node = meta->FirstChildElement("description"); @@ -80,13 +80,13 @@ void LoadMetadataV1(TiXmlElement *meta, RemoteIndex *ri) } else if(!url) url = name; - ri->addLink(RemoteIndex::linkTypeFor(rel), {name, url}); + ri->addLink(Index::linkTypeFor(rel), {name, url}); node = node->NextSiblingElement("link"); } } -void LoadCategoryV1(TiXmlElement *catNode, RemoteIndex *ri) +void LoadCategoryV1(TiXmlElement *catNode, Index *ri) { const char *name = catNode->Attribute("name"); if(!name) name = ""; diff --git a/src/reapack.cpp b/src/reapack.cpp @@ -303,7 +303,7 @@ void ReaPack::about(const Remote &remote, HWND parent) if(remote.isNull()) return; - loadIndex(remote, [=] (const RemoteIndex *index) { + loadIndex(remote, [=] (const Index *index) { const auto ret = Dialog::Show<About>(m_instance, parent, index); if(ret == About::InstallResult) @@ -320,7 +320,7 @@ void ReaPack::loadIndex(const Remote &remote, const auto load = [=] { try { // callback is responsible of deleting the index after use - callback(RemoteIndex::load(remote.name())); + callback(Index::load(remote.name())); } catch(const reapack_error &e) { const auto_string &desc = make_autostring(e.what()); @@ -340,7 +340,7 @@ void ReaPack::loadIndex(const Remote &remote, } }; - Download *dl = RemoteIndex::fetch(remote); + Download *dl = Index::fetch(remote); if(!dl) { load(); @@ -363,7 +363,7 @@ void ReaPack::loadIndex(const Remote &remote, switch(dl->state()) { case Download::Success: - if(FS::write(RemoteIndex::pathFor(remote.name()), dl->contents())) + if(FS::write(Index::pathFor(remote.name()), dl->contents())) load(); else MessageBox(parent, make_autostring(FS::lastError()).c_str(), @@ -441,7 +441,7 @@ void ReaPack::runTasks() void ReaPack::registerSelf() { // hard-coding galore! - RemoteIndex ri("ReaPack"); + Index ri("ReaPack"); Category cat("Extensions", &ri); Package pkg(Package::ExtensionType, "ReaPack.ext", &cat); Version ver(VERSION, &pkg); diff --git a/src/reapack.hpp b/src/reapack.hpp @@ -27,16 +27,16 @@ class Config; class Import; +class Index; class Manager; class Progress; class Remote; -class RemoteIndex; class Transaction; class ReaPack { public: typedef std::function<void ()> ActionCallback; - typedef std::function<void (const RemoteIndex *)> IndexCallback; + typedef std::function<void (const Index *)> IndexCallback; static const std::string VERSION; static const std::string BUILDTIME; diff --git a/src/registry.cpp b/src/registry.cpp @@ -120,7 +120,7 @@ auto Registry::push(const Version *ver, vector<Path> *conflicts) -> Entry const Package *pkg = ver->package(); const Category *cat = pkg->category(); - const RemoteIndex *ri = cat->index(); + const Index *ri = cat->index(); m_clearFiles->bind(1, ri->name()); m_clearFiles->bind(2, cat->name()); @@ -194,7 +194,7 @@ auto Registry::getEntry(const Package *pkg) const -> Entry Version::Code version = 0; const Category *cat = pkg->category(); - const RemoteIndex *ri = cat->index(); + const Index *ri = cat->index(); m_findEntry->bind(1, ri->name()); m_findEntry->bind(2, cat->name()); diff --git a/src/transaction.cpp b/src/transaction.cpp @@ -58,7 +58,7 @@ Transaction::~Transaction() for(Task *task : m_tasks) delete task; - for(const RemoteIndex *ri : m_remoteIndexes) + for(const Index *ri : m_indexes) delete ri; delete m_registry; @@ -71,11 +71,11 @@ void Transaction::synchronize(const Remote &remote, const bool isUserAction) m_receipt.setEnabled(true); fetchIndex(remote, [=] { - const RemoteIndex *ri; + const Index *ri; try { - ri = RemoteIndex::load(remote.name()); - m_remoteIndexes.push_back(ri); + ri = Index::load(remote.name()); + m_indexes.push_back(ri); } catch(const reapack_error &e) { // index file is invalid (load error) @@ -106,7 +106,7 @@ void Transaction::fetchIndex(const Remote &remote, const IndexCallback &cb) if(m_remotes.count(name) > 1) return; - Download *dl = RemoteIndex::fetch(remote, true); + Download *dl = Index::fetch(remote, true); if(!dl) { // the index was last downloaded less than a few seconds ago @@ -121,7 +121,7 @@ void Transaction::fetchIndex(const Remote &remote, const IndexCallback &cb) void Transaction::saveIndex(Download *dl, const string &name) { - if(!saveFile(dl, RemoteIndex::pathFor(name))) + if(!saveFile(dl, Index::pathFor(name))) return; const auto end = m_remotes.upper_bound(name); @@ -222,7 +222,7 @@ void Transaction::unregisterAll(const Remote &remote) void Transaction::uninstall(const Remote &remote) { inhibit(remote); - FS::remove(RemoteIndex::pathFor(remote.name())); + FS::remove(Index::pathFor(remote.name())); const vector<Registry::Entry> &entries = m_registry->getEntries(remote.name()); diff --git a/src/transaction.hpp b/src/transaction.hpp @@ -28,7 +28,7 @@ #include <set> class Remote; -class RemoteIndex; +class Index; class Task; struct InstallTicket { @@ -92,7 +92,7 @@ private: Receipt m_receipt; std::multimap<std::string, IndexCallback> m_remotes; - std::vector<const RemoteIndex *> m_remoteIndexes; + std::vector<const Index *> m_indexes; std::vector<Task *> m_tasks; DownloadQueue m_downloadQueue; diff --git a/test/index.cpp b/test/index.cpp @@ -6,7 +6,7 @@ #include <string> #define RIPATH "test/indexes/" -#define RIPTR(ptr) unique_ptr<const RemoteIndex> riptr(ptr) +#define RIPTR(ptr) unique_ptr<const Index> riptr(ptr) using namespace std; @@ -16,7 +16,7 @@ TEST_CASE("file not found", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("404"); + const Index *ri = Index::load("404"); RIPTR(ri); FAIL(); } @@ -29,7 +29,7 @@ TEST_CASE("broken", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("broken"); + const Index *ri = Index::load("broken"); RIPTR(ri); FAIL(); } @@ -42,7 +42,7 @@ TEST_CASE("wrong root tag name", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("wrong_root"); + const Index *ri = Index::load("wrong_root"); RIPTR(ri); FAIL(); } @@ -55,7 +55,7 @@ TEST_CASE("invalid version", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("invalid_version"); + const Index *ri = Index::load("invalid_version"); RIPTR(ri); FAIL(); } @@ -68,7 +68,7 @@ TEST_CASE("future version", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("future_version"); + const Index *ri = Index::load("future_version"); RIPTR(ri); FAIL(); } @@ -80,7 +80,7 @@ TEST_CASE("future version", M) { TEST_CASE("unicode index path", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("Новая папка"); + const Index *ri = Index::load("Новая папка"); RIPTR(ri); REQUIRE(ri->name() == "Новая папка"); @@ -88,7 +88,7 @@ TEST_CASE("unicode index path", M) { TEST_CASE("empty index name", M) { try { - RemoteIndex cat{string()}; + Index cat{string()}; FAIL(); } catch(const reapack_error &e) { @@ -97,7 +97,7 @@ TEST_CASE("empty index name", M) { } TEST_CASE("add category", M) { - RemoteIndex ri("a"); + Index ri("a"); Category *cat = new Category("a", &ri); Package *pack = new Package(Package::ScriptType, "name", cat); Version *ver = new Version("1", pack); @@ -116,8 +116,8 @@ TEST_CASE("add category", M) { } TEST_CASE("add owned category", M) { - RemoteIndex ri1("a"); - RemoteIndex ri2("b"); + Index ri1("a"); + Index ri2("b"); Category *cat = new Category("name", &ri1); @@ -132,14 +132,14 @@ TEST_CASE("add owned category", M) { } TEST_CASE("drop empty category", M) { - RemoteIndex ri("a"); + Index ri("a"); ri.addCategory(new Category("a", &ri)); REQUIRE(ri.categories().empty()); } TEST_CASE("add a package", M) { - RemoteIndex ri("a"); + Index ri("a"); Category cat("a", &ri); Package *pack = new Package(Package::ScriptType, "name", &cat); Version *ver = new Version("1", pack); @@ -197,13 +197,13 @@ TEST_CASE("category full name", M) { Category cat1("Category Name"); REQUIRE(cat1.fullName() == "Category Name"); - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat2("Category Name", &ri); REQUIRE(cat2.fullName() == "Remote Name/Category Name"); } TEST_CASE("repository description", M) { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); CHECK(ri.aboutText().empty()); ri.setAboutText("Hello World"); @@ -211,36 +211,36 @@ TEST_CASE("repository description", M) { } TEST_CASE("repository links", M) { - RemoteIndex ri("Remote name"); - CHECK(ri.links(RemoteIndex::WebsiteLink).empty()); - CHECK(ri.links(RemoteIndex::DonationLink).empty()); + Index ri("Remote name"); + CHECK(ri.links(Index::WebsiteLink).empty()); + CHECK(ri.links(Index::DonationLink).empty()); SECTION("website links") { - ri.addLink(RemoteIndex::WebsiteLink, {"First", "http://example.com"}); - REQUIRE(ri.links(RemoteIndex::WebsiteLink).size() == 1); - ri.addLink(RemoteIndex::WebsiteLink, {"Second", "http://example.com"}); + ri.addLink(Index::WebsiteLink, {"First", "http://example.com"}); + REQUIRE(ri.links(Index::WebsiteLink).size() == 1); + ri.addLink(Index::WebsiteLink, {"Second", "http://example.com"}); - const auto &links = ri.links(RemoteIndex::WebsiteLink); + const auto &links = ri.links(Index::WebsiteLink); REQUIRE(links.size() == 2); REQUIRE(links[0]->name == "First"); REQUIRE(links[1]->name == "Second"); - REQUIRE(ri.links(RemoteIndex::DonationLink).empty()); + REQUIRE(ri.links(Index::DonationLink).empty()); } SECTION("donation links") { - ri.addLink(RemoteIndex::DonationLink, {"First", "http://example.com"}); - REQUIRE(ri.links(RemoteIndex::DonationLink).size() == 1); + ri.addLink(Index::DonationLink, {"First", "http://example.com"}); + REQUIRE(ri.links(Index::DonationLink).size() == 1); } SECTION("drop invalid links") { - ri.addLink(RemoteIndex::WebsiteLink, {"name", "not http(s)"}); - REQUIRE(ri.links(RemoteIndex::WebsiteLink).empty()); + ri.addLink(Index::WebsiteLink, {"name", "not http(s)"}); + REQUIRE(ri.links(Index::WebsiteLink).empty()); } } TEST_CASE("link type from string", M) { - REQUIRE(RemoteIndex::linkTypeFor("website") == RemoteIndex::WebsiteLink); - REQUIRE(RemoteIndex::linkTypeFor("donation") == RemoteIndex::DonationLink); - REQUIRE(RemoteIndex::linkTypeFor("bacon") == RemoteIndex::WebsiteLink); + REQUIRE(Index::linkTypeFor("website") == Index::WebsiteLink); + REQUIRE(Index::linkTypeFor("donation") == Index::DonationLink); + REQUIRE(Index::linkTypeFor("bacon") == Index::WebsiteLink); } diff --git a/test/index_v1.cpp b/test/index_v1.cpp @@ -7,7 +7,7 @@ #include <string> #define RIPATH "test/indexes/v1/" -#define RIPTR(ptr) unique_ptr<const RemoteIndex> riptr(ptr) +#define RIPTR(ptr) unique_ptr<const Index> riptr(ptr) using namespace std; @@ -17,7 +17,7 @@ TEST_CASE("unnamed category", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("unnamed_category"); + const Index *ri = Index::load("unnamed_category"); RIPTR(ri); FAIL(); } @@ -29,7 +29,7 @@ TEST_CASE("unnamed category", M) { TEST_CASE("invalid category tag", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("wrong_category_tag"); + const Index *ri = Index::load("wrong_category_tag"); RIPTR(ri); REQUIRE(ri->categories().empty()); @@ -38,7 +38,7 @@ TEST_CASE("invalid category tag", M) { TEST_CASE("invalid package tag", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("wrong_package_tag"); + const Index *ri = Index::load("wrong_package_tag"); RIPTR(ri); REQUIRE(ri->categories().empty()); @@ -48,7 +48,7 @@ TEST_CASE("null package name", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("unnamed_package"); + const Index *ri = Index::load("unnamed_package"); RIPTR(ri); FAIL(); } @@ -61,7 +61,7 @@ TEST_CASE("null package type", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("missing_type"); + const Index *ri = Index::load("missing_type"); RIPTR(ri); } catch(const reapack_error &) { @@ -72,13 +72,13 @@ TEST_CASE("null package type", M) { TEST_CASE("unsupported package type", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("unsupported_type"); + const Index *ri = Index::load("unsupported_type"); } TEST_CASE("read version author", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("author"); + const Index *ri = Index::load("author"); RIPTR(ri); CHECK(ri->packages().size() == 1); @@ -89,7 +89,7 @@ TEST_CASE("read version author", M) { TEST_CASE("read version time", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("time"); + const Index *ri = Index::load("time"); RIPTR(ri); CHECK(ri->packages().size() == 1); @@ -103,7 +103,7 @@ TEST_CASE("read version time", M) { TEST_CASE("invalid version tag", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("wrong_version_tag"); + const Index *ri = Index::load("wrong_version_tag"); RIPTR(ri); REQUIRE(ri->categories().empty()); @@ -113,7 +113,7 @@ TEST_CASE("null package version", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("missing_version"); + const Index *ri = Index::load("missing_version"); RIPTR(ri); FAIL(); } @@ -126,7 +126,7 @@ TEST_CASE("null source url", M) { UseRootPath root(RIPATH); try { - const RemoteIndex *ri = RemoteIndex::load("missing_source_url"); + const Index *ri = Index::load("missing_source_url"); RIPTR(ri); FAIL(); } @@ -138,7 +138,7 @@ TEST_CASE("null source url", M) { TEST_CASE("null source file", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("missing_source_file"); + const Index *ri = Index::load("missing_source_file"); RIPTR(ri); CHECK(ri->packages().size() == 1); @@ -150,7 +150,7 @@ TEST_CASE("null source file", M) { TEST_CASE("default platform", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("missing_platform"); + const Index *ri = Index::load("missing_platform"); RIPTR(ri); CHECK(ri->packages().size() == 1); @@ -161,7 +161,7 @@ TEST_CASE("default platform", M) { TEST_CASE("version changelog", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("changelog"); + const Index *ri = Index::load("changelog"); RIPTR(ri); CHECK(ri->packages().size() == 1); @@ -173,7 +173,7 @@ TEST_CASE("version changelog", M) { TEST_CASE("full index", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("valid_index"); + const Index *ri = Index::load("valid_index"); RIPTR(ri); REQUIRE(ri->categories().size() == 1); @@ -201,7 +201,7 @@ TEST_CASE("full index", M) { TEST_CASE("read index metadata", M) { UseRootPath root(RIPATH); - const RemoteIndex *ri = RemoteIndex::load("metadata"); + const Index *ri = Index::load("metadata"); RIPTR(ri); SECTION("description") { @@ -209,7 +209,7 @@ TEST_CASE("read index metadata", M) { } SECTION("website links") { - const auto &links = ri->links(RemoteIndex::WebsiteLink); + const auto &links = ri->links(Index::WebsiteLink); REQUIRE(links.size() == 4); REQUIRE(links[0]->name == "http://cfillion.tk"); REQUIRE(links[0]->url == "http://cfillion.tk"); @@ -222,7 +222,7 @@ TEST_CASE("read index metadata", M) { } SECTION("donation links") { - const auto &links = ri->links(RemoteIndex::DonationLink); + const auto &links = ri->links(Index::DonationLink); REQUIRE(links.size() == 1); REQUIRE(links[0]->name == "Donate"); REQUIRE(links[0]->url == "http://paypal.com"); diff --git a/test/package.cpp b/test/package.cpp @@ -33,7 +33,7 @@ TEST_CASE("empty package name", M) { } TEST_CASE("package versions are sorted", M) { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("Category Name", &ri); Package pack(Package::ScriptType, "a", &cat); @@ -82,7 +82,7 @@ TEST_CASE("add owned version", M) { } TEST_CASE("target path for unknown package type", M) { - RemoteIndex ri("name"); + Index ri("name"); Category cat("name", &ri); Package pack(Package::UnknownType, "a", &cat); @@ -91,7 +91,7 @@ TEST_CASE("target path for unknown package type", M) { } TEST_CASE("script target path", M) { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("Category Name", &ri); Package pack(Package::ScriptType, "file.name", &cat); @@ -105,7 +105,7 @@ TEST_CASE("script target path", M) { } TEST_CASE("script target path: directory traversal", M) { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("../..", &ri); Package pack(Package::ScriptType, "file.name", &cat); @@ -130,7 +130,7 @@ TEST_CASE("script target path without category", M) { } TEST_CASE("extension target path", M) { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("Category Name", &ri); Package pack(Package::ExtensionType, "file.name", &cat); @@ -157,7 +157,7 @@ TEST_CASE("full name", M) { } SECTION("with index") { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("Category Name", &ri); Package pack(Package::ScriptType, "file.name", &cat); diff --git a/test/registry.cpp b/test/registry.cpp @@ -14,7 +14,7 @@ using namespace std; static const char *M = "[registry]"; #define MAKE_PACKAGE \ - RemoteIndex ri("Remote Name"); \ + Index ri("Remote Name"); \ Category cat("Category Name", &ri); \ Package pkg(Package::ScriptType, "Hello", &cat); \ Version *ver = new Version("1.0", &pkg); \ @@ -125,7 +125,7 @@ TEST_CASE("file conflicts", M) { reg.push(ver); } - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("Category Name", &ri); Package pkg(Package::ScriptType, "Duplicate Package", &cat); Version *ver = new Version("1.0", &pkg); diff --git a/test/source.cpp b/test/source.cpp @@ -113,7 +113,7 @@ TEST_CASE("full name with version", M) { } TEST_CASE("source target path", M) { - RemoteIndex ri("RemoteIndex Name"); + Index ri("Index Name"); Category cat("Category Name", &ri); Package pack(Package::ScriptType, "package name", &cat); Version ver("1.0", &pack); @@ -122,7 +122,7 @@ TEST_CASE("source target path", M) { Path expected; expected.append("Scripts"); - expected.append("RemoteIndex Name"); + expected.append("Index Name"); expected.append("Category Name"); expected.append("file.name"); @@ -130,7 +130,7 @@ TEST_CASE("source target path", M) { } TEST_CASE("source target path with parent directory traversal", M) { - RemoteIndex ri("RemoteIndex Name"); + Index ri("Index Name"); Category cat("Category Name", &ri); Package pack(Package::ScriptType, "package name", &cat); Version ver("1.0", &pack); @@ -139,7 +139,7 @@ TEST_CASE("source target path with parent directory traversal", M) { Path expected; expected.append("Scripts"); - expected.append("RemoteIndex Name"); + expected.append("Index Name"); // expected.append("Category Name"); // only the category can be bypassed! expected.append("file.name"); diff --git a/test/version.cpp b/test/version.cpp @@ -11,7 +11,7 @@ using namespace std; #define MAKE_VERSION \ - RemoteIndex ri("Remote Name"); \ + Index ri("Remote Name"); \ Category cat("Category Name", &ri); \ Package pkg(Package::ScriptType, "Hello", &cat); \ Version ver("1", &pkg); @@ -134,7 +134,7 @@ TEST_CASE("version full name", M) { } SECTION("with index") { - RemoteIndex ri("Remote Name"); + Index ri("Remote Name"); Category cat("Category Name", &ri); Package pkg(Package::UnknownType, "file.name", &cat); Version ver("1.0", &pkg);