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,15 @@
1
+ module Blog::Models
2
+ class CreateUser < V 1.0
3
+ def self.up
4
+ create_table :blog_users do |t|
5
+ t.column :id , :integer , :null => false
6
+ t.column :username , :string
7
+ t.column :password , :string
8
+ end
9
+ User.create :username => 'admin', :password => 'bivouac'
10
+ end
11
+ def self.down
12
+ drop_table :blog_users
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ # Logfile created on Tue Jul 31 18:06:59 +0200 2007 by /
2
+ SQL (0.000289) SELECT name FROM sqlite_master WHERE type = 'table'
3
+ SQL (0.000000) SQLite3::SQLException: no such table: sessions: DROP TABLE sessions
4
+ SQL (0.075142) CREATE TABLE sessions ("id" INTEGER PRIMARY KEY NOT NULL, "hashid" varchar(32) DEFAULT NULL, "created_at" datetime DEFAULT NULL, "ivars" text DEFAULT NULL) 
5
+ SQL (0.000466) SELECT name FROM sqlite_master WHERE type = 'table'
6
+ SQL (0.000276) SELECT name FROM sqlite_master WHERE type = 'table'
7
+ SQL (0.056713) CREATE TABLE blog_schema_infos ("id" INTEGER PRIMARY KEY NOT NULL, "version" float DEFAULT NULL) 
8
+ Blog::Models::SchemaInfo Load (0.000256) SELECT * FROM blog_schema_infos LIMIT 1
9
+ SQL (0.052790) CREATE TABLE blog_comments ("id" INTEGER PRIMARY KEY NOT NULL, "post_id" integer NOT NULL, "username" varchar(255) DEFAULT NULL, "body" text DEFAULT NULL) 
10
+ SQL (0.064286) CREATE TABLE blog_posts ("id" INTEGER PRIMARY KEY NOT NULL, "user_id" integer NOT NULL, "title" varchar(255) DEFAULT NULL, "body" text DEFAULT NULL) 
11
+ SQL (0.054837) CREATE TABLE blog_users ("id" INTEGER PRIMARY KEY NOT NULL, "username" varchar(255) DEFAULT NULL, "password" varchar(255) DEFAULT NULL) 
12
+ SQL (0.000642) INSERT INTO blog_users ("username", "password") VALUES('admin', 'bivouac')
13
+ SQL (0.000488) INSERT INTO blog_schema_infos ("version") VALUES(1.0)
14
+ Camping::Models::Session Load (0.000347) SELECT * FROM sessions WHERE (sessions."hashid" = 'rfdZccdRGZpTif7vT2lwggt43wsHyGLi') LIMIT 1
15
+ SQL (0.000590) INSERT INTO sessions ("hashid", "created_at", "ivars") VALUES('embQk59C3ESMmQvAyXAwvYP3eBTDoegY', '2007-07-31 18:07:10', '--- !map:HashWithIndifferentAccess {}
16
+
17
+ ')
18
+ Blog::Models::Post Load (0.000249) SELECT * FROM blog_posts 
19
+ Camping::Models::Session Load (0.000529) SELECT * FROM sessions WHERE (sessions."hashid" = 'embQk59C3ESMmQvAyXAwvYP3eBTDoegY') LIMIT 1
@@ -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}"
@@ -3,6 +3,8 @@
3
3
  # (c)2007 Grégoire Lejeune
4
4
 
5
5
  require 'rubygems'
6
+ require 'optparse'
7
+ require 'ostruct'
6
8
  require 'bivouac/template'
7
9
  require 'active_support'
8
10
  require File.dirname($0) + '/../config/environment.rb'
@@ -12,39 +14,97 @@ module Bivouac
12
14
  include Bivouac::Template
13
15
 
14
16
  def initialize( argv )
15
- @script_arguments = argv
16
- # if @script_arguments.include?( '-h' ) or @script_arguments.include?( '--help' )
17
- # help( )
18
- # exit
19
- # end
17
+ @generator_type = argv.shift
20
18
 
21
- @app = Bivouac::Environment.new( )
22
- @generation_app_name = @app.environment.appname
19
+ @options = OpenStruct.new( :noview => false, :default_route => true, :routes => [] )
20
+ @opts = OptionParser.new do |opts|
21
+ opts.banner = "Usage: script/generate generator [options] [args]"
22
+
23
+ opts.separator ""
24
+ opts.separator "Generators"
25
+ opts.separator " Builtin: controller, model, migrate, view"
26
+
27
+ opts.separator ""
28
+ opts.separator "controller generator options:"
29
+ opts.on("-v", "--no-view", "Do not generate any view for the controller") { |@options.noview|
30
+ if @generator_type != 'controller'
31
+ puts @opts
32
+ exit
33
+ end
34
+ @options.noview = true
35
+ }
36
+ opts.on("-d", "--no-route", "Do not add the default route to the controller (/controller_name)") { |@options.default_route|
37
+ if @generator_type != 'controller'
38
+ puts @opts
39
+ exit
40
+ end
41
+ @options.default_route = false
42
+ }
43
+ opts.on("-r", "--route ROUTE,ROUTE,...", "Add ROUTES to the controller") { |routes|
44
+ if @generator_type != 'controller'
45
+ puts @opts
46
+ exit
47
+ end
48
+ @options.routes = routes.split(',')
49
+ }
50
+
51
+ opts.separator ""
52
+ opts.separator "Common options:"
53
+ opts.on_tail("-h", "--help", "Show this message") do
54
+ puts opts
55
+ exit
56
+ end
57
+ end
58
+
59
+ if ['-h', '--help'].include?( @generator_type )
60
+ puts @opts
61
+ exit
62
+ end
23
63
 
