Skip to content
Browse files

first commit

  • Loading branch information...
0 parents commit 88bea274b7a7528e7b4702387991201b6aad803a @charliesome committed
Showing with 46 additions and 0 deletions.
  1. +6 −0 Gemfile
  2. +13 −0 app.rb
  3. +14 −0 config.yml
  4. +3 −0 models/example_model.rb
  5. +1 −0 views/index.erb
  6. +9 −0 views/layout.erb
6 Gemfile
@@ -0,0 +1,6 @@
+source :rubygems
+
+gem "sinatra"
+gem "erubis"
+gem "activerecord"
+gem "mysql2"
13 app.rb
@@ -0,0 +1,13 @@
+require "sinatra"
+require "erubis"
+require "active_record"
+Dir["./models/*.rb"].each { |m| require m }
+
+CONFIG = YAML.load_file("config.yml")[Sinatra::Application.environment.to_s]
+ActiveRecord::Base.establish_connection CONFIG["db"]
+
+set :erb, :escape_html => true
+
+get "/" do
+ erb :index
+end
14 config.yml
@@ -0,0 +1,14 @@
+development:
+ db:
+ adapter: mysql2
+ host: localhost
+ username: root
+ password:
+ database: sinatra-barebones-development
+production:
+ db:
+ adapter: mysql2
+ host: localhost
+ username: root
+ password:
+ database: sinatra-barebones-production
3 models/example_model.rb
@@ -0,0 +1,3 @@
+class ExampleModel < ActiveRecord::Base
+ # ...
+end
1 views/index.erb
@@ -0,0 +1 @@
+<h1>Welcome to sinatra-barebones</h1>
9 views/layout.erb
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>sinatra-barebones</title>
+</head>
+<body>
+ <%== yield %>
+</body>
+</html>

0 comments on commit 88bea27

Please sign in to comment.
Something went wrong with that request. Please try again.