-
Notifications
You must be signed in to change notification settings - Fork 13
/
Rakefile
31 lines (27 loc) · 800 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'rubygems'
require 'sinatra'
require 'dm-core'
require 'dm-validations'
require 'dm-types'
require 'dm-migrations'
require 'dm-postgres-adapter'
DataMapper.setup(:default, ENV['DATABASE_URL'] || "sqlite3://#{Dir.pwd}/database.db")
class Page
include DataMapper::Resource
property :id, Serial
property :slug, String
property :title, String
property :content, Text
property :last_updated, DateTime
property :sidebar, Enum[ :yes, :no ], :default => :no
end
DataMapper.auto_migrate!
task :setup do
@page = Page.create(:slug => 'home')
@page.slug = 'home'
@page.title = 'Home'
@page.content = 'This is the home page. Press the edit button below to get started.'
@page.last_updated = Time.now
@page.sidebar = :no
@page.save
end