tng 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ require "tty-prompt"
4
4
  require "tty-spinner"
5
5
  require "pastel"
6
6
  require "tty-screen"
7
+ require_relative "theme"
7
8
 
8
9
  class ControllerTestFlowDisplay
9
10
  def initialize(prompt, pastel)
@@ -17,73 +18,79 @@ class ControllerTestFlowDisplay
17
18
  end
18
19
 
19
20
  def select_controller(controllers)
20
- header = @pastel.bright_white.bold("📋 Select controller to test:")
21
- puts center_text(header)
21
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:config)} Select controller to test:")
22
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
22
23
 
23
24
  @prompt.select(
24
25
  "",
25
26
  cycle: true,
26
27
  per_page: 12,
27
28
  filter: true,
28
- symbols: { marker: "▶" }
29
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
29
30
  ) do |menu|
30
31
  controllers.each do |controller|
31
- display_name = "#{controller[:name]} #{@pastel.dim("(#{controller[:path]})")}"
32
+ display_name = "#{controller[:name]} #{@pastel.public_send(Tng::UI::Theme.color(:muted),
33
+ "(#{controller[:path]})")}"
32
34
  menu.choice display_name, controller
33
35
  end
34
- menu.choice @pastel.cyan("⬅️ Back"), :back
36
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
35
37
  end
36
38
  end
37
39
 
38
40
  def select_test_option(controller_choice)
39
- header = @pastel.bright_white.bold("🎯 Test Generation Options for #{controller_choice[:name]}")
40
- puts center_text(header)
41
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Test Generation Options for #{controller_choice[:name]}")
42
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
41
43
  puts
42
44
 
43
45
  @prompt.select(
44
- @pastel.bright_white("Choose test generation type:"),
46
+ @pastel.public_send(Tng::UI::Theme.color(:primary), "Choose test generation type:"),
45
47
  cycle: true,
46
- symbols: { marker: "▶" }
48
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
47
49
  ) do |menu|
48
- menu.choice @pastel.green("Generate all possible tests"), :all_possible_tests
49
- menu.choice @pastel.blue("Generate per method"), :per_method
50
- menu.choice @pastel.cyan("⬅️ Back"), :back
50
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:success), "Generate all possible tests"),
51
+ :all_possible_tests
52
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:info), "Generate per method"), :per_method
53
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
51
54
  end
52
55
  end
53
56
 
54
57
  def show_no_controllers_message
55
- error_msg = "#{@pastel.red.bold(" No controllers found in your application")}\n#{@pastel.dim("Make sure you have controllers in app/controllers/")}"
56
- puts center_text(error_msg)
57
- @prompt.keypress(center_text(@pastel.dim("Press any key to continue...")))
58
+ error_msg = "#{@pastel.public_send(Tng::UI::Theme.color(:error)).bold("#{Tng::UI::Theme.icon(:error)} No controllers found in your application")}\n#{@pastel.public_send(
59
+ Tng::UI::Theme.color(:muted), "Make sure you have controllers in app/controllers/"
60
+ )}"
61
+ puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
62
+ @prompt.keypress(Tng::UI::Theme.center_text(
63
+ @pastel.public_send(Tng::UI::Theme.color(:muted),
64
+ "Press any key to continue..."), @terminal_width
65
+ ))
58
66
  end
59
67
 
60
68
  def select_controller_method(controller, methods)
61
- header = @pastel.bright_white.bold("🎯 Select method to test in #{controller[:name]}")
62
- puts center_text(header)
69
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Select method to test in #{controller[:name]}")
70
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
63
71
 
64
72
  @prompt.select(
65
73
  "",
66
74
  cycle: true,
67
75
  per_page: 10,
68
76
  filter: true,
69
- symbols: { marker: "▶" }
77
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
70
78
  ) do |menu|
71
79
  methods.each do |method|
72
80
  menu.choice method[:name], method
73
81
  end
74
- menu.choice @pastel.cyan("⬅️ Back"), :back
82
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
75
83
  end
76
84
  end
77
85
 
78
86
  def show_no_methods_message(controller)
79
- error_msg = "#{@pastel.red.bold(" No methods found in #{controller[:name]}")}\n#{@pastel.dim("Controller may be empty or have syntax errors")}"
80
- puts center_text(error_msg)
81
- @prompt.keypress(center_text(@pastel.dim("Press any key to continue...")))
82
- end
83
-
84
- def center_text(text)
85
- padding = (@terminal_width - @pastel.strip(text).length) / 2
86
- padding = 0 if padding.negative?
87
- (" " * padding) + text
87
+ error_msg = "#{@pastel.public_send(Tng::UI::Theme.color(:error)).bold("#{Tng::UI::Theme.icon(:error)} No methods found in #{controller[:name]}")}\n#{@pastel.public_send(
88
+ Tng::UI::Theme.color(:muted), "Controller may be empty or have syntax errors"
89
+ )}"
90
+ puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
91
+ @prompt.keypress(Tng::UI::Theme.center_text(
92
+ @pastel.public_send(Tng::UI::Theme.color(:muted),
93
+ "Press any key to continue..."), @terminal_width
94
+ ))
88
95
  end
89
96
  end
@@ -1,6 +1,7 @@
1
1
  require "tty-box"
2
2
  require "pastel"
3
3
  require "tty-screen"
4
+ require_relative "theme"
4
5
 
5
6
  class DisplayBanner
6
7
  attr_reader :pastel, :version, :terminal_width
@@ -9,46 +10,35 @@ class DisplayBanner
9
10
  @pastel = pastel
10
11
  @version = version
11
12
  @terminal_width = begin
12
- TTY::Screen.width
13
- rescue StandardError
14
- 80
15
- end
13
+ TTY::Screen.width
14
+ rescue StandardError
15
+ 80
16
+ end
16
17
  end
17
18
 
18
19
  def render
19
20
  banner_content = [
20
- pastel.cyan.bold("Tng - LLM-Powered Rails Test Generator"),
21
- pastel.dim("Version: #{version}"),
21
+ pastel.public_send(Tng::UI::Theme.color(:secondary)).bold("Tng - LLM-Powered Rails Test Generator"),
22
+ pastel.public_send(Tng::UI::Theme.color(:muted), "Version: #{version}"),
22
23
  "",
23
- pastel.yellow("Generate comprehensive tests for your Rails application"),
24
- pastel.dim("Powered by LLM and static analysis")
24
+ pastel.public_send(Tng::UI::Theme.color(:accent), "Generate comprehensive tests for your Rails application"),
25
+ pastel.public_send(Tng::UI::Theme.color(:muted), "Powered by LLM and static analysis")
25
26
  ].join("\n")
26
27
 
27
28
  box_width = 64
28
29
  box_width = terminal_width if box_width > terminal_width
30
+ style = Tng::UI::Theme.box_style(:default)
29
31
 
30
32
  box = TTY::Box.frame(
31
33
  title: { top_left: " Tng ", bottom_right: " Ready " },
32
- style: {
33
- fg: :bright_white,
34
- border: { fg: :cyan },
35
- title: { fg: :bright_cyan }
36
- },
37
- padding: [1, 2],
34
+ style: style[:style],
35
+ padding: style[:padding],
38
36
  align: :center,
39
37
  width: box_width
40
38
  ) do
41
39
  banner_content
42
40
  end
43
41
 
44
- "#{center_box(box, box_width)}\n"
45
- end
46
-
47
- private
48
-
49
- def center_box(box_string, box_width)
50
- padding = (terminal_width - box_width) / 2
51
- padding = 0 if padding.negative?
52
- box_string.lines.map { |line| (" " * padding) + line.chomp }.join("\n")
42
+ "#{Tng::UI::Theme.center_box(box, box_width, terminal_width)}\n"
53
43
  end
54
44
  end
@@ -3,48 +3,39 @@
3
3
  require "tty-box"
4
4
  require "pastel"
5
5
  require "tty-screen"
6
+ require_relative "theme"
6
7
 
7
8
  class GoodbyeDisplay
8
9
  def initialize(pastel)
9
10
  @pastel = pastel
10
11
  @terminal_width = begin
11
- TTY::Screen.width
12
- rescue StandardError
13
- 80
14
- end
12
+ TTY::Screen.width
13
+ rescue StandardError
14
+ 80
15
+ end
15
16
  end
16
17
 
17
18
  def display
18
- box_width = 54
19
+ box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
20
+ style = Tng::UI::Theme.box_style(:success)
21
+
19
22
  goodbye_box = TTY::Box.frame(
20
23
  title: { top_left: " Thank You " },
21
- style: {
22
- fg: :bright_white,
23
- border: { fg: :green },
24
- title: { fg: :bright_green }
25
- },
26
- padding: [1, 2],
24
+ style: style[:style],
25
+ padding: style[:padding],
27
26
  align: :center,
28
27
  width: box_width
29
28
  ) do
