diff --git a/lib/linguist/generated.rb b/lib/linguist/generated.rb index 35a321cf..3058cf4d 100644 --- a/lib/linguist/generated.rb +++ b/lib/linguist/generated.rb @@ -52,6 +52,7 @@ module Linguist # Return true or false def generated? xcode_file? || + cocoapods? || generated_net_designer_file? || generated_net_specflow_feature_file? || composer_lock? || @@ -95,6 +96,13 @@ module Linguist ['.nib', '.xcworkspacedata', '.xcuserstate'].include?(extname) end + # Internal: Is the blob part of Pods/, which contains dependencies not meant for humans in pull requests. + # + # Returns true or false. + def cocoapods? + !!name.match(/(^Pods|\/Pods)\//) + end + # Internal: Is the blob minified files? # # Consider a file minified if the average line length is diff --git a/lib/linguist/vendor.yml b/lib/linguist/vendor.yml index b9a98127..5bbbdc96 100644 --- a/lib/linguist/vendor.yml +++ b/lib/linguist/vendor.yml @@ -242,9 +242,6 @@ # Carthage - ^Carthage/ -# Cocoapods -- ^Pods/ - # Sparkle - (^|/)Sparkle/ diff --git a/test/test_file_blob.rb b/test/test_file_blob.rb index 2396d5be..c290a4b9 100644 --- a/test/test_file_blob.rb +++ b/test/test_file_blob.rb @@ -188,6 +188,10 @@ class TestFileBlob < Minitest::Test assert fixture_blob("Binary/MainMenu.nib").generated? assert !sample_blob("XML/project.pbxproj").generated? + # Cocoapods + assert sample_blob('Pods/blah').generated? + assert !sample_blob('My-Pods/blah').generated? + # Gemfile.lock is NOT generated assert !sample_blob("Gemfile.lock").generated? @@ -489,9 +493,6 @@ class TestFileBlob < Minitest::Test # Carthage assert sample_blob('Carthage/blah').vendored? - # Cocoapods - assert sample_blob('Pods/blah').vendored? - # Html5shiv assert sample_blob("Scripts/html5shiv.js").vendored? assert sample_blob("Scripts/html5shiv.min.js").vendored? diff --git a/test/test_generated.rb b/test/test_generated.rb index fbd2beab..e83f2832 100644 --- a/test/test_generated.rb +++ b/test/test_generated.rb @@ -42,6 +42,16 @@ class TestGenerated < Minitest::Test generated_sample_without_loading_data("Dummy/foo.xcworkspacedata") generated_sample_without_loading_data("Dummy/foo.xcuserstate") + # Cocoapods + generated_sample_without_loading_data("Pods/Pods.xcodeproj") + generated_sample_without_loading_data("Pods/SwiftDependency/foo.swift") + generated_sample_without_loading_data("Pods/ObjCDependency/foo.h") + generated_sample_without_loading_data("Pods/ObjCDependency/foo.m") + generated_sample_without_loading_data("Dummy/Pods/Pods.xcodeproj") + generated_sample_without_loading_data("Dummy/Pods/SwiftDependency/foo.swift") + generated_sample_without_loading_data("Dummy/Pods/ObjCDependency/foo.h") + generated_sample_without_loading_data("Dummy/Pods/ObjCDependency/foo.m") + # Go-specific vendored paths generated_sample_without_loading_data("go/vendor/github.com/foo.go") generated_sample_without_loading_data("go/vendor/golang.org/src/foo.c")