diff options
author | James Lopez <james@jameslopez.es> | 2016-06-14 17:31:03 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-06-14 17:31:03 +0300 |
commit | 9ecebaaea16d206ed20a2f4fc0021a2145c873f5 (patch) | |
tree | 346f9df3661e5cd0e31116fa19270c8e0f3fc032 /lib/gitlab/gitlab_import | |
parent | fe370b1c396cb3c290fcdb1d716a79ffe5c29169 (diff) |
adding notifications stuff and more refactoring for exporting projects
Diffstat (limited to 'lib/gitlab/gitlab_import')
-rw-r--r-- | lib/gitlab/gitlab_import/project_creator.rb | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/gitlab/gitlab_import/project_creator.rb b/lib/gitlab/gitlab_import/project_creator.rb index 72b10f536ec..3d0418261bb 100644 --- a/lib/gitlab/gitlab_import/project_creator.rb +++ b/lib/gitlab/gitlab_import/project_creator.rb @@ -3,21 +3,24 @@ module Gitlab class ProjectCreator attr_reader :repo, :namespace, :current_user, :session_data - def initialize(namespace_id, current_user, file, project_path) - @namespace_id = namespace_id + def initialize(repo, namespace, current_user, session_data) + @repo = repo + @namespace = namespace @current_user = current_user - @file = file - @project_path = project_path + @session_data = session_data end def execute ::Projects::CreateService.new( current_user, - name: @project_path, - path: @project_path, - namespace_id: namespace_id, - import_type: "gitlab_project", - import_source: @file + name: repo["name"], + path: repo["path"], + description: repo["description"], + namespace_id: namespace.id, + visibility_level: repo["visibility_level"], + import_type: "gitlab", + import_source: repo["path_with_namespace"], + import_url: repo["http_url_to_repo"].sub("://", "://oauth2:#{@session_data[:gitlab_access_token]}@") ).execute end end |