tng 0.3.0 → 0.3.3

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.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ralucab
@@ -9,6 +9,26 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activesupport
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '6.0'
19
+ - - "<"
20
+ - !ruby/object:Gem::Version
21
+ version: '9.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ version: '6.0'
29
+ - - "<"
30
+ - !ruby/object:Gem::Version
31
+ version: '9.0'
12
32
  - !ruby/object:Gem::Dependency
13
33
  name: httpx
14
34
  requirement: !ruby/object:Gem::Requirement
@@ -93,20 +113,6 @@ dependencies:
93
113
  - - "~>"
94
114
  - !ruby/object:Gem::Version
95
115
  version: '0.7'
96
- - !ruby/object:Gem::Dependency
97
- name: tty-file
98
- requirement: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '0.10'
103
- type: :runtime
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '0.10'
110
116
  - !ruby/object:Gem::Dependency
111
117
  name: tty-option
112
118
  requirement: !ruby/object:Gem::Requirement
@@ -121,48 +127,6 @@ dependencies:
121
127
  - - "~>"
122
128
  - !ruby/object:Gem::Version
123
129
  version: '0.3'
124
- - !ruby/object:Gem::Dependency
125
- name: tty-progressbar
126
- requirement: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: 0.18.3
131
- type: :runtime
132
- prerelease: false
133
- version_requirements: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: 0.18.3
138
- - !ruby/object:Gem::Dependency
139
- name: tty-prompt
140
- requirement: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '0.23'
145
- type: :runtime
146
- prerelease: false
147
- version_requirements: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '0.23'
152
- - !ruby/object:Gem::Dependency
153
- name: tty-reader
154
- requirement: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '0.9'
159
- type: :runtime
160
- prerelease: false
161
- version_requirements: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.9'
166
130
  - !ruby/object:Gem::Dependency
167
131
  name: tty-screen
168
132
  requirement: !ruby/object:Gem::Requirement
@@ -177,34 +141,6 @@ dependencies:
177
141
  - - "~>"
178
142
  - !ruby/object:Gem::Version
179
143
  version: '0.8'
180
- - !ruby/object:Gem::Dependency
181
- name: tty-spinner
182
- requirement: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: 0.9.3
187
- type: :runtime
188
- prerelease: false
189
- version_requirements: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: 0.9.3
194
- - !ruby/object:Gem::Dependency
195
- name: tty-table
196
- requirement: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '0.12'
201
- type: :runtime
202
- prerelease: false
203
- version_requirements: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '0.12'
208
144
  description: TNG (Test Next Generation) is a Rails gem that automatically generates
209
145
  comprehensive test files by analyzing your Ruby code using static analysis and AI.
210
146
  It supports models, controllers, and services with intelligent test case generation.
@@ -226,8 +162,9 @@ files:
226
162
  - binaries/go-ui-darwin-arm64
227
163
  - binaries/go-ui-linux-amd64
228
164
  - binaries/go-ui-linux-arm64
229
- - binaries/tng.bundle
230
- - binaries/tng.so
165
+ - binaries/tng-darwin-arm64.bundle
166
+ - binaries/tng-linux-arm64.so
167
+ - binaries/tng-linux-x86_64.so
231
168
  - lib/generators/tng/install_generator.rb
232
169
  - lib/tng.rb
233
170
  - lib/tng/analyzers/controller.rb
@@ -242,20 +179,9 @@ files:
242
179
  - lib/tng/services/test_generator.rb
243
180
  - lib/tng/services/testng.rb
244
181
  - lib/tng/services/user_app_config.rb
245
- - lib/tng/ui/about_display.rb
246
- - lib/tng/ui/authentication_warning_display.rb
247
- - lib/tng/ui/configuration_display.rb
248
- - lib/tng/ui/controller_test_flow_display.rb
249
- - lib/tng/ui/display_banner.rb
250
- - lib/tng/ui/goodbye_display.rb
251
- - lib/tng/ui/model_test_flow_display.rb
252
- - lib/tng/ui/other_test_flow_display.rb
182
+ - lib/tng/ui/go_ui_session.rb
253
183
  - lib/tng/ui/post_install_box.rb
