2016-04-14 14:57:25 +00:00
|
|
|
module Gitlab
|
2016-03-08 17:17:57 +00:00
|
|
|
module ImportExport
|
|
|
|
class WikiRepoBundler < RepoBundler
|
|
|
|
def bundle
|
|
|
|
@wiki = ProjectWiki.new(@project)
|
2016-05-16 08:13:00 +00:00
|
|
|
return true unless wiki_repository_exists? # it's okay to have no Wiki
|
|
|
|
bundle_to_disk(File.join(@shared.export_path, project_filename))
|
2016-03-08 17:17:57 +00:00
|
|
|
end
|
|
|
|
|
2016-05-16 08:13:00 +00:00
|
|
|
def bundle_to_disk(full_path)
|
2016-05-10 15:15:20 +00:00
|
|
|
FileUtils.mkdir_p(@shared.export_path)
|
2016-05-16 08:13:00 +00:00
|
|
|
git_bundle(repo_path: path_to_repo, bundle_path: full_path)
|
2016-05-10 15:15:20 +00:00
|
|
|
rescue => e
|
2016-05-13 10:33:13 +00:00
|
|
|
@shared.error(e)
|
2016-03-08 17:17:57 +00:00
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-03-09 09:35:38 +00:00
|
|
|
def project_filename
|
2016-04-22 10:49:37 +00:00
|
|
|
"project.wiki.bundle"
|
2016-03-09 09:35:38 +00:00
|
|
|
end
|
|
|
|
|
2016-03-08 17:17:57 +00:00
|
|
|
def path_to_repo
|
|
|
|
@wiki.repository.path_to_repo
|
|
|
|
end
|
|
|
|
|
2016-05-16 08:13:00 +00:00
|
|
|
def wiki_repository_exists?
|
2016-03-08 17:17:57 +00:00
|
|
|
File.exists?(@wiki.repository.path_to_repo) && !@wiki.repository.empty?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|