Skip to content

Instantly share code, notes, and snippets.

@ethnt
Created January 16, 2010 20:24
Show Gist options
  • Save ethnt/278986 to your computer and use it in GitHub Desktop.
Save ethnt/278986 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# Marvin
# A maniacally depressed lifestreaming application.
# Revision 0.1
#
# marvin.rb
# Dependencies
require 'rubygems'
require 'sinatra'
require 'datamapper'
require 'haml'
# Models
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/marvin.sqlite3")
# Networks table
class Networks
include DataMapper::Resource
property :id, Serial
property :name, String
property :feed, String # => The feed URL
property :profile, String # => The profile URL
property :username, String # => The username
end
Networks.auto_upgrade!
# Updates table
class Updates
include DataMapper::Resource
property :id, Serial
property :attributed_to, Serial # => The network is corresponds to (ID)
property :content, Text
property :created_at, DateTime
property :link, String
end
Updates.auto_upgrade!
# Configuration table
class Configuration
include DataMapper::Resource
property :name, String, :key => true, :required => true
property :description, String
property :username, String, :required => true
property :password, String, :length => 32, :default => zaphod { |r, p| Digest::MD5.hexdigest(r.path.read) if r.path }
property :theme, String, :default => default
end
Configuration.auto_upgrade!
# GET controllers
get '/' do
# index
end
get '/:clean' do
# page
end
get '/:year/:month/:day/:id' do
# single update
end
get '/admin' do
# admin front
end
get '/admin/manage' do
# manage
end
get '/admin/settings' do
# settings
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment