Permalink
Browse files

Add and configure DataMapper for models.

  • Loading branch information...
1 parent ca0f710 commit 63472c4a82b736768a3e65da698f546982c0b832 @bbck committed Feb 10, 2012
Showing with 75 additions and 1 deletion.
  1. +1 −0 .gitignore
  2. +4 −1 Gemfile
  3. +63 −0 Gemfile.lock
  4. +2 −0 config.ru
  5. +5 −0 spec/spec_helper.rb
View
@@ -1 +1,2 @@
.bundle
+db/*.db
View
@@ -1,9 +1,12 @@
source :rubygems
gem "sinatra"
+gem "datamapper", require: "data_mapper"
+gem "dm-postgres-adapter"
group :development, :test do
gem "heroku"
gem "rspec"
- gem "rack-test"
+ gem "rack-test", require: "rack/test"
+ gem "dm-sqlite-adapter"
end
View
@@ -2,15 +2,73 @@ GEM
remote: http://rubygems.org/
specs:
addressable (2.2.6)
+ 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)
diff-lcs (1.1.3)
+ 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-postgres-adapter (1.2.0)
+ dm-do-adapter (~> 1.2.0)
+ do_postgres (~> 0.10.6)
+ 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_postgres (0.10.8)
+ data_objects (= 0.10.8)
+ do_sqlite3 (0.10.8)
+ data_objects (= 0.10.8)
+ fastercsv (1.5.4)
heroku (2.19.2)
launchy (>= 0.3.2)
rest-client (~> 1.6.1)
rubyzip
term-ansicolor (~> 1.0.5)
+ json (1.6.5)
+ json_pure (1.6.5)
launchy (2.0.5)
addressable (~> 2.2.6)
mime-types (1.17.2)
+ multi_json (1.0.4)
rack (1.4.1)
rack-protection (1.2.0)
rack
@@ -31,13 +89,18 @@ GEM
rack (~> 1.3, >= 1.3.6)
rack-protection (~> 1.2)
tilt (~> 1.3, >= 1.3.3)
+ stringex (1.3.0)
term-ansicolor (1.0.7)
tilt (1.3.3)
+ uuidtools (2.1.2)
PLATFORMS
ruby
DEPENDENCIES
+ datamapper
+ dm-postgres-adapter
+ dm-sqlite-adapter
heroku
rack-test
rspec
View
@@ -5,4 +5,6 @@ Bundler.require
require './auction_notifier'
+DataMapper.setup(:default, ENV['HEROKU_SHARED_POSTGRESQL_PINK_URL'] || "sqlite3://#{Dir.pwd}/db/development.db")
+
run Sinatra::Application
View
@@ -1,5 +1,6 @@
require 'sinatra'
require 'rack/test'
+require 'data_mapper'
require File.join(File.dirname(__FILE__), '..', 'auction_notifier.rb')
@@ -9,10 +10,14 @@
set :raise_errors, true
set :logging, false
+DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/db/test.db")
+
def app
Sinatra::Application
end
RSpec.configure do |config|
config.include Rack::Test::Methods
+
+ config.before(:each) { DataMapper.auto_migrate! }
end

0 comments on commit 63472c4

Please sign in to comment.