254
- - lib/tng/ui/service_test_flow_display.rb
255
- - lib/tng/ui/show_help.rb
256
- - lib/tng/ui/system_status_display.rb
257
184
  - lib/tng/ui/theme.rb
258
- - lib/tng/ui/user_stats_display.rb
259
185
  - lib/tng/utils.rb
260
186
  - lib/tng/version.rb
261
187
  - tng.gemspec
@@ -265,33 +191,36 @@ licenses:
265
191
  metadata:
266
192
  allowed_push_host: https://rubygems.org
267
193
  homepage_uri: https://tng.sh/
268
- source_code_uri: https://github.com/tng-sh/tng-rails
269
- license_uri: https://github.com/tng-sh/tng-rails/blob/master/LICENSE.md
194
+ source_code_uri: https://github.com/tng-sh/tng-rails-public
195
+ license_uri: https://github.com/tng-sh/tng-rails-public/blob/main/LICENSE.md
270
196
  post_install_message: "┌ TNG ───────────────────────────────────────────────────────────────┐\n│
271
- \ │\n│ ✅ Tng
272
- installed successfully! │\n│ │\n│
273
- \ \U0001F4CB SETUP REQUIRED │\n│
274
- \ │\n│ 1. Generate
275
- configuration: │\n│ rails g tng:install
276
- \ │\n│ │\n│
277
- \ 2. Edit configuration file: │\n│ config/initializers/tng.rb
278
- \ │\n│ │\n│
279
- \ 3. Add your license key: │\n│ config.api_key
280
- = 'your-license-key-here' │\n│ │\n│
281
- \ \U0001F4CB Check documentation for the correct authentication setup │\n│
282
- \ │\n│ \U0001F680
283
- Usage: │\n│ │\n│
284
- \ Interactive mode: │\n│ • bundle
285
- exec tng - Interactive CLI with method selection │\n│ │\n│
286
- \ Features: │\n│ • Test
287
- 20+ file types: Controllers, Models, Services + Jobs, │\n│ Helpers, Lib, Policies,
288
- Presenters, Mailers, GraphQL, and more │\n│ • Select specific methods to test
289
- \ │\n│ Search and filter through methods │\n│
290
- \ │\n│ Help:
291
- \ │\n│ • bundle exec
292
- tng --help - Show help information │\n│ │\n│
293
- \ \U0001F4A1 Generate tests for individual methods with precision │\n└────────────────────────────────────────────────────────────
294
- v0.3.0 ┘\n"
197
+ \ │\n│ \e[32;1m
198
+ Tng installed successfully!\e[0m │\n│ │\n│
199
+ \ \e[31;1m\U0001F4CB SETUP REQUIRED\e[0m │\n│
200
+ \ │\n│ \e[37m1.
201
+ Generate configuration:\e[0m │\n│ \e[34m
202
+ \ rails g tng:install\e[0m │\n│ │\n│
203
+ \ \e[37m2. Edit configuration file:\e[0m │\n│
204
+ \ \e[34m config/initializers/tng.rb\e[0m │\n│
205
+ \ │\n│ \e[37m3.
206
+ Add your license key:\e[0m │\n│ \e[34m
207
+ \ config.api_key = 'your-license-key-here'\e[0m │\n│ │\n│
208
+ \ \e[37m\U0001F4CB Check documentation for the correct authentication setup\e[0m
209
+ \ │\n│ │\n│
210
+ \ \e[31;1m\U0001F680 Usage:\e[0m │\n│
211
+ \ │\n│ \e[37mInteractive
212
+ mode:\e[0m │\n│ \e[32mbundle
213
+ exec tng\e[0m\e[37m - Interactive CLI with method selection\e[0m │\n│ │\n│
214
+ \ \e[37mFeatures:\e[0m │\n│
215
+ \ \e[32mTest 20+ file types: Controllers, Models, Services + Jobs, \e[0m │\n│
216
+ \ \e[32mHelpers, Lib, Policies, Presenters, Mailers, GraphQL, and more\e[0m │\n│
217
+ \ \e[32m• Select specific methods to test\e[0m │\n│
218
+ \ \e[32m• Search and filter through methods\e[0m │\n│
219
+ \ │\n│ \e[37mHelp:\e[0m
220
+ \ │\n│ \e[32m• bundle
221
+ exec tng --help\e[0m\e[37m - Show help information\e[0m │\n│ │\n│
222
+ \ \e[37m\U0001F4A1 Generate tests for individual methods with precision\e[0m │\n└────────────────────────────────────────────────────────────
223
+ v0.3.3 ┘\n"
295
224
  rdoc_options: []
296
225
  require_paths:
297
226
  - lib
@@ -304,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
304
233
  requirements:
305
234
  - - ">="
306
235
  - !ruby/object:Gem::Version
307
- version: 3.3.11
236
+ version: '3.0'
308
237
  requirements: []
309
238
  rubygems_version: 3.6.7
310
239
  specification_version: 4
data/binaries/tng.bundle DELETED
Binary file
data/binaries/tng.so DELETED
Binary file
@@ -1,66 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tty-box"
4
- require "pastel"
5
- require "tty-screen"
6
- require_relative "theme"
7
-
8
- class AboutDisplay
9
- def initialize(pastel, prompt, version)
10
- @pastel = pastel
11
- @prompt = prompt
12
- @version = version
13
- @terminal_width = begin
14
- TTY::Screen.width
15
- rescue StandardError
16
- 80
17
- end
18
- end
19
-
20
- def display
21
- about_content = [
22
- "",
23
- @pastel.public_send(Tng::UI::Theme.color(:secondary),
24
- "Tng is an LLM-powered test generation tool for Rails applications."),
25
- "",
26
- @pastel.public_send(Tng::UI::Theme.color(:accent), "Features:"),
27
- @pastel.public_send(Tng::UI::Theme.color(:muted),
28
- "#{Tng::UI::Theme.icon(:bullet)} 20+ Rails file types supported"),
29
- @pastel.public_send(Tng::UI::Theme.color(:muted),
30
- "#{Tng::UI::Theme.icon(:bullet)} Core: Controllers, Models, Services"),
31
- @pastel.public_send(Tng::UI::Theme.color(:muted),
32
- "#{Tng::UI::Theme.icon(:bullet)} Extended: Jobs, Helpers, Lib, Policies, Presenters, Mailers, GraphQL + more"),
33
- @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} LLM-powered test suggestions"),
34
- @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} Test coverage analysis"),
35
- "",
36
- @pastel.public_send(Tng::UI::Theme.color(:accent), "Technology:"),
37
- @pastel.public_send(Tng::UI::Theme.color(:muted),
38
- "#{Tng::UI::Theme.icon(:bullet)} Static code analysis with Prism"),
39
- @pastel.public_send(Tng::UI::Theme.color(:muted),
40
- "#{Tng::UI::Theme.icon(:bullet)} Intelligent pattern recognition"),
41
- @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} Rails-specific optimizations"),
42
- "",
43
- @pastel.public_send(Tng::UI::Theme.color(:muted), "Version: #{@version}"),
44
- @pastel.public_send(Tng::UI::Theme.color(:muted),
45
- "Built with #{Tng::UI::Theme.icon(:heart)} for Rails developers")
46
- ].join("\n")
47
-
48
- box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
49
- style = Tng::UI::Theme.box_style(:default)
50
-
51
- about_box = TTY::Box.frame(
52
- title: { top_left: " About Tng " },
53
- style: style[:style],
54
- padding: style[:padding],
55
- width: box_width
56
- ) do
57
- about_content
58
- end
59
-
60
- puts Tng::UI::Theme.center_box(about_box, box_width, @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
- ))
65
- end
66
- end
@@ -1,122 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tty-box"
4
- require "pastel"
5
- require "tty-screen"
6
- require_relative "theme"
7
-
8
- class AuthenticationWarningDisplay
9
- def initialize(pastel)
10
- @pastel = pastel
11
- @terminal_width = begin
12
- TTY::Screen.width
13
- rescue StandardError
14
- 80
15
- end
16
- end
17
-
18
- def display_if_missing
19
- return false unless authentication_config_missing?
20
-
21
- display_warning
22
- handle_user_choice
23
- end
24
-
25
- def display_warning
26
- warning_content = [
27
- @pastel.public_send(Tng::UI::Theme.color(:error)).bold("Authentication Configuration Missing"),
28
- "",
29
- @pastel.public_send(Tng::UI::Theme.color(:primary), "TNG needs authentication setup to generate proper tests."),
30
- "",
31
- @pastel.public_send(Tng::UI::Theme.color(:accent), "Missing: ") + build_missing_items_summary,
32
- "",
33
- @pastel.public_send(Tng::UI::Theme.color(:secondary), "Quick fix:"),
34
- @pastel.public_send(Tng::UI::Theme.color(:muted),
35
- "#{Tng::UI::Theme.icon(:bullet)} Edit config/initializers/tng.rb"),
36
- @pastel.public_send(Tng::UI::Theme.color(:muted),
37
- "#{Tng::UI::Theme.icon(:bullet)} Uncomment authentication_methods array"),
38
- @pastel.public_send(Tng::UI::Theme.color(:muted), "#{Tng::UI::Theme.icon(:bullet)} Add your auth method details"),
39
- "",
40
- @pastel.public_send(Tng::UI::Theme.color(:success), "Press Enter to continue anyway"),
41
- @pastel.public_send(Tng::UI::Theme.color(:error), "Press Esc to cancel and fix configuration")
42
- ].join("\n")
43
-
44
- box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
45
- style = Tng::UI::Theme.box_style(:warning)
46
-
47
- warning_box = TTY::Box.frame(
48
- title: { top_left: " Auth Warning " },
49
- style: style[:style],
50
- padding: style[:padding],
51
- width: box_width
52
- ) do
53
- warning_content
54
- end
55
-
56
- puts Tng::UI::Theme.center_box(warning_box, box_width, @terminal_width)
57
- puts
58
- end
59
-
60
- private
61
-
62
- def handle_user_choice
63
- require "io/console"
64
-
65
- loop do
66
- key = $stdin.getch
67
- case key
68
- when "\r", "\n" # Enter key
69
- return false # Continue anyway
70
- when "\e" # Escape key
71
- return true # Cancel (authentication missing)
72
- when "\u0003" # Ctrl+C
73
- puts "\n#{@pastel.public_send(Tng::UI::Theme.color(:warning), "Operation cancelled.")}"
74
- exit(0)
75
- end
76
- end
77
- rescue StandardError
78
- # Fallback if getch is not available
79
- puts @pastel.public_send(Tng::UI::Theme.color(:muted), "Press Enter to continue or Ctrl+C to cancel...")
80
- gets
81
- false
82
- end
83
-
84
- def build_missing_items_summary
85
- issues = []
86
-
87
- issues << "empty auth methods" if Tng.authentication_enabled && authentication_methods_empty?
88
-
89
- issues << "invalid auth config" if !authentication_methods_empty? && !authentication_methods_valid?
90
-
91
- issues << "auth disabled" unless Tng.authentication_enabled
92
-
93
- issues.empty? ? "unknown issue" : issues.join(", ")
94
- end
95
-
96
- def authentication_config_missing?
97
- # Check if authentication is enabled but methods are not configured
98
- return true if Tng.authentication_enabled && authentication_methods_empty?
99
-
100
- # Check if authentication methods exist but are invalid
101
- return true if !authentication_methods_empty? && !authentication_methods_valid?
102
-
103
- false
104
- end
105
-
106
- def authentication_methods_empty?
107
- methods = Tng.authentication_methods
108
- methods.nil? || methods.empty?
109
- end
110
-
111
- def authentication_methods_valid?
112
- methods = Tng.authentication_methods
113
- return false if methods.nil? || methods.empty?
114
-
115
- methods.all? do |method|
116
- method.is_a?(Hash) &&
117
- method.key?(:method) && !method[:method].to_s.strip.empty? &&
118
- method.key?(:file_location) && !method[:file_location].to_s.strip.empty? &&
119
- method.key?(:auth_type) && !method[:auth_type].to_s.strip.empty?
120
- end
121
- end
122
- end
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tty-box"
4
- require "pastel"
5
- require "tty-screen"
6
- require_relative "theme"
7
-
8
- class ConfigurationDisplay
9
- def initialize(pastel)
10
- @pastel = pastel
11
- @terminal_width = begin
12
- TTY::Screen.width
13
- rescue StandardError
14
- 80
15
- end
16
- end
17
-
18
- def display_missing_config(missing_config)
19
- config_content = [
20
- @pastel.public_send(Tng::UI::Theme.color(:error)).bold("Configuration Required"),
21
- "",
22
- @pastel.public_send(Tng::UI::Theme.color(:accent), "Missing required configuration:"),
23
- missing_config.map do |key|
24
- @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:bullet)} #{key}")
25
- end.join("\n"),
26
- "",
27
- @pastel.public_send(Tng::UI::Theme.color(:secondary), "Quick fix:"),
28
- @pastel.public_send(Tng::UI::Theme.color(:muted),
29
- "#{Tng::UI::Theme.icon(:bullet)} Edit config/initializers/tng.rb"),
30
- @pastel.public_send(Tng::UI::Theme.color(:muted),
31
- "#{Tng::UI::Theme.icon(:bullet)} Set your API key and other required values"),
32
- "",
33
- @pastel.public_send(Tng::UI::Theme.color(:success), "Press Enter to continue after fixing"),
34
- @pastel.public_send(Tng::UI::Theme.color(:error), "Press Ctrl+C to exit")
35
- ].join("\n")
36
-
37
- box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
38
- style = Tng::UI::Theme.box_style(:error)
39
-
40
- config_box = TTY::Box.frame(
41
- title: { top_left: " Config Required " },
42
- style: style[:style],
43
- padding: style[:padding],
44
- width: box_width
45
- ) do
46
- config_content
47
- end
48
-
49
- puts Tng::UI::Theme.center_box(config_box, box_width, @terminal_width)
50
- puts
51
- end
52
- end
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tty-prompt"
4
- require "tty-spinner"
5
- require "pastel"
6
- require "tty-screen"
7
- require_relative "theme"
8
-
9
- class ControllerTestFlowDisplay
10
- def initialize(prompt, pastel)
11
- @prompt = prompt
12
- @pastel = pastel
13
- @terminal_width = begin
14
- TTY::Screen.width
15
- rescue StandardError
16
- 80
17
- end
18
- end
19
-
20
- def select_controller(controllers)
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)
23
-
24
- @prompt.select(
25
- "",
26
- cycle: true,
27
- per_page: 12,
28
- filter: true,
29
- symbols: { marker: Tng::UI::Theme.icon(:marker) }
30
- ) do |menu|
31
- controllers.each do |controller|
32
- display_name = "#{controller[:name]} #{@pastel.public_send(Tng::UI::Theme.color(:muted),
33
- "(#{controller[:path]})")}"
34
- menu.choice display_name, controller
35
- end
36
- menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
37
- end
38
- end
39
-
40
- def show_no_controllers_message
41
- 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(
42
- Tng::UI::Theme.color(:muted), "Make sure you have controllers in app/controllers/"
43
- )}"
44
- puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
45
- @prompt.keypress(Tng::UI::Theme.center_text(
46
- @pastel.public_send(Tng::UI::Theme.color(:muted),
47
- "Press any key to continue..."), @terminal_width
48
- ))
49
- end
50
-
51
- def select_controller_method(controller, methods)
52
- header = @pastel.public_send(Tng::UI::Theme.color(:primary)).bold("#{Tng::UI::Theme.icon(:rocket)} Select method to test in #{controller[:name]}")
53
- puts Tng::UI::Theme.center_text(header, @terminal_width)
54
-
55
- @prompt.select(
56
- "",
57
- cycle: true,
58
- per_page: 10,
59
- filter: true,
60
- symbols: { marker: Tng::UI::Theme.icon(:marker) }
61
- ) do |menu|
62
- methods.each do |method|
63
- menu.choice method[:name], method
64
- end
65
- menu.choice @pastel.public_send(Tng::UI::Theme.color(:secondary), "#{Tng::UI::Theme.icon(:back)} Back"), :back
66
- end
67
- end
68
-
69
- def show_no_methods_message(controller)
70
- 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(
71
- Tng::UI::Theme.color(:muted), "Controller may be empty or have syntax errors"
72
- )}"
73
- puts Tng::UI::Theme.center_text(error_msg, @terminal_width)
74
- @prompt.keypress(Tng::UI::Theme.center_text(
75
- @pastel.public_send(Tng::UI::Theme.color(:muted),
76
- "Press any key to continue..."), @terminal_width
77
- ))
78
- end
79
- end
@@ -1,44 +0,0 @@
1
- require "tty-box"
2
- require "pastel"
3
- require "tty-screen"
4
- require_relative "theme"
5
-
6
- class DisplayBanner
7
- attr_reader :pastel, :version, :terminal_width
8
-
9
- def initialize(pastel, version)
10
- @pastel = pastel
11
- @version = version
12
- @terminal_width = begin
13
- TTY::Screen.width
14
- rescue StandardError
15
- 80
16
- end
17
- end
18
-
19
- def render
20
- banner_content = [
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}"),
23
- "",
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")
26
- ].join("\n")
27
-
28
- box_width = 64
29
- box_width = terminal_width if box_width > terminal_width
30
- style = Tng::UI::Theme.box_style(:default)
31
-
32
- box = TTY::Box.frame(
33
- title: { top_left: " Tng ", bottom_right: " Ready " },
34
- style: style[:style],
35
- padding: style[:padding],
36
- align: :center,
37
- width: box_width
38
- ) do
39
- banner_content
40
- end
41
-
42
- "#{Tng::UI::Theme.center_box(box, box_width, terminal_width)}\n"
43
- end
44
- end
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "tty-box"
4
- require "pastel"
5
- require "tty-screen"
6
- require_relative "theme"
7
-
8
- class GoodbyeDisplay
9
- def initialize(pastel)
10
- @pastel = pastel
11
- @terminal_width = begin
12
- TTY::Screen.width
13
- rescue StandardError
14
- 80
15
- end
16
- end
17
-
18
- def display
19
- box_width = Tng::UI::Theme.calculate_box_width(@terminal_width)
20
- style = Tng::UI::Theme.box_style(:success)
21
-
22
- goodbye_box = TTY::Box.frame(
23
- title: { top_left: " Thank You " },
24
- style: style[:style],
25
- padding: style[:padding],
26
- align: :center,
27
- width: box_width
28
- ) do
29
- [
30
- @pastel.public_send(Tng::UI::Theme.color(:success)).bold("Thanks for using Tng!"),
31
- "",
32
- @pastel.public_send(Tng::UI::Theme.color(:secondary), "Happy testing!"),
33
- "",
34
- @pastel.public_send(Tng::UI::Theme.color(:muted), "Your Rails tests are now supercharged with LLM")
35
- ].join("\n")
36
- end
37
-
38
- puts Tng::UI::Theme.center_box(goodbye_box, box_width, @terminal_width)
39
- puts
40
- end
41
- end