diff options
author | James Lopez <james@jameslopez.es> | 2016-03-08 17:53:32 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-03-08 17:53:32 +0300 |
commit | 556cafa44e7baae4de0f4169703d8a6174de458a (patch) | |
tree | e411b9760e2c094442b6e1522fdde7a1778f935a /app/services/projects/import_export | |
parent | 4e73f9827cc5b164e409a6beb9a305ef5604423d (diff) |
added repo bundler spec and refactored some of the export code
Diffstat (limited to 'app/services/projects/import_export')
-rw-r--r-- | app/services/projects/import_export/export_service.rb | 2 | ||||
-rw-r--r-- | app/services/projects/import_export/repo_bundler.rb | 7 | ||||
-rw-r--r-- | app/services/projects/import_export/shared.rb | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/app/services/projects/import_export/export_service.rb b/app/services/projects/import_export/export_service.rb index b3ad278733a..99aa8489f65 100644 --- a/app/services/projects/import_export/export_service.rb +++ b/app/services/projects/import_export/export_service.rb @@ -2,7 +2,7 @@ module Projects module ImportExport class ExportService < BaseService def execute(options = {}) - @shared = Projects::ImportExport::Shared.new(project_name: @project_name) + @shared = Projects::ImportExport::Shared.new(relative_path: project.path_with_namespace) save_project_tree bundle_repo end diff --git a/app/services/projects/import_export/repo_bundler.rb b/app/services/projects/import_export/repo_bundler.rb index 27f1d5c87e5..b0b2df1c14c 100644 --- a/app/services/projects/import_export/repo_bundler.rb +++ b/app/services/projects/import_export/repo_bundler.rb @@ -11,14 +11,15 @@ module Projects end def bundle - return false if project.empty_repo? - @full_path = File.join(export_path, project_filename) + return false if @project.empty_repo? + @full_path = File.join(@export_path, project_filename) bundle_to_disk end private def bundle_to_disk + FileUtils.mkdir_p(@export_path) tar_cf(archive: full_path, dir: path_to_repo) rescue #TODO: handle error @@ -26,7 +27,7 @@ module Projects end def project_filename - @project.path_with_namespace + ".bundle" + "#{@project.namespace}#{@project.name}.bundle" end def path_to_repo diff --git a/app/services/projects/import_export/shared.rb b/app/services/projects/import_export/shared.rb index cdff8b02dd3..5101f514ab2 100644 --- a/app/services/projects/import_export/shared.rb +++ b/app/services/projects/import_export/shared.rb @@ -6,7 +6,7 @@ module Projects end def export_path - @export_path ||= ImportExport.export_path(project_name: @opts[:project_name]) + @export_path ||= Projects::ImportExport.export_path(relative_path: @opts[:relative_path]) end end end |