diff options
author | James Lopez <james@jameslopez.es> | 2016-05-11 15:08:27 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-05-11 15:08:27 +0200 |
commit | 5c59ba35c9ae6a7e5d6d6cd20d0b2ba51166f60f (patch) | |
tree | 9a184c487705aca19c1eae9ea4b54f6c1bb20f02 /app/services/projects | |
parent | 68aca6f6635090a33cf4d96c6dbc7ceab6ac2385 (diff) | |
download | gitlab-ce-5c59ba35c9ae6a7e5d6d6cd20d0b2ba51166f60f.tar.gz |
fix complexity of method
Diffstat (limited to 'app/services/projects')
-rw-r--r-- | app/services/projects/create_service.rb | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 53a16e95f5b..1693ae609cf 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -50,18 +50,9 @@ module Projects @project.build_forked_project_link(forked_from_project_id: forked_from_project_id) end - Project.transaction do - @project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data - @project.save - - if @project.persisted? && !@project.import? - raise 'Failed to create repository' unless @project.create_repository - end - end + process_import_data(import_data) - Project.transaction do - @project.import_start if @project.import? - end + start_import if @project.import? after_create_actions if @project.persisted? @@ -100,5 +91,22 @@ module Projects @project.team << [current_user, :master, current_user] end end + + def start_import + Project.transaction do + @project.import_start + end + end + + def process_import_data(import_data) + Project.transaction do + @project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data + @project.save + + if @project.persisted? && !@project.import? + raise 'Failed to create repository' unless @project.create_repository + end + end + end end end |