mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Move mime types to separate yaml file
This commit is contained in:
		| @@ -1,16 +1,12 @@ | ||||
| require 'mime/types' | ||||
| require 'yaml' | ||||
|  | ||||
| # Register additional binary extensions | ||||
| binary = MIME::Types['application/octet-stream'].first | ||||
| binary.extensions << 'dmg' | ||||
| binary.extensions << 'dll' | ||||
| MIME::Types.index_extensions(binary) | ||||
|  | ||||
| # Register 'ear' and 'war' as java | ||||
| java = MIME::Types['application/java-archive'].first | ||||
| java.extensions << 'ear' | ||||
| java.extensions << 'war' | ||||
| MIME::Types.index_extensions(java) | ||||
| # Register additional mime type extensions | ||||
| YAML.load_file(File.expand_path("../mimes.yml", __FILE__)).each do |mime_type, exts| | ||||
|   mime = MIME::Types[mime_type].first | ||||
|   exts.each { |ext| mime.extensions << ext } | ||||
|   MIME::Types.index_extensions(mime) | ||||
| end | ||||
|  | ||||
| module Linguist | ||||
|   module Mime | ||||
|   | ||||
							
								
								
									
										11
									
								
								lib/linguist/mimes.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								lib/linguist/mimes.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| # Additional types to add to MIME::Types | ||||
| # | ||||
| # Review this list if we ever upgrade from mime-types 1.15 to 1.16 | ||||
|  | ||||
| application/octet-stream: | ||||
| - dmg | ||||
| - dll | ||||
|  | ||||
| application/java-archive: | ||||
| - ear | ||||
| - war | ||||
		Reference in New Issue
	
	Block a user