Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Last active December 25, 2015 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/7040852 to your computer and use it in GitHub Desktop.
Save shigemk2/7040852 to your computer and use it in GitHub Desktop.
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