forked from hacketyhack/hackety-hack.com
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhackety.rb
More file actions
54 lines (40 loc) · 1.28 KB
/
hackety.rb
File metadata and controls
54 lines (40 loc) · 1.28 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#woo hoo! This is the main file for the Hackety site.
#first off, we need to include rubygems and sinatra
require 'rubygems'
#this bundler stuff needed for heroku
require 'bundler'
Bundler.setup
require 'sinatra'
#this lets us send emails
require 'pony'
#haml gives us all of our templates
require 'haml'
#mongomapper connects us to our database
require 'mongo_mapper'
#rack-flash gives us nice flash messages
require 'rack-flash'
#rdiscount lets us write things using markdown
require 'rdiscount'
#we need to set up a secret to encrypt our sessions with
use Rack::Session::Cookie, :secret => 'h4ck3ty h4ck f0r gr347 g00d'
#we also have to let the world know we want to use flashes
use Rack::Flash
#let's require a bunch of files that do good things
require 'utility'
require 'configure'
require 'helpers'
#here's the root route. This is what happens when you go to '/'
get "/" do
haml :index
end
#this will be used to make sass work
Dir.glob("#{File.expand_path(File.dirname(__FILE__))}/views/stylesheets/*.sass").each do |sheet|
sheet =~ /\/([^\/]*).sass/
sheet_name = $1
get "/stylesheets/#{sheet_name}.css" do
content_type 'text/css', :charset => 'utf-8'
sass :"stylesheets/#{sheet_name}"
end
end
#finally, let's require all of our controllers
require_directory "controllers"