mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	
				
					committed by
					
						 Arfon Smith
						Arfon Smith
					
				
			
			
				
	
			
			
			
						parent
						
							b1f5e93b4a
						
					
				
				
					commit
					270fa8f5d3
				
			| @@ -63,7 +63,7 @@ module Linguist | |||||||
|     # |     # | ||||||
|     # Returns an Array |     # Returns an Array | ||||||
|     def extensions |     def extensions | ||||||
|       basename, *segments = name.downcase.split(".") |       _, *segments = name.downcase.split(".") | ||||||
|  |  | ||||||
|       segments.map.with_index do |segment, index| |       segments.map.with_index do |segment, index| | ||||||
|         "." + segments[index..-1].join(".") |         "." + segments[index..-1].join(".") | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ module Linguist | |||||||
|       @oid = oid |       @oid = oid | ||||||
|       @path = path |       @path = path | ||||||
|       @mode = mode |       @mode = mode | ||||||
|  |       @data = nil | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     def git_attributes |     def git_attributes | ||||||
|   | |||||||
| @@ -30,6 +30,9 @@ module Linguist | |||||||
|       @repository = repo |       @repository = repo | ||||||
|       @commit_oid = commit_oid |       @commit_oid = commit_oid | ||||||
|  |  | ||||||
|  |       @old_commit_oid = nil | ||||||
|  |       @old_stats = nil | ||||||
|  |  | ||||||
|       raise TypeError, 'commit_oid must be a commit SHA1' unless commit_oid.is_a?(String) |       raise TypeError, 'commit_oid must be a commit SHA1' unless commit_oid.is_a?(String) | ||||||
|     end |     end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -42,10 +42,10 @@ module Linguist | |||||||
|       return unless script |       return unless script | ||||||
|  |  | ||||||
|       # "python2.6" -> "python2" |       # "python2.6" -> "python2" | ||||||
|       script.sub! /(\.\d+)$/, '' |       script.sub!(/(\.\d+)$/, '') | ||||||
|  |  | ||||||
|       # #! perl -> perl |       # #! perl -> perl | ||||||
|       script.sub! /^#!\s*/, '' |       script.sub!(/^#!\s*/, '') | ||||||
|  |  | ||||||
|       # Check for multiline shebang hacks that call `exec` |       # Check for multiline shebang hacks that call `exec` | ||||||
|       if script == 'sh' && |       if script == 'sh' && | ||||||
|   | |||||||
| @@ -132,7 +132,7 @@ class TestBlob < Minitest::Test | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   def test_csv |   def test_csv | ||||||
|     assert fixture_blob_memory("Data/cars.csv").csv? |     assert sample_blob_memory("CSV/cars.csv").csv? | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def test_pdf |   def test_pdf | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| require_relative "./helper" | require_relative "./helper" | ||||||
|  |  | ||||||
| class TestBlob < Minitest::Test | class TestFileBlob < Minitest::Test | ||||||
|   include Linguist |   include Linguist | ||||||
|  |  | ||||||
|   def setup |   def setup | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ class TestRepository < Minitest::Test | |||||||
|  |  | ||||||
|   def test_linguist_override_vendored? |   def test_linguist_override_vendored? | ||||||
|     attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd' |     attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd' | ||||||
|     repo = linguist_repo(attr_commit).read_index |     linguist_repo(attr_commit).read_index | ||||||
|  |  | ||||||
|     override_vendored = Linguist::LazyBlob.new(rugged_repository, attr_commit, 'Gemfile') |     override_vendored = Linguist::LazyBlob.new(rugged_repository, attr_commit, 'Gemfile') | ||||||
|  |  | ||||||
| @@ -91,7 +91,7 @@ class TestRepository < Minitest::Test | |||||||
|  |  | ||||||
|   def test_linguist_override_unvendored? |   def test_linguist_override_unvendored? | ||||||
|     attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd' |     attr_commit = '351c1cc8fd57340839bdb400d7812332af80e9bd' | ||||||
|     repo = linguist_repo(attr_commit).read_index |     linguist_repo(attr_commit).read_index | ||||||
|  |  | ||||||
|     # lib/linguist/vendor.yml defines this as vendored. |     # lib/linguist/vendor.yml defines this as vendored. | ||||||
|     override_unvendored = Linguist::LazyBlob.new(rugged_repository, attr_commit, 'test/fixtures/foo.rb') |     override_unvendored = Linguist::LazyBlob.new(rugged_repository, attr_commit, 'test/fixtures/foo.rb') | ||||||
| @@ -102,7 +102,7 @@ class TestRepository < Minitest::Test | |||||||
|  |  | ||||||
|   def test_linguist_override_documentation? |   def test_linguist_override_documentation? | ||||||
|     attr_commit = "d4c8fb8a28e91f97a7e53428a365c0abbac36d3d" |     attr_commit = "d4c8fb8a28e91f97a7e53428a365c0abbac36d3d" | ||||||
|     repo = linguist_repo(attr_commit).read_index |     linguist_repo(attr_commit).read_index | ||||||
|  |  | ||||||
|     readme = Linguist::LazyBlob.new(rugged_repository, attr_commit, "README.md") |     readme = Linguist::LazyBlob.new(rugged_repository, attr_commit, "README.md") | ||||||
|     arduino = Linguist::LazyBlob.new(rugged_repository, attr_commit, "samples/Arduino/hello.ino") |     arduino = Linguist::LazyBlob.new(rugged_repository, attr_commit, "samples/Arduino/hello.ino") | ||||||
| @@ -114,7 +114,7 @@ class TestRepository < Minitest::Test | |||||||
|  |  | ||||||
|   def test_linguist_override_generated? |   def test_linguist_override_generated? | ||||||
|     attr_commit = "351c1cc8fd57340839bdb400d7812332af80e9bd" |     attr_commit = "351c1cc8fd57340839bdb400d7812332af80e9bd" | ||||||
|     repo = linguist_repo(attr_commit).read_index |     linguist_repo(attr_commit).read_index | ||||||
|  |  | ||||||
|     rakefile = Linguist::LazyBlob.new(rugged_repository, attr_commit, "Rakefile") |     rakefile = Linguist::LazyBlob.new(rugged_repository, attr_commit, "Rakefile") | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user