Skip to content

Commit

Permalink
Merge pull request #359 from scala-native/topic/github-rate-limit
Browse files Browse the repository at this point in the history
Use dummy account for scalafmt
  • Loading branch information
densh committed Oct 26, 2016
2 parents ca3c66f + 3811267 commit fe572f1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/scalafmt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ check_binary "$GREP"

check_latest () {
echo "Checking latest version from github..."
latest_version=$($CURL -s https://api.github.com/repos/olafurpg/scalafmt/releases/latest | $GREP -Eo '"tag_name":(.*)' | $GREP -Eo 'v[0-9\.]+')
latest_version=$($CURL -u dummy4dummy:dummy2dummy -s https://api.github.com/repos/olafurpg/scalafmt/releases/latest | $GREP -Eo '"tag_name":(.*)' | $GREP -Eo 'v[0-9\.]+')
if [[ $latest_version = "" ]]; then
echo "The github call failed, either because of an internet connection issue or rate limits..."
exit 1
Expand All @@ -42,7 +42,7 @@ if [[ -e $version_file ]]; then
fi

print_usage (){
echo -e "scalafmt runner verson: 0.1"
echo -e "scalafmt runner verson: 0.1.1"
echo -e "Usage: ./scalafmt [RUNNER OPTS] [SCALAFMT OPTS]"
echo -e "--version [VERSION] \t Version to invoke for scalafmt (fmt: 0.4.2, not v0.4.2)"
echo -e "--dir [DIR] \t\t Directory to store scalafmt jars, default is $HOME/.scalafmt-bin/"
Expand Down Expand Up @@ -96,7 +96,7 @@ for arg in "$1" "$2" "$3"; do
esac
done

if [[ ! -e $version_file && $upgrade = false ]]; then
if [[ ! -e $version_file && $upgrade = false && -z $scalafmt_version ]]; then
echo "No version file, checking for latest..."
check_latest
echo "Setting latest version to: $latest_version"
Expand Down

0 comments on commit fe572f1

Please sign in to comment.