t-ruby 0.0.35 → 0.0.37

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.
@@ -14,7 +14,7 @@ module TRuby
14
14
  yellow: "\e[33m",
15
15
  blue: "\e[34m",
16
16
  cyan: "\e[36m",
17
- gray: "\e[90m"
17
+ gray: "\e[90m",
18
18
  }.freeze
19
19
 
20
20
  attr_reader :incremental_compiler, :stats
@@ -47,7 +47,7 @@ module TRuby
47
47
  @stats = {
48
48
  total_compilations: 0,
49
49
  incremental_hits: 0,
50
- total_time: 0.0
50
+ total_time: 0.0,
51
51
  }
52
52
  end
53
53
 
@@ -92,8 +92,8 @@ module TRuby
92
92
 
93
93
  def handle_changes(modified, added, removed)
94
94
  changed_files = (modified + added)
95
- .select { |f| f.end_with?(".trb") || f.end_with?(".rb") }
96
- .reject { |f| @config.excluded?(f) }
95
+ .select { |f| f.end_with?(".trb") || f.end_with?(".rb") }
96
+ .reject { |f| @config.excluded?(f) }
97
97
  return if changed_files.empty? && removed.empty?
98
98
 
99
99
  puts
@@ -279,7 +279,7 @@ module TRuby
279
279
  file: file,
280
280
  line: line,
281
281
  col: col,
282
- message: message
282
+ message: message,
283
283
  }
284
284
  end
285
285
 
@@ -287,7 +287,10 @@ module TRuby
287
287
  errors.each do |error|
288
288
  puts
289
289
  # TypeScript-style error format: file:line:col - error TSXXXX: message
290
- location = "#{colorize(:cyan, relative_path(error[:file]))}:#{colorize(:yellow, error[:line])}:#{colorize(:yellow, error[:col])}"
290
+ location = "#{colorize(:cyan,
291
+ relative_path(error[:file]))}:#{colorize(:yellow,
292
+ error[:line])}:#{colorize(:yellow,
293
+ error[:col])}"
291
294
  puts "#{location} - #{colorize(:red, "error")} #{colorize(:gray, "TRB0001")}: #{error[:message]}"
292
295
  end
293
296
  end
@@ -298,7 +301,8 @@ module TRuby
298
301
  end
299
302
 
300
303
  def print_file_change_message
301
- puts "#{colorize(:gray, timestamp)} #{colorize(:bold, "File change detected. Starting incremental compilation...")}"
304
+ puts "#{colorize(:gray,
305
+ timestamp)} #{colorize(:bold, "File change detected. Starting incremental compilation...")}"
302
306
  puts
303
307
  end
304
308
 
@@ -306,12 +310,11 @@ module TRuby
306
310
  puts
307
311
  if @error_count.zero?
308
312
  msg = "Found #{colorize(:green, "0 errors")}. Watching for file changes."
309
- puts "#{colorize(:gray, timestamp)} #{msg}"
310
313
  else
311
314
  error_word = @error_count == 1 ? "error" : "errors"
312
315
  msg = "Found #{colorize(:red, "#{@error_count} #{error_word}")}. Watching for file changes."
313
- puts "#{colorize(:gray, timestamp)} #{msg}"
314
316
  end
317
+ puts "#{colorize(:gray, timestamp)} #{msg}"
315
318
  end
316
319
 
317
320
  def print_watching_message
@@ -323,11 +326,12 @@ module TRuby
323
326
  puts "#{colorize(:gray, timestamp)} #{colorize(:bold, "Watch Mode Statistics:")}"
324
327
  puts " Total compilations: #{@stats[:total_compilations]}"
325
328
  puts " Incremental cache hits: #{@stats[:incremental_hits]}"
326
- hit_rate = if @stats[:total_compilations] + @stats[:incremental_hits] > 0
327
- (@stats[:incremental_hits].to_f / (@stats[:total_compilations] + @stats[:incremental_hits]) * 100).round(1)
328
- else
329
- 0
330
- end
329
+ total = @stats[:total_compilations] + @stats[:incremental_hits]
330
+ hit_rate = if total.positive?
331
+ (@stats[:incremental_hits].to_f / total * 100).round(1)
332
+ else
333
+ 0
334
+ end
331
335
  puts " Cache hit rate: #{hit_rate}%"
332
336
  puts " Total compile time: #{@stats[:total_time].round(2)}s"
333
337
  end
data/lib/t_ruby.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "t_ruby/version"
4
+ require_relative "t_ruby/version_checker"
4
5
  require_relative "t_ruby/config"
5
6
 
6
7
  # Core infrastructure (must be loaded first)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Y. Fred Kim
@@ -65,11 +65,13 @@ files:
65
65
  - lib/t_ruby/type_inferencer.rb
66
66
  - lib/t_ruby/union_type_parser.rb
67
67
  - lib/t_ruby/version.rb
68
+ - lib/t_ruby/version_checker.rb
68
69
  - lib/t_ruby/watcher.rb
69
70
  homepage: https://type-ruby.github.io
70
71
  licenses:
71
72
  - MIT
72
- metadata: {}
73
+ metadata:
74
+ rubygems_mfa_required: 'true'
73
75
  rdoc_options: []
74
76
  require_paths:
75
77
  - lib
@@ -77,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
79
  requirements:
78
80
  - - ">="
79
81
  - !ruby/object:Gem::Version
80
- version: 3.0.0
82
+ version: 3.1.0
81
83
  required_rubygems_version: !ruby/object:Gem::Requirement
82
84
  requirements:
83
85
  - - ">="