bivouac 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. data/AUTHORS +0 -0
  2. data/COPYING +0 -0
  3. data/README +14 -2
  4. data/bin/bivouac +0 -0
  5. data/examples/blog_erb/app/controllers/add.rb +19 -0
  6. data/examples/blog_erb/app/controllers/blog.rb +84 -0
  7. data/examples/blog_erb/app/controllers/comment.rb +9 -0
  8. data/examples/blog_erb/app/controllers/edit.rb +18 -0
  9. data/examples/blog_erb/app/controllers/index.rb +8 -0
  10. data/examples/blog_erb/app/controllers/info.rb +11 -0
  11. data/examples/blog_erb/app/controllers/login.rb +15 -0
  12. data/examples/blog_erb/app/controllers/logout.rb +8 -0
  13. data/examples/blog_erb/app/controllers/view.rb +9 -0
  14. data/examples/blog_erb/app/models/comment.rb +5 -0
  15. data/examples/blog_erb/app/models/post.rb +5 -0
  16. data/examples/blog_erb/app/models/user.rb +4 -0
  17. data/examples/blog_erb/app/views/add.html +18 -0
  18. data/examples/blog_erb/app/views/edit.html +18 -0
  19. data/examples/blog_erb/app/views/index.html +12 -0
  20. data/examples/blog_erb/app/views/layout.html +12 -0
  21. data/examples/blog_erb/app/views/login.html +2 -0
  22. data/examples/blog_erb/app/views/logout.html +2 -0
  23. data/examples/blog_erb/app/views/view.html +20 -0
  24. data/examples/blog_erb/config/environment.rb +27 -0
  25. data/examples/blog_erb/db/create.rb +8 -0
  26. data/examples/blog_erb/db/migrate/comment.rb +15 -0
  27. data/examples/blog_erb/db/migrate/post.rb +15 -0
  28. data/examples/blog_erb/db/migrate/user.rb +15 -0
  29. data/examples/blog_erb/log/Blog.log +112 -0
  30. data/examples/blog_erb/public/images/camping.png +0 -0
  31. data/examples/blog_erb/public/index.html +242 -0
  32. data/examples/blog_erb/public/stylesheets/style.css +10 -0
  33. data/examples/blog_erb/script/generate +3 -0
  34. data/examples/blog_erb/script/server +5 -0
  35. data/examples/blog_goh/app/controllers/add.rb +19 -0
  36. data/examples/blog_goh/app/controllers/blog.rb +76 -0
  37. data/examples/blog_goh/app/controllers/comment.rb +9 -0
  38. data/examples/blog_goh/app/controllers/edit.rb +18 -0
  39. data/examples/blog_goh/app/controllers/index.rb +8 -0
  40. data/examples/blog_goh/app/controllers/info.rb +11 -0
  41. data/examples/blog_goh/app/controllers/login.rb +15 -0
  42. data/examples/blog_goh/app/controllers/logout.rb +8 -0
  43. data/examples/blog_goh/app/controllers/view.rb +9 -0
  44. data/examples/blog_goh/app/models/comment.rb +5 -0
  45. data/examples/blog_goh/app/models/post.rb +5 -0
  46. data/examples/blog_goh/app/models/user.rb +4 -0
  47. data/examples/blog_goh/app/views/_form.rb +16 -0
  48. data/examples/blog_goh/app/views/_login.rb +13 -0
  49. data/examples/blog_goh/app/views/_post.rb +9 -0
  50. data/examples/blog_goh/app/views/add.rb +9 -0
  51. data/examples/blog_goh/app/views/edit.rb +9 -0
  52. data/examples/blog_goh/app/views/index.rb +12 -0
  53. data/examples/blog_goh/app/views/layout.rb +18 -0
  54. data/examples/blog_goh/app/views/login.rb +6 -0
  55. data/examples/blog_goh/app/views/logout.rb +6 -0
  56. data/examples/blog_goh/app/views/view.rb +20 -0
  57. data/examples/blog_goh/config/environment.rb +27 -0
  58. data/examples/blog_goh/db/create.rb +4 -0
  59. data/examples/blog_goh/db/migrate/comment.rb +15 -0
  60. data/examples/blog_goh/db/migrate/post.rb +15 -0
  61. data/examples/blog_goh/db/migrate/user.rb +15 -0
  62. data/examples/blog_goh/log/camping.log +19 -0
  63. data/examples/blog_goh/public/images/camping.png +0 -0
  64. data/examples/blog_goh/public/index.html +242 -0
  65. data/examples/blog_goh/public/stylesheets/style.css +10 -0
  66. data/examples/blog_goh/script/generate +3 -0
  67. data/examples/blog_goh/script/server +5 -0
  68. data/lib/bivouac/commands/generate.rb +87 -40
  69. data/lib/bivouac/commands/server.rb +0 -0
  70. data/lib/bivouac/template/application/postamble_cgi.rb +2 -2
  71. data/lib/bivouac/template/application/postamble_fastcgi.rb +2 -2
  72. data/lib/bivouac/template/application/postamble_mongrel.rb +0 -0
  73. data/lib/bivouac/template/application/postamble_none.rb +0 -0
  74. data/lib/bivouac/template/application/postamble_webrick.rb +2 -2
  75. data/lib/bivouac/template/application_erb.rb +3 -1
  76. data/lib/bivouac/template/application_goh.rb +1 -0
  77. data/lib/bivouac/template/application_jof.rb +5 -0
  78. data/lib/bivouac/template/environment.rb +0 -0
  79. data/lib/bivouac/template/generate/controller.rb +1 -1
  80. data/lib/bivouac/template/generate/create.rb +5 -1
  81. data/lib/bivouac/template/generate/migrate.rb +0 -0
  82. data/lib/bivouac/template/generate/model.rb +0 -0
  83. data/lib/bivouac/template/generate/view_erb.rb +2 -0
  84. data/lib/bivouac/template/generate/{view.rb → view_goh.rb} +0 -0
  85. data/lib/bivouac/template/generate.rb +0 -0
  86. data/lib/bivouac/template/server.rb +0 -0
  87. data/lib/bivouac/template/static/camping.png +0 -0
  88. data/lib/bivouac/template/static/index.html +0 -0
  89. data/lib/bivouac/template/static/index.rb +0 -0
  90. data/lib/bivouac/template.rb +0 -0
  91. data/lib/bivouac.rb +0 -0
  92. data/setup.rb +1585 -0
  93. data/test/test_bivouac.rb +0 -0
  94. data/test/test_template.rb +0 -0
  95. metadata +99 -14
  96. data/doc/created.rid +0 -1
  97. data/doc/files/AUTHORS.html +0 -95
  98. data/doc/files/COPYING.html +0 -519
  99. data/doc/files/README.html +0 -160
  100. data/doc/index.html +0 -10
  101. data/doc/permalink.gif +0 -0
  102. data/doc/rdoc-style.css +0 -106
  103. data/doc/rubyfr.png +0 -0
@@ -0,0 +1,242 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
6
+ <title>Bivouac: Welcome aboard</title>
7
+ <style type="text/css" media="screen">
8
+ body {
9
+ margin: 0;
10
+ margin-bottom: 25px;
11
+ padding: 0;
12
+ background-color: #f0f0f0;
13
+ font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
14
+ font-size: 13px;
15
+ color: #333;
16
+ }
17
+
18
+ h1 {
19
+ font-size: 28px;
20
+ color: #000;
21
+ }
22
+
23
+ a {color: #03c}
24
+ a:hover {
25
+ background-color: #03c;
26
+ color: white;
27
+ text-decoration: none;
28
+ }
29
+
30
+
31
+ #page {
32
+ background-color: #f0f0f0;
33
+ width: 750px;
34
+ margin: 0;
35
+ margin-left: auto;
36
+ margin-right: auto;
37
+ }
38
+
39
+ #content {
40
+ float: left;
41
+ background-color: white;
42
+ border: 3px solid #aaa;
43
+ border-top: none;
44
+ padding: 25px;
45
+ width: 500px;
46
+ }
47
+
48
+ #sidebar {
49
+ float: right;
50
+ width: 175px;
51
+ }
52
+
53
+ #footer {
54
+ clear: both;
55
+ }
56
+
57
+
58
+ #header, #about, #getting-started {
59
+ padding-left: 75px;
60
+ padding-right: 30px;
61
+ }
62
+
63
+
64
+ #header {
65
+ background-image: url("images/camping.png");
66
+ background-repeat: no-repeat;
67
+ background-position: top right;
68
+ height: 100px;
69
+ }
70
+ #header h1, #header h2 {margin: 0}
71
+ #header h2 {
72
+ color: #888;
73
+ font-weight: normal;
74
+ font-size: 16px;
75
+ }
76
+
77
+
78
+ #about h3 {
79
+ margin: 0;
80
+ margin-bottom: 10px;
81
+ font-size: 14px;
82
+ }
83
+
84
+ #about-content {
85
+ background-color: #ffd;
86
+ border: 1px solid #fc0;
87
+ margin-left: -11px;
88
+ }
89
+ #about-content table {
90
+ margin-top: 10px;
91
+ margin-bottom: 10px;
92
+ font-size: 11px;
93
+ border-collapse: collapse;
94
+ }
95
+ #about-content td {
96
+ padding: 10px;
97
+ padding-top: 3px;
98
+ padding-bottom: 3px;
99
+ }
100
+ #about-content td.name {color: #555}
101
+ #about-content td.value {color: #000}
102
+
103
+ #about-content.failure {
104
+ background-color: #fcc;
105
+ border: 1px solid #f00;
106
+ }
107
+ #about-content.failure p {
108
+ margin: 0;
109
+ padding: 10px;
110
+ }
111
+
112
+
113
+ #getting-started {
114
+ border-top: 1px solid #ccc;
115
+ margin-top: 25px;
116
+ padding-top: 15px;
117
+ }
118
+ #getting-started h1 {
119
+ margin: 0;
120
+ font-size: 20px;
121
+ }
122
+ #getting-started h2 {
123
+ margin: 0;
124
+ font-size: 14px;
125
+ font-weight: normal;
126
+ color: #333;
127
+ margin-bottom: 25px;
128
+ }
129
+ #getting-started ol {
130
+ margin-left: 0;
131
+ padding-left: 0;
132
+ }
133
+ #getting-started li {
134
+ font-size: 18px;
135
+ color: #888;
136
+ margin-bottom: 25px;
137
+ }
138
+ #getting-started li h2 {
139
+ margin: 0;
140
+ font-weight: normal;
141
+ font-size: 18px;
142
+ color: #333;
143
+ }
144
+ #getting-started li p {
145
+ color: #555;
146
+ font-size: 13px;
147
+ }
148
+
149
+
150
+ #search {
151
+ margin: 0;
152
+ padding-top: 10px;
153
+ padding-bottom: 10px;
154
+ font-size: 11px;
155
+ }
156
+ #search input {
157
+ font-size: 11px;
158
+ margin: 2px;
159
+ }
160
+ #search-text {width: 170px}
161
+
162
+
163
+ #sidebar ul {
164
+ margin-left: 0;
165
+ padding-left: 0;
166
+ }
167
+ #sidebar ul h3 {
168
+ margin-top: 25px;
169
+ font-size: 16px;
170
+ padding-bottom: 10px;
171
+ border-bottom: 1px solid #ccc;
172
+ }
173
+ #sidebar li {
174
+ list-style-type: none;
175
+ }
176
+ #sidebar ul.links li {
177
+ margin-bottom: 5px;
178
+ }
179
+
180
+ </style>
181
+ </head>
182
+ <body>
183
+ <div id="page">
184
+ <div id="sidebar">
185
+ <ul id="sidebar-items">
186
+ <li>
187
+ <form id="search" action="http://www.google.com/search" method="get">
188
+ <input type="hidden" name="hl" value="en" />
189
+ <input type="text" id="search-text" name="q" value="site:code.whytheluckystiff.net/camping " />
190
+ <input type="submit" value="Search" /> the Camping site
191
+ </form>
192
+ </li>
193
+
194
+ <li>
195
+ <h3>Join the community</h3>
196
+ <ul class="links">
197
+ <li><a href="http://redhanded.hobix.com/bits/campingAMicroframework.html">Camping</a></li>
198
+ <li><a href="http://code.whytheluckystiff.net/camping">Wiki</a></li>
199
+ <li><a href="http://code.whytheluckystiff.net/camping/browser/">Code</a></li>
200
+ <li><a href="http://code.whytheluckystiff.net/camping/report/1">Bug tracker</a></li>
201
+ </ul>
202
+ </li>
203
+
204
+ <li>
205
+ <h3>Browse the documentation</h3>
206
+ <ul class="links">
207
+ <li><a href="http://camping.rubyforge.org/files/README.html">Camping API</a></li>
208
+ <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
209
+ <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
210
+ </ul>
211
+ </li>
212
+ </ul>
213
+ </div>
214
+
215
+ <div id="content">
216
+ <div id="header">
217
+ <h1>Welcome aboard</h1>
218
+ <h2>You can now go in the tent!</h2>
219
+ </div>
220
+
221
+ <div id="getting-started">
222
+ <h1>Getting started</h1>
223
+ <h2>Here&rsquo;s how to get rolling:</h2>
224
+
225
+ <ol>
226
+ <li>
227
+ <h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
228
+ <p>To see all available options, run it without parameters.</p>
229
+ </li>
230
+
231
+ <li>
232
+ <h2>That's all folks...</h2>
233
+ <p>...time for barbecue!</p>
234
+ </li>
235
+ </ol>
236
+ </div>
237
+ </div>
238
+
239
+ <div id="footer">&nbsp;</div>
240
+ </div>
241
+ </body>
242
+ </html>
@@ -0,0 +1,10 @@
1
+ body {
2
+ font-family: Utopia, Georga, serif;
3
+ }
4
+ h1.header {
5
+ background-color: #fef;
6
+ margin: 0; padding: 10px;
7
+ }
8
+ div.content {
9
+ padding: 10px;
10
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'bivouac/commands/generate'
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ app = File.dirname(__FILE__) + "/../app/controllers/blog.rb"
4
+
5
+ system "ruby #{app}"
@@ -0,0 +1,19 @@
1
+ module Blog::Controllers
2
+ class Add
3
+ def get
4
+ unless @state.user_id.blank?
5
+ @user = User.find @state.user_id
6
+ @post = Post.new
7
+ end
8
+ render :add
9
+ end
10
+ def post
11
+ unless @state.user_id.blank?
12
+ post = Post.create :title => input.post_title,
13
+ :body => input.post_body,
14
+ :user_id => @state.user_id
15
+ redirect View, post
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # Project Blog
5
+ #
6
+ # Created using bivouac on Tue Jul 31 11:59:59 +0200 2007.
7
+ # Copyright (c) 2007 __My__. All rights reserved.
8
+ #
9
+
10
+ require 'rubygems'
11
+ require 'camping'
12
+ require 'camping/session'
13
+ require 'mime/types'
14
+ require 'bivouac'
15
+
16
+ include Bivouac
17
+
18
+ Camping.goes :Blog
19
+
20
+ module Blog
21
+ include Camping::Session
22
+ end
23
+
24
+ # Load helpers from app/helpers
25
+ files( '../helpers' ) { |file| require( file ) }
26
+
27
+ # Load models from app/models
28
+ files( '../models' ) { |file| require( file ) }
29
+
30
+ # Load database schema from db/migrate
31
+ files( '../../db/migrate' ) { |file| require( file ) }
32
+
33
+ # Load views from app/views
34
+ files( '../views' ) { |file| require( file ) }
35
+
36
+ # Load controllers from app/controllers
37
+ files( '../controllers', :except => [File.basename(__FILE__)] ) { |file| require( file ) }
38
+
39
+ module Blog::Controllers
40
+ class Public < R '/public/(.+)'
41
+ PATH = File.expand_path(File.dirname(__FILE__))
42
+
43
+ def get file
44
+ if file.include? '..'
45
+ @status = '403'
46
+ return '403 - Invalid path'
47
+ else
48
+ type = (MIME::Types.type_for(file)[0] || '/text/plain').to_s
49
+ @headers['Content-Type'] = type
50
+ @headers['X-Sendfile'] = File.join PATH, '..', '..', 'public', file
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ # Load create
57
+ files( '../../db' ) { |file| require( file ) }
58
+
59
+ # WEBrick postamble
60
+ if __FILE__ == $0
61
+ require 'webrick/httpserver'
62
+ require 'camping/webrick'
63
+
64
+ Blog::Models::Base.establish_connection :adapter => 'sqlite3', :database => File.dirname(__FILE__) + "/../../db/Blog.db"
65
+ Blog::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/camping.log")
66
+ Blog.create if Blog.respond_to? :create
67
+ s = WEBrick::HTTPServer.new :BindAddress => "0.0.0.0", :Port => 3301
68
+ s.mount "/", WEBrick::CampingHandler, Blog
69
+
70
+ # This lets Ctrl+C shut down your server
71
+ trap(:INT) do
72
+ s.shutdown
73
+ end
74
+
75
+ s.start
76
+ end
@@ -0,0 +1,9 @@
1
+ module Blog::Controllers
2
+ class Comment
3
+ def post
4
+ Models::Comment.create(:username => input.post_username,
5
+ :body => input.post_body, :post_id => input.post_id)
6
+ redirect View, input.post_id
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ module Blog::Controllers
2
+ class Edit < R '/edit/(\d+)', '/edit'
3
+ def get post_id
4
+ unless @state.user_id.blank?
5
+ @user = User.find @state.user_id
6
+ end
7
+ @post = Post.find post_id
8
+ render :edit
9
+ end
10
+ def post
11
+ unless @state.user_id.blank?
12
+ @post = Post.find input.post_id
13
+ @post.update_attributes :title => input.post_title, :body => input.post_body
14
+ redirect View, @post
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,8 @@
1
+ module Blog::Controllers
2
+ class Index < R '/'
3
+ def get
4
+ @posts = Post.find :all
5
+ render :index
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ module Blog::Controllers
2
+ class Info < R '/info/(\d+)', '/info/(\w+)/(\d+)', '/info', '/info/(\d+)/(\d+)/(\d+)/([\w-]+)'
3
+ def get(*args)
4
+ div do
5
+ code args.inspect; br; br
6
+ code @env.inspect; br
7
+ code "Link: #{R(Info, 1, 2)}"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module Blog::Controllers
2
+ class Login
3
+ def post
4
+ @user = User.find :first, :conditions => ['username = ? AND password = ?', input.username, input.password]
5
+
6
+ if @user
7
+ @login = 'login success !'
8
+ @state.user_id = @user.id
9
+ else
10
+ @login = 'wrong user name or password'
11
+ end
12
+ render :login
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ module Blog::Controllers
2
+ class Logout
3
+ def get
4
+ @state.user_id = nil
5
+ render :logout
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,9 @@
1
+ module Blog::Controllers
2
+ class View < R '/view/(\d+)'
3
+ def get post_id
4
+ @post = Post.find post_id
5
+ @comments = Models::Comment.find :all, :conditions => ['post_id = ?', post_id]
6
+ render :view
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,5 @@
1
+ module Blog::Models
2
+ class Comment < Base
3
+ belongs_to :post
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module Blog::Models
2
+ class Post < Base
3
+ belongs_to :user
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module Blog::Models
2
+ class User < Base
3
+ end
4
+ end
@@ -0,0 +1,16 @@
1
+ module Blog::Views
2
+ def _form(post, opts)
3
+ p { "You are logged in as #{@user.username} | #{a 'Logout', :href => R(Logout)}" }
4
+ form({:method => 'post'}.merge(opts)) do
5
+ label 'Title', :for => 'post_title'; br
6
+ input :name => 'post_title', :type => 'text',
7
+ :value => post.title; br
8
+
9
+ label 'Body', :for => 'post_body'; br
10
+ textarea post.body, :name => 'post_body'; br
11
+
12
+ input :type => 'hidden', :name => 'post_id', :value => post.id
13
+ input :type => 'submit'
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ module Blog::Views
2
+ def _login
3
+ form :action => R(Login), :method => 'post' do
4
+ label 'Username', :for => 'username'; br
5
+ input :name => 'username', :type => 'text'; br
6
+
7
+ label 'Password', :for => 'password'; br
8
+ input :name => 'password', :type => 'text'; br
9
+
10
+ input :type => 'submit', :name => 'login', :value => 'Login'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ module Blog::Views
2
+ def _post( post )
3
+ h1 post.title
4
+ p post.body
5
+ p do
6
+ [a("Edit", :href => R(Edit, post)), a("View", :href => R(View, post))].join " | "
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Blog::Views
2
+ def add
3
+ if @user
4
+ _form( @post, :action => R(Add) )
5
+ else
6
+ _login
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Blog::Views
2
+ def edit
3
+ if @user
4
+ _form(@post, :action => R(Edit))
5
+ else
6
+ _login
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module Blog::Views
2
+ def index
3
+ if @posts.empty?
4
+ p 'No posts found.'
5
+ p { a 'Add', :href => R(Add) }
6
+ else
7
+ for post in @posts
8
+ _post( post )
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ module Blog::Views
2
+ def layout
3
+ html do
4
+ head do
5
+ title 'blog'
6
+ link :rel => 'stylesheet', :type => 'text/css',
7
+ :href => '/public/stylesheets/style.css', :media => 'screen'
8
+ end
9
+ body do
10
+ h1.header { a 'blog', :href => R(Index) }
11
+ small { a 'add', :href => R(Add) }
12
+ div.content do
13
+ self << yield
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,6 @@
1
+ module Blog::Views
2
+ def login
3
+ p { b @login }
4
+ p { a 'Continue', :href => R(Add) }
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Blog::Views
2
+ def logout
3
+ p "You have been logged out."
4
+ p { a 'Continue', :href => R(Index) }
5
+ end
6
+ end
@@ -0,0 +1,20 @@
1
+ module Blog::Views
2
+ def view
3
+ _post(@post)
4
+
5
+ p "Comment for this post:"
6
+ for c in @comments
7
+ h1 c.username
8
+ p c.body
9
+ end
10
+
11
+ form :action => R(Comment), :method => 'post' do
12
+ label 'Name', :for => 'post_username'; br
13
+ input :name => 'post_username', :type => 'text'; br
14
+ label 'Comment', :for => 'post_body'; br
15
+ textarea :name => 'post_body' do; end; br
16
+ input :type => 'hidden', :name => 'post_id', :value => @post.id
17
+ input :type => 'submit'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ #
2
+ # Project Blog
3
+ #
4
+ # Created using bivouac on Tue Jul 31 11:59:59 +0200 2007.
5
+ # Copyright (c) 2007 __My__. All rights reserved.
6
+ #
7
+ # DO NOT EDIT THIS FILE, OR YOU REALLY KNOW WHAT YOU ARE DOING !
8
+ #
9
+
10
+ require 'ostruct'
11
+
12
+ module Bivouac
13
+ class Environment
14
+
15
+ attr_reader :environment
16
+
17
+ def initialize
18
+ @environment = OpenStruct.new( )
19
+
20
+ @environment.appname = "Blog"
21
+ @environment.db = "sqlite3"
22
+ @environment.appdir = "blog"
23
+ @environment.orgtype = "GOH"
24
+ @environment.postamble = "webrick"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ def Blog.create
2
+ Camping::Models::Session.create_schema
3
+ Blog::Models.create_schema :assume => (Blog::Models::Post.table_exists? ? 1.0 : 0.0)
4
+ end
@@ -0,0 +1,15 @@
1
+ module Blog::Models
2
+ class CreateComment < V 1.0
3
+ def self.up
4
+ create_table :blog_comments do |t|
5
+ t.column :id , :integer , :null => false
6
+ t.column :post_id , :integer , :null => false
7
+ t.column :username , :string
8
+ t.column :body , :text
9
+ end
10
+ end
11
+ def self.down
12
+ drop_table :blog_comments
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module Blog::Models
2
+ class CreatePost < V 1.0
3
+ def self.up
4
+ create_table :blog_posts do |t|
5
+ t.column :id , :integer , :null => false
6
+ t.column :user_id , :integer , :null => false
7
+ t.column :title , :string , :limit => 255
8
+ t.column :body , :text
9
+ end
10
+ end
11
+ def self.down
12
+ drop_table :blog_posts
13
+ end
14
+ end
15
+ end