Skip to content

Commit

Permalink
Merge pull request #808 from Moya/cocoapod-carthage-update
Browse files Browse the repository at this point in the history
Add a Danger rule to check for (simultaneous) changes in CocoaPods / Carthage files
  • Loading branch information
pedrovereza authored Nov 30, 2016
2 parents 5535ffa + 613b216 commit d01c87c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,19 @@ if has_app_changes && missing_doc_changes && doc_changes_recommended
warn("Consider adding supporting documentation to this change. Documentation can be found in the `docs` directory.")
end

# Warn when either the podspec or Cartfile + Cartfile.resolved has been updated,
# but not both.
podspec_updated = !git.modified_files.grep(/Moya.podspec/).empty?
cartfile_updated = !git.modified_files.grep(/Cartfile/).empty?
cartfile_resolved_updated = !git.modified_files.grep(/Cartfile.resolved/).empty?

if podspec_updated && (!cartfile_updated || !cartfile_resolved_updated)
warn("The `podspec` was updated, but there were no changes in either the `Cartfile` nor `Cartfile.resolved`. Did you forget updating `Cartfile` or `Cartfile.resolved`?")
end

if (cartfile_updated || cartfile_resolved_updated) && !podspec_updated
warn("The `Cartfile` or `Cartfile.resolved` was updated, but there were no changes in the `podspec`. Did you forget updating the `podspec`?")
end

# Run SwiftLint
swiftlint.lint_files

0 comments on commit d01c87c

Please sign in to comment.