summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-08-30 19:20:11 +0200
committerJames Lopez <james@jameslopez.es>2017-08-30 21:41:25 +0200
commit294c9251af85242d50bc70b8277371b4ff7ea4f3 (patch)
treeb5a190b0be6ae24cac8e8f304b1bfbab79a4b479
parent60247bfa8bb63b43164ea9ab183a5de9a6ae7b24 (diff)
downloadgitlab-ce-294c9251af85242d50bc70b8277371b4ff7ea4f3.tar.gz
fix rake task
-rw-r--r--lib/tasks/gitlab/import_export.rake17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/tasks/gitlab/import_export.rake b/lib/tasks/gitlab/import_export.rake
index ff88635be87..6ff911e2c23 100644
--- a/lib/tasks/gitlab/import_export.rake
+++ b/lib/tasks/gitlab/import_export.rake
@@ -1,18 +1,16 @@
class GitLabProjectImport
- def self.run(*args)
- new(*args).run
- end
-
def initialize(project_path, gitlab_username, file_path)
@project_path = project_path
@current_user = User.find_by_username(gitlab_username)
@file_path = file_path
end
- def run
+ def import
+ show_warning!
+
project = import_project
- puts "Project will be exported to #{project.export_path}"
+ puts 'Project will be imported.'
end
private
@@ -35,7 +33,10 @@ class GitLabProjectImport
namespace_path, _sep, name = @project_path.rpartition('/')
namespace = find_or_create_namespace(namespace_path)
- ::Projects::GitlabProjectsImportService.new(@current_user, namespace_id: namespace.id, path: name).execute
+ ::Projects::GitlabProjectsImportService.new(@current_user,
+ namespace_id: namespace.id,
+ path: name,
+ file: File.new(@file_path)).execute
end
end
@@ -61,7 +62,7 @@ namespace :gitlab do
desc 'GitLab | Import a project'
task :import, [:project_path, :gitlab_username, :file_path] => :environment do |_t, args|
- GitLabProjectImport.new(args.project_path, args.gitlab_username, args.file_path)
+ GitLabProjectImport.new(args.project_path, args.gitlab_username, args.file_path).import
end
desc 'GitLab | Export a project'