diff options
author | Rémy Coutable <remy@rymai.me> | 2016-12-15 19:31:14 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-12-19 19:35:51 +0300 |
commit | 103114e3d73819f76bed9d8ad1bbdb8964875579 (patch) | |
tree | 3457c48ed93ee0266acf6f459e5a9c312e3d42b4 /lib/gitlab | |
parent | 5d4531db2555d3051fc47e9268728a670ece95f9 (diff) |
Rename Gogs to Gitea, DRY the controller and improve views
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/current_settings.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/gogs_import/importer.rb | 54 | ||||
-rw-r--r-- | lib/gitlab/gogs_import/milestone_formatter.rb | 9 | ||||
-rw-r--r-- | lib/gitlab/import_sources.rb | 4 |
4 files changed, 3 insertions, 66 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb index eb3d9f29451..9d142f1b82e 100644 --- a/lib/gitlab/current_settings.rb +++ b/lib/gitlab/current_settings.rb @@ -45,7 +45,7 @@ module Gitlab default_project_visibility: Settings.gitlab.default_projects_features['visibility_level'], default_snippet_visibility: Settings.gitlab.default_projects_features['visibility_level'], domain_whitelist: Settings.gitlab['domain_whitelist'], - import_sources: %w[gogs github bitbucket gitlab google_code fogbugz git gitlab_project], + import_sources: %w[gitea github bitbucket gitlab google_code fogbugz git gitlab_project], shared_runners_enabled: Settings.gitlab_ci['shared_runners_enabled'], max_artifacts_size: Settings.artifacts['max_size'], require_two_factor_authentication: false, diff --git a/lib/gitlab/gogs_import/importer.rb b/lib/gitlab/gogs_import/importer.rb deleted file mode 100644 index 604e31d35a3..00000000000 --- a/lib/gitlab/gogs_import/importer.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'uri' - -module Gitlab - module GogsImport - class Importer < Gitlab::GithubImport::Importer - include Gitlab::ShellAdapter - - attr_reader :client, :errors, :project, :repo, :repo_url - - def initialize(project) - @project = project - @repo = project.import_source - @repo_url = project.import_url - @errors = [] - @labels = {} - - if credentials - uri = URI.parse(project.import_url) - host = "#{uri.scheme}://#{uri.host}:#{uri.port}#{uri.path}".sub(/[\w-]+\/[\w-]+\.git\z/, '') - @client = GithubImport::Client.new(credentials[:user], host: host, api_version: 'v1') - else - raise Projects::ImportService::Error, "Unable to find project import data credentials for project ID: #{@project.id}" - end - end - - def execute - import_labels - import_milestones - import_pull_requests - import_issues - import_comments(:issues) - import_comments(:pull_requests) - import_wiki - # NOTE: this is commented out since Gogs doesn't have release-API yet - # import_releases - handle_errors - - true - end - - def import_milestones - fetch_resources(:milestones, repo, state: :all, per_page: 100) do |milestones| - milestones.each do |raw| - begin - GogsImport::MilestoneFormatter.new(project, raw).create! - rescue => e - errors << { type: :milestone, url: Gitlab::UrlSanitizer.sanitize(raw.url), errors: e.message } - end - end - end - end - end - end -end diff --git a/lib/gitlab/gogs_import/milestone_formatter.rb b/lib/gitlab/gogs_import/milestone_formatter.rb deleted file mode 100644 index 990e792929a..00000000000 --- a/lib/gitlab/gogs_import/milestone_formatter.rb +++ /dev/null @@ -1,9 +0,0 @@ -module Gitlab - module GogsImport - class MilestoneFormatter < GithubImport::MilestoneFormatter - def self.iid_attr - :id - end - end - end -end diff --git a/lib/gitlab/import_sources.rb b/lib/gitlab/import_sources.rb index 9564c4cc134..34587582bd1 100644 --- a/lib/gitlab/import_sources.rb +++ b/lib/gitlab/import_sources.rb @@ -14,14 +14,14 @@ module Gitlab def options { - 'Gogs' => 'gogs', 'GitHub' => 'github', 'Bitbucket' => 'bitbucket', 'GitLab.com' => 'gitlab', 'Google Code' => 'google_code', 'FogBugz' => 'fogbugz', 'Repo by URL' => 'git', - 'GitLab export' => 'gitlab_project' + 'GitLab export' => 'gitlab_project', + 'Gitea' => 'gitea' } end end |