Skip to content

Commit

Permalink
Added Bundler and Datamapper
Browse files Browse the repository at this point in the history
  • Loading branch information
peteygee123 committed Apr 3, 2012
1 parent 0a19af9 commit 2a9cd32
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 51 deletions.
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,10 @@
source "http://rubygems.org"

gem 'sinatra'
gem 'sinatra-reloader'
#gem 'activerecord'
#gem 'sinatra-activerecord'
gem 'datamapper'
gem 'dm-sqlite-adapter'
gem 'sqlite3'
gem 'json'
92 changes: 92 additions & 0 deletions Gemfile.lock
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,92 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.2.7)
backports (2.5.1)
bcrypt-ruby (3.0.1)
data_objects (0.10.8)
addressable (~> 2.1)
datamapper (1.2.0)
dm-aggregates (~> 1.2.0)
dm-constraints (~> 1.2.0)
dm-core (~> 1.2.0)
dm-migrations (~> 1.2.0)
dm-serializer (~> 1.2.0)
dm-timestamps (~> 1.2.0)
dm-transactions (~> 1.2.0)
dm-types (~> 1.2.0)
dm-validations (~> 1.2.0)
dm-aggregates (1.2.0)
dm-core (~> 1.2.0)
dm-constraints (1.2.0)
dm-core (~> 1.2.0)
dm-core (1.2.0)
addressable (~> 2.2.6)
dm-do-adapter (1.2.0)
data_objects (~> 0.10.6)
dm-core (~> 1.2.0)
dm-migrations (1.2.0)
dm-core (~> 1.2.0)
dm-serializer (1.2.1)
dm-core (~> 1.2.0)
fastercsv (~> 1.5.4)
json (~> 1.6.1)
json_pure (~> 1.6.1)
multi_json (~> 1.0.3)
dm-sqlite-adapter (1.2.0)
dm-do-adapter (~> 1.2.0)
do_sqlite3 (~> 0.10.6)
dm-timestamps (1.2.0)
dm-core (~> 1.2.0)
dm-transactions (1.2.0)
dm-core (~> 1.2.0)
dm-types (1.2.1)
bcrypt-ruby (~> 3.0.0)
dm-core (~> 1.2.0)
fastercsv (~> 1.5.4)
json (~> 1.6.1)
multi_json (~> 1.0.3)
stringex (~> 1.3.0)
uuidtools (~> 2.1.2)
dm-validations (1.2.0)
dm-core (~> 1.2.0)
do_sqlite3 (0.10.8)
data_objects (= 0.10.8)
eventmachine (0.12.10)
fastercsv (1.5.4)
json (1.6.6)
json_pure (1.6.6)
multi_json (1.0.4)
rack (1.4.1)
rack-protection (1.2.0)
rack
rack-test (0.6.1)
rack (>= 1.0)
sinatra (1.3.2)
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
sinatra-contrib (1.3.1)
backports (>= 2.0)
eventmachine
rack-protection
rack-test
sinatra (~> 1.3.0)
tilt (~> 1.3)
sinatra-reloader (1.0)
sinatra-contrib
sqlite3 (1.3.5)
stringex (1.3.2)
tilt (1.3.3)
uuidtools (2.1.2)

PLATFORMS
ruby

DEPENDENCIES
datamapper
dm-sqlite-adapter
json
sinatra
sinatra-reloader
sqlite3
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,2 @@
#require 'app'
require 'sinatra/activerecord/rake'
53 changes: 53 additions & 0 deletions app.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,53 @@
require 'rubygems'
require 'sinatra'
require 'data_mapper'
require 'json'

DataMapper.setup(:default, "sqlite3::memory:")


class Province
include DataMapper::Resource
property :id, Serial
property :name, String

attr_accessor :name

def initialize(name)
@name = name
end

def to_json(*)
{name: @name}.to_json
end
end

get '/provinces' do
provinces = Province.all
content_type :json
provinces.to_json
end

class IncidentType
include DataMapper::Resource
property :id, Serial
property :name, String

attr_accessor :name

def initialize(name)
@name = name
end

def to_json(*)
{name: @name}.to_json
end
end

get '/incident_types' do
incident_types = IncidentType.all
content_type :json
incident_types.to_json
end

DataMapper.auto_upgrade!
51 changes: 0 additions & 51 deletions application.rb

This file was deleted.

0 comments on commit 2a9cd32

Please sign in to comment.