public
Description: A 'blog' demo of how to use the Mack framework
Homepage: http://www.mackframework.com
Clone URL: git://github.com/markbates/mack_blog_demo.git
Rewrote demo to work with 0.4.6
markbates (author)
Fri Apr 18 14:45:18 -0700 2008
commit  49d6e493d77085052367ee709a13284613f94911
tree    b2ac04aa8dd541955fd235ca73fb49ffb3c6840c
parent  a30600ef263471c096ea0b7caf09f87b9695a4b1
...
1
2
3
4
5
6
7
8
9
10
11
12
13
 
 
...
1
2
3
 
4
 
 
 
 
 
 
 
5
6
7
0
@@ -1,12 +1,6 @@
0
 require 'rake'
0
 require 'rake/testtask'
0
 require 'rake/rdoctask'
0
-require 'rubygems'
0
 
0
-begin
0
- gem 'mack'
0
- require 'mack_tasks'
0
-rescue Exception => e
0
- raise e
0
- # require File.join(File.dirname(__FILE__), "..", "mack", "tasks")
0
-end
0
\ No newline at end of file
0
+gem 'mack', '0.4.6'
0
+require 'mack_tasks'
...
1
2
 
 
3
4
5
6
 
7
8
9
10
 
11
12
13
14
 
15
16
17
18
 
19
20
21
...
25
26
27
 
28
29
30
...
34
35
36
 
37
38
39
40
41
42
43
44
45
 
 
...
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
...
30
31
32
33
34
35
36
...
40
41
42
43
44
45
 
46
47
48
 
 
49
50
51
0
@@ -1,21 +1,26 @@
0
 class PostsController < Mack::Controller::Base
0
-
0
+
0
+ # GET /posts
0
   def index
0
     @posts = Post.find(:all)
0
   end
0
 
0
+ # GET /posts/1
0
   def show
0
     @post = Post.find(params(:id))
0
   end
0
 
0
+ # GET /posts/new
0
   def new
0
     @post = Post.new
0
   end
0
 
0
+ # GET /posts/1/edit
0
   def edit
0
     @post = Post.find(params(:id))
0
   end
0
 
0
+ # POST /posts
0
   def create
0
     @post = Post.new(params(:post))
0
     if @post.save
0
@@ -25,6 +30,7 @@ class PostsController < Mack::Controller::Base
0
     end
0
   end
0
 
0
+ # PUT /posts/1
0
   def update
0
     @post = Post.find(params(:id))
0
     if @post.update_attributes(params(:post))
0
@@ -34,11 +40,11 @@ class PostsController < Mack::Controller::Base
0
     end
0
   end
0
 
0
+ # DELETE /posts/1
0
   def delete
0
     @post = Post.find(params(:id))
0
- # data_mapper needs a ! after destroy
0
     @post.destroy!
0
     redirect_to(posts_index_url)
0
   end
0
-
0
-end
0
\ No newline at end of file
0
+
0
+end
...
1
2
3
4
5
6
7
8
 
...
1
 
 
 
 
 
 
2
3
0
@@ -1,7 +1,2 @@
0
 module ApplicationHelper
0
-
0
- def love_you
0
- "love you"
0
- end
0
-
0
-end
0
\ No newline at end of file
0
+end
...
4
5
6
7
8
9
10
11
12
 
...
4
5
6
 
 
 
 
 
7
8
0
@@ -4,8 +4,4 @@ class Post < DataMapper::Base
0
   property :body, :text
0
   property :created_at, :datetime
0
   property :updated_at, :datetime
0
-
0
- validates_presence_of :title
0
- validates_presence_of :body
0
- validates_presence_of :email
0
-end
0
\ No newline at end of file
0
+end
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@
0
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
0
 <head>
0
   <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
0
- <title>Posts: <%= controller.action_name %></title>
0
+ <title><%= controller.controller_name %>: <%= controller.action_name %></title>
0
   <link href="/stylesheets/scaffold.css" media="screen" rel="stylesheet" type="text/css" />
0
 </head>
0
 <body>
...
1
 
2
3
4
...
6
7
8
9
 
10
11
12
13
14
 
 
15
16
17
18
19
 
 
20
21
22
23
24
...
 
1
2
3
4
...
6
7
8
 
9
10
 
11
 
 
12
13
14
 
15
 
 
16
17
18
 
19
20
21
0
@@ -1,4 +1,4 @@
0
-<h1>Edit post</h1>
0
+<h1>Edit Post</h1>
0
 
0
 <%= error_messages_for :post %>
0
 
0
@@ -6,19 +6,16 @@
0
   <input type="hidden" name="_method" value="put">
0
   <p>
0
     <b>Title</b><br />
0
- <input id="post_title" name="post[title]" size="30" type="text" value="<%= @post.title %>" />
0
+ <input type="text" name="post[title]" id="post_title" size="30" value="<%= @post.title %>" />
0
   </p>
0
-
0
   <p>
0
- <b>Body</b><br />
0
- <textarea id="post_body" name="post[body]"><%= @post.body %></textarea>
0
+ <b>Email</b><br />
0
+ <input type="text" name="post[email]" id="post_email" size="30" value="<%= @post.email %>" />
0
   </p>
0
-
0
   <p>
0
- <b>Email</b><br />
0
- <input id="post_email" name="post[email]" size="30" type="text" value="<%= @post.email %>" />
0
+ <b>Body</b><br />
0
+ <textarea name="post[body]" id="post_body"><%= @post.body %></textarea>
0
   </p>
0
-
0
   <p>
0
     <input id="post_submit" name="commit" type="submit" value="Create" />
0
   </p>
...
1
2
3
 
4
5
6
7
8
9
 
 
 
10
11
12
13
14
15
16
 
 
 
 
 
17
18
19
...
1
2
 
3
4
5
6
7
 
8
9
10
11
12
13
14
15
 
 
 
16
17
18
19
20
21
22
23
0
@@ -1,19 +1,23 @@
0
 <%= rss_tag(posts_index_url(:format => :xml)) %>
0
 
0
-<h1>Listing posts</h1>
0
+<h1>Listing Posts</h1>
0
 
0
 <table>
0
   <tr>
0
     <th>Title</th>
0
- <th>Body</th>
0
     <th>Email</th>
0
+ <th>Body</th>
0
+ <th>CreatedAt</th>
0
+ <th>UpdatedAt</th>
0
   </tr>
0
 
0
 <% for post in @posts %>
0
   <tr>
0
- <td><%=post.title %></td>
0
- <td><%=post.body %></td>
0
- <td><%=post.email %></td>
0
+ <td><%= post.title %></td>
0
+ <td><%= post.email %></td>
0
+ <td><%= post.body %></td>
0
+ <td><%= post.created_at %></td>
0
+ <td><%= post.updated_at %></td>
0
     <td><%= link_to("Show", posts_show_url(:id => post.id)) %></td>
0
     <td><%= link_to("Edit", posts_edit_url(:id => post.id)) %></td>
0
     <td><%= link_to("Delete", posts_delete_url(:id => post.id), :method => :delete, :confirm => "Are you sure?") %></td>
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-xml.instruct! :xml, :version=>"1.0"
0
+xml.instruct! :xml, :version=>"1.0"
0
 xml.rss(:version => "2.0") do
0
   xml.channel do
0
     xml.title("My Mack Blog")
...
1
 
2
3
4
5
6
7
8
 
9
10
11
12
13
 
 
14
15
16
17
18
 
 
19
20
21
22
23
...
 
1
2
3
4
5
6
7
 
8
9
 
10
 
 
11
12
13
 
14
 
 
15
16
17
 
18
19
20
0
@@ -1,23 +1,20 @@
0
-<h1>New post</h1>
0
+<h1>New Post</h1>
0
 
0
 <%= error_messages_for :post %>
0
 
0
 <form action="<%= posts_create_url %>" class="new_post" id="new_post" method="post">
0
   <p>
0
     <b>Title</b><br />
0
- <input id="post_title" name="post[title]" size="30" type="text" value="<%= @post.title %>" />
0
+ <input type="text" name="post[title]" id="post_title" size="30" value="<%= @post.title %>" />
0
   </p>
0
-
0
   <p>
0
- <b>Body</b><br />
0
- <textarea id="post_body" name="post[body]"><%= @post.body %></textarea>
0
+ <b>Email</b><br />
0
+ <input type="text" name="post[email]" id="post_email" size="30" value="<%= @post.email %>" />
0
   </p>
0
-
0
   <p>
0
- <b>Email</b><br />
0
- <input id="post_email" name="post[email]" size="30" type="text" value="<%= @post.email %>" />
0
+ <b>Body</b><br />
0
+ <textarea name="post[body]" id="post_body"><%= @post.body %></textarea>
0
   </p>
0
-
0
   <p>
0
     <input id="post_submit" name="commit" type="submit" value="Create" />
0
   </p>
...
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
...
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
0
@@ -1,28 +1,26 @@
0
 <p>
0
- <b>Title:</b>
0
- <%= @post.title %>
0
+ <h1>Post</h1>
0
 </p>
0
-
0
 <p>
0
- <b>Body:</b>
0
- <%= @post.body %>
0
+ <b>Title</b><br />
0
+ <%= @post.title %>
0
 </p>
0
-
0
 <p>
0
- <b>Email:</b>
0
+ <b>Email</b><br />
0
   <%= @post.email %>
0
 </p>
0
-
0
 <p>
0
- <b>Created at:</b>
0
+ <b>Body</b><br />
0
+ <%= @post.body %>
0
+</p>
0
+<p>
0
+ <b>CreatedAt</b><br />
0
   <%= @post.created_at %>
0
 </p>
0
-
0
 <p>
0
- <b>Updated at:</b>
0
+ <b>UpdatedAt</b><br />
0
   <%= @post.updated_at %>
0
 </p>
0
 
0
-
0
 <%= link_to("Edit", posts_edit_url(:id => @post.id)) %> |
0
 <%= link_to("Back", posts_index_url) %>
...
1
2
3
4
5
6
7
 
8
9
10
11
12
13
14
 
 
 
...
 
 
 
 
1
2
 
3
4
 
 
 
 
 
5
6
7
8
0
@@ -1,13 +1,7 @@
0
-# mack::log_level: error
0
-
0
-orm: data_mapper
0
-
0
 whiny_config_missing: false
0
 
0
-foo: bar
0
+mack::session_id: _mack_blog_demo_session_id
0
 
0
-# cachetastic_default_options:
0
-# logging:
0
-# logger_1:
0
-# type: console
0
-# level: debug
0
\ No newline at end of file
0
+# log::level: error
0
+
0
+orm: data_mapper
...
1
2
 
...
 
1
2
0
@@ -1 +1 @@
0
-mack::session_id: _my_fake_app_session_id
0
\ No newline at end of file
0
+
...
 
...
1
0
@@ -0,0 +1 @@
0
+
...
 
...
1
0
@@ -0,0 +1 @@
0
+
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
 
 
5
6
7
 
8
9
10
11
 
...
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
0
@@ -1,11 +1,32 @@
0
+# development:
0
+# adapter: mysql
0
+# database: mack_blog_demo_development
0
+# host: localhost
0
+# username: root
0
+# password:
0
+#
0
+# test:
0
+# adapter: mysql
0
+# database: mack_blog_demo_test
0
+# host: localhost
0
+# username: root
0
+# password:
0
+#
0
+# production:
0
+# adapter: mysql
0
+# database: mack_blog_demo_production
0
+# host: localhost
0
+# username: root
0
+# password:
0
+
0
 development:
0
   adapter: sqlite3
0
- database: db/blog_comp_development.db
0
-
0
+ database: db/mack_blog_demo_development.db
0
+
0
 test:
0
   adapter: sqlite3
0
- database: db/blog_comp_test.db
0
+ database: db/mack_blog_demo_test.db
0
 
0
 production:
0
   adapter: sqlite3
0
- database: db/blog_comp_production.db
0
+ database: db/mack_blog_demo_production.db
...
1
2
3
 
 
4
5
6
7
8
9
10
 
...
1
 
 
2
3
4
5
6
7
8
 
9
10
0
@@ -1,9 +1,9 @@
0
 Mack::Routes.build do |r|
0
-
0
- r.resource :posts
0
+
0
+ r.resource :posts # Added by rake generate:scaffold name=post
0
   
0
   r.home_page "/", :controller => :posts, :action => :index
0
   
0
   r.defaults
0
   
0
-end
0
\ No newline at end of file
0
+end
...
1
2
 
...
 
1
2
0
@@ -1 +1 @@
0
-run Mack::Utils::Server.build_app
0
\ No newline at end of file
0
+run Mack::Utils::Server.build_app
...
4
5
6
7
8
9
10
...
4
5
6
 
 
7
8
0
@@ -4,7 +4,5 @@ log: log/thin.log
0
 timeout: 60
0
 port: 3000
0
 rackup: config/thin.ru
0
-# chdir: /Users/markbates/mack/test/fake_application
0
-# environment: development # => This is for RAILS apps ONLY!!
0
 address: 0.0.0.0
0
 # servers: 10
0
public/favicon.ico 100755 → 100644
...
14
15
16
17
 
18
19
20
...
27
28
29
30
 
31
32
33
...
36
37
38
39
 
40
41
42
...
46
47
48
49
 
50
51
52
...
14
15
16
 
17
18
19
20
...
27
28
29
 
30
31
32
33
...
36
37
38
 
39
40
41
42
...
46
47
48
 
49
50
51
52
0
@@ -14,7 +14,7 @@ class PostsControllerTest < Test::Unit::TestCase
0
   def test_index
0
     get posts_index_url
0
     assert_response :success
0
- assert_match "<title>Posts: index</title>", response.body
0
+ assert_match "<title>posts: index</title>", response.body
0
     posts = assigns(:posts)
0
     assert_not_nil posts
0
     assert_equal Post.count, posts.size
0
@@ -27,7 +27,7 @@ class PostsControllerTest < Test::Unit::TestCase
0
     p = Post.find(:first)
0
     get posts_show_url(:id => p.id)
0
     assert_response :success
0
- assert_match "<title>Posts: show</title>", response.body
0
+ assert_match "<title>posts: show</title>", response.body
0
     post = assigns(:post)
0
     assert_not_nil post
0
     assert_equal p, post
0
@@ -36,7 +36,7 @@ class PostsControllerTest < Test::Unit::TestCase
0
   def test_new
0
     get posts_new_url
0
     assert_response :success
0
- assert_match "<title>Posts: new</title>", response.body
0
+ assert_match "<title>posts: new</title>", response.body
0
     post = assigns(:post)
0
     assert_not_nil post
0
     assert_nil post.title
0
@@ -46,7 +46,7 @@ class PostsControllerTest < Test::Unit::TestCase
0
     p = Post.find(:first)
0
     get posts_edit_url(:id => p.id)
0
     assert_response :success
0
- assert_match "<title>Posts: edit</title>", response.body
0
+ assert_match "<title>posts: edit</title>", response.body
0
     post = assigns(:post)
0
     assert_not_nil post
0
     assert_equal p, post
...
13
14
15
16
17
 
...
13
14
15
 
16
17
0
@@ -13,4 +13,4 @@ require 'mack'
0
 
0
 class Test::Unit::TestCase
0
   
0
-end
0
\ No newline at end of file
0
+end

Comments

    No one has commented yet.