Class: Gitlab::Cleanup::OrphanLfsFileReferences
- Inherits:
-
Object
- Object
- Gitlab::Cleanup::OrphanLfsFileReferences
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/cleanup/orphan_lfs_file_references.rb
Constant Summary collapse
- DEFAULT_REMOVAL_LIMIT =
1000
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
readonly
Returns the value of attribute dry_run.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project, dry_run: true, logger: nil) ⇒ OrphanLfsFileReferences
constructor
A new instance of OrphanLfsFileReferences.
- #run! ⇒ Object
Constructor Details
#initialize(project, dry_run: true, logger: nil) ⇒ OrphanLfsFileReferences
Returns a new instance of OrphanLfsFileReferences.
12 13 14 15 16 |
# File 'lib/gitlab/cleanup/orphan_lfs_file_references.rb', line 12 def initialize(project, dry_run: true, logger: nil) @project = project @dry_run = dry_run @logger = logger || Gitlab::AppLogger end |
Instance Attribute Details
#dry_run ⇒ Object (readonly)
Returns the value of attribute dry_run.
8 9 10 |
# File 'lib/gitlab/cleanup/orphan_lfs_file_references.rb', line 8 def dry_run @dry_run end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/gitlab/cleanup/orphan_lfs_file_references.rb', line 8 def logger @logger end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
8 9 10 |
# File 'lib/gitlab/cleanup/orphan_lfs_file_references.rb', line 8 def project @project end |
Instance Method Details
#run! ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitlab/cleanup/orphan_lfs_file_references.rb', line 18 def run! log_info("Looking for orphan LFS files for project #{project.name_with_namespace}") if project.lfs_objects.empty? log_info("Project #{project.name_with_namespace} is linked to 0 LFS objects. Nothing to do") return end remove_orphan_references end |