diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-15 17:31:14 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-19 17:35:51 +0100 |
commit | 103114e3d73819f76bed9d8ad1bbdb8964875579 (patch) | |
tree | 3457c48ed93ee0266acf6f459e5a9c312e3d42b4 /app/services/projects | |
parent | 5d4531db2555d3051fc47e9268728a670ece95f9 (diff) | |
download | gitlab-ce-103114e3d73819f76bed9d8ad1bbdb8964875579.tar.gz |
Rename Gogs to Gitea, DRY the controller and improve views
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/import_service.rb | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/app/services/projects/import_service.rb b/app/services/projects/import_service.rb index 8cac0b01881..287c0a4257f 100644 --- a/app/services/projects/import_service.rb +++ b/app/services/projects/import_service.rb @@ -5,13 +5,13 @@ module Projects class Error < StandardError; end ALLOWED_TYPES = [ - 'gogs', + 'github', 'bitbucket', - 'fogbugz', 'gitlab', - 'github', 'google_code', - 'gitlab_project' + 'fogbugz', + 'gitlab_project', + 'gitea' ] def execute @@ -71,8 +71,23 @@ module Projects def importer return Gitlab::ImportExport::Importer.new(project) if @project.gitlab_project_import? - class_name = "Gitlab::#{project.import_type.camelize}Import::Importer" - class_name.constantize.new(project) + class_name = + case project.import_type + when 'github', 'gitea' + Gitlab::GithubImport::Importer + when 'bitbucket' + Gitlab::BitbucketImport::Importer + when 'gitlab' + Gitlab::GitlabImport::Importer + when 'google_code' + Gitlab::GoogleCodeImport::Importer + when 'fogbugz' + Gitlab::FogbugzImport::Importer + else + raise 'Unknown importer type!' + end + + class_name.new(project) end def unknown_url? |