30
29
  [
31
- @pastel.green.bold("Thanks for using Tng!"),
30
+ @pastel.public_send(Tng::UI::Theme.color(:success)).bold("Thanks for using Tng!"),
32
31
  "",
33
- @pastel.bright_white("Happy testing!"),
32
+ @pastel.public_send(Tng::UI::Theme.color(:secondary), "Happy testing!"),
34
33
  "",
35
- @pastel.dim("Your Rails tests are now supercharged with LLM")
34
+ @pastel.public_send(Tng::UI::Theme.color(:muted), "Your Rails tests are now supercharged with LLM")
36
35
  ].join("\n")
37
36
  end
38
37
 
39
- puts center_box(goodbye_box, box_width)
38
+ puts Tng::UI::Theme.center_box(goodbye_box, box_width, @terminal_width)
40
39
  puts
41
40
  end
42
-
43
- private
44
-
45
- def center_box(box_string, box_width)
46
- padding = (@terminal_width - box_width) / 2
47
- padding = 0 if padding.negative?
48
- box_string.lines.map { |line| (" " * padding) + line.chomp }.join("\n")
49
- end
50
41
  end
@@ -4,6 +4,7 @@ require "tty-prompt"
4
4
  require "tty-spinner"
5
5
  require "pastel"
6
6
  require "tty-screen"
7
+ require_relative "theme"
7
8
 
8
9
  class ModelTestFlowDisplay
9
10
  def initialize(prompt, pastel)
@@ -17,79 +18,80 @@ class ModelTestFlowDisplay
17
18
  end
18
19
 
19
20
  def select_model(models)
20
- header = @pastel.bright_white.bold("📋 Select model to test:")
21
- puts center_text(header)
21
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:config)} Select model to test:")
22
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
22
23
 
23
24
  @prompt.select(
24
25
  "",
25
26
  cycle: true,
26
27
  per_page: 12,
27
28
  filter: true,
28
- symbols: { marker: "▶" }
29
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
29
30
  ) do |menu|
30
31
  models.each do |model|
31
- display_name = "#{model[:name]} #{@pastel.dim("(#{model[:path]})")}"
32
+ display_name = "#{model[:name]} #{@pastel.public_send(Tng::UI::Theme.color(:muted), "(#{model[:path]})")}"
32
33
  menu.choice display_name, model
33
34
  end
34
- menu.choice @pastel.cyan("⬅️ Back"), :back
35
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
35
36
  end
36
37
  end
37
38
 
38
39
  def select_test_option(model_choice)
39
- header = @pastel.bright_white.bold("🎯 Test Generation Options for #{model_choice[:name]}")
40
- puts center_text(header)
40
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Test Generation Options for #{model_choice[:name]}")
41
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
41
42
  puts
42
43
 
43
44
  @prompt.select(
44
- @pastel.bright_white("Choose test generation type:"),
45
+ @pastel.public_send(Tng::UI::Theme.color(:primary), "Choose test generation type:"),
45
46
  cycle: true,
46
- symbols: { marker: "▶" }
47
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
47
48
  ) do |menu|
48
- menu.choice @pastel.green("Generate all possible tests"), :all_possible_tests
49
- menu.choice @pastel.blue("Generate per method"), :per_method
50
- menu.choice @pastel.cyan("⬅️ Back"), :back
49
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:success), "Generate all possible tests"),
50
+ :all_possible_tests
51
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:info), "Generate per method"), :per_method
52
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
51
53
  end
52
54
  end
53
55
 
54
56
  def show_no_models_message
55
57
  puts
56
- puts center_text(@pastel.yellow("⚠️ No models found in app/models"))
57
- puts center_text(@pastel.dim("Make sure you're in a Rails project with models"))
58
+ puts Tng::UI::Theme.center_text(
59
+ @pastel.public_send(Tng::UI::Theme.color(:warning),
60
+ "#{Tng::UI::Theme.icon(:warning)} No models found in app/models"), @terminal_width
61
+ )
62
+ puts Tng::UI::Theme.center_text(
63
+ @pastel.public_send(Tng::UI::Theme.color(:muted),
64
+ "Make sure you're in a Rails project with models"), @terminal_width
65
+ )
58
66
  puts
59
67
  end
60
68
 
61
69
  def select_model_method(model, methods)
62
- header = @pastel.bright_white.bold("🎯 Select method to test in #{model[:name]}")
63
- puts center_text(header)
70
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Select method to test in #{model[:name]}")
71
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
64
72
 
65
73
  @prompt.select(
66
74
  "",
67
75
  cycle: true,
68
76
  per_page: 10,
69
77
  filter: true,
70
- symbols: { marker: "▶" }
78
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
71
79
  ) do |menu|
72
80
  methods.each do |method|
73
81
  menu.choice method[:name], method
74
82
  end
75
- menu.choice @pastel.cyan("⬅️ Back"), :back
83
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
76
84
  end
77
85
  end
78
86
 
79
87
  def show_no_methods_message(model)
80
- error_msg = "#{@pastel.red.bold(" No methods found in #{model[:name]}")}\n#{@pastel.dim("Model may be empty or have syntax errors")}"
81
- puts center_text(error_msg)
82
- @prompt.keypress(center_text(@pastel.dim("Press any key to continue...")))
83
- end
84
-
85
- private
86
-
87
- def center_text(text)
88
- padding = [(@terminal_width - strip_ansi(text).length) / 2, 0].max
89
- "#{" " * padding}#{text}"
90
- end
91
-
92
- def strip_ansi(text)
93
- text.gsub(/\e\[([;\d]+)?m/, "")
88
+ error_msg = "#{@pastel.public_send(Tng::UI::Theme.color(:error)).bold("#{Tng::UI::Theme.icon(:error)} No methods found in #{model[:name]}")}\n#{@pastel.public_send(
89
+ Tng::UI::Theme.color(:muted), "Model may be empty or have syntax errors"
90
+ )}"
91
+ puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
92
+ @prompt.keypress(Tng::UI::Theme.center_text(
93
+ @pastel.public_send(Tng::UI::Theme.color(:muted),
94
+ "Press any key to continue..."), @terminal_width
95
+ ))
94
96
  end
95
97
  end
@@ -1,5 +1,6 @@
1
1
  require "tty-box"
2
2
  require "pastel"
3
+ require_relative "theme"
3
4
 
4
5
  class PostInstallBox
5
6
  attr_reader :version, :pastel
@@ -16,35 +17,46 @@ class PostInstallBox
16
17
 
17
18
  def content
18
19
  [
19
- pastel.green.bold(" Tng installed successfully!"),
20
+ pastel.public_send(Tng::UI::Theme.color(:success)).bold("#{Tng::UI::Theme.icon(:success)} Tng installed successfully!"),
20
21
  "",
21
- pastel.yellow.bold("📋 SETUP REQUIRED"),
22
+ pastel.public_send(Tng::UI::Theme.color(:warning)).bold("#{Tng::UI::Theme.icon(:config)} SETUP REQUIRED"),
22
23
  "",
23
- pastel.bright_white("1. Generate configuration:"),
24
- pastel.cyan(" rails g tng:install"),
24
+ pastel.public_send(Tng::UI::Theme.color(:primary), "1. Generate configuration:"),
25
+ pastel.public_send(Tng::UI::Theme.color(:secondary), " rails g tng:install"),
25
26
  "",
26
- pastel.bright_white("2. Edit configuration file:"),
27
- pastel.cyan(" config/initializers/tng.rb"),
27
+ pastel.public_send(Tng::UI::Theme.color(:primary), "2. Edit configuration file:"),
28
+ pastel.public_send(Tng::UI::Theme.color(:secondary), " config/initializers/tng.rb"),
28
29
  "",
29
- pastel.bright_white("3. Add your license key:"),
30
- pastel.cyan(" config.api_key = 'your-license-key-here'"),
30
+ pastel.public_send(Tng::UI::Theme.color(:primary), "3. Add your license key:"),
31
+ pastel.public_send(Tng::UI::Theme.color(:secondary), " config.api_key = 'your-license-key-here'"),
31
32
  "",
32
- pastel.bright_white("📖 Check documentation for the correct authentication setup"),
33
+ pastel.public_send(Tng::UI::Theme.color(:primary),
34
+ "#{Tng::UI::Theme.icon(:config)} Check documentation for the correct authentication setup"),
33
35
  "",
34
- pastel.magenta.bold("🚀 Usage:"),
36
+ pastel.public_send(Tng::UI::Theme.color(:accent)).bold("#{Tng::UI::Theme.icon(:rocket)} Usage:"),
35
37
  "",
36
- pastel.bright_white("Interactive mode:"),
37
- pastel.green("• bundle exec tng") + pastel.dim(" - Full interactive CLI"),
38
+ pastel.public_send(Tng::UI::Theme.color(:primary), "Interactive mode:"),
39
+ pastel.public_send(Tng::UI::Theme.color(:success),
40
+ "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng") + pastel.public_send(Tng::UI::Theme.color(:muted),
41
+ " - Full interactive CLI"),
38
42
  "",
39
- pastel.bright_white("Direct generation:"),
40
- pastel.green("• bundle exec tng -t c -f ping") + pastel.dim(" - Short"),
41
- pastel.green("• bundle exec tng -t=c f=ping") + pastel.dim(" - Mixed"),
42
- pastel.green(" bundle exec tng --type=controller --file=ping"),
43
+ pastel.public_send(Tng::UI::Theme.color(:primary), "Direct generation:"),
44
+ pastel.public_send(Tng::UI::Theme.color(:success),
45
+ "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng -t c -f ping") + pastel.public_send(Tng::UI::Theme.color(:muted),
46
+ " - Short"),
47
+ pastel.public_send(Tng::UI::Theme.color(:success),
48
+ "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng -t=c f=ping") + pastel.public_send(Tng::UI::Theme.color(:muted),
49
+ " - Mixed"),
50
+ pastel.public_send(Tng::UI::Theme.color(:success),
51
+ "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng --type=controller --file=ping"),
43
52
  "",
44
- pastel.bright_white("Help:"),
45
- pastel.green("• bundle exec tng --help") + pastel.dim(" - Show all options"),
53
+ pastel.public_send(Tng::UI::Theme.color(:primary), "Help:"),
54
+ pastel.public_send(Tng::UI::Theme.color(:success),
55
+ "#{Tng::UI::Theme.icon(:bullet)} bundle exec tng --help") + pastel.public_send(Tng::UI::Theme.color(:muted),
56
+ " - Show all options"),
46
57
  "",
47
- pastel.dim("💡 Use -t c for controller, -t m for model")
58
+ pastel.public_send(Tng::UI::Theme.color(:muted),
59
+ "#{Tng::UI::Theme.icon(:lightbulb)} Use -t c for controller, -t m for model")
48
60
  ].join("\n")
49
61
  end
50
62
 
@@ -52,20 +64,17 @@ class PostInstallBox
52
64
  # Use a reasonable width that won't cause issues
53
65
  box_width = [@terminal_width, 70].min
54
66
 
67
+ style = Tng::UI::Theme.box_style(:default)
55
68
  TTY::Box.frame(
56
69
  title: { top_left: " TNG ", bottom_right: " v#{@version} " },
57
- style: {
58
- fg: :bright_white,
59
- border: { fg: :cyan },
60
- title: { fg: :bright_cyan }
61
- },
62
- padding: [1, 2],
70
+ style: style[:style],
71
+ padding: style[:padding],
63
72
  align: :left,
64
73
  width: box_width
65
74
  ) do
66
75
  content
67
76
  end
68
- rescue StandardError => e
77
+ rescue StandardError
69
78
  "TNG v#{@version} installed successfully!\n" +
70
79
  "Run 'rails g tng:install' to get started.\n" +
71
80
  "Use 'bundle exec tng --help' for usage information."
@@ -4,6 +4,7 @@ require "tty-prompt"
4
4
  require "tty-spinner"
5
5
  require "pastel"
6
6
  require "tty-screen"
7
+ require_relative "theme"
7
8
 
8
9
  class ServiceTestFlowDisplay
9
10
  def initialize(prompt, pastel)
@@ -17,73 +18,78 @@ class ServiceTestFlowDisplay
17
18
  end
18
19
 
19
20
  def select_service(services)
20
- header = @pastel.bright_white.bold("📋 Select service to test:")
21
- puts center_text(header)
21
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:config)} Select service to test:")
22
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
22
23
 
23
24
  @prompt.select(
24
25
  "",
25
26
  cycle: true,
26
27
  per_page: 12,
27
28
  filter: true,
28
- symbols: { marker: "▶" }
29
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
29
30
  ) do |menu|
30
31
  services.each do |service|
31
- display_name = "#{service[:name]} #{@pastel.dim("(#{service[:path]})")}"
32
+ display_name = "#{service[:name]} #{@pastel.public_send(Tng::UI::Theme.color(:muted), "(#{service[:path]})")}"
32
33
  menu.choice display_name, service
33
34
  end
34
- menu.choice @pastel.cyan("⬅️ Back"), :back
35
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
35
36
  end
36
37
  end
37
38
 
38
39
  def select_test_option(service_choice)
39
- header = @pastel.bright_white.bold("🎯 Test Generation Options for #{service_choice[:name]}")
40
- puts center_text(header)
40
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Test Generation Options for #{service_choice[:name]}")
41
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
41
42
  puts
42
43
 
43
44
  @prompt.select(
44
- @pastel.bright_white("Choose test generation type:"),
45
+ @pastel.public_send(Tng::UI::Theme.color(:primary), "Choose test generation type:"),
45
46
  cycle: true,
46
- symbols: { marker: "▶" }
47
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
47
48
  ) do |menu|
48
- menu.choice @pastel.green("Generate all possible tests"), :all_possible_tests
49
- menu.choice @pastel.blue("Generate per method"), :per_method
50
- menu.choice @pastel.cyan("⬅️ Back"), :back
49
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:success), "Generate all possible tests"),
50
+ :all_possible_tests
51
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:info), "Generate per method"), :per_method
52
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
51
53
  end
52
54
  end
53
55
 
54
56
  def show_no_services_message
55
- error_msg = "#{@pastel.red.bold(" No services found in your application")}\n#{@pastel.dim("Make sure you have services in app/services/ or app/service/")}"
56
- puts center_text(error_msg)
57
- @prompt.keypress(center_text(@pastel.dim("Press any key to continue...")))
57
+ error_msg = "#{@pastel.public_send(Tng::UI::Theme.color(:error)).bold("#{Tng::UI::Theme.icon(:error)} No services found in your application")}\n#{@pastel.public_send(
58
+ Tng::UI::Theme.color(:muted), "Make sure you have services in app/services/ or app/service/"
59
+ )}"
60
+ puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
61
+ @prompt.keypress(Tng::UI::Theme.center_text(
62
+ @pastel.public_send(Tng::UI::Theme.color(:muted),
63
+ "Press any key to continue..."), @terminal_width
64
+ ))
58
65
  end
59
66
 
60
67
  def select_service_method(service, methods)
61
- header = @pastel.bright_white.bold("🔍 Select method to test for #{service[:name]}")
62
- puts center_text(header)
68
+ header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Select method to test for #{service[:name]}")
69
+ puts Tng::UI::Theme.center_text(header, @terminal_width)
63
70
 
64
71
  @prompt.select(
65
72
  "",
66
73
  cycle: true,
67
74
  per_page: 12,
68
75
  filter: true,
69
- symbols: { marker: "▶" }
76
+ symbols: { marker: Tng::UI::Theme.icon(:marker) }
70
77
  ) do |menu|
71
78
  methods.each do |method|
72
79
  menu.choice "#{method[:name]}", method
73
80
  end
74
- menu.choice @pastel.cyan("⬅️ Back"), :back
81
+ menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
75
82
  end
76
83
  end
77
84
 
78
85
  def show_no_methods_message(service)
79
- error_msg = "#{@pastel.red.bold(" No methods found in #{service[:name]}")}\n#{@pastel.dim("The service might not have any public methods or could not be analyzed.")}"
80
- puts center_text(error_msg)
81
- @prompt.keypress(center_text(@pastel.dim("Press any key to continue...")))
82
- end
83
-
84
- def center_text(text)
85
- padding = (@terminal_width - @pastel.strip(text).length) / 2
86
- padding = 0 if padding.negative?
87
- (" " * padding) + text
86
+ error_msg = "#{@pastel.public_send(Tng::UI::Theme.color(:error)).bold("#{Tng::UI::Theme.icon(:error)} No methods found in #{service[:name]}")}\n#{@pastel.public_send(
87
+ Tng::UI::Theme.color(:muted), "The service might not have any public methods or could not be analyzed."
88
+ )}"
89
+ puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
90
+ @prompt.keypress(Tng::UI::Theme.center_text(
91
+ @pastel.public_send(Tng::UI::Theme.color(:muted),
92
+ "Press any key to continue..."), @terminal_width
93
+ ))
88
94
  end
89
95
  end