25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/tng/ui/authentication_warning_display.rb', line 25
def display_warning
warning_content = [
@pastel.public_send(Tng::UI::Theme.color(:error)).bold("Authentication Configuration Missing"),
"",
@pastel.public_send(Tng::UI::Theme.color(:primary), "TNG needs authentication setup to generate proper tests."),
"",
@pastel.public_send(Tng::UI::Theme.color(:accent), "Missing: ") + build_missing_items_summary,
"",
@pastel.public_send(Tng::UI::Theme.color(:secondary), "Quick fix:"),
@pastel.public_send(Tng::UI::Theme.color(:muted),
"#{Tng::UI::Theme.icon(:bullet)} Edit config/initializers/tng.rb"),
@pastel.public_send(Tng::UI::Theme.color(:muted),
"#{Tng::UI::Theme.icon(:bullet)} Uncomment authentication_methods array"),
@pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} Add your auth method details"),
"",
@pastel.public_send(Tng::UI::Theme.color(:success), "Press Enter to continue anyway"),
@pastel.public_send(Tng::UI::Theme.color(:error), "Press Esc to cancel and fix configuration")
].join("\n")
box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
style = Tng::UI::Theme.box_style(:warning)
warning_box = TTY::Box.frame(
title: { top_left: " Auth Warning " },
style: style[:style],
padding: style[:padding],
width: box_width
) do
warning_content
end
puts Tng::UI::Theme.center_box(warning_box, box_width, @terminal_width)
puts
end
|