Module: SystemCheck::Helpers
- Includes:
- Gitlab::TaskHelpers
- Included in:
- BaseCheck, RakeTask::RakeTaskHelpers
- Defined in:
- lib/system_check/helpers.rb
Overview
Helpers used inside a SystemCheck instance to standardize output responses
Instance Method Summary collapse
-
#finished_checking(component) ⇒ Object
deprecated
Deprecated.
This will no longer be used when all checks were executed using SystemCheck
-
#fix_and_rerun ⇒ Object
Display a message telling to fix and rerun the checks.
-
#for_more_information(*sources) ⇒ Object
Display a formatted list of references (documentation or links) where to find more information.
- #omnibus_gitlab? ⇒ Boolean
- #sanitized_message(project) ⇒ Object
- #see_installation_guide_section(section) ⇒ Object
- #should_sanitize? ⇒ Boolean
-
#start_checking(component) ⇒ Object
deprecated
Deprecated.
This will no longer be used when all checks were executed using SystemCheck
- #sudo_gitlab(command) ⇒ Object
-
#try_fixing_it(*steps) ⇒ Object
Display a formatted list of instructions on how to fix the issue identified by the #check?.
Methods included from Gitlab::TaskHelpers
#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, #prompt_for_password, #repository_storage_paths_args, #run_and_match, #run_command, #run_command!, #uid_for, #user_home, #warn_user_is_not_gitlab
Instance Method Details
#finished_checking(component) ⇒ Object
This will no longer be used when all checks were executed using SystemCheck
28 29 30 31 32 |
# File 'lib/system_check/helpers.rb', line 28 def finished_checking(component) $stdout.puts '' $stdout.puts "Checking #{component.color(:yellow)} ... #{'Finished'.color(:green)}" $stdout.puts '' end |
#fix_and_rerun ⇒ Object
Display a message telling to fix and rerun the checks
9 10 11 |
# File 'lib/system_check/helpers.rb', line 9 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
16 17 18 19 20 21 |
# File 'lib/system_check/helpers.rb', line 16 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
64 65 66 |
# File 'lib/system_check/helpers.rb', line 64 def omnibus_gitlab? Dir.pwd == '/opt/gitlab/embedded/service/gitlab-rails' end |
#sanitized_message(project) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/system_check/helpers.rb', line 52 def (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
23 24 25 |
# File 'lib/system_check/helpers.rb', line 23 def see_installation_guide_section(section) "doc/install/installation.md in section \"#{section}\"" end |
#should_sanitize? ⇒ Boolean
60 61 62 |
# File 'lib/system_check/helpers.rb', line 60 def should_sanitize? ENV['SANITIZE'] == 'true' end |
#start_checking(component) ⇒ Object
This will no longer be used when all checks were executed using SystemCheck
35 36 37 38 |
# File 'lib/system_check/helpers.rb', line 35 def start_checking(component) $stdout.puts "Checking #{component.color(:yellow)} ..." $stdout.puts '' end |
#sudo_gitlab(command) ⇒ Object
68 69 70 |
# File 'lib/system_check/helpers.rb', line 68 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?
43 44 45 46 47 48 49 50 |
# File 'lib/system_check/helpers.rb', line 43 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 |