Make gitlab:update_project_templates rake task more robust and improve tests
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=30952) </details> <!--IssueSummary end--> ## Summary Spun off from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31592#note_203414463 The rake task `gitlab:update_project_templates` could be more robust, and the tests could be better ## Improvements - easy: the task has grown fairly large and could be extracted into a class - somewhat difficult: the task could be refactored to not require a database or a full rails environment - easy: the tests could cover not just that export "works" but also that projects can be created from the files it generates - easy: the "unit" tests should use fixtures instead of downloading actual source code archives From GitLab.com - difficult: the whole project template feature could be simplified, leading to a simpler vendoring process, see https://gitlab.com/gitlab-org/gitlab-ce/issues/66068 ## Risks <!-- Please list features that can break because of this refactoring and how you intend to solve that. --> Project templates can break in various ways that might not be covered by tests. ## Involved components <!-- List files or directories that will be changed by the refactoring. --> ## Optional: Intended side effects <!-- If the refactoring involves changes apart from the main improvements (such as a better UI), list them here. It may be a good idea to create separate issues and link them here. --> ## Optional: Missing test coverage <!-- If you are aware of tests that need to be written or adjusted apart from unit tests for the changed components, please list them here. -->
issue