24
- @file_type = s( )
25
- @generation_name = s( )
26
- @generation_class_name = @generation_name.classify
27
- @generation_file_name = @generation_class_name.underscore
64
+ @opts.parse! argv
65
+ if argv.length < 1
66
+ puts @opts
67
+ exit
68
+ end
69
+
70
+ @script_arguments = argv.dup
28
71
 
29
- @destination_file = File.dirname( $0 ) + "/../app/" + @file_type.pluralize + "/" + @generation_file_name.underscore + ".rb"
72
+ @app = Bivouac::Environment.new( )
73
+ @generation_app_name = @app.environment.appname
74
+ @generation_type = @app.environment.orgtype
30
75
  end
31
76
 
32
77
  def run
33
- send( @file_type.to_sym )
78
+ @script_arguments.each do |@generation_name|
79
+ @generation_class_name = @generation_name.classify
80
+ @generation_file_name = @generation_class_name.underscore
81
+ send( @generator_type.to_sym )
82
+ end
34
83
  end
35
84
 
36
85
  private
37
86
  def controller
87
+ @destination_file = File.dirname( $0 ) + "/../app/" + @generator_type.pluralize + "/" + @generation_file_name.underscore + ".rb"
38
88
  @generation_view_name = @generation_class_name.underscore
89
+
90
+ default_route = '/' + @generation_view_name
91
+ @options.routes << default_route if @options.default_route and @options.routes.include?( default_route ) == false
92
+ @generation_routes = if @options.routes.size > 0
93
+ " < R '" + @options.routes.join("', '") + "'"
94
+ else
95
+ ""
96
+ end
97
+
39
98
  createFile( @destination_file ) do |io|
40
99
  io.puts template( "generate/controller", binding )
41
100
  end
42
101
 
43
- view( )
102
+ view( ) if @options.noview == false
44
103
  end
45
104
 
46
105
  def migrate
47
- @generation_table_name = (@generation_app_name + "_" + @generation_name).tableize
106
+ @generation_table_name = (@generation_class_name.downcase + "_" + @generation_name).tableize
107
+
48
108
  @destination_file = File.dirname( $0 ) + "/../db/migrate/" + @generation_file_name.underscore + ".rb"
49
109
  createFile( @destination_file ) do |io|
50
110
  io.puts template( "generate/migrate", binding )
@@ -57,6 +117,7 @@ module Bivouac
57
117
  end
58
118
 
59
119
  def model
120
+ @destination_file = File.dirname( $0 ) + "/../app/" + @generator_type.pluralize + "/" + @generation_file_name.underscore + ".rb"
60
121
  createFile( @destination_file ) do |io|
61
122
  io.puts template( "generate/model", binding )
62
123
  end
@@ -64,35 +125,21 @@ module Bivouac
64
125
  migrate( )
65
126
  end
66
127
 
67
- def view( )
68
- @destination_file = File.dirname( $0 ) + "/../app/views/" + @generation_file_name.underscore + ".rb"
69
- createFile( @destination_file ) do |io|
70
- io.puts template( "generate/view", binding )
128
+ def view
129
+ if @generation_type.downcase == "erb"
130
+ @destination_file = File.dirname( $0 ) + "/../app/views/" + @generation_file_name.underscore + ".html"
131
+ else
132
+ @destination_file = File.dirname( $0 ) + "/../app/views/" + @generation_file_name.underscore + ".rb"
71
133
  end
72
- end
73
-
74
- def s
75
- begin
76
- return @script_arguments.shift
77
- rescue
78
- help( )
79
- exit
134
+
135
+ @generation_view_name = @generation_class_name.underscore
136
+ createFile( @destination_file ) do |io|
137
+ io.puts template( "generate/view_#{@generation_type.downcase}", binding )
80
138
  end
81
139
  end
82
140
 
83
- def help
84
- puts <<-'END_PRODUCT'.gsub(/^\s+/, "")
85
- Usage: script/generate generator [args]
86
-
87
- Bivouac Info:
88
- -h, --help Show this help message and quit.
89
-
90
- Generators
91
- Builtin: controller, model, migrate
92
- END_PRODUCT
93
- end
94
-
95
141
  end
96
142
  end
97
143
 
