From c5d8157670ea2b7f448fc41ca790b25c03a4bedb Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Thu, 7 Jun 2018 16:34:59 +0100 Subject: Replace GitHub with GitLab across the project --- .dockerignore | 1 + .github/CONTRIBUTING.md | 42 ---------------------- .gitlab/CONTRIBUTING.md | 42 ++++++++++++++++++++++ README.md | 11 +++--- .../migrations/tables/code_jam_participants/v2.py | 12 +++++++ pysite/tables.py | 2 +- pysite/views/error_handlers/http_4xx.py | 3 +- pysite/views/error_handlers/http_5xx.py | 4 +-- pysite/views/main/jams/profile.py | 6 ++-- pysite/views/main/redirects/github.py | 2 +- pysite/views/main/redirects/gitlab.py | 8 +++++ pysite/views/wiki/edit.py | 2 +- templates/main/about/privacy.html | 10 ++++-- templates/main/base.html | 2 +- templates/main/info/faq.html | 2 +- templates/main/info/help.html | 2 +- templates/main/info/resources.html | 4 +-- templates/main/jams/index.html | 2 +- templates/main/jams/info.html | 22 ++++++------ templates/main/jams/profile.html | 10 +++--- templates/main/jams/retract.html | 4 +-- templates/staff/jams/edit_ending.html | 2 +- templates/staff/jams/edit_info.html | 4 +-- templates/wiki/base.html | 2 +- 24 files changed, 115 insertions(+), 86 deletions(-) delete mode 100644 .github/CONTRIBUTING.md create mode 100644 .gitlab/CONTRIBUTING.md create mode 100644 pysite/migrations/tables/code_jam_participants/v2.py create mode 100644 pysite/views/main/redirects/gitlab.py diff --git a/.dockerignore b/.dockerignore index 210f85f9..b2eb2073 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,6 +6,7 @@ __pycache__ .pytest_cache .git .github +.gitlab .cache Vagrantfile .coverage diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 8b803aca..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,42 +0,0 @@ -# Contributing to one of our projects - -Our projects are open-source, and are deployed as commits are pushed to the `master` branch on each repository. -We've created a set of guidelines here in order to keep everything clean and in working order. Please note that -contributions may be rejected on the basis of a contributor failing to follow the guidelines. - -## Rules - -1. **No force-pushes** or modifying the Git history in any way. -1. If you have direct access to the repository, **create a branch for your changes** and create a pull request for that branch. - If not, fork it and work on a separate branch there. - * Some repositories require this and will reject any direct pushes to `master`. Make this a habit! -1. If someone is working on a pull request, **do not open your own pull request for the same task**. Instead, leave some comments - on the existing pull request. Communication is key, and there's no point in two separate implementations of the same thing. - * One option is to fork the other contributor's repository, and submit your changes to their branch with your - own pull request. If you do this, we suggest following these guidelines when interacting with their repository - as well. -1. **Adhere to the prevailing code style**, which we enforce using [flake8](http://flake8.pycqa.org/en/latest/index.html). - * Additionally, run `flake8` against your code before you push it. Your commit will be rejected by the build server - if it fails to lint. For an automatic way to do this, check out - [our article on Git hooks](https://github.com/discord-python/site/wiki/Git-Hooks). -1. **Don't fight the framework**. Every framework has its flaws, but the frameworks we've picked out have been carefully - chosen for their particular merits. If you can avoid it, please resist reimplementing swathes of framework logic - the - work has already been done for you! -1. **Work as a team** and cooperate where possible. Keep things friendly, and help each other out - these are shared - projects, and nobody likes to have their feet trodden on. -1. **Internal projects are internal**. As a contributor, you have access to information that the rest of the server - does not. With this trust comes responsibility - do not release any information you have learned as a result of - your contributor position. We are very strict about announcing things at specific times, and many staff members - will not appreciate a disruption of the announcement schedule. - -Above all, the needs of our community should come before the wants of an individual. Work together, build solutions to -problems and try to do so in a way that people can learn from easily. Abuse of our trust may result in the loss of your Contributor role, especially in relation to Rule 7. - -## Changes to this arrangement - -All projects evolve over time, and this contribution guide is no different. This document may also be subject to pull -requests or changes by contributors, where you believe you have something valuable to add or change. - -## Footnotes - -This document was inspired by the [Glowstone contribution guidelines](https://github.com/GlowstoneMC/Glowstone/blob/dev/docs/CONTRIBUTING.md). diff --git a/.gitlab/CONTRIBUTING.md b/.gitlab/CONTRIBUTING.md new file mode 100644 index 00000000..62b7e739 --- /dev/null +++ b/.gitlab/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing to one of our projects + +Our projects are open-source, and are deployed as commits are pushed to the `master` branch on each repository. +We've created a set of guidelines here in order to keep everything clean and in working order. Please note that +contributions may be rejected on the basis of a contributor failing to follow the guidelines. + +## Rules + +1. **No force-pushes** or modifying the Git history in any way. +1. If you have direct access to the repository, **create a branch for your changes** and create a merge request for that branch. + If not, fork it and work on a separate branch there. + * Some repositories require this and will reject any direct pushes to `master`. Make this a habit! +1. If someone is working on a merge request, **do not open your own merge request for the same task**. Instead, leave some comments + on the existing merge request. Communication is key, and there's no point in two separate implementations of the same thing. + * One option is to fork the other contributor's repository, and submit your changes to their branch with your + own merge request. If you do this, we suggest following these guidelines when interacting with their repository + as well. +1. **Adhere to the prevailing code style**, which we enforce using [flake8](http://flake8.pycqa.org/en/latest/index.html). + * Additionally, run `flake8` against your code before you push it. Your commit will be rejected by the build server + if it fails to lint. For an automatic way to do this, check out + [our article on Git hooks](https://github.com/discord-python/site/wiki/Git-Hooks). +1. **Don't fight the framework**. Every framework has its flaws, but the frameworks we've picked out have been carefully + chosen for their particular merits. If you can avoid it, please resist reimplementing swathes of framework logic - the + work has already been done for you! +1. **Work as a team** and cooperate where possible. Keep things friendly, and help each other out - these are shared + projects, and nobody likes to have their feet trodden on. +1. **Internal projects are internal**. As a contributor, you have access to information that the rest of the server + does not. With this trust comes responsibility - do not release any information you have learned as a result of + your contributor position. We are very strict about announcing things at specific times, and many staff members + will not appreciate a disruption of the announcement schedule. + +Above all, the needs of our community should come before the wants of an individual. Work together, build solutions to +problems and try to do so in a way that people can learn from easily. Abuse of our trust may result in the loss of your Contributor role, especially in relation to Rule 7. + +## Changes to this arrangement + +All projects evolve over time, and this contribution guide is no different. This document may also be subject to pull +requests or changes by contributors, where you believe you have something valuable to add or change. + +## Footnotes + +This document was inspired by the [Glowstone contribution guidelines](https://github.com/GlowstoneMC/Glowstone/blob/dev/docs/CONTRIBUTING.md). diff --git a/README.md b/README.md index 5a65550f..beec49ed 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# Python Discord website +# Python Discord: Site -[![Build Status](https://travis-ci.org/discord-python/site.svg?branch=master)](https://travis-ci.org/discord-python/site) [![Coverage Status](https://coveralls.io/repos/github/discord-python/site/badge.svg?branch=master)](https://coveralls.io/github/discord-python/site?branch=master) [![Discord](https://discordapp.com/api/guilds/267624335836053506/embed.png)](https://discord.gg/2B963hn) +This is all of the code that is responsible for maintaining [our website](https://pythondiscord.com), and all of +its subdomains. -### See the wiki for details - -[https://github.com/discord-python/site/wiki](https://github.com/discord-python/site/wiki) +If you're looking to contribute or play around with the code, take a look at our +[Project Guide](https://wiki.pythondiscord.com/wiki/contributing/project/site), hosted on the wiki you'll find +in this very repository. diff --git a/pysite/migrations/tables/code_jam_participants/v2.py b/pysite/migrations/tables/code_jam_participants/v2.py new file mode 100644 index 00000000..858da279 --- /dev/null +++ b/pysite/migrations/tables/code_jam_participants/v2.py @@ -0,0 +1,12 @@ +def run(db, table, table_obj): + """ + GitHub usernames -> Store as GitLab username, this will be correct for most jammers + """ + + for document in db.get_all(table): + if "github_username" in document: + document["gitlab_username"] = document["github_username"] + del document["github_username"] + + db.insert(table, document, conflict="replace", durability="soft") + db.sync(table) diff --git a/pysite/tables.py b/pysite/tables.py index 7e43fe87..87e6cf47 100644 --- a/pysite/tables.py +++ b/pysite/tables.py @@ -112,7 +112,7 @@ TABLES = { primary_key="id", keys=sorted([ "id", # str - "github_username", # str + "gitlab_username", # str "timezone" # str ]) ), diff --git a/pysite/views/error_handlers/http_4xx.py b/pysite/views/error_handlers/http_4xx.py index 69c0bdda..1667adcf 100644 --- a/pysite/views/error_handlers/http_4xx.py +++ b/pysite/views/error_handlers/http_4xx.py @@ -26,5 +26,6 @@ class Error400View(ErrorView): return self.render( "errors/error.html", code=error.code, req=request, error_title=error_desc, error_message=f"{error_desc} If you believe we have made a mistake, please " - "open an issue on our GitHub." + "" + "open an issue on our GitLab." ), error.code diff --git a/pysite/views/error_handlers/http_5xx.py b/pysite/views/error_handlers/http_5xx.py index 5a4fbdc2..c9ffa007 100644 --- a/pysite/views/error_handlers/http_5xx.py +++ b/pysite/views/error_handlers/http_5xx.py @@ -36,6 +36,6 @@ class Error500View(ErrorView): "errors/error.html", code=error.code, req=request, error_title=error_desc, error_message="An error occurred while processing this request, please try " "again later. If you believe we have made a mistake, please " - "file an issue on our" - " GitHub." + "file an issue on our" + " GitLab." ), error.code diff --git a/pysite/views/main/jams/profile.py b/pysite/views/main/jams/profile.py index f84534e6..e918c135 100644 --- a/pysite/views/main/jams/profile.py +++ b/pysite/views/main/jams/profile.py @@ -45,13 +45,13 @@ class JamsProfileView(RouteView, DBMixin, OAuthMixin): if not participant: participant = {"id": self.user_data["user_id"]} - github_username = request.form.get("github_username") + gitlab_username = request.form.get("gitlab_username") timezone = request.form.get("timezone") - if not github_username or not timezone: + if not gitlab_username or not timezone: return BadRequest() - participant["github_username"] = github_username + participant["gitlab_username"] = gitlab_username participant["timezone"] = timezone self.db.insert(self.table_name, participant, conflict="replace") diff --git a/pysite/views/main/redirects/github.py b/pysite/views/main/redirects/github.py index 3c74ace3..816d165f 100644 --- a/pysite/views/main/redirects/github.py +++ b/pysite/views/main/redirects/github.py @@ -4,5 +4,5 @@ from pysite.base_route import RedirectView class GitHubView(RedirectView): path = "/github" name = "github" - page = "https://github.com/discord-python/" + page = "https://gitlab.com/discord-python/" code = 302 diff --git a/pysite/views/main/redirects/gitlab.py b/pysite/views/main/redirects/gitlab.py new file mode 100644 index 00000000..eda0e179 --- /dev/null +++ b/pysite/views/main/redirects/gitlab.py @@ -0,0 +1,8 @@ +from pysite.base_route import RedirectView + + +class GitLabView(RedirectView): + path = "/gitlab" + name = "gitlab" + page = "https://gitlab.com/discord-python/" + code = 302 diff --git a/pysite/views/wiki/edit.py b/pysite/views/wiki/edit.py index f6f61272..cc121cc6 100644 --- a/pysite/views/wiki/edit.py +++ b/pysite/views/wiki/edit.py @@ -156,7 +156,7 @@ class EditView(RouteView, DBMixin): headers = { "Authorization": f"token {GITHUB_TOKEN}", - "User-Agent": "Discord Python Wiki (https://github.com/discord-python)" + "User-Agent": "Discord Python Wiki (https://gitlab.com/discord-python)" } gist = requests.post("https://api.github.com/gists", diff --git a/templates/main/about/privacy.html b/templates/main/about/privacy.html index 3f956247..508536ac 100644 --- a/templates/main/about/privacy.html +++ b/templates/main/about/privacy.html @@ -78,9 +78,9 @@ - GitHub username + GitLab username Code jam profile - Used to identify you on GitHub as part of a code jam team + Used to identify you on GitLab as part of a code jam team Public, for code jam team listings @@ -231,6 +231,12 @@