t-ruby 0.0.7 → 0.0.34
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/README.md +6 -2
- data/lib/t_ruby/cli.rb +131 -6
- data/lib/t_ruby/compiler.rb +97 -9
- data/lib/t_ruby/config.rb +366 -24
- data/lib/t_ruby/docs_badge_generator.rb +192 -0
- data/lib/t_ruby/docs_example_extractor.rb +156 -0
- data/lib/t_ruby/docs_example_verifier.rb +222 -0
- data/lib/t_ruby/error_handler.rb +191 -13
- data/lib/t_ruby/parser.rb +33 -0
- data/lib/t_ruby/version.rb +1 -1
- data/lib/t_ruby/watcher.rb +42 -12
- data/lib/t_ruby.rb +5 -0
- metadata +4 -1
data/lib/t_ruby/watcher.rb
CHANGED
|
@@ -59,8 +59,8 @@ module TRuby
|
|
|
59
59
|
compile_all
|
|
60
60
|
@stats[:total_time] += Time.now - start_time
|
|
61
61
|
|
|
62
|
-
# Start watching
|
|
63
|
-
listener = Listen.to(*watch_directories, only: /\.trb$/) do |modified, added, removed|
|
|
62
|
+
# Start watching (.trb and .rb files)
|
|
63
|
+
listener = Listen.to(*watch_directories, only: /\.(trb|rb)$/) do |modified, added, removed|
|
|
64
64
|
handle_changes(modified, added, removed)
|
|
65
65
|
end
|
|
66
66
|
|
|
@@ -91,7 +91,9 @@ module TRuby
|
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def handle_changes(modified, added, removed)
|
|
94
|
-
changed_files = (modified + added)
|
|
94
|
+
changed_files = (modified + added)
|
|
95
|
+
.select { |f| f.end_with?(".trb") || f.end_with?(".rb") }
|
|
96
|
+
.reject { |f| @config.excluded?(f) }
|
|
95
97
|
return if changed_files.empty? && removed.empty?
|
|
96
98
|
|
|
97
99
|
puts
|
|
@@ -120,7 +122,9 @@ module TRuby
|
|
|
120
122
|
errors = []
|
|
121
123
|
|
|
122
124
|
trb_files = find_trb_files
|
|
123
|
-
|
|
125
|
+
rb_files = find_rb_files
|
|
126
|
+
all_files = trb_files + rb_files
|
|
127
|
+
@file_count = all_files.size
|
|
124
128
|
|
|
125
129
|
if @incremental && @cross_file_check
|
|
126
130
|
# Use enhanced incremental compiler with cross-file checking
|
|
@@ -128,9 +132,15 @@ module TRuby
|
|
|
128
132
|
errors = result[:errors].map { |e| format_error(e[:file], e[:error] || e[:message]) }
|
|
129
133
|
@error_count = errors.size
|
|
130
134
|
@stats[:total_compilations] += trb_files.size
|
|
131
|
-
|
|
135
|
+
|
|
136
|
+
# Also compile .rb files
|
|
137
|
+
rb_files.each do |file|
|
|
138
|
+
result = compile_file(file)
|
|
139
|
+
errors.concat(result[:errors]) if result[:errors].any?
|
|
140
|
+
end
|
|
141
|
+
elsif @parallel && all_files.size > 1
|
|
132
142
|
# Parallel compilation
|
|
133
|
-
results = @parallel_processor.process_files(
|
|
143
|
+
results = @parallel_processor.process_files(all_files) do |file|
|
|
134
144
|
compile_file(file)
|
|
135
145
|
end
|
|
136
146
|
results.each do |result|
|
|
@@ -138,7 +148,7 @@ module TRuby
|
|
|
138
148
|
end
|
|
139
149
|
else
|
|
140
150
|
# Sequential compilation
|
|
141
|
-
|
|
151
|
+
all_files.each do |file|
|
|
142
152
|
result = compile_file(file)
|
|
143
153
|
errors.concat(result[:errors]) if result[:errors].any?
|
|
144
154
|
end
|
|
@@ -223,14 +233,34 @@ module TRuby
|
|
|
223
233
|
end
|
|
224
234
|
|
|
225
235
|
def find_trb_files
|
|
236
|
+
find_source_files_by_extension(".trb")
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def find_rb_files
|
|
240
|
+
find_source_files_by_extension(".rb")
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
def find_source_files_by_extension(ext)
|
|
226
244
|
files = []
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
245
|
+
|
|
246
|
+
# If watching specific paths, use those paths
|
|
247
|
+
# Otherwise, use Config's find_source_files which respects include/exclude patterns
|
|
248
|
+
if @paths == [File.expand_path(".")]
|
|
249
|
+
# Default case: use config's src_dir with include/exclude patterns
|
|
250
|
+
files = @config.find_source_files.select { |f| f.end_with?(ext) }
|
|
251
|
+
else
|
|
252
|
+
# Specific paths provided: search in those paths but still apply exclude patterns
|
|
253
|
+
@paths.each do |path|
|
|
254
|
+
if File.directory?(path)
|
|
255
|
+
Dir.glob(File.join(path, "**", "*#{ext}")).each do |file|
|
|
256
|
+
files << file unless @config.excluded?(file)
|
|
257
|
+
end
|
|
258
|
+
elsif File.file?(path) && path.end_with?(ext) && !@config.excluded?(path)
|
|
259
|
+
files << path
|
|
260
|
+
end
|
|
232
261
|
end
|
|
233
262
|
end
|
|
263
|
+
|
|
234
264
|
files.uniq
|
|
235
265
|
end
|
|
236
266
|
|
data/lib/t_ruby.rb
CHANGED
|
@@ -38,5 +38,10 @@ require_relative "t_ruby/bundler_integration"
|
|
|
38
38
|
require_relative "t_ruby/benchmark"
|
|
39
39
|
require_relative "t_ruby/doc_generator"
|
|
40
40
|
|
|
41
|
+
# Milestone -7: Documentation Verification
|
|
42
|
+
require_relative "t_ruby/docs_example_extractor"
|
|
43
|
+
require_relative "t_ruby/docs_example_verifier"
|
|
44
|
+
require_relative "t_ruby/docs_badge_generator"
|
|
45
|
+
|
|
41
46
|
module TRuby
|
|
42
47
|
end
|
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.
|
|
4
|
+
version: 0.0.34
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Y. Fred Kim
|
|
@@ -45,6 +45,9 @@ files:
|
|
|
45
45
|
- lib/t_ruby/constraint_checker.rb
|
|
46
46
|
- lib/t_ruby/declaration_generator.rb
|
|
47
47
|
- lib/t_ruby/doc_generator.rb
|
|
48
|
+
- lib/t_ruby/docs_badge_generator.rb
|
|
49
|
+
- lib/t_ruby/docs_example_extractor.rb
|
|
50
|
+
- lib/t_ruby/docs_example_verifier.rb
|
|
48
51
|
- lib/t_ruby/error_handler.rb
|
|
49
52
|
- lib/t_ruby/generic_type_parser.rb
|
|
50
53
|
- lib/t_ruby/intersection_type_parser.rb
|