Skip to content

Instantly share code, notes, and snippets.

@qrohlf
Last active August 29, 2015 14:01
Show Gist options
  • Save qrohlf/150b44deecf6ec3123ed to your computer and use it in GitHub Desktop.
Save qrohlf/150b44deecf6ec3123ed to your computer and use it in GitHub Desktop.
getting started check for webdev
# app.rb
# this is a simple Sinatra app that will test to make sure that your
# system is set up for the class correctly
# use bundler
require 'rubygems'
require 'bundler/setup'
# load all of the gems in the gemfile
Bundler.require
get '/' do
erb :index
end
# Sneaky template stuff: http://www.sinatrarb.com/intro.html#Inline%20Templates
__END__
@@ index
<!DOCTYPE html>
<html lang="en">
<head>
<title>Sinatra Hello World</title>
<style>
body {
text-align: center;
font-family: Tahoma, Geneva, sans-serif;
}
</style>
</head>
<body>
<h1>Hello, World!</h1>
<p>If you're seeing this, it means that you've got git, ruby, bundler, and sqlite working properly. Nice job!</p>
<p>Here is some example dynamic content: <em><%= Time.now.to_s %></em></p>
</body>
</html>
require './app'
run Sinatra::Application
ruby "2.1.1"
source 'https://rubygems.org'
gem 'sinatra'
gem 'sqlite3'
gem 'shotgun'
GEM
remote: https://rubygems.org/
specs:
rack (1.5.2)
rack-protection (1.5.3)
rack
shotgun (0.9)
rack (>= 1.0)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sqlite3 (1.3.9)
tilt (1.4.1)
PLATFORMS
ruby
DEPENDENCIES
shotgun
sinatra
sqlite3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment