tng 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8117d0deac71e21186a4f542e78e5f24ec177b824b01f1d0e67c96ecce4071bc
4
+ data.tar.gz: 2de1b1a266e9910ff0e42b864eaaed3315577b7a5713db04ceaea85ea32ead5b
5
+ SHA512:
6
+ metadata.gz: 9ffad360f44acb0207e5e351a60faf60935a31be10aabc578e50a9f0bbf9ceb7b23c1828ba6973e5fdd2d7b07912662fdb9241c436b60a61a46c91cb6567af1d
7
+ data.tar.gz: efe3aabffedbfedef28b3cea9aebccaede10954e48f77d18ec3aeae3463f6d926c6565e4a7f8280a3e58bcf3afecffbd364e81cef0b82e65043881c6d2ce8841
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in tng.gemspec
6
+ gemspec
7
+
8
+ gem "irb"
9
+ gem "rake", "~> 13.0"
10
+
11
+ gem "rake-compiler"
12
+
13
+ gem "minitest", "~> 5.16"
14
+
15
+ gem "rubocop", "~> 1.21"
data/LICENSE.md ADDED
@@ -0,0 +1,32 @@
1
+ # Commercial License
2
+
3
+ Copyright (c) 2025 TNG. All rights reserved.
4
+
5
+ ## License Grant
6
+
7
+ This software is available under a commercial license. You may use this software if you have obtained a valid license from the copyright holder.
8
+
9
+ ## Restrictions
10
+
11
+ Without a valid commercial license, you may NOT:
12
+ - Use this software in any commercial or production environment
13
+ - Fork, copy, modify, or create derivative works
14
+ - Distribute, redistribute, sublicense, or sell copies
15
+ - Reverse engineer or decompile the software
16
+ - Remove or alter any copyright notices
17
+
18
+ ## Commercial Use
19
+
20
+ To obtain a commercial license for production use, contact: [claudiu@tng.sh]
21
+
22
+ ## Evaluation Use
23
+
24
+ You may evaluate this software for a period of 30 days for non-commercial purposes only.
25
+
26
+ ## Termination
27
+
28
+ Any unauthorized use will result in immediate termination of rights and may result in legal action.
29
+
30
+ ## Disclaimer
31
+
32
+ THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
data/README.md ADDED
@@ -0,0 +1,506 @@
1
+ # TNG - AI-Powered Test Generation for Rails
2
+
3
+ TNG is an AI-powered test generation tool that automatically creates comprehensive tests for your Rails applications. It analyzes your code structure, authentication patterns, and configuration to generate high-quality, contextual tests that follow your project's conventions.
4
+
5
+ ## Installation
6
+
7
+ ### Standard Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'tng'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```bash
18
+ bundle install
19
+ ```
20
+
21
+ ### Local Gem Installation
22
+
23
+ If you have a local `.gem` file (e.g., for beta versions):
24
+
25
+ #### Option 1: Direct Installation (Recommended)
26
+
27
+ ```bash
28
+ gem install ~/Downloads/tng-0.1.0.gem
29
+ ```
30
+
31
+ Then add to your `Gemfile`:
32
+ ```ruby
33
+ gem "tng", "~> 0.1.0"
34
+ ```
35
+
36
+ Run bundle install:
37
+ ```bash
38
+ bundle install
39
+ ```
40
+
41
+ #### Option 2: Vendor Path Installation
42
+
43
+ 1. Create vendor directory structure:
44
+ ```bash
45
+ mkdir -p vendor/gems
46
+ ```
47
+
48
+ 2. Unpack the gem:
49
+ ```bash
50
+ cd vendor/gems
51
+ rm -rf tng-0.1.0 # Remove existing folder if it exists
52
+ gem unpack ~/Downloads/tng-0.1.0.gem
53
+ cd ../..
54
+ ```
55
+
56
+ 3. Add to your `Gemfile`:
57
+ ```ruby
58
+ gem "tng", path: "vendor/gems/tng-0.1.0"
59
+ ```
60
+
61
+ 4. Run bundle install:
62
+ ```bash
63
+ bundle install
64
+ ```
65
+
66
+ ### Installation Troubleshooting
67
+
68
+ For detailed installation troubleshooting, see the [Troubleshooting](#troubleshooting) section.
69
+
70
+ ## Configuration
71
+
72
+ TNG requires proper configuration to generate high-quality tests. Generate the configuration file by running:
73
+
74
+ ```bash
75
+ rails generate tng:install
76
+ ```
77
+
78
+ This creates `config/initializers/tng.rb` with a configuration template that you'll need to customize for your application. The generator will attempt to detect your existing setup and pre-configure common settings.
79
+
80
+ ### Configuration Options Explained
81
+
82
+ #### API Configuration
83
+ - **`api_key`**: Your TNG API key from https://app.tng.sh/
84
+ - **`base_url`**: TNG service endpoint (automatically configured, do not modify)
85
+
86
+ #### Code Reading
87
+ - **`read_source_code`**: Analyzes the specific code file for which tests are being generated
88
+ - **`read_test_code`**: Reads existing tests for the specific file to match your testing patterns
89
+
90
+ #### Testing Framework Settings
91
+ - **`testing_framework`**: Automatically detected. Possible values: `minitest` or `rspec`
92
+
93
+ *Note: The following settings depend on your testing framework.*
94
+
95
+ **For Minitest:**
96
+ - **`test_style`**: Test organization style. Possible options:
97
+ - `test_block` - `test "does something" do ... end`
98
+ - `spec` - `it "does something" do ... end`
99
+ - `unit` - `def test_does_something ... end`
100
+ - **`assertion_style`**: Assertion syntax preference. Possible values:
101
+ - `assert/refute` - Uses syntax like `assert`, `assert_equal`, `assert_nil`, `refute`, `refute_nil`
102
+ - `assert/assert_not` - Uses syntax like `assert`, `assert_equal`, `assert_nil`, `assert_not`, `assert_not_equl`, `assert_not_nil`
103
+ - `must/wont` - `value.must_equal`, `value.must_be_instance_of`, `value.must_raise`, `value.wont_equal`, `value.wont_be_instance_of`, `value.wont_raise`
104
+
105
+ **For RSpec:**
106
+ - **`describe_style`**: Include describe blocks. Possible values: `true`, `false`
107
+ - **`context_style`**: Context block style. Possible values: `context`, `describe`
108
+ - **`it_style`**: Example block style. Possible values: `it`, `specify`
109
+ - **`before_style`**: Setup block style. Possible values: `before`, `setup`
110
+ - **`after_style`**: Teardown block style. Possible values: `after`, `teardown`
111
+ - **`let_style`**: Use let helpers. Possible values: `true`, `false`
112
+ - **`subject_style`**: Use subject helpers. Possible values: `true`, `false`
113
+
114
+ #### Authentication Methods
115
+ Supported authentication types:
116
+ - **`session`**: Session-based authentication
117
+ - **`devise`**: Devise gem integration
118
+ - **`jwt`**: JSON Web Token authentication
119
+ - **`token_auth`**: Token-based authentication
120
+ - **`basic_auth`**: HTTP Basic Authentication
121
+ - **`oauth`**: OAuth authentication
122
+ - **`headers`**: Custom header authentication
123
+ - **`custom`**: Custom authentication logic
124
+
125
+ #### Mock and Factory Libraries
126
+ - **`mock_library`**: Mock library preference
127
+ - **For Minitest**: `minitest/mock`, `mocha`, `nil`
128
+ - **For RSpec**: `rspec-mocks`, `mocha`, `flexmock`, `nil`
129
+ - **`http_mock_library`**: HTTP mocking library. Possible values: `webmock`, `vcr`, `httparty`, `nil`
130
+ - **`factory_library`**: Factory library preference. Possible values: `factory_bot`, `factory_girl`, `fabrication`, `fabricator`, `fixtures`, `active_record`
131
+
132
+ ## Configuration Examples
133
+
134
+ ### Minitest with FactoryBot Setup
135
+
136
+ ```ruby
137
+ # config/initializers/tng.rb
138
+ Tng.configure do |config|
139
+ config.api_key = ENV["TNG_API_KEY"]
140
+ config.base_url = "https://app.tng.sh/"
141
+
142
+ config.read_source_code = true
143
+ config.read_test_code = true
144
+
145
+ config.testing_framework = "minitest"
146
+ config.test_style = "test_block"
147
+ config.assertion_style = "assert/refute"
148
+ config.setup_style = true
149
+ config.teardown_style = false
150
+
151
+ config.mock_library = "minitest/mock"
152
+ config.http_mock_library = "webmock"
153
+ config.factory_library = "factory_bot"
154
+
155
+ config.authentication_enabled = true
156
+ config.authentication_methods = [
157
+ {
158
+ method: "authenticate_user!",
159
+ file_location: "app/controllers/application_controller.rb",
160
+ auth_type: "session"
161
+ }
162
+ ]
163
+ end
164
+ ```
165
+
166
+ ### RSpec with FactoryBot Setup
167
+
168
+ ```ruby
169
+ # config/initializers/tng.rb
170
+ Tng.configure do |config|
171
+ config.api_key = ENV["TNG_API_KEY"]
172
+ config.base_url = "https://app.tng.sh/"
173
+
174
+ config.read_source_code = true
175
+ config.read_test_code = true
176
+
177
+ config.testing_framework = "rspec"
178
+ config.assertion_style = "expect"
179
+ config.describe_style = true
180
+ config.context_style = "context"
181
+ config.it_style = "it"
182
+ config.before_style = "before"
183
+ config.after_style = "after"
184
+ config.let_style = true
185
+ config.subject_style = true
186
+
187
+ config.mock_library = "rspec-mocks"
188
+ config.http_mock_library = "webmock"
189
+ config.factory_library = "factory_bot"
190
+
191
+ config.authentication_enabled = true
192
+ config.authentication_methods = [
193
+ {
194
+ method: "authenticate_user!",
195
+ file_location: "app/controllers/application_controller.rb",
196
+ auth_type: "devise"
197
+ }
198
+ ]
199
+ end
200
+ ```
201
+
202
+ ### API-Only Application with Token Authentication
203
+
204
+ ```ruby
205
+ # config/initializers/tng.rb
206
+ Tng.configure do |config|
207
+ config.api_key = ENV["TNG_API_KEY"]
208
+ config.base_url = "https://app.tng.sh/"
209
+
210
+ config.read_source_code = true
211
+ config.read_test_code = true
212
+
213
+ config.testing_framework = "minitest"
214
+ config.test_style = "test_block"
215
+ config.assertion_style = "assert/refute"
216
+
217
+ config.mock_library = "minitest/mock"
218
+ config.http_mock_library = "webmock"
219
+ config.factory_library = "fixtures"
220
+
221
+ config.authentication_enabled = true
222
+ config.authentication_methods = [
223
+ {
224
+ method: "authenticate_via_token!",
225
+ file_location: "app/controllers/application_controller.rb",
226
+ auth_type: "headers"
227
+ }
228
+ ]
229
+ end
230
+ ```
231
+
232
+ ### Multiple Authentication Methods
233
+
234
+ ```ruby
235
+ # config/initializers/tng.rb
236
+ Tng.configure do |config|
237
+ config.api_key = ENV["TNG_API_KEY"]
238
+ config.base_url = "https://app.tng.sh/"
239
+
240
+ config.read_source_code = true
241
+ config.read_test_code = true
242
+
243
+ config.testing_framework = "rspec"
244
+ config.assertion_style = "expect"
245
+ config.let_style = true
246
+
247
+ config.mock_library = "rspec-mocks"
248
+ config.http_mock_library = "webmock"
249
+ config.factory_library = "factory_bot"
250
+
251
+ config.authentication_enabled = true
252
+ config.authentication_methods = [
253
+ {
254
+ method: "authenticate_user!",
255
+ file_location: "app/controllers/application_controller.rb",
256
+ auth_type: "session"
257
+ },
258
+ {
259
+ method: "authenticate_api_user!",
260
+ file_location: "app/controllers/api/base_controller.rb",
261
+ auth_type: "token_auth"
262
+ }
263
+ ]
264
+
265
+ config.authorization_library = "pundit"
266
+ end
267
+ ```
268
+
269
+ ## Advanced Configuration
270
+
271
+ ### Custom Authentication Setup
272
+
273
+ For applications with custom authentication logic that doesn't fit standard patterns:
274
+
275
+ ```ruby
276
+ config.authentication_methods = [
277
+ {
278
+ method: "verify_custom_auth!",
279
+ file_location: "app/controllers/concerns/custom_auth.rb",
280
+ auth_type: "custom"
281
+ }
282
+ ]
283
+ ```
284
+
285
+ #### Rails API Application
286
+
287
+ ```ruby
288
+ config.authentication_enabled = true
289
+ config.authentication_methods = [
290
+ {
291
+ method: "authenticate_with_token",
292
+ file_location: "app/controllers/application_controller.rb",
293
+ auth_type: "jwt"
294
+ }
295
+ ]
296
+ config.factory_library = "fixtures" # Often simpler for API apps
297
+ ```
298
+
299
+ #### Multi-Tenant Application
300
+
301
+ ```ruby
302
+ config.authentication_methods = [
303
+ {
304
+ method: "authenticate_tenant!",
305
+ file_location: "app/controllers/application_controller.rb",
306
+ auth_type: "custom"
307
+ },
308
+ {
309
+ method: "authenticate_user!",
310
+ file_location: "app/controllers/application_controller.rb",
311
+ auth_type: "devise"
312
+ }
313
+ ]
314
+ ```
315
+
316
+ #### Legacy Application with Mixed Authentication
317
+
318
+ ```ruby
319
+ config.authentication_methods = [
320
+ {
321
+ method: "authenticate_admin!",
322
+ file_location: "app/controllers/admin/base_controller.rb",
323
+ auth_type: "basic_auth"
324
+ },
325
+ {
326
+ method: "authenticate_user!",
327
+ file_location: "app/controllers/application_controller.rb",
328
+ auth_type: "session"
329
+ },
330
+ {
331
+ method: "authenticate_api_key!",
332
+ file_location: "app/controllers/api/v1/base_controller.rb",
333
+ auth_type: "headers"
334
+ }
335
+ ]
336
+ ```
337
+
338
+ ## Usage Patterns
339
+
340
+ ### Interactive Mode
341
+
342
+ The recommended way to use TNG for beginners and exploratory testing:
343
+
344
+ ```bash
345
+ bundle exec tng
346
+ ```
347
+
348
+ This launches an interactive session where you can:
349
+ - Browse your application structure
350
+ - Select files to generate tests for
351
+ - Preview generated tests before saving
352
+ - Adjust configuration on the fly
353
+
354
+ ### Direct Mode
355
+
356
+ Generate tests directly from the command line without interactive prompts:
357
+
358
+ #### Standard Format
359
+ ```bash
360
+ bundle exec tng --type=controller --file=users_controller
361
+ bundle exec tng --type=controller --file="admin/users_controller"
362
+ bundle exec tng --type=model --file=user
363
+ bundle exec tng --type=model --file="blog/post"
364
+ ```
365
+
366
+ #### Short Aliases
367
+ ```bash
368
+ # Super concise - perfect for quick generation
369
+ bundle exec tng -t c -f ping
370
+ bundle exec tng -t m -f user
371
+
372
+ # Mixed format also works
373
+ bundle exec tng --type=c --file=ping
374
+ bundle exec tng -t controller -f users_controller
375
+ ```
376
+
377
+ Use `bundle exec tng --help` for more options.
378
+
379
+ ### Debug Mode
380
+
381
+ For troubleshooting configuration or generation issues:
382
+
383
+ ```bash
384
+ # Interactive mode with debug on
385
+ DEBUG=1 bundle exec tng
386
+
387
+ # Direct mode with debug
388
+ DEBUG=1 bundle exec tng -t c -f ping
389
+ ```
390
+
391
+ ### Help and Options
392
+
393
+ ```bash
394
+ bundle exec tng --help # Show help message
395
+ bundle exec tng -h # Short help
396
+ ```
397
+
398
+ ## Troubleshooting
399
+
400
+ ### Installation Issues
401
+
402
+ #### Gem Installation Problems
403
+
404
+ **Error: "Could not find gem 'tng'"**
405
+ - Ensure you installed the gem file first: `gem install ~/Downloads/tng-0.1.0.gem`
406
+ - Check installed gems: `gem list tng`
407
+ - Verify gem name and version in Gemfile matches installed gem
408
+
409
+ **Error: "No such file ~/Downloads/tng-0.1.0.gem"**
410
+ - Verify correct path to downloaded gem file
411
+ - Use `ls ~/Downloads/tng*` to check exact filename
412
+
413
+ **Error: "Could not find gem 'tng' in source" (vendor path)**
414
+ - Verify path points to correct unpacked directory
415
+ - Ensure `vendor/gems/tng-0.1.0/` contains `.gemspec` file
416
+ - Check gem was unpacked correctly: `gem unpack ~/Downloads/tng-0.1.0.gem`
417
+
418
+ #### Binary Loading Problems
419
+
420
+ **Error: "Native extension not found"**
421
+ - Check your platform is supported (macOS or Linux x86_64)
422
+ - Verify binary exists: `ls vendor/gems/tng-*/lib/tng/`
423
+ - Try reinstalling: `bundle install --force`
424
+
425
+ **Error: "Symbol not found" or "Library not loaded"**
426
+ - macOS: Ensure you have Xcode command line tools: `xcode-select --install`
427
+ - Linux: Ensure glibc compatibility
428
+ - Try clearing gem cache: `gem cleanup tng`
429
+
430
+ ### Configuration Issues
431
+
432
+ #### API Key Problems
433
+
434
+ **Error: "Invalid API key"**
435
+ - Verify your API key from https://app.tng.sh/
436
+ - Check environment variable: `echo $TNG_API_KEY`
437
+ - Ensure no extra spaces in `.env` file: `TNG_API_KEY=your_key_here`
438
+
439
+ **Error: "API key not found"**
440
+ - Set environment variable: `export TNG_API_KEY=your_key`
441
+ - Or add to `.env` file: `TNG_API_KEY=your_key`
442
+ - Restart Rails server after changing environment variables
443
+
444
+ #### Configuration Validation
445
+
446
+ **Error: "Invalid configuration"**
447
+ - Run configuration check: `rails console` then `Tng.configuration`
448
+ - Verify all required settings are present
449
+ - Check for typos in configuration file
450
+
451
+ **Poor Test Quality**
452
+ - Verify authentication methods are correctly configured
453
+ - Check factory library setting matches your setup
454
+ - Ensure `read_source_code` and `read_test_code` are enabled
455
+ - Review testing framework settings match your project
456
+
457
+ #### Authentication Configuration Issues
458
+
459
+ **Tests don't include authentication**
460
+ - Verify `authentication_enabled = true`
461
+ - Check authentication methods are correctly specified
462
+ - Ensure file paths exist: `ls app/controllers/application_controller.rb`
463
+ - Verify method names exist in specified files
464
+
465
+ **Authentication tests fail**
466
+ - Check auth method names match your application
467
+ - Verify file locations are correct
468
+ - Ensure auth_type matches your authentication pattern
469
+
470
+ ### Generation Issues
471
+
472
+ #### No Tests Generated
473
+
474
+ **Check these common issues:**
475
+ 1. File path is correct: `ls app/controllers/users_controller.rb`
476
+ 2. File contains valid Ruby code
477
+ 3. Configuration is valid
478
+ 4. API key is working
479
+ 5. Internet connection is available
480
+
481
+ #### Generated Tests Are Generic
482
+
483
+ **Common causes:**
484
+ - Authentication not properly configured
485
+ - Factory library setting doesn't match your setup
486
+ - `read_source_code` or `read_test_code` disabled
487
+ - File analysis failed (check DEBUG mode)
488
+
489
+ ### Debug Mode
490
+
491
+ Enable debug mode to get detailed information:
492
+
493
+ ```bash
494
+ DEBUG=1 bundle exec tng -t c -f your_controller
495
+ ```
496
+
497
+ Debug output includes:
498
+ - API request/response information
499
+
500
+ ### Getting Help
501
+
502
+ If you're still experiencing issues: Contact the gem maintainers or open a GitHub issue for support
503
+
504
+ ## License
505
+
506
+ See [LICENSE.md](LICENSE.md) for details.
data/Rakefile ADDED
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ require "rb_sys/extensiontask"
13
+
14
+ task build: :compile
15
+
16
+ GEMSPEC = Gem::Specification.load("tng.gemspec")
17
+
18
+ RbSys::ExtensionTask.new("tng", GEMSPEC) do |ext|
19
+ ext.lib_dir = "lib/tng"
20
+ end
21
+
22
+ task default: %i[compile test rubocop]
23
+
24
+ desc "Recompile Rust code and copy the binary for packaging"
25
+ task redo: :compile do
26
+ puts "Copying compiled binary to binaries/ directory..."
27
+ binary_name = RUBY_PLATFORM.include?("darwin") ? "tng.bundle" : "tng.so"
28
+ source_file = File.join("lib", "tng", binary_name)
29
+ destination_dir = "binaries"
30
+
31
+ if File.exist?(source_file)
32
+ FileUtils.mkdir_p(destination_dir)
33
+ FileUtils.cp(source_file, File.join(destination_dir, binary_name))
34
+ puts "✅ Copied #{binary_name} to #{destination_dir}/"
35
+ else
36
+ puts "❌ Error: Compiled binary not found at #{source_file}"
37
+ puts "Make sure 'rake compile' ran successfully."
38
+ end
39
+ end
40
+
41
+ desc "Build binaries for both Mac and Linux platforms"
42
+ task :build_both do
43
+ puts "Building tng native extensions for both platforms..."
44
+
45
+ # Clean up and create binaries directory
46
+ puts "Cleaning up old binaries..."
47
+ FileUtils.rm_rf("binaries")
48
+ puts "Creating binaries directory..."
49
+ FileUtils.mkdir_p("binaries")
50
+ puts "Binaries directory created: #{Dir.pwd}/binaries/"
51
+
52
+ # Build Mac version
53
+ puts "Building Mac version..."
54
+ system("bundle exec rake compile") || (puts "❌ Mac build failed"
55
+ exit 1)
56
+
57
+ # Copy Mac binary
58
+ mac_binary = "lib/tng/tng.bundle"
59
+ if File.exist?(mac_binary)
60
+ FileUtils.cp(mac_binary, "binaries/tng.bundle")
61
+ puts "Mac binary copied to binaries/ for packaging"
62
+ else
63
+ puts "❌ Mac binary not found"
64
+ exit 1
65
+ end
66
+
67
+ # Ensure it's in lib/tng/ for gem loading
68
+ if File.exist?("lib/tng/tng.bundle")
69
+ puts "Mac binary confirmed in lib/tng/ for gem loading"
70
+ else
71
+ puts "Warning: Mac binary not found in lib/tng/ - copying from binaries/"
72
+ FileUtils.cp("binaries/tng.bundle", "lib/tng/tng.bundle")
73
+ end
74
+
75
+ # Build Linux version
76
+ puts "Building Linux version..."
77
+ system("./build_linux_binaries.sh") || (puts "❌ Linux build failed"
78
+ exit 1)
79
+
80
+ puts "Build complete!"
81
+ puts "Binaries for packaging:"
82
+ system("ls -la binaries/")
83
+ puts "Binaries for gem loading:"
84
+ system("ls -la lib/tng/*.bundle lib/tng/*.so 2>/dev/null || echo 'No binaries found in lib/tng/'")
85
+ end
86
+
87
+ desc "Development build: compile for current OS and build gem"
88
+ task dev: :redo do
89
+ puts "Building gem..."
90
+ system("gem build tng.gemspec") || (puts "❌ Gem build failed"
91
+ exit 1)
92
+ puts "✅ Development build complete!"
93
+ end
94
+
95
+ # Add this task to suppress the native artifact warning
96
+ task release: :build_both do
97
+ # Temporarily rename the binary to avoid the warning during gem build
98
+ puts "📦 Building gem with pre-compiled binaries..." if File.exist?("binaries/tng.bundle")
99
+ end
100
+
101
+ desc "Clean release: build binaries and release gem"
102
+ task :clean_release do
103
+ puts "🔨 Running build_both to ensure fresh binaries..."
104
+ Rake::Task[:build_both].invoke
105
+
106
+ puts "🧹 Cleaning development artifacts (keeping binaries/)..."
107
+ # Clean ext/ compiled files (development artifacts)
108
+ Dir.glob("ext/**/*.{bundle,so,dylib}").each do |file|
109
+ File.delete(file)
110
+ puts "Removed development artifact: #{file}"
111
+ end
112
+
113
+ # Clean lib/tng/ compiled files (development artifacts)
114
+ Dir.glob("lib/tng/*.{bundle,so,dylib}").each do |file|
115
+ File.delete(file)
116
+ puts "Removed development artifact: #{file}"
117
+ end
118
+
119
+ puts "📦 Binaries for distribution:"
120
+ system("ls -la binaries/")
121
+
122
+ puts "🚀 Releasing gem..."
123
+ Rake::Task["release"].invoke
124
+ end
data/bin/load_dev ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Development loader for TNG gem
5
+ # This script loads the local development version of the gem
6
+ # Usage: bin/load_dev
7
+
8
+ puts "🔧 Loading TNG development environment..."
9
+
10
+ # Add the lib directory to the load path
11
+ lib_path = File.expand_path("../lib", __dir__)
12
+ $LOAD_PATH.unshift(lib_path) unless $LOAD_PATH.include?(lib_path)
13
+
14
+ # Load the development version
15
+ require_relative "../lib/tng"
16
+
17
+ puts "✅ TNG development version loaded!"
18
+ puts "📍 Loaded from: #{lib_path}"
19
+
20
+ # Start IRB with the gem loaded
21
+ require "irb"
22
+ IRB.start