Skip to content

Instantly share code, notes, and snippets.

@shigemk2 shigemk2/makereadme
Last active Dec 25, 2015

Embed
What would you like to do?
Making README.md with TravisCI and gemnasium badges
#!/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
You can’t perform that action at this time.