-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check to ensure pod install doesn't change Podfile.lock (#19)
- Loading branch information
Showing
2 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,21 @@ | ||
#!/bin/bash -eu | ||
#!/bin/bash -e | ||
|
||
if [ -z "$1" ]; then | ||
echo "You must pass a filename to hash" | ||
exit 1 | ||
fi | ||
|
||
sha256sum "$1" | cut -f1 -d " " | ||
# Calling `set -u` here instead of the shebang otherwise the `-z "$1"` above | ||
# would fail without printing the error message if `$1` was unbound. | ||
set -u | ||
|
||
# `shasum` is available on only macOS | ||
if command -v shasum &> /dev/null; then | ||
sha_command='shasum -a 256' | ||
else | ||
sha_command='sha256sum' | ||
fi | ||
|
||
# Both `shasum` and `sha256sum` will print the hash and the file name (`$1`). | ||
# We only care about the hash, so we use `cut` to extract it. | ||
$sha_command "$1" | cut -f1 -d " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters