gitlab-org--gitlab-foss/lib/gitlab/import_export/wiki_repo_bundler.rb

35 lines
793 B
Ruby
Raw Normal View History

module Gitlab
2016-03-08 17:17:57 +00:00
module ImportExport
class WikiRepoBundler < RepoBundler
def bundle
@wiki = ProjectWiki.new(@project)
return true if !wiki? # it's okay to have no Wiki
@full_path = File.join(@shared.export_path, project_filename)
2016-03-08 17:17:57 +00:00
bundle_to_disk
end
def bundle_to_disk
FileUtils.mkdir_p(@shared.export_path)
2016-03-08 17:17:57 +00:00
git_bundle(repo_path: path_to_repo, bundle_path: @full_path)
rescue => e
@shared.error(e.message)
2016-03-08 17:17:57 +00:00
false
end
private
2016-03-09 09:35:38 +00:00
def project_filename
"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
def wiki?
File.exists?(@wiki.repository.path_to_repo) && !@wiki.repository.empty?
end
end
end
end