2017-05-25 10:16:25 -04:00
|
|
|
module SystemCheck
|
|
|
|
module App
|
|
|
|
class ProjectsHaveNamespaceCheck < SystemCheck::BaseCheck
|
2017-05-30 13:06:58 -04:00
|
|
|
set_name 'Projects have namespace:'
|
2017-05-25 10:16:25 -04:00
|
|
|
set_skip_reason "can't check, you have no projects"
|
|
|
|
|
|
|
|
def skip?
|
|
|
|
!Project.exists?
|
|
|
|
end
|
|
|
|
|
|
|
|
def multi_check
|
2017-05-25 20:34:25 -04:00
|
|
|
$stdout.puts ''
|
2017-05-25 10:16:25 -04:00
|
|
|
|
|
|
|
Project.find_each(batch_size: 100) do |project|
|
2017-05-25 20:34:25 -04:00
|
|
|
$stdout.print sanitized_message(project)
|
2017-05-25 10:16:25 -04:00
|
|
|
|
|
|
|
if project.namespace
|
2017-05-25 20:34:25 -04:00
|
|
|
$stdout.puts 'yes'.color(:green)
|
2017-05-25 10:16:25 -04:00
|
|
|
else
|
2017-05-25 20:34:25 -04:00
|
|
|
$stdout.puts 'no'.color(:red)
|
2017-05-25 10:16:25 -04:00
|
|
|
show_error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def show_error
|
|
|
|
try_fixing_it(
|
|
|
|
"Migrate global projects"
|
|
|
|
)
|
|
|
|
for_more_information(
|
|
|
|
"doc/update/5.4-to-6.0.md in section \"#global-projects\""
|
|
|
|
)
|
|
|
|
fix_and_rerun
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|