-
-
Save dinkengraven/b54b1fc979733dac33fe to your computer and use it in GitHub Desktop.
This file contains 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
#! /usr/bin/env sh | |
# Generate a new, simple sinatra app | |
# Usage: sinatra-new name_of_app | |
set -e | |
dir=$1 | |
mkdir -p $dir/{views,public} | |
cd $dir | |
bundle init | |
echo "gem 'sinatra'" >> Gemfile | |
echo "web: bundle exec ruby main.rb" >> Procfile | |
( | |
cat <<HEREDOC | |
<html> | |
<head> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> | |
</head> | |
<body> | |
<h1>Hello world!</h1> | |
</body> | |
</html> | |
HEREDOC | |
) > views/index.erb | |
( | |
cat <<HEREDOC | |
require 'sinatra' | |
get '/' do | |
erb :index | |
end | |
HEREDOC | |
) > main.rb | |
git init . | |
git add -A | |
git commit -m"Initial setup" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment