Merge pull request #74 from isanae/master

Added trosski's morrowind style
This commit is contained in:
isanae
2020-12-20 23:13:32 -05:00
committed by GitHub
3 changed files with 56 additions and 80 deletions
+1
View File
@@ -119,6 +119,7 @@ ss_paper_lad_6788 = 6.0
ss_paper_automata_6788 = 2.2
ss_paper_mono_6788 = 2.1
ss_dark_mode_1809_6788 = 2.0
ss_morrowind_trosski = 1.0
[paths]
third_party =
+47 -62
View File
@@ -4,6 +4,49 @@
namespace mob::tasks
{
std::vector<stylesheets::release> releases()
{
// note that 6788's releases have 'v' in front of the version, but not others
return
{
{
"6788-00",
"paper-light-and-dark",
"v" + conf().version().get("ss_paper_lad_6788"),
conf().version().get("ss_paper_lad_6788"),
},
{
"6788-00",
"paper-automata",
"v" + conf().version().get("ss_paper_automata_6788"),
"Paper-Automata"
},
{
"6788-00",
"paper-mono",
"v" + conf().version().get("ss_paper_mono_6788"),
"Paper-Mono"
},
{
"6788-00",
"1809-dark-mode",
"v" + conf().version().get("ss_dark_mode_1809_6788"),
conf().version().get("ss_dark_mode_1809_6788")
},
{
"Trosski",
"ModOrganizer_Style_Morrowind",
conf().version().get("ss_morrowind_trosski"),
"Transparent-Style-Morrowind"
}
};
}
stylesheets::stylesheets()
: task("ss", "stylesheets")
{
@@ -14,26 +57,6 @@ bool stylesheets::prebuilt()
return false;
}
std::string stylesheets::paper_lad_6788_version()
{
return conf().version().get("ss_paper_lad_6788");
}
std::string stylesheets::paper_automata_6788_version()
{
return conf().version().get("ss_paper_automata_6788");
}
std::string stylesheets::paper_mono_6788_version()
{
return conf().version().get("ss_paper_mono_6788");
}
std::string stylesheets::dark_mode_1809_6788_version()
{
return conf().version().get("ss_dark_mode_1809_6788");
}
void stylesheets::do_clean(clean c)
{
// delete download file for each release
@@ -72,23 +95,19 @@ void stylesheets::do_fetch()
fs::path stylesheets::release_build_path(const release& r) const
{
// something like build/paper-mono-v2.1
return conf().path().build() / (r.name + "-v" + r.version);
return conf().path().build() / (r.repo + "-" + r.version);
}
downloader stylesheets::make_downloader_tool(
const release& r, downloader::ops o) const
{
// this isn't generic at all and will probably fail for future stylesheets,
// but 6788 is the only repo so far and that's the convention they use for
// their releases
url u =
"https://github.com/" + r.repo + "/" + r.name + "/releases/"
"download/v" + r.version + "/" + r.file + ".7z";
"https://github.com/" + r.user + "/" + r.repo + "/releases/"
"download/" + r.version + "/" + r.file + ".7z";
return std::move(downloader(o)
.url(u)
.file(conf().path().cache() / (r.name + ".7z")));
.file(conf().path().cache() / (r.repo + ".7z")));
}
void stylesheets::do_build_and_install()
@@ -104,38 +123,4 @@ void stylesheets::do_build_and_install()
}
}
std::vector<stylesheets::release> stylesheets::releases()
{
return
{
{
"6788-00",
"paper-light-and-dark",
stylesheets::paper_lad_6788_version(),
stylesheets::paper_lad_6788_version(),
},
{
"6788-00",
"paper-automata",
paper_automata_6788_version(),
"Paper-Automata"
},
{
"6788-00",
"paper-mono",
paper_mono_6788_version(),
"Paper-Mono"
},
{
"6788-00",
"1809-dark-mode",
dark_mode_1809_6788_version(),
dark_mode_1809_6788_version()
}
};
}
} // namespace
+8 -18
View File
@@ -575,41 +575,31 @@ protected:
};
// none of this is very generic, but it works for now because there are only
// four stylesheets
//
class stylesheets : public task
{
public:
struct release
{
std::string user;
std::string repo;
std::string version;
std::string file;
};
stylesheets();
static bool prebuilt();
static std::string paper_lad_6788_version();
static std::string paper_automata_6788_version();
static std::string paper_mono_6788_version();
static std::string dark_mode_1809_6788_version();
protected:
void do_clean(clean c) override;
void do_fetch() override;
void do_build_and_install() override;
private:
struct release
{
std::string repo;
std::string name;
std::string version;
std::string file;
};
downloader make_downloader_tool(
const release& r, downloader::ops=downloader::download) const;
fs::path release_build_path(const release& r) const;
static std::vector<release> releases();
};