Commit c5bc2629 authored by James Lopez's avatar James Lopez

few fixes - import from UI working

parent 5908bdf3
...@@ -191,6 +191,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -191,6 +191,7 @@ class ProjectsController < Projects::ApplicationController
end end
def export def export
#TODO: Move to worker
::Projects::ImportExport::ExportService.new(@project, current_user).execute ::Projects::ImportExport::ExportService.new(@project, current_user).execute
redirect_to( redirect_to(
...@@ -267,6 +268,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -267,6 +268,7 @@ class ProjectsController < Projects::ApplicationController
def export_project_path def export_project_path
# TODO: move this, probably to ImportExport and refactor # TODO: move this, probably to ImportExport and refactor
File.join(Settings.shared['path'], 'tmp/project_exports', @project.path_with_namespace, 'project.tar.gz') folder = File.join(Settings.shared['path'], 'tmp/project_exports', @project.path_with_namespace)
Dir.glob("#{folder}/*export.tar.gz").max_by {|f| File.ctime(f)}
end end
end end
...@@ -3,7 +3,7 @@ module Projects ...@@ -3,7 +3,7 @@ module Projects
class ExportService < BaseService class ExportService < BaseService
def execute(options = {}) def execute(options = {})
@shared = Gitlab::ImportExport::Shared.new(relative_path: project.path_with_namespace) @shared = Gitlab::ImportExport::Shared.new(relative_path: File.join(project.path_with_namespace, 'work'))
save_project_tree save_project_tree
bundle_repo bundle_repo
save_all save_all
......
...@@ -24,7 +24,7 @@ module Gitlab ...@@ -24,7 +24,7 @@ module Gitlab
end end
def tar_with_options(archive:, dir:, options:) def tar_with_options(archive:, dir:, options:)
cmd = %W(tar -#{options} #{archive} #{dir}) cmd = %W(tar -#{options} #{archive} -C #{dir} .)
_output, status = Gitlab::Popen.popen(cmd) _output, status = Gitlab::Popen.popen(cmd)
status.zero? status.zero?
end end
......
...@@ -14,6 +14,7 @@ module Gitlab ...@@ -14,6 +14,7 @@ module Gitlab
def save def save
if compress_and_save if compress_and_save
remove_storage_path remove_storage_path
Rails.logger.info("Saved project export #{archive_file}")
archive_file archive_file
else else
false false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment