Permalink
Browse files

Initital init

  • Loading branch information...
0 parents commit 1b056f8ea7c03bcd5c947e311c9ecf35626e3d23 @runemadsen committed Apr 12, 2011
Showing with 84 additions and 0 deletions.
  1. +7 −0 Gemfile
  2. +35 −0 Gemfile.lock
  3. +2 −0 Rakefile
  4. +2 −0 config.ru
  5. +11 −0 db/migrate/20110412175929_create_images.rb
  6. +9 −0 index.rb
  7. +4 −0 models.rb
  8. +3 −0 views/hello.erb
  9. +11 −0 views/layout.erb
@@ -0,0 +1,7 @@
+source "http://gemcutter.org"
+source :rubygems
+
+gem "sinatra"
+gem "mysql"
+gem "activerecord"
+gem "sinatra-activerecord", :require => "sinatra/activerecord"
@@ -0,0 +1,35 @@
+GEM
+ remote: http://gemcutter.org/
+ remote: http://rubygems.org/
+ specs:
+ activemodel (3.0.4)
+ activesupport (= 3.0.4)
+ builder (~> 2.1.2)
+ i18n (~> 0.4)
+ activerecord (3.0.4)
+ activemodel (= 3.0.4)
+ activesupport (= 3.0.4)
+ arel (~> 2.0.2)
+ tzinfo (~> 0.3.23)
+ activesupport (3.0.4)
+ arel (2.0.9)
+ builder (2.1.2)
+ i18n (0.5.0)
+ mysql (2.8.1)
+ rack (1.2.2)
+ sinatra (1.2.1)
+ rack (~> 1.1)
+ tilt (< 2.0, >= 1.2.2)
+ sinatra-activerecord (0.1.3)
+ sinatra (>= 0.9.4)
+ tilt (1.2.2)
+ tzinfo (0.3.25)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord
+ mysql
+ sinatra
+ sinatra-activerecord
@@ -0,0 +1,2 @@
+require 'index.rb'
+require 'sinatra/activerecord/rake'
@@ -0,0 +1,2 @@
+require 'index'
+run Sinatra::Application
@@ -0,0 +1,11 @@
+class CreateImages < ActiveRecord::Migration
+ def self.up
+ create_table :images do |t|
+ t.string :url
+ end
+ end
+
+ def self.down
+ drop_table :images
+ end
+end
@@ -0,0 +1,9 @@
+require 'rubygems'
+require 'bundler'
+Bundler.require
+require 'models'
+
+get '/' do
+ erb :hello
+end
+
@@ -0,0 +1,4 @@
+set :database, 'mysql://user:password@localhost/dbname'
+
+class Image < ActiveRecord::Base
+end
@@ -0,0 +1,3 @@
+<h1>Sinatra Activerecord Bundler Example</h1>
+
+Hello there! There are <% Image.all.count %> images in your database.
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<head></head>
+
+<body>
+
+ <%= yield %>
+
+</body>
+</html>
+
+

0 comments on commit 1b056f8

Please sign in to comment.