tng 0.4.6 → 0.4.7
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.
- checksums.yaml +4 -4
- data/binaries/go-ui-darwin-amd64 +0 -0
- data/binaries/go-ui-darwin-arm64 +0 -0
- data/binaries/go-ui-linux-amd64 +0 -0
- data/binaries/go-ui-linux-arm64 +0 -0
- data/binaries/tng-darwin-arm64.bundle +0 -0
- data/binaries/tng-darwin-x86_64.bundle +0 -0
- data/binaries/tng-linux-arm64.so +0 -0
- data/binaries/tng-linux-x86_64.so +0 -0
- data/binaries/tng.bundle +0 -0
- data/lib/tng/ui/go_ui_session.rb +54 -52
- data/lib/tng/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7727b2d4c08387a0e8c876ec10b2a8f6eccd489012bd9f67a0a603edc3ac2355
|
|
4
|
+
data.tar.gz: 7bcd5620b9d3f655a535a340bcdeff03dc55732026f3778e99cea0dba1bfea82
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54e4257601da9e968ce490c289d5bc51988d24940cc8c4879a172622edbb789c0512f3aa3b787c2262fe4370869ed21c15f3e0c8a9816b81458eff491f0cc62f
|
|
7
|
+
data.tar.gz: da6a48c02b0a509c80fbee1192737176b193743e21e34320aa4a868224ae9de3cc9ef3dcce1ade936ece5297c89f5770759adc18f6e4e56979aee18fdc66dc0a
|
data/binaries/go-ui-darwin-amd64
CHANGED
|
Binary file
|
data/binaries/go-ui-darwin-arm64
CHANGED
|
Binary file
|
data/binaries/go-ui-linux-amd64
CHANGED
|
Binary file
|
data/binaries/go-ui-linux-arm64
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/binaries/tng-linux-arm64.so
CHANGED
|
Binary file
|
|
Binary file
|
data/binaries/tng.bundle
CHANGED
|
Binary file
|
data/lib/tng/ui/go_ui_session.rb
CHANGED
|
@@ -28,9 +28,7 @@ module Tng
|
|
|
28
28
|
# Show main menu and return selected choice
|
|
29
29
|
# Returns: "tests", "stats", "about", "exit"
|
|
30
30
|
def show_menu
|
|
31
|
-
|
|
32
|
-
output_path = output_file.path
|
|
33
|
-
output_file.close
|
|
31
|
+
output_path = _create_temp_file("go_ui_menu", ".json")
|
|
34
32
|
|
|
35
33
|
begin
|
|
36
34
|
system(@binary_path, "menu", "--output", output_path)
|
|
@@ -42,15 +40,13 @@ module Tng
|
|
|
42
40
|
rescue StandardError
|
|
43
41
|
"exit"
|
|
44
42
|
ensure
|
|
45
|
-
|
|
43
|
+
_cleanup_temp_file(output_path)
|
|
46
44
|
end
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
# Returns: "controller", "model", "service", "other", "back"
|
|
50
48
|
def show_test_type_menu(mode = "test")
|
|
51
|
-
|
|
52
|
-
output_path = output_file.path
|
|
53
|
-
output_file.close
|
|
49
|
+
output_path = _create_temp_file("go_ui_test_type", ".json")
|
|
54
50
|
|
|
55
51
|
begin
|
|
56
52
|
system(@binary_path, "rails-test-menu", "--output", output_path, "--mode", mode)
|
|
@@ -62,14 +58,12 @@ module Tng
|
|
|
62
58
|
rescue StandardError
|
|
63
59
|
"back"
|
|
64
60
|
ensure
|
|
65
|
-
|
|
61
|
+
_cleanup_temp_file(output_path)
|
|
66
62
|
end
|
|
67
63
|
end
|
|
68
64
|
# Returns: "1", "2", "all", "back"
|
|
69
65
|
def show_clone_menu
|
|
70
|
-
|
|
71
|
-
output_path = output_file.path
|
|
72
|
-
output_file.close
|
|
66
|
+
output_path = _create_temp_file("go_ui_clone_menu", ".json")
|
|
73
67
|
|
|
74
68
|
begin
|
|
75
69
|
system(@binary_path, "clone-menu", "--output", output_path)
|
|
@@ -81,40 +75,34 @@ module Tng
|
|
|
81
75
|
rescue StandardError
|
|
82
76
|
"back"
|
|
83
77
|
ensure
|
|
84
|
-
|
|
78
|
+
_cleanup_temp_file(output_path)
|
|
85
79
|
end
|
|
86
80
|
end
|
|
87
81
|
|
|
88
|
-
# @return [String] Selected item name or "back"
|
|
89
82
|
def show_list_view(title, items)
|
|
90
83
|
data_json = JSON.generate({ title: title, items: items })
|
|
91
|
-
|
|
92
|
-
output_file = Tempfile.new(["go_ui_list", ".txt"])
|
|
93
|
-
output_path = output_file.path
|
|
94
|
-
output_file.close
|
|
84
|
+
output_path = _create_temp_file("go_ui_list", ".txt")
|
|
95
85
|
|
|
96
86
|
begin
|
|
97
87
|
system(@binary_path, "list-view", "--data", data_json, "--output", output_path)
|
|
98
88
|
|
|
99
89
|
selected = File.read(output_path).strip
|
|
100
90
|
selected.empty? ? "back" : selected
|
|
91
|
+
rescue StandardError
|
|
92
|
+
"back"
|
|
101
93
|
ensure
|
|
102
|
-
|
|
94
|
+
_cleanup_temp_file(output_path)
|
|
103
95
|
end
|
|
104
96
|
end
|
|
105
97
|
|
|
106
98
|
def show_spinner(message)
|
|
107
|
-
|
|
108
|
-
control_path = control_file.path
|
|
109
|
-
control_file.close
|
|
99
|
+
control_path = _create_temp_file("go_ui_spinner", ".json")
|
|
110
100
|
|
|
111
|
-
# Start spinner in background
|
|
112
101
|
pid = spawn(@binary_path, "spinner", "--message", message, "--control", control_path)
|
|
113
102
|
|
|
114
103
|
begin
|
|
115
104
|
result = yield
|
|
116
105
|
|
|
117
|
-
# Write completion status
|
|
118
106
|
status = {
|
|
119
107
|
status: result&.dig(:success) ? "success" : "error",
|
|
120
108
|
message: result&.dig(:message) || "Done!"
|
|
@@ -129,18 +117,12 @@ module Tng
|
|
|
129
117
|
Process.wait(pid)
|
|
130
118
|
raise
|
|
131
119
|
ensure
|
|
132
|
-
|
|
120
|
+
_cleanup_temp_file(control_path)
|
|
133
121
|
end
|
|
134
122
|
end
|
|
135
123
|
|
|
136
|
-
# Show progress bar with steps
|
|
137
|
-
# @param title [String] Progress title
|
|
138
|
-
# @yield [ProgressUpdater] Block receives updater and returns Hash with :message and :result
|
|
139
|
-
# @return [Hash] Result from block
|
|
140
124
|
def show_progress(title)
|
|
141
|
-
|
|
142
|
-
control_path = control_file.path
|
|
143
|
-
control_file.close
|
|
125
|
+
control_path = _create_temp_file("go_ui_progress", ".json")
|
|
144
126
|
|
|
145
127
|
# Start progress in background (inherit TTY)
|
|
146
128
|
pid = spawn(@binary_path, "progress", "--title", title, "--control", control_path)
|
|
@@ -165,7 +147,7 @@ module Tng
|
|
|
165
147
|
Process.wait(pid)
|
|
166
148
|
raise
|
|
167
149
|
ensure
|
|
168
|
-
|
|
150
|
+
_cleanup_temp_file(control_path)
|
|
169
151
|
end
|
|
170
152
|
end
|
|
171
153
|
|
|
@@ -206,10 +188,7 @@ module Tng
|
|
|
206
188
|
# @return [String] Selected choice ("run_tests", "copy_command", "back")
|
|
207
189
|
def show_post_generation_menu(file_path, run_command)
|
|
208
190
|
data_json = JSON.generate({ file_path: file_path, run_command: run_command })
|
|
209
|
-
|
|
210
|
-
output_file = Tempfile.new(["go_ui_post_gen", ".txt"])
|
|
211
|
-
output_path = output_file.path
|
|
212
|
-
output_file.close
|
|
191
|
+
output_path = _create_temp_file("go_ui_post_gen", ".txt")
|
|
213
192
|
|
|
214
193
|
begin
|
|
215
194
|
system(@binary_path, "post-generation-menu", "--data", data_json, "--output", output_path)
|
|
@@ -217,7 +196,7 @@ module Tng
|
|
|
217
196
|
choice = File.read(output_path).strip
|
|
218
197
|
choice.empty? ? "back" : choice
|
|
219
198
|
ensure
|
|
220
|
-
|
|
199
|
+
_cleanup_temp_file(output_path)
|
|
221
200
|
end
|
|
222
201
|
end
|
|
223
202
|
|
|
@@ -259,17 +238,14 @@ module Tng
|
|
|
259
238
|
|
|
260
239
|
# Send full result object via temp file to avoid CLI argument limits
|
|
261
240
|
data_json = JSON.generate(audit_result)
|
|
262
|
-
|
|
263
|
-
input_file = Tempfile.new(["go_ui_audit", ".json"])
|
|
264
|
-
input_path = input_file.path
|
|
241
|
+
input_path = _create_temp_file("go_ui_audit", ".json")
|
|
265
242
|
File.write(input_path, data_json)
|
|
266
|
-
input_file.close
|
|
267
243
|
|
|
268
244
|
system(@binary_path, command, "--file", input_path)
|
|
269
245
|
rescue StandardError => e
|
|
270
246
|
puts "Audit results error: #{e.message}"
|
|
271
247
|
ensure
|
|
272
|
-
|
|
248
|
+
_cleanup_temp_file(input_path)
|
|
273
249
|
end
|
|
274
250
|
|
|
275
251
|
# Show symbolic trace results
|
|
@@ -286,17 +262,14 @@ module Tng
|
|
|
286
262
|
def show_clones(file_path, results)
|
|
287
263
|
data = { file_path: file_path, matches: results[:matches] }
|
|
288
264
|
data_json = JSON.generate(data)
|
|
289
|
-
|
|
290
|
-
input_file = Tempfile.new(["go_ui_clones", ".json"])
|
|
291
|
-
input_path = input_file.path
|
|
265
|
+
input_path = _create_temp_file("go_ui_clones", ".json")
|
|
292
266
|
File.write(input_path, data_json)
|
|
293
|
-
input_file.close
|
|
294
267
|
|
|
295
268
|
system(@binary_path, "clones", "--file", input_path)
|
|
296
269
|
rescue StandardError => e
|
|
297
270
|
puts "Clones results error: #{e.message}"
|
|
298
271
|
ensure
|
|
299
|
-
|
|
272
|
+
_cleanup_temp_file(input_path)
|
|
300
273
|
end
|
|
301
274
|
|
|
302
275
|
# Show authentication error
|
|
@@ -429,8 +402,6 @@ module Tng
|
|
|
429
402
|
items.each { |item| puts " - #{item}" }
|
|
430
403
|
end
|
|
431
404
|
|
|
432
|
-
# Show system status
|
|
433
|
-
# @param status [Hash] Status data from testng
|
|
434
405
|
def show_system_status(status)
|
|
435
406
|
data = {
|
|
436
407
|
status: status[:status].to_s,
|
|
@@ -441,13 +412,44 @@ module Tng
|
|
|
441
412
|
server_base_url: status[:server_base_url]
|
|
442
413
|
}
|
|
443
414
|
data_json = JSON.generate(data)
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
415
|
+
input_path = _create_temp_file("go_ui_status", ".json")
|
|
416
|
+
File.write(input_path, data_json)
|
|
417
|
+
|
|
418
|
+
begin
|
|
419
|
+
system(@binary_path, "system-status", "--file", input_path)
|
|
420
|
+
rescue StandardError => e
|
|
421
|
+
puts "System status error: #{e.message}"
|
|
422
|
+
ensure
|
|
423
|
+
_cleanup_temp_file(input_path)
|
|
424
|
+
end
|
|
447
425
|
end
|
|
448
426
|
|
|
449
427
|
private
|
|
450
428
|
|
|
429
|
+
def _create_temp_file(prefix, suffix)
|
|
430
|
+
tmp_dir = Dir.tmpdir
|
|
431
|
+
file_name = "tng-#{prefix}-#{Time.now.to_i}-#{rand(1000)}#{suffix}"
|
|
432
|
+
file_path = File.join(tmp_dir, file_name)
|
|
433
|
+
|
|
434
|
+
begin
|
|
435
|
+
File.write(file_path, "")
|
|
436
|
+
file_path
|
|
437
|
+
rescue StandardError
|
|
438
|
+
# Fallback to local directory if system tmp is not writable
|
|
439
|
+
local_tmp = File.join(Dir.pwd, ".tng-tmp")
|
|
440
|
+
FileUtils.mkdir_p(local_tmp) unless Dir.exist?(local_tmp)
|
|
441
|
+
file_path = File.join(local_tmp, file_name)
|
|
442
|
+
File.write(file_path, "")
|
|
443
|
+
file_path
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
def _cleanup_temp_file(file_path)
|
|
448
|
+
File.unlink(file_path) if file_path && File.exist?(file_path)
|
|
449
|
+
rescue StandardError
|
|
450
|
+
# Ignore cleanup errors
|
|
451
|
+
end
|
|
452
|
+
|
|
451
453
|
def find_go_ui_binary
|
|
452
454
|
# Detect platform
|
|
453
455
|
platform = RUBY_PLATFORM
|
data/lib/tng/version.rb
CHANGED
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.4.
|
|
4
|
+
version: 0.4.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ralucab
|
|
@@ -222,7 +222,7 @@ post_install_message: "┌ TNG ────────────────
|
|
|
222
222
|
\ │\n│ • bundle exec
|
|
223
223
|
tng --help - Show help information │\n│ │\n│
|
|
224
224
|
\ \U0001F4A1 Generate tests for individual methods with precision │\n└────────────────────────────────────────────────────────────
|
|
225
|
-
v0.4.
|
|
225
|
+
v0.4.7 ┘\n"
|
|
226
226
|
rdoc_options: []
|
|
227
227
|
require_paths:
|
|
228
228
|
- lib
|