Module: SystemCheck::Helpers

Includes:
Gitlab::TaskHelpers
Included in:
BaseCheck, RakeTask::RakeTaskHelpers
Defined in:
lib/system_check/helpers.rb

Instance Method Summary collapse

Methods included from Gitlab::TaskHelpers

#all_repos, #ask_to_continue, #checkout_or_clone_version, #checkout_version, #clone_repo, #get_version, #gid_for, #gitlab_user, #gitlab_user?, #invoke_and_time_task, #os_name, #prompt, #repository_storage_paths_args, #run_and_match, #run_command, #run_command!, #uid_for, #user_home, #warn_user_is_not_gitlab

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Instance Method Details

#finished_checking(component) ⇒ Object

Deprecated.

This will no longer be used when all checks were executed using SystemCheck


27
28
29
30
31
# File 'lib/system_check/helpers.rb', line 27

def finished_checking(component)
  $stdout.puts ''
  $stdout.puts "Checking #{component.color(:yellow)} ... #{'Finished'.color(:green)}"
  $stdout.puts ''
end

#fix_and_rerunObject

Display a message telling to fix and rerun the checks


8
9
10
# File 'lib/system_check/helpers.rb', line 8

def fix_and_rerun
  $stdout.puts '  Please fix the error above and rerun the checks.'.color(:red)
end

#for_more_information(*sources) ⇒ Object

Display a formatted list of references (documentation or links) where to find more information

Parameters:

  • sources (Array<String>)

    one or more references (documentation or links)


15
16
17
18
19
20
# File 'lib/system_check/helpers.rb', line 15

def for_more_information(*sources)
  $stdout.puts '  For more information see:'.color(:blue)
  sources.each do |source|
    $stdout.puts "  #{source}"
  end
end

#omnibus_gitlab?Boolean

Returns:

  • (Boolean)

63
64
65
# File 'lib/system_check/helpers.rb', line 63

def omnibus_gitlab?
  Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails'
end

#sanitized_message(project) ⇒ Object


51
52
53
54
55
56
57
# File 'lib/system_check/helpers.rb', line 51

def sanitized_message(project)
  if should_sanitize?
    "#{project.namespace_id.to_s.color(:yellow)}/#{project.id.to_s.color(:yellow)} ... "
  else
    "#{project.full_name.color(:yellow)} ... "
  end
end

#see_installation_guide_section(section) ⇒ Object


22
23
24
# File 'lib/system_check/helpers.rb', line 22

def see_installation_guide_section(section)
  "doc/install/installation.md in section \"#{section}\""
end

#should_sanitize?Boolean

Returns:

  • (Boolean)

59
60
61
# File 'lib/system_check/helpers.rb', line 59

def should_sanitize?
  ENV['SANITIZE'] == 'true'
end

#start_checking(component) ⇒ Object

Deprecated.

This will no longer be used when all checks were executed using SystemCheck


34
35
36
37
# File 'lib/system_check/helpers.rb', line 34

def start_checking(component)
  $stdout.puts "Checking #{component.color(:yellow)} ..."
  $stdout.puts ''
end

#sudo_gitlab(command) ⇒ Object


67
68
69
# File 'lib/system_check/helpers.rb', line 67

def sudo_gitlab(command)
  "sudo -u #{gitlab_user} -H #{command}"
end

#try_fixing_it(*steps) ⇒ Object

Display a formatted list of instructions on how to fix the issue identified by the #check?

Parameters:

  • steps (Array<String>)

    one or short sentences with help how to fix the issue


42
43
44
45
46
47
48
49
# File 'lib/system_check/helpers.rb', line 42

def try_fixing_it(*steps)
  steps = steps.shift if steps.first.is_a?(Array)

  $stdout.puts '  Try fixing it:'.color(:blue)
  steps.each do |step|
    $stdout.puts "  #{step}"
  end
end