Skip to content

Instantly share code, notes, and snippets.

@nicholalexander
Created November 11, 2013 13:55
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 nicholalexander/7413525 to your computer and use it in GitHub Desktop.
Save nicholalexander/7413525 to your computer and use it in GitHub Desktop.
a script to build the sinatra skeleton and minimal config of files. missing sinatra reloader and ability to set path. chmod 755 to make executable - and also i think it has to be in the path where you're building, i don't know how it would work to make it part of your bin folder.
#!/bin/sh
mkdir app
cd app
mkdir public
mkdir views
touch server.rb
echo "require 'pry' \n require 'sinatra' \n \n get '/' do \n erb :index \n end \n" >> server.rb
cd public
touch app.js
echo "window.onload = function(){ \n console.log('ready to ajax'); \n } \n" >> app.js
cd ../views
touch index.erb
echo "<h1>Hello World</h1>" >> index.erb
touch layout.erb
echo " <!doctype html> \n <html lang='en'> \n <head> \n <meta charset='UTF-8'> \n <title>postey</title> \n <script type='text/javascript' src="app.js"></script> \n </head> \n <body> \n <%= yield %> \n </body> \n </html>" >> layout.erb
cd ..
ruby server.rb
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment