Class: Gitlab::RepositorySizeErrorMessage

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::NumberHelper
Defined in:
lib/gitlab/repository_size_error_message.rb

Instance Method Summary collapse

Constructor Details

#initialize(checker) ⇒ RepositorySizeErrorMessage

Returns a new instance of RepositorySizeErrorMessage.

Parameters:



10
11
12
# File 'lib/gitlab/repository_size_error_message.rb', line 10

def initialize(checker)
  @checker = checker
end

Instance Method Details

#above_size_limit_messageObject



38
39
40
# File 'lib/gitlab/repository_size_error_message.rb', line 38

def above_size_limit_message
  "The size of this repository (#{formatted(current_size)}) exceeds the limit of #{formatted(limit)} by #{formatted(exceeded_size)}. You won't be able to push new code to this project. #{more_info_message}"
end

#commit_errorObject



14
15
16
# File 'lib/gitlab/repository_size_error_message.rb', line 14

def commit_error
  "Your changes could not be committed, #{base_message}"
end

#merge_errorObject



18
19
20
# File 'lib/gitlab/repository_size_error_message.rb', line 18

def merge_error
  "This merge request cannot be merged, #{base_message}"
end

#more_info_messageObject



34
35
36
# File 'lib/gitlab/repository_size_error_message.rb', line 34

def more_info_message
  'Please contact your GitLab administrator for more information.'
end

#new_changes_errorObject



26
27
28
29
30
31
32
# File 'lib/gitlab/repository_size_error_message.rb', line 26

def new_changes_error
  if additional_repo_storage_available?
    "Your push to this repository has been rejected because it would exceed storage limits. #{more_info_message}"
  else
    "Your push to this repository would cause it to exceed the size limit of #{formatted(limit)} so it has been rejected. #{more_info_message}"
  end
end

#push_error(change_size = 0) ⇒ Object



22
23
24
# File 'lib/gitlab/repository_size_error_message.rb', line 22

def push_error(change_size = 0)
  "Your push has been rejected, #{base_message(change_size)}. #{more_info_message}"
end