summaryrefslogtreecommitdiff
path: root/lib/gitlab/fogbugz_import/project_creator.rb
diff options
context:
space:
mode:
authorJared Szechy <jared.szechy@brilligent.com>2015-08-04 18:21:12 -0400
committerJared Szechy <jared.szechy@brilligent.com>2015-09-08 20:23:01 -0400
commite156f42079ebf8247b6a39fa6314d4d5c6b73d12 (patch)
tree8a4c08adda59c7cdd09fb2164df43d8b950b0389 /lib/gitlab/fogbugz_import/project_creator.rb
parent86556a079e34eb1267e63f7b39cc018665e21bfc (diff)
downloadgitlab-ce-e156f42079ebf8247b6a39fa6314d4d5c6b73d12.tar.gz
FogBugz project import
Diffstat (limited to 'lib/gitlab/fogbugz_import/project_creator.rb')
-rw-r--r--lib/gitlab/fogbugz_import/project_creator.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/gitlab/fogbugz_import/project_creator.rb b/lib/gitlab/fogbugz_import/project_creator.rb
new file mode 100644
index 00000000000..f02ea43910f
--- /dev/null
+++ b/lib/gitlab/fogbugz_import/project_creator.rb
@@ -0,0 +1,38 @@
+module Gitlab
+ module FogbugzImport
+ class ProjectCreator
+ attr_reader :repo, :fb_session, :namespace, :current_user, :user_map
+
+ def initialize(repo, fb_session, namespace, current_user, user_map = nil)
+ @repo = repo
+ @fb_session = fb_session
+ @namespace = namespace
+ @current_user = current_user
+ @user_map = user_map
+ end
+
+ def execute
+ project = ::Projects::CreateService.new(current_user,
+ name: repo.safe_name,
+ path: repo.path,
+ namespace: namespace,
+ creator: current_user,
+ visibility_level: Gitlab::VisibilityLevel::INTERNAL,
+ import_type: 'fogbugz',
+ import_source: repo.name,
+ import_url: Project::UNKNOWN_IMPORT_URL
+ ).execute
+
+ import_data = project.create_import_data(
+ data: {
+ 'repo' => repo.raw_data,
+ 'user_map' => user_map,
+ 'fb_session' => fb_session
+ }
+ )
+
+ project
+ end
+ end
+ end
+end