commit 54246f5cafdb86a9c7f0c414f817286e71b8c09a
parent 5f1b28e8506226d6f2803e26bc6e915a88f8f1a7
Author: cfillion <cfillion@users.noreply.github.com>
Date: Tue, 1 Dec 2015 19:51:17 -0500
remove the author attribute from the packages
Diffstat:
12 files changed, 22 insertions(+), 53 deletions(-)
diff --git a/src/database_v1.cpp b/src/database_v1.cpp
@@ -45,17 +45,13 @@ CategoryPtr LoadCategoryV1(TiXmlElement *catNode)
PackagePtr LoadPackageV1(TiXmlElement *packNode)
{
- const char *name = packNode->Attribute("name");
- if(!name) name = "";
-
const char *type = packNode->Attribute("type");
if(!type) type = "";
- const char *author = packNode->Attribute("author");
- if(!author) author = "";
+ const char *name = packNode->Attribute("name");
+ if(!name) name = "";
- PackagePtr pack = make_shared<Package>(
- Package::convertType(type), name, author);
+ PackagePtr pack = make_shared<Package>(Package::convertType(type), name);
TiXmlElement *verNode = packNode->FirstChildElement("version");
diff --git a/src/package.cpp b/src/package.cpp
@@ -11,15 +11,11 @@ Package::Type Package::convertType(const char *type)
return UnknownType;
}
-Package::Package(const Type type,
- const std::string &name, const std::string &author)
- : m_category(0), m_type(type), m_name(name), m_author(author)
+Package::Package(const Type type, const std::string &name)
+ : m_category(0), m_type(type), m_name(name)
{
if(m_name.empty())
throw reapack_error("empty package name");
-
- if(m_author.empty())
- throw reapack_error("empty package author");
}
void Package::addVersion(VersionPtr ver)
diff --git a/src/package.hpp b/src/package.hpp
@@ -46,14 +46,13 @@ public:
static Type convertType(const char *);
- Package(const Type, const std::string &name, const std::string &author);
+ Package(const Type, const std::string &name);
void setCategory(Category *cat) { m_category = cat; }
Category *category() const { return m_category; }
Type type() const { return m_type; }
const std::string &name() const { return m_name; }
- const std::string &author() const { return m_author; }
void addVersion(VersionPtr ver);
const VersionSet &versions() const { return m_versions; }
@@ -68,7 +67,6 @@ private:
Category *m_category;
Type m_type;
std::string m_name;
- std::string m_author;
VersionSet m_versions;
};
diff --git a/test/database.cpp b/test/database.cpp
@@ -64,7 +64,7 @@ TEST_CASE("add category", M) {
VersionPtr ver = make_shared<Version>("1");
ver->addSource(make_shared<Source>(Source::GenericPlatform, "google.com"));
- PackagePtr pack = make_shared<Package>(Package::ScriptType, "a", "b");
+ PackagePtr pack = make_shared<Package>(Package::ScriptType, "name");
pack->addVersion(ver);
CategoryPtr cat = make_shared<Category>("a");
@@ -90,7 +90,7 @@ TEST_CASE("add a package", M) {
VersionPtr ver = make_shared<Version>("1");
ver->addSource(make_shared<Source>(Source::GenericPlatform, "google.com"));
- PackagePtr pack = make_shared<Package>(Package::ScriptType, "a", "b");
+ PackagePtr pack = make_shared<Package>(Package::ScriptType, "name");
pack->addVersion(ver);
Category cat("a");
@@ -105,14 +105,14 @@ TEST_CASE("add a package", M) {
TEST_CASE("drop empty package", M) {
Category cat("a");
- cat.addPackage(make_shared<Package>(Package::ScriptType, "a", "b"));
+ cat.addPackage(make_shared<Package>(Package::ScriptType, "name"));
REQUIRE(cat.packages().empty());
}
TEST_CASE("drop unknown package", M) {
Category cat("a");
- cat.addPackage(make_shared<Package>(Package::UnknownType, "a", "b"));
+ cat.addPackage(make_shared<Package>(Package::UnknownType, "name"));
REQUIRE(cat.packages().size() == 0);
}
diff --git a/test/database_v1.cpp b/test/database_v1.cpp
@@ -51,16 +51,6 @@ TEST_CASE("null package type", M) {
}
}
-TEST_CASE("null author", M) {
- try {
- Database::load(DBPATH "anonymous_package.xml");
- FAIL();
- }
- catch(const reapack_error &e) {
- REQUIRE(string(e.what()) == "empty package author");
- }
-}
-
TEST_CASE("invalid version tag", M) {
DatabasePtr db = Database::load(DBPATH "wrong_version_tag.xml");
@@ -116,7 +106,6 @@ TEST_CASE("full database", M) {
PackagePtr pack = cat->package(0);
REQUIRE(pack->type() == Package::ScriptType);
REQUIRE(pack->name() == "Hello World.lua");
- REQUIRE(pack->author() == "cfillion");
REQUIRE(pack->versions().size() == 1);
VersionPtr ver = pack->version(0);
diff --git a/test/db/v1/changelog.xml b/test/db/v1/changelog.xml
@@ -1,6 +1,6 @@
<index version="1">
<category name="hello">
- <reapack name="a" type="script" author="abc">
+ <reapack name="a" type="script">
<version name="1">
<source platform="all">http://google.com</source>
<changelog><![CDATA[Hello
diff --git a/test/db/v1/full_database.xml b/test/db/v1/full_database.xml
@@ -1,6 +1,6 @@
<index version="1">
<category name="Category Name">
- <reapack name="Hello World.lua" author="cfillion" type="script">
+ <reapack name="Hello World.lua" type="script">
<version name="1.0">
<source platform="all">https://google.com/</source>
<changelog>Fixed a division by zero error.</changelog>
diff --git a/test/db/v1/missing_platform.xml b/test/db/v1/missing_platform.xml
@@ -1,6 +1,6 @@
<index version="1">
<category name="hello">
- <reapack name="a" type="script" author="abc">
+ <reapack name="a" type="script">
<version name="1">
<source>hello</source>
</version>
diff --git a/test/db/v1/missing_source_url.xml b/test/db/v1/missing_source_url.xml
@@ -1,6 +1,6 @@
<index version="1">
<category name="hello">
- <reapack name="a" type="script" author="abc">
+ <reapack name="a" type="script">
<version name="1">
<source platform="all" />
</version>
diff --git a/test/db/v1/missing_version.xml b/test/db/v1/missing_version.xml
@@ -1,6 +1,6 @@
<index version="1">
<category name="a">
- <reapack name="a" author="b" type="script">
+ <reapack name="a" type="script">
<version />
</reapack>
</category>
diff --git a/test/db/v1/wrong_version_tag.xml b/test/db/v1/wrong_version_tag.xml
@@ -1,6 +1,6 @@
<index version="1">
<category name="a">
- <reapack name="a" author="b" type="script">
+ <reapack name="a" type="script">
<hello />
</reapack>
</category>
diff --git a/test/package.cpp b/test/package.cpp
@@ -12,7 +12,7 @@ static const char *M = "[package]";
TEST_CASE("empty package name", M) {
try {
- Package pack(Package::ScriptType, string(), "a");
+ Package pack(Package::ScriptType, string());
FAIL();
}
catch(const reapack_error &e) {
@@ -20,18 +20,8 @@ TEST_CASE("empty package name", M) {
}
}
-TEST_CASE("empty package author", M) {
- try {
- Package pack(Package::ScriptType, "a", string());
- FAIL();
- }
- catch(const reapack_error &e) {
- REQUIRE(string(e.what()) == "empty package author");
- }
-}
-
TEST_CASE("package versions are sorted", M) {
- Package pack(Package::ScriptType, "a", "b");
+ Package pack(Package::ScriptType, "a");
CHECK(pack.versions().size() == 0);
SourcePtr source = make_shared<Source>(Source::GenericPlatform, "google.com");
@@ -54,7 +44,7 @@ TEST_CASE("package versions are sorted", M) {
}
TEST_CASE("drop empty version", M) {
- Package pack(Package::ScriptType, "a", "b");
+ Package pack(Package::ScriptType, "a");
pack.addVersion(make_shared<Version>("1"));
REQUIRE(pack.versions().empty());
@@ -87,7 +77,7 @@ TEST_CASE("set install location prefix", M) {
}
TEST_CASE("unknown target location", M) {
- Package pack(Package::UnknownType, "a", "b");
+ Package pack(Package::UnknownType, "a");
try {
pack.targetLocation();
@@ -101,7 +91,7 @@ TEST_CASE("unknown target location", M) {
TEST_CASE("script target location", M) {
Category cat("Category Name");
- Package pack(Package::ScriptType, "file.name", "author");
+ Package pack(Package::ScriptType, "file.name");
pack.setCategory(&cat);
const InstallLocation loc = pack.targetLocation();
@@ -110,7 +100,7 @@ TEST_CASE("script target location", M) {
}
TEST_CASE("script target location without category", M) {
- Package pack(Package::ScriptType, "file.name", "author");
+ Package pack(Package::ScriptType, "file.name");
const InstallLocation loc = pack.targetLocation();
REQUIRE(loc ==