summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-24 13:24:35 +0100
committerDouwe Maan <douwe@gitlab.com>2015-03-31 12:52:20 +0200
commitccc01b36ba3cd0e1f9c3a6e0201207114e3d1d41 (patch)
treee1505fcaf39759b1d27e1745d3a1c3d684c29e7e
parente7bbd85b3424ec64cb7f56452fd7f5ee48663a60 (diff)
downloadgitlab-ce-ccc01b36ba3cd0e1f9c3a6e0201207114e3d1d41.tar.gz
Small code cleanup.
-rw-r--r--app/services/archive_repository_service.rb13
-rw-r--r--app/workers/repository_archive_worker.rb12
2 files changed, 8 insertions, 17 deletions
diff --git a/app/services/archive_repository_service.rb b/app/services/archive_repository_service.rb
index cb2026fedba..40b0a64fb73 100644
--- a/app/services/archive_repository_service.rb
+++ b/app/services/archive_repository_service.rb
@@ -3,7 +3,7 @@ class ArchiveRepositoryService
def initialize(project, ref, format)
format ||= 'tar.gz'
- @project, @ref, @format = project, ref, format
+ @project, @ref, @format = project, ref, format.downcase
end
def execute
@@ -28,16 +28,12 @@ class ArchiveRepositoryService
Gitlab.config.gitlab.repository_downloads_path
end
- def archive_args
- @archive_args ||= [ref, storage_path, format.downcase]
- end
-
def file_path
- @file_path ||= project.repository.archive_file_path(*archive_args)
+ @file_path ||= project.repository.archive_file_path(ref, storage_path, format)
end
def pid_file_path
- @pid_file_path ||= project.repository.archive_pid_file_path(*archive_args)
+ @pid_file_path ||= project.repository.archive_pid_file_path(ref, storage_path, format)
end
def archived?
@@ -48,8 +44,7 @@ class ArchiveRepositoryService
File.exist?(pid_file_path)
end
- def wait_until_archived
- timeout = 5.0
+ def wait_until_archived(timeout = 5.0)
t1 = Time.now
begin
diff --git a/app/workers/repository_archive_worker.rb b/app/workers/repository_archive_worker.rb
index 3f4681a80f4..42ac77c588e 100644
--- a/app/workers/repository_archive_worker.rb
+++ b/app/workers/repository_archive_worker.rb
@@ -7,7 +7,7 @@ class RepositoryArchiveWorker
def perform(project_id, ref, format)
@project = Project.find(project_id)
- @ref, @format = ref, format
+ @ref, @format = ref, format.downcase
repository = project.repository
@@ -15,7 +15,7 @@ class RepositoryArchiveWorker
return if archived? || archiving?
- repository.archive_repo(*archive_args)
+ repository.archive_repo(ref, storage_path, format)
end
private
@@ -24,16 +24,12 @@ class RepositoryArchiveWorker
Gitlab.config.gitlab.repository_downloads_path
end
- def archive_args
- @archive_args ||= [ref, storage_path, format.downcase]
- end
-
def file_path
- @file_path ||= project.repository.archive_file_path(*archive_args)
+ @file_path ||= project.repository.archive_file_path(ref, storage_path, format)
end
def pid_file_path
- @pid_file_path ||= project.repository.archive_pid_file_path(*archive_args)
+ @pid_file_path ||= project.repository.archive_pid_file_path(ref, storage_path, format)
end
def archived?