diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2018-05-21 19:40:57 +0300 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2018-05-29 00:39:36 +0300 |
commit | d17b45adf58936e52c0d97dc5bdf259f7e7ed06e (patch) | |
tree | d0a7e2356150e240123e6f447372a57a5c3bc608 /lib/tasks | |
parent | 818b4d0a19686d7c549127c75c7977a5d8ee647c (diff) |
assign helper full name to variable to reduce code length
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/storage.rake | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/lib/tasks/gitlab/storage.rake b/lib/tasks/gitlab/storage.rake index 1fc65d13056..24e10ba9ba8 100644 --- a/lib/tasks/gitlab/storage.rake +++ b/lib/tasks/gitlab/storage.rake @@ -3,6 +3,7 @@ namespace :gitlab do desc 'GitLab | Storage | Migrate existing projects to Hashed Storage' task migrate_to_hashed: :environment do legacy_projects_count = Project.with_unmigrated_storage.count + helper = Gitlab::HashedStorage::RakeHelper if legacy_projects_count == 0 puts 'There are no projects requiring storage migration. Nothing to do!' @@ -10,9 +11,9 @@ namespace :gitlab do next end - print "Enqueuing migration of #{legacy_projects_count} projects in batches of #{Gitlab::HashedStorage::RakeHelper.batch_size}" + print "Enqueuing migration of #{legacy_projects_count} projects in batches of #{helper.batch_size}" - Gitlab::HashedStorage::RakeHelper.project_id_batches do |start, finish| + helper.project_id_batches do |start, finish| StorageMigratorWorker.perform_async(start, finish) print '.' @@ -23,42 +24,50 @@ namespace :gitlab do desc 'Gitlab | Storage | Summary of existing projects using Legacy Storage' task legacy_projects: :environment do - Gitlab::HashedStorage::RakeHelper.relation_summary('projects', Project.without_storage_feature(:repository)) + helper = Gitlab::HashedStorage::RakeHelper + helper.relation_summary('projects', Project.without_storage_feature(:repository)) end desc 'Gitlab | Storage | List existing projects using Legacy Storage' task list_legacy_projects: :environment do - Gitlab::HashedStorage::RakeHelper.projects_list('projects using Legacy Storage', Project.without_storage_feature(:repository)) + helper = Gitlab::HashedStorage::RakeHelper + helper.projects_list('projects using Legacy Storage', Project.without_storage_feature(:repository)) end desc 'Gitlab | Storage | Summary of existing projects using Hashed Storage' task hashed_projects: :environment do - Gitlab::HashedStorage::RakeHelper.relation_summary('projects using Hashed Storage', Project.with_storage_feature(:repository)) + helper = Gitlab::HashedStorage::RakeHelper + helper.relation_summary('projects using Hashed Storage', Project.with_storage_feature(:repository)) end desc 'Gitlab | Storage | List existing projects using Hashed Storage' task list_hashed_projects: :environment do - Gitlab::HashedStorage::RakeHelper.projects_list('projects using Hashed Storage', Project.with_storage_feature(:repository)) + helper = Gitlab::HashedStorage::RakeHelper + helper.projects_list('projects using Hashed Storage', Project.with_storage_feature(:repository)) end desc 'Gitlab | Storage | Summary of project attachments using Legacy Storage' task legacy_attachments: :environment do - Gitlab::HashedStorage::RakeHelper.relation_summary('attachments using Legacy Storage', Gitlab::HashedStorage::RakeHelper.legacy_attachments_relation) + helper = Gitlab::HashedStorage::RakeHelper + helper.relation_summary('attachments using Legacy Storage', helper.legacy_attachments_relation) end desc 'Gitlab | Storage | List existing project attachments using Legacy Storage' task list_legacy_attachments: :environment do - Gitlab::HashedStorage::RakeHelper.attachments_list('attachments using Legacy Storage', Gitlab::HashedStorage::RakeHelper.legacy_attachments_relation) + helper = Gitlab::HashedStorage::RakeHelper + helper.attachments_list('attachments using Legacy Storage', helper.legacy_attachments_relation) end desc 'Gitlab | Storage | Summary of project attachments using Hashed Storage' task hashed_attachments: :environment do - Gitlab::HashedStorage::RakeHelper.relation_summary('attachments using Hashed Storage', Gitlab::HashedStorage::RakeHelper.hashed_attachments_relation) + helper = Gitlab::HashedStorage::RakeHelper + helper.relation_summary('attachments using Hashed Storage', helper.hashed_attachments_relation) end desc 'Gitlab | Storage | List existing project attachments using Hashed Storage' task list_hashed_attachments: :environment do - Gitlab::HashedStorage::RakeHelper.attachments_list('attachments using Hashed Storage', Gitlab::HashedStorage::RakeHelper.hashed_attachments_relation) + helper = Gitlab::HashedStorage::RakeHelper + helper.attachments_list('attachments using Hashed Storage', helper.hashed_attachments_relation) end end end |