Skip to content

Commit

Permalink
Recognize Thor files as Ruby files (#2080)
Browse files Browse the repository at this point in the history
Recognize `Thorfile` and `*.thor` files
as Ruby files since they are Ruby files.

Reference:

- https://github.com/rails/thor/wiki/Getting-Started#file-names
  • Loading branch information
vitallium authored Oct 22, 2024
1 parent 8272f9f commit b22c4f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rouge/lexers/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
2 changes: 2 additions & 0 deletions spec/lexers/ruby_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b22c4f8

Please sign in to comment.