Skip to content

Instantly share code, notes, and snippets.

@rev087
Last active December 14, 2015 03:29
Show Gist options
  • Save rev087/5021792 to your computer and use it in GitHub Desktop.
Save rev087/5021792 to your computer and use it in GitHub Desktop.
Start the FontPrep server and open it in Google Chrome's app mode
fontprep ()
{
# Move to the server folder
cd /Applications/FontPrep.app/Contents/Resources/fontprep_server
# Start the FontPrep server, fork the process and store it's pid
ruby src/main.rb & pid_server=$!
# Give some time for the server to start, then open the URL in Google Chrome's app mode
sleep 2
exec /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="http://localhost:7500/?sasha" --user-data-dir="~/Library/Application Support/Google/Chrome/" "$@" & pid_browser=$!
# Wait for the Chrome process to close, then kill the server process
wait $pid_browser
kill $pid_server
# Finally, move back to the original folder
cd -
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment