File tree 5 files changed +118
-0
lines changed
5 files changed +118
-0
lines changed Original file line number Diff line number Diff line change
1
+ .DS_Store
2
+ .bundle
Original file line number Diff line number Diff line change
1
+ source 'http://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'haml'
5
+ gem 'mongoid'
6
+ gem 'bson_ext'
7
+ gem 'sinatra-mongoid'
8
+ gem 'mail'
Original file line number Diff line number Diff line change
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (2.3.8 )
5
+ bson (1.0.4 )
6
+ bson_ext (1.0.4 )
7
+ durran-validatable (2.0.1 )
8
+ haml (3.0.16 )
9
+ mail (2.2.5 )
10
+ activesupport (>= 2.3.6 )
11
+ mime-types
12
+ treetop (>= 1.4.5 )
13
+ mime-types (1.16 )
14
+ mongo (1.0.7 )
15
+ bson (>= 1.0.4 )
16
+ mongo_ext (0.19.3 )
17
+ mongoid (1.9.1 )
18
+ activesupport (<= 3.0.0 )
19
+ bson (~> 1.0.1 )
20
+ durran-validatable (>= 2.0.1 )
21
+ mongo (~> 1.0.1 )
22
+ will_paginate (< 2.9 )
23
+ polyglot (0.3.1 )
24
+ rack (1.2.1 )
25
+ sinatra (1.0 )
26
+ rack (>= 1.0 )
27
+ sinatra-mongoid (0.0.2 )
28
+ mongo_ext
29
+ mongoid
30
+ sinatra
31
+ treetop (1.4.8 )
32
+ polyglot (>= 0.3.1 )
33
+ will_paginate (2.3.14 )
34
+
35
+ PLATFORMS
36
+ ruby
37
+
38
+ DEPENDENCIES
39
+ bson_ext
40
+ haml
41
+ mail
42
+ mongoid
43
+ sinatra
44
+ sinatra-mongoid
Original file line number Diff line number Diff line change
1
+ begin
2
+ # Require the preresolved locked set of gems.
3
+ require ::File . expand_path ( '../.bundle/environment' , __FILE__ )
4
+ rescue LoadError
5
+ # Fallback on doing the resolve at runtime.
6
+ require "rubygems"
7
+ require "bundler"
8
+ Bundler . setup
9
+ end
10
+
11
+ require 'email_cms'
12
+ run Sinatra ::Application
Original file line number Diff line number Diff line change
1
+ require 'sinatra'
2
+ require 'haml'
3
+ require 'mongoid'
4
+ require 'sinatra/mongoid'
5
+ require 'mail'
6
+
7
+ get '/' do
8
+ @posts = Post . all
9
+ haml :posts
10
+ end
11
+
12
+ get '/:id' do
13
+ @post = Post . first ( :conditions => { :id => params [ :id ] } )
14
+ pass if @post . nil?
15
+ haml :post
16
+ end
17
+
18
+ post '/incoming_message/' do
19
+ message = Mail . new ( params [ :message ] )
20
+
21
+ @post = Post . create! ( :title => message . subject , :body => message . body . decoded )
22
+ haml :post
23
+ end
24
+
25
+ class Post
26
+ include Mongoid ::Document
27
+ field :title
28
+ field :body
29
+ end
30
+
31
+ __END__
32
+
33
+ @@layout
34
+ %html
35
+ %head
36
+ %body
37
+ =yield
38
+
39
+ @@posts
40
+ %h1 Posts
41
+ #posts
42
+ - for post in @posts
43
+ #post
44
+ %h2
45
+ %a{:href => "/#{post.id}"}= post.title
46
+ #content
47
+ = post.body
48
+
49
+ @@post
50
+ %h1= @post.title
51
+ #content
52
+ = @post.body
You can’t perform that action at this time.
0 commit comments