98
- Bivouac::Generate.new( ARGV ).run( )
144
+
145
+ Bivouac::Generate.new( ARGV ).run( )
File without changes
@@ -1,8 +1,8 @@
1
1
  # CGI postamble
2
2
 
3
3
  if __FILE__ == $0
4
- <%= @appname %>::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'File.dirname(__FILE__) + "/../../db/#{conf.appname.tableize}.db"'
5
- <%= @appname %>::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/camping.log")
4
+ <%= @appname %>::Models::Base.establish_connection :adapter => 'sqlite3', :database => File.dirname(__FILE__) + "/../../db/<%= @appname %>.db"
5
+ <%= @appname %>::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/<%= @appname %>.log")
6
6
  <%= @appname %>.create if <%= @appname %>.respond_to? :create
7
7
  puts <%= @appname %>.run
8
8
  end
@@ -1,8 +1,8 @@
1
1
  # FastCGI postamble
2
2
  if __FILE__ == $0
3
3
  require 'camping/fastcgi'
4
- <%= @appname %>::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'File.dirname(__FILE__) + "/../../db/#{conf.appname.tableize}.db"'
5
- <%= @appname %>::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/camping.log")
4
+ <%= @appname %>::Models::Base.establish_connection :adapter => 'sqlite3', :database => File.dirname(__FILE__) + "/../../db/<%= @appname %>.db"
5
+ <%= @appname %>::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/<%= @appname %>.log")
6
6
  <%= @appname %>.create if <%= @appname %>.respond_to? :create
7
7
  Camping::FastCGI.start(<%= @appname %>)
8
8
  end
File without changes
@@ -3,8 +3,8 @@ if __FILE__ == $0
3
3
  require 'webrick/httpserver'
4
4
  require 'camping/webrick'
5
5
 
6
- <%= @appname %>::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'File.dirname(__FILE__) + "/../../db/#{conf.appname.tableize}.db"'
7
- <%= @appname %>::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/camping.log")
6
+ <%= @appname %>::Models::Base.establish_connection :adapter => 'sqlite3', :database => File.dirname(__FILE__) + "/../../db/<%= @appname %>.db"
7
+ <%= @appname %>::Models::Base.logger = Logger.new(File.dirname(__FILE__) + "/../../log/<%= @appname %>.log")
8
8
  <%= @appname %>.create if <%= @appname %>.respond_to? :create
9
9
  s = WEBrick::HTTPServer.new :BindAddress => "0.0.0.0", :Port => 3301
10
10
  s.mount "/", WEBrick::CampingHandler, <%= @appname %>
@@ -9,6 +9,8 @@
9
9
 
10
10
  require 'rubygems'
11
11
  require 'camping'
12
+ require 'camping/session'
13
+ require 'mime/types'
12
14
  require 'bivouac'
13
15
 
14
16
  include Bivouac
@@ -16,7 +18,7 @@ include Bivouac
16
18
  begin
17
19
  require 'erubis'
18
20
  ERB = Erubis::Eruby
19
- rescue
21
+ rescue MissingSourceFile
20
22
  require 'erb'
21
23
  end
22
24
 
@@ -9,6 +9,7 @@
9
9
 
10
10
  require 'rubygems'
11
11
  require 'camping'
12
+ require 'camping/session'
12
13
  require 'mime/types'
13
14
  require 'bivouac'
14
15
 
@@ -9,9 +9,14 @@
9
9
 
10
10
  require 'rubygems'
11
11
  require 'camping'
12
+ require 'camping/session'
12
13
 
13
14
  Camping.goes :<%= @appname %>
14
15
 
16
+ # module <%= @appname %>
17
+ # include Camping::Session
18
+ # end
19
+
15
20
  module <%= @appname %>::Helpers
16
21
  # Add your helpers here !
17
22
  end
File without changes
@@ -1,5 +1,5 @@
1
1
  module <%= @generation_app_name %>::Controllers
2
- class <%= @generation_class_name %> < R '/<%= @generation_view_name %>'
2
+ class <%= @generation_class_name %><%= @generation_routes %>
3
3
  def get
4
4
  render :<%= @generation_view_name %>
5
5
  end
@@ -1,4 +1,8 @@
1
+ module <%= @generation_app_name %>
2
+ include Camping::Session
3
+ end
4
+
1
5
  def <%= @generation_app_name %>.create
2
6
  Camping::Models::Session.create_schema
3
- <%= @generation_app_name %>::Models.create_schema :assume => (<%= @generation_app_name %>::Models::Post.table_exists? ? 1.0 : 0.0)
7
+ <%= @generation_app_name %>::Models.create_schema :assume => (<%= @generation_app_name %>::Models::<%= @generation_class_name %>.table_exists? ? 1.0 : 0.0)
4
8
  end
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ <h1 id="header"><%= @generation_app_name %>::Views#<%= @generation_view_name %></h1>
2
+ <p>Find me in <%= @destination_file %></p>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/lib/bivouac.rb CHANGED
File without changes