mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Merge pull request #978 from cronycle/master
added VCR Cassette to the 'generated' list so they get suppressed
This commit is contained in:
		| @@ -62,7 +62,8 @@ module Linguist | ||||
|         generated_protocol_buffer? || | ||||
|         generated_jni_header? || | ||||
|         composer_lock? || | ||||
|         node_modules? | ||||
|         node_modules? || | ||||
|         vcr_cassette? | ||||
|     end | ||||
|  | ||||
|     # Internal: Is the blob an XCode project file? | ||||
| @@ -235,5 +236,15 @@ module Linguist | ||||
|     def composer_lock? | ||||
|       !!name.match(/composer.lock/) | ||||
|     end | ||||
|  | ||||
|     # Is the blob a VCR Cassette file? | ||||
|     # | ||||
|     # Returns true or false | ||||
|     def vcr_cassette? | ||||
|       return false unless extname == '.yml' | ||||
|       return false unless lines.count > 2 | ||||
|       # VCR Cassettes have "recorded_with: VCR" in the second last line. | ||||
|       return lines[-2].include?("recorded_with: VCR") | ||||
|     end | ||||
|   end | ||||
| end | ||||
|   | ||||
							
								
								
									
										20
									
								
								samples/YAML/vcr_cassette.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								samples/YAML/vcr_cassette.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| --- | ||||
| http_interactions: | ||||
| - request: | ||||
|     method: get | ||||
|     uri: http://example.com/ | ||||
|     body: '' | ||||
|     headers: {} | ||||
|   response: | ||||
|     status: | ||||
|       code: 200 | ||||
|       message: OK | ||||
|     headers: | ||||
|       Content-Type: | ||||
|       - text/html;charset=utf-8 | ||||
|       Content-Length: | ||||
|       - '26' | ||||
|     body: This is the response body | ||||
|     http_version: '1.1' | ||||
|   recorded_at: Tue, 01 Nov 2011 04:58:44 GMT | ||||
| recorded_with: VCR 2.0.0 | ||||
| @@ -211,6 +211,9 @@ class TestBlob < Test::Unit::TestCase | ||||
|     assert !blob("CSS/bootstrap.css").generated? | ||||
|     assert blob("CSS/bootstrap.min.css").generated? | ||||
|  | ||||
|     # Generated VCR | ||||
|     assert blob("YAML/vcr_cassette.yml").generated? | ||||
|  | ||||
|     assert Linguist::Generated.generated?("node_modules/grunt/lib/grunt.js", nil) | ||||
|   end | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user