Last active
December 25, 2015 21:09
-
-
Save shigemk2/7040852 to your computer and use it in GitHub Desktop.
Making README.md with TravisCI and gemnasium badges
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
#!/bin/zsh | |
CURRENT_REPOSITORY () { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref=$(git rev-parse --short HEAD 2> /dev/null) || return | |
echo $(git remote -v | cut -d':' -f 2) | |
} | |
CURRENT_REPOSITORY_USER_NAME () { | |
echo ${$(CURRENT_REPOSITORY | awk '{print $1}')%.git} | |
} | |
CURRENT_REPOSITORY_DIRECTORY=`git rev-parse --show-toplevel` | |
CURRENT_REPOSITORY_NAME=$(basename $CURRENT_REPOSITORY_DIRECTORY) | |
rm README.md | |
touch README.md | |
cat << EOT >> README.md | |
${CURRENT_REPOSITORY_NAME} | |
=============== | |
[![Build Status](https://travis-ci.org/$(CURRENT_REPOSITORY_USER_NAME).png)](https://travis-ci.org/$(CURRENT_REPOSITORY_USER_NAME)) | |
[![Dependency Status](https://gemnasium.com/$(CURRENT_REPOSITORY_USER_NAME).png)](https://gemnasium.com/$(CURRENT_REPOSITORY_USER_NAME)) | |
EOT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment