diff --git a/lib/steep/project/dsl.rb b/lib/steep/project/dsl.rb index c7ed76b9..7a7f448c 100644 --- a/lib/steep/project/dsl.rb +++ b/lib/steep/project/dsl.rb @@ -74,6 +74,10 @@ def check(*args) sources.concat(args) end + def ext(ext) + @ext = ext + end + def ignore(*args) ignored_sources.concat(args) end @@ -103,7 +107,7 @@ def ignored_signatures end def source_pattern - Pattern.new(patterns: sources, ignores: ignored_sources, ext: ".rb") + Pattern.new(patterns: sources, ignores: ignored_sources, ext: @ext || ".rb") end def signature_pattern diff --git a/lib/steep/server/master.rb b/lib/steep/server/master.rb index 1be27ed5..f2d90448 100644 --- a/lib/steep/server/master.rb +++ b/lib/steep/server/master.rb @@ -421,7 +421,7 @@ def process_message_from_client(message) end target.source_pattern.prefixes.each do |pat| path = project.base_dir + pat - patterns << (path + "**/*.rb").to_s unless path.file? + patterns << (path + "**/*#{target.source_pattern.ext}").to_s unless path.file? end target.signature_pattern.patterns.each do |pat| path = project.base_dir + pat @@ -800,7 +800,7 @@ def start_type_check(request: nil, last_request:, progress: nil, include_unchang Steep.logger.info "Starting new progress..." @current_type_check_request = request - + if progress # If `request:` keyword arg is not given request.work_done_progress.begin("Type checking", request_id: fresh_request_id) diff --git a/sample/Steepfile b/sample/Steepfile index e88611c7..55a37afd 100644 --- a/sample/Steepfile +++ b/sample/Steepfile @@ -20,3 +20,8 @@ end # signature "sig/length.rbs" # unreferenced! # end + +# target :templates do +# check "lib/templates" # Directory name +# ext ".erb" +# end diff --git a/sig/steep/project/dsl.rbs b/sig/steep/project/dsl.rbs index ea999b6b..3b557c8d 100644 --- a/sig/steep/project/dsl.rbs +++ b/sig/steep/project/dsl.rbs @@ -59,8 +59,12 @@ module Steep attr_reader ignored_signatures: Array[String] + @ext: String? + def check: (*String args) -> void + def ext: (String ext) -> void + def ignore: (*String args) -> void def signature: (*String args) -> void diff --git a/test/steepfile_test.rb b/test/steepfile_test.rb index e09d080d..6abbbdf8 100644 --- a/test/steepfile_test.rb +++ b/test/steepfile_test.rb @@ -336,4 +336,28 @@ def test_string end end end + + def test_ext + in_tmpdir do + project = Project.new(steepfile_path: current_dir + "Steepfile") + + Project::DSL.parse(project, <