mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-12-29 21:31:01 +00:00
Adding linguist_vendored? and linguist_generated? to include overrides from .gitattributes
This commit is contained in:
@@ -4,7 +4,7 @@ require 'rugged'
|
||||
|
||||
module Linguist
|
||||
class LazyBlob
|
||||
GIT_ATTR = ['linguist-ignore', 'linguist-lang']
|
||||
GIT_ATTR = ['linguist-language', 'linguist-vendored', 'linguist-generated']
|
||||
GIT_ATTR_OPTS = { :priority => [:index], :skip_system => true }
|
||||
GIT_ATTR_FLAGS = Rugged::Repository::Attributes.parse_opts(GIT_ATTR_OPTS)
|
||||
|
||||
@@ -29,12 +29,16 @@ module Linguist
|
||||
name, GIT_ATTR, GIT_ATTR_FLAGS)
|
||||
end
|
||||
|
||||
def ignored?
|
||||
!!git_attributes['linguist-ignore']
|
||||
def linguist_vendored?
|
||||
vendored? || !!git_attributes['linguist-vendored']
|
||||
end
|
||||
|
||||
def linguist_generated?
|
||||
generated? || !!git_attributes['linguist-generated']
|
||||
end
|
||||
|
||||
def overriden_language
|
||||
if lang = git_attributes['linguist-lang']
|
||||
if lang = git_attributes['linguist-language']
|
||||
Language.find_by_name(lang)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user