summaryrefslogtreecommitdiff
path: root/lib/gitlab
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-03-06 15:24:14 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-03-06 15:24:14 +0000
commit39b393fa72026eeddd141c03696310162304ea98 (patch)
tree0141fded5989d81794e51992d237bd12ff2ea140 /lib/gitlab
parent5e8138aa54492dd3ace42d889ba01f82e8e19c83 (diff)
parent3e71955befba95f823ba92290dedc13a9bf332ff (diff)
downloadgitlab-ce-39b393fa72026eeddd141c03696310162304ea98.tar.gz
Merge branch '29130-api-project-export' into 'master'
Resolve "API endpoint for exporting project" Closes #29130 See merge request gitlab-org/gitlab-ce!15860
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/import_export/importer.rb2
-rw-r--r--lib/gitlab/import_export/shared.rb14
2 files changed, 10 insertions, 6 deletions
diff --git a/lib/gitlab/import_export/importer.rb b/lib/gitlab/import_export/importer.rb
index a00795f553e..c38df9102eb 100644
--- a/lib/gitlab/import_export/importer.rb
+++ b/lib/gitlab/import_export/importer.rb
@@ -9,7 +9,7 @@ module Gitlab
@archive_file = project.import_source
@current_user = project.creator
@project = project
- @shared = Gitlab::ImportExport::Shared.new(relative_path: path_with_namespace)
+ @shared = project.import_export_shared
end
def execute
diff --git a/lib/gitlab/import_export/shared.rb b/lib/gitlab/import_export/shared.rb
index b34cafc6876..3d3d998a6a3 100644
--- a/lib/gitlab/import_export/shared.rb
+++ b/lib/gitlab/import_export/shared.rb
@@ -1,13 +1,17 @@
module Gitlab
module ImportExport
class Shared
- attr_reader :errors, :opts
+ attr_reader :errors, :project
- def initialize(opts)
- @opts = opts
+ def initialize(project)
+ @project = project
@errors = []
end
+ def active_export_count
+ Dir[File.join(archive_path, '*')].count { |name| File.directory?(name) }
+ end
+
def export_path
@export_path ||= Gitlab::ImportExport.export_path(relative_path: relative_path)
end
@@ -31,11 +35,11 @@ module Gitlab
private
def relative_path
- File.join(opts[:relative_path], SecureRandom.hex)
+ File.join(relative_archive_path, SecureRandom.hex)
end
def relative_archive_path
- File.join(opts[:relative_path], '..')
+ @project.disk_path
end
def error_out(message, caller)