Created
January 19, 2012 14:37
-
-
Save hirochachacha/1640354 to your computer and use it in GitHub Desktop.
rocco on the fly
This file contains hidden or 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/bash -- | |
set -e | |
TEMP_DIR="/tmp/rocco-$$" | |
GEM_DIR=$(ruby -e "print Gem::Specification.find_by_name(\"$1\").full_gem_path") | |
trap "rm -rf $TEMP_DIR" EXIT | |
mkdir $TEMP_DIR | |
cd $GEM_DIR/lib && find . -name '*.rb' -type f | xargs rocco -o $TEMP_DIR | |
cd $TEMP_DIR | |
if [ -r "$1.html" ] | |
then | |
INDEX="$1.html" | |
else | |
INDEX="" | |
fi | |
sleep 1 && python -c "import webbrowser; webbrowser.open(\"http://localhost:8000/$INDEX\")" & | |
python -m SimpleHTTPServer 2>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment