From 0414c502ff16bd6cf05521ad95c1e1fb755ac1ac Mon Sep 17 00:00:00 2001 From: Vitaly Slobodin Date: Tue, 22 Oct 2024 18:26:37 +0200 Subject: [PATCH] Recognize Thor files as Ruby files Recognize `Thorfile` and `*.thor` files as Ruby files since they are Ruby files. Reference: - https://github.com/rails/thor/wiki/Getting-Started#file-names --- lib/rouge/lexers/ruby.rb | 2 +- spec/lexers/ruby_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/rouge/lexers/ruby.rb b/lib/rouge/lexers/ruby.rb index 2f6be1a5a5..c3a77ec32a 100644 --- a/lib/rouge/lexers/ruby.rb +++ b/lib/rouge/lexers/ruby.rb @@ -11,7 +11,7 @@ class Ruby < RegexLexer filenames '*.rb', '*.ruby', '*.rbw', '*.rake', '*.gemspec', '*.podspec', 'Rakefile', 'Guardfile', 'Gemfile', 'Capfile', 'Podfile', 'Vagrantfile', '*.ru', '*.prawn', 'Berksfile', '*.arb', - 'Dangerfile', 'Fastfile', 'Deliverfile', 'Appfile' + 'Dangerfile', 'Fastfile', 'Deliverfile', 'Appfile', '*.thor', 'Thorfile' mimetypes 'text/x-ruby', 'application/x-ruby' diff --git a/spec/lexers/ruby_spec.rb b/spec/lexers/ruby_spec.rb index 6f2609860c..1ade145b3c 100644 --- a/spec/lexers/ruby_spec.rb +++ b/spec/lexers/ruby_spec.rb @@ -113,6 +113,8 @@ assert_guess :filename => 'Deliverfile' assert_guess :filename => 'Fastfile' assert_guess :filename => 'Appfile' + assert_guess :filename => 'Thorfile' + assert_guess :filename => 'foo.thor' end it 'guesses by mimetype' do