Skip to content

Instantly share code, notes, and snippets.

Last active Oct 12, 2015
What would you like to do?
Sinatra kickstart boilerplate: HTML5 + Bootstrap + jQuery
require 'sinatra'
get '/' do
@name = ENV['USER']
erb :main
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>My site</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="/css/bootstrap.css" rel="stylesheet">
<link href="/css/bootstrap-responsive.css" rel="stylesheet">
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<%= yield %>
<div class="container">
<h1>Hello, <%= @name %></h1>
<p>This is Sinatra app.</p>
function fail() {
echo Something went wrong. Exiting.
echo Checking if you have wget
which -s wget || fail
echo Checking if you have unzip
which -s unzip || fail
mkdir -p public/css
mkdir -p public/js
mkdir -p public/img
mkdir -p views
# Skeleton app files
echo Downloading app stub
wget -q || fail
echo Downloading layout.erb
wget -q -P views || fail
echo Downloading main.erb
wget -q -P views || fail
# Download jQuery and Twitter Bootstrap
echo Downloading jQuery
wget -q -P public/js || fail
echo Downloading Bootstrap
wget -q || fail
unzip -q
mv bootstrap/css/* public/css/
mv bootstrap/js/* public/js/
mv bootstrap/img/* public/img/
# clean up
echo Cleaning up
rm -rf bootstrap
echo Done!
echo You can run your app with
echo ruby -rubygems app.rb

This comment has been minimized.

Copy link
Owner Author

@tomekc tomekc commented Nov 11, 2012

one-liner to execute kickstart script:

bash -c "$(curl -fsSkL"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment