bivouac 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README +11 -2
- data/bin/bivouac +38 -3
- data/doc/rdoc/classes/BivouacHelpers/BaseView.html +38 -0
- data/doc/rdoc/classes/BivouacHelpers/FormView.html +24 -24
- data/doc/rdoc/classes/BivouacHelpers/HtmlView.html +12 -12
- data/doc/rdoc/classes/BivouacHelpers/JavaScriptView.html +32 -32
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/README.html +31 -5
- data/doc/rdoc/files/lib/bivouac/helpers/view/goh/base_rb.html +1 -1
- data/doc/rdoc/rdoc-style.css +8 -8
- data/lib/bivouac/commands/generate.rb +70 -10
- data/lib/bivouac/helpers/view/goh/base.rb +19 -0
- data/lib/bivouac/template/application/postamble.rb +8 -2
- data/lib/bivouac/template/environment.rb +3 -0
- data/lib/bivouac/template/generate/create.rb +2 -1
- data/lib/bivouac/template/generate/migrate.rb +2 -1
- data/lib/bivouac/template/generate/migration.rb +9 -0
- data/lib/bivouac/template/generate/test_begin.rb +10 -0
- data/lib/bivouac/template/generate/test_end.rb +1 -0
- data/lib/bivouac/template/generate/test_views.rb +4 -0
- data/lib/bivouac/template/server.rb +1 -0
- data/lib/bivouac.rb +3 -0
- metadata +16 -3
data/README
CHANGED
@@ -12,6 +12,16 @@ Bivouac is a simple generator for camping[http://code.whytheluckystiff.net/campi
|
|
12
12
|
|
13
13
|
== FEATURES/PROBLEMS:
|
14
14
|
|
15
|
+
=== 0.0.9:
|
16
|
+
* Upgrade to simple-daemon >=0.1.2
|
17
|
+
* Better migration support! And migrate is now migration ! That's better no ?
|
18
|
+
* Add MySQL, PostgreSQL, ... support. See
|
19
|
+
$ bivouac -h
|
20
|
+
* Add tests support with mosquito[http://mosquito.rubyforge.org/] :
|
21
|
+
$ ruby script/generate test my_test_name
|
22
|
+
To run a test, juste do :
|
23
|
+
$ ruby test/test_my_test_name.rb
|
24
|
+
|
15
25
|
=== 0.0.8:
|
16
26
|
* Bivouac now work with WEBrick -- Bug correction
|
17
27
|
* Markaby::Builder.set(:indent, 2)
|
@@ -58,8 +68,7 @@ Bivouac is a simple generator for camping[http://code.whytheluckystiff.net/campi
|
|
58
68
|
== TODO:
|
59
69
|
|
60
70
|
* add test with mosquito[http://code.whytheluckystiff.net/camping/wiki/MosquitoForBugFreeCamping]
|
61
|
-
*
|
62
|
-
* add mysql, postgresql, oracle, ... support
|
71
|
+
* more helpers...
|
63
72
|
|
64
73
|
== SYNOPSIS:
|
65
74
|
|
data/bin/bivouac
CHANGED
@@ -13,7 +13,10 @@ require 'fileutils'
|
|
13
13
|
require 'bivouac/template'
|
14
14
|
include Bivouac::Template
|
15
15
|
|
16
|
-
|
16
|
+
database_configuration = {
|
17
|
+
:adapter => "sqlite3"
|
18
|
+
}
|
19
|
+
@conf = OpenStruct.new( :db => "{\n\t:adapter => 'sqlite3'\n\t:database => 'db/bivouac.db'\n}", :orgtype => "GOH", :port => 3301, :address => "0.0.0.0" )
|
17
20
|
|
18
21
|
opts = OptionParser.new do |opts|
|
19
22
|
opts.banner = "Usage: bivouac [options] app"
|
@@ -21,8 +24,33 @@ opts = OptionParser.new do |opts|
|
|
21
24
|
opts.separator ""
|
22
25
|
opts.separator "Specific options:"
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
opts.on("-d", "--database NAME", "Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).") { |dbtype|
|
28
|
+
database_configuration = {
|
29
|
+
:adapter => dbtype
|
30
|
+
}
|
31
|
+
|
32
|
+
case dbtype
|
33
|
+
when "mysql"
|
34
|
+
database_configuration[:username] = ""
|
35
|
+
database_configuration[:password] = ""
|
36
|
+
database_configuration[:host] = "localhost"
|
37
|
+
when "postgresql"
|
38
|
+
database_configuration[:username] = "root"
|
39
|
+
database_configuration[:password] = ""
|
40
|
+
database_configuration[:host] = "localhost"
|
41
|
+
when "oracle"
|
42
|
+
database_configuration[:username] = ""
|
43
|
+
database_configuration[:password] = ""
|
44
|
+
when "sqlite2"
|
45
|
+
database_configuration[:adapter] = "sqlite"
|
46
|
+
when "sqlite3"
|
47
|
+
else
|
48
|
+
puts opts
|
49
|
+
exit
|
50
|
+
end
|
51
|
+
|
52
|
+
@conf.db = "{\n\t:adapter => '#{dbtype}'\n\t:database => 'db/bivouac.db'\n}"
|
53
|
+
}
|
26
54
|
opts.on("-P", "--port PORT", "Which port to bind to (3301)") { |@conf.port| }
|
27
55
|
opts.on("-a", "--address ADDR", "Address to bind to (0.0.0.0)") { |@conf.address| }
|
28
56
|
opts.on("-o", "--organize TYPE", "Type or organisation (options: JOF:Just On File/GOH:Get Out of Hand/ERB:use Eruby or Erb)") { |@conf.orgtype|
|
@@ -61,6 +89,13 @@ name = ARGV.dup
|
|
61
89
|
@conf.appname = name[0].classify
|
62
90
|
@conf.appdir = @conf.appname.underscore
|
63
91
|
|
92
|
+
if database_configuration[:adapter] =~ /sqlite/
|
93
|
+
database_configuration[:database] = "db/" + @conf.appdir + ".db"
|
94
|
+
else
|
95
|
+
database_configuration[:database] = @conf.appdir
|
96
|
+
end
|
97
|
+
@conf.db = database_configuration.inspect
|
98
|
+
|
64
99
|
@appname = @conf.appname
|
65
100
|
|
66
101
|
createDir( @conf.appdir )
|
@@ -103,6 +103,44 @@ bivouac/helpers/view/html
|
|
103
103
|
|
104
104
|
<h2 class="ruled">Methods</h2>
|
105
105
|
<h4 class="ruled">Public Instance method:
|
106
|
+
<strong><a name="M000027">partial( partial, options = {} )</a></strong> <a href="#M000027"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: partial" /></a></h4>
|
107
|
+
|
108
|
+
<p>
|
109
|
+
Alias for <a href="BaseView.html#M000026">render</a>
|
110
|
+
</p>
|
111
|
+
|
112
|
+
<h4 class="ruled">Public Instance method:
|
113
|
+
<strong><a name="M000028">public_to_str( file )</a></strong> <a href="#M000028"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: public_to_str" /></a></h4>
|
114
|
+
|
115
|
+
<p>
|
116
|
+
Return the content of a public file as string
|
117
|
+
</p>
|
118
|
+
<pre>
|
119
|
+
public_to_str( "/stylesheets/autocomplete.css" )
|
120
|
+
#=> "div.autocomplete {\n position:absolute;\n..."
|
121
|
+
</pre>
|
122
|
+
|
123
|
+
<div class="sourcecode">
|
124
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000028_source')" id="l_M000028_source">show source</a> ]</p>
|
125
|
+
<div id="M000028_source" class="dyn-source">
|
126
|
+
<pre>
|
127
|
+
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/base.rb, line 22</span>
|
128
|
+
22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">public_to_str</span>( <span class="ruby-identifier">file</span> )
|
129
|
+
23: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">file</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">".."</span>
|
130
|
+
24: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
131
|
+
25: <span class="ruby-keyword kw">end</span>
|
132
|
+
26:
|
133
|
+
27: <span class="ruby-identifier">file</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'BIVOUAC_ROOT'</span>] <span class="ruby-operator">+</span> <span class="ruby-value str">"/public/"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">file</span>
|
134
|
+
28: <span class="ruby-identifier">open</span>( <span class="ruby-identifier">file</span> ) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
135
|
+
29: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span>
|
136
|
+
30: <span class="ruby-keyword kw">end</span>
|
137
|
+
31:
|
138
|
+
32: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">data</span>
|
139
|
+
33: <span class="ruby-keyword kw">end</span>
|
140
|
+
</pre>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
<h4 class="ruled">Public Instance method:
|
106
144
|
<strong><a name="M000026">render( partial, options = {} )</a></strong> <a href="#M000026"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: render" /></a></h4>
|
107
145
|
|
108
146
|
<pre>
|
@@ -103,7 +103,7 @@ bivouac/helpers/view/html
|
|
103
103
|
|
104
104
|
<h2 class="ruled">Methods</h2>
|
105
105
|
<h4 class="ruled">Public Instance method:
|
106
|
-
<strong><a name="
|
106
|
+
<strong><a name="M000042">auto_complete_field( field_id, options = nil )</a></strong> <a href="#M000042"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: auto_complete_field" /></a></h4>
|
107
107
|
|
108
108
|
<p>
|
109
109
|
Adds AJAX autocomplete functionality to the text input field with the DOM
|
@@ -111,8 +111,8 @@ ID specified by <tt>field_id</tt>.
|
|
111
111
|
</p>
|
112
112
|
|
113
113
|
<div class="sourcecode">
|
114
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
115
|
-
<div id="
|
114
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show source</a> ]</p>
|
115
|
+
<div id="M000042_source" class="dyn-source">
|
116
116
|
<pre>
|
117
117
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 6</span>
|
118
118
|
6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">auto_complete_field</span>( <span class="ruby-identifier">field_id</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span> )
|
@@ -131,7 +131,7 @@ ID specified by <tt>field_id</tt>.
|
|
131
131
|
</div>
|
132
132
|
</div>
|
133
133
|
<h4 class="ruled">Public Instance method:
|
134
|
-
<strong><a name="
|
134
|
+
<strong><a name="M000044">button_to_function(name, *args, &block)</a></strong> <a href="#M000044"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: button_to_function" /></a></h4>
|
135
135
|
|
136
136
|
<p>
|
137
137
|
Returns a button that‘ll trigger a JavaScript function using the
|
@@ -144,8 +144,8 @@ making an Ajax request first).
|
|
144
144
|
</p>
|
145
145
|
|
146
146
|
<div class="sourcecode">
|
147
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
148
|
-
<div id="
|
147
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000044_source')" id="l_M000044_source">show source</a> ]</p>
|
148
|
+
<div id="M000044_source" class="dyn-source">
|
149
149
|
<pre>
|
150
150
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 63</span>
|
151
151
|
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">button_to_function</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -163,7 +163,7 @@ making an Ajax request first).
|
|
163
163
|
</div>
|
164
164
|
</div>
|
165
165
|
<h4 class="ruled">Public Instance method:
|
166
|
-
<strong><a name="
|
166
|
+
<strong><a name="M000047">form_remote_tag(options = {}, &block)</a></strong> <a href="#M000047"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: form_remote_tag" /></a></h4>
|
167
167
|
|
168
168
|
<p>
|
169
169
|
Returns a form tag that will submit using XMLHttpRequest in the background
|
@@ -185,15 +185,15 @@ Example:
|
|
185
185
|
</pre>
|
186
186
|
<p>
|
187
187
|
The Hash passed to the :html key is equivalent to the options (2nd)
|
188
|
-
argument in the <a href="FormView.html#
|
188
|
+
argument in the <a href="FormView.html#M000046">form_tag</a> method.
|
189
189
|
</p>
|
190
190
|
<p>
|
191
191
|
By default the fall-through action is the same as the one specified in the
|
192
192
|
:url (and the default method is :post).
|
193
193
|
</p>
|
194
194
|
<p>
|
195
|
-
<a href="FormView.html#
|
196
|
-
href="FormView.html#
|
195
|
+
<a href="FormView.html#M000047">form_remote_tag</a> takes a block, like <a
|
196
|
+
href="FormView.html#M000046">form_tag</a>:
|
197
197
|
</p>
|
198
198
|
<pre>
|
199
199
|
form_remote_tag :url => '/posts' do
|
@@ -202,8 +202,8 @@ href="FormView.html#M000044">form_tag</a>:
|
|
202
202
|
</pre>
|
203
203
|
|
204
204
|
<div class="sourcecode">
|
205
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
206
|
-
<div id="
|
205
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show source</a> ]</p>
|
206
|
+
<div id="M000047_source" class="dyn-source">
|
207
207
|
<pre>
|
208
208
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 159</span>
|
209
209
|
159: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_remote_tag</span>(<span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -220,7 +220,7 @@ href="FormView.html#M000044">form_tag</a>:
|
|
220
220
|
</div>
|
221
221
|
</div>
|
222
222
|
<h4 class="ruled">Public Instance method:
|
223
|
-
<strong><a name="
|
223
|
+
<strong><a name="M000046">form_tag(url, options = {}) {|| ...}</a></strong> <a href="#M000046"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: form_tag" /></a></h4>
|
224
224
|
|
225
225
|
<p>
|
226
226
|
Starts a form tag that points the action to an url. The method for the form
|
@@ -230,11 +230,11 @@ defaults to POST.
|
|
230
230
|
Examples:
|
231
231
|
</p>
|
232
232
|
<ul>
|
233
|
-
<li><tt><a href="FormView.html#
|
233
|
+
<li><tt><a href="FormView.html#M000046">form_tag</a>(’/posts’)
|
234
234
|
=> <form action="/posts" method="post"></tt>
|
235
235
|
|
236
236
|
</li>
|
237
|
-
<li><tt><a href="FormView.html#
|
237
|
+
<li><tt><a href="FormView.html#M000046">form_tag</a>(’/upload’,
|
238
238
|
:multipart => true) => <form action="/upload"
|
239
239
|
method="post" enctype="multipart/form-data"></tt>
|
240
240
|
|
@@ -273,8 +273,8 @@ either "get" or "post".
|
|
273
273
|
</ul>
|
274
274
|
|
275
275
|
<div class="sourcecode">
|
276
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
277
|
-
<div id="
|
276
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000046_source')" id="l_M000046_source">show source</a> ]</p>
|
277
|
+
<div id="M000046_source" class="dyn-source">
|
278
278
|
<pre>
|
279
279
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 109</span>
|
280
280
|
109: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">form_tag</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
@@ -306,18 +306,18 @@ either "get" or "post".
|
|
306
306
|
</div>
|
307
307
|
</div>
|
308
308
|
<h4 class="ruled">Public Instance method:
|
309
|
-
<strong><a name="
|
309
|
+
<strong><a name="M000045">submit_to_remote(name, value, options = {})</a></strong> <a href="#M000045"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: submit_to_remote" /></a></h4>
|
310
310
|
|
311
311
|
<p>
|
312
312
|
Returns a button input tag that will submit form using XMLHttpRequest in
|
313
313
|
the background instead of regular reloading POST arrangement.
|
314
314
|
<tt>options</tt> argument is the same as in <tt><a
|
315
|
-
href="FormView.html#
|
315
|
+
href="FormView.html#M000047">form_remote_tag</a></tt>.
|
316
316
|
</p>
|
317
317
|
|
318
318
|
<div class="sourcecode">
|
319
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
320
|
-
<div id="
|
319
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000045_source')" id="l_M000045_source">show source</a> ]</p>
|
320
|
+
<div id="M000045_source" class="dyn-source">
|
321
321
|
<pre>
|
322
322
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 78</span>
|
323
323
|
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">submit_to_remote</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span> = {})
|
@@ -335,7 +335,7 @@ href="FormView.html#M000045">form_remote_tag</a></tt>.
|
|
335
335
|
</div>
|
336
336
|
</div>
|
337
337
|
<h4 class="ruled">Public Instance method:
|
338
|
-
<strong><a name="
|
338
|
+
<strong><a name="M000043">text_field(field_name, value = "", options = {})</a></strong> <a href="#M000043"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: text_field" /></a></h4>
|
339
339
|
|
340
340
|
<p>
|
341
341
|
Autocomplete options :
|
@@ -355,8 +355,8 @@ them here, in the usual {field: ‘value’,another:
|
|
355
355
|
</p>
|
356
356
|
|
357
357
|
<div class="sourcecode">
|
358
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
359
|
-
<div id="
|
358
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000043_source')" id="l_M000043_source">show source</a> ]</p>
|
359
|
+
<div id="M000043_source" class="dyn-source">
|
360
360
|
<pre>
|
361
361
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/form.rb, line 30</span>
|
362
362
|
30: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">text_field</span>(<span class="ruby-identifier">field_name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-value str">""</span>, <span class="ruby-identifier">options</span> = {})
|
@@ -103,7 +103,7 @@ bivouac/helpers/view/html
|
|
103
103
|
|
104
104
|
<h2 class="ruled">Methods</h2>
|
105
105
|
<h4 class="ruled">Public Instance method:
|
106
|
-
<strong><a name="
|
106
|
+
<strong><a name="M000040">image_tag( source, options = {} )</a></strong> <a href="#M000040"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: image_tag" /></a></h4>
|
107
107
|
|
108
108
|
<p>
|
109
109
|
Returns an html image tag for the <tt>source</tt>. The <tt>source</tt> must
|
@@ -121,8 +121,8 @@ without the extension)
|
|
121
121
|
</pre>
|
122
122
|
|
123
123
|
<div class="sourcecode">
|
124
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
125
|
-
<div id="
|
124
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show source</a> ]</p>
|
125
|
+
<div id="M000040_source" class="dyn-source">
|
126
126
|
<pre>
|
127
127
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 73</span>
|
128
128
|
73: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">image_tag</span>( <span class="ruby-identifier">source</span>, <span class="ruby-identifier">options</span> = {} )
|
@@ -135,7 +135,7 @@ without the extension)
|
|
135
135
|
</div>
|
136
136
|
</div>
|
137
137
|
<h4 class="ruled">Public Instance method:
|
138
|
-
<strong><a name="
|
138
|
+
<strong><a name="M000039">javascript_include_tag( *sources )</a></strong> <a href="#M000039"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: javascript_include_tag" /></a></h4>
|
139
139
|
|
140
140
|
<p>
|
141
141
|
Returns an html script tag for each of the <tt>sources</tt> provided. You
|
@@ -154,8 +154,8 @@ libraries in your application, pass :defaults as the source.
|
|
154
154
|
</pre>
|
155
155
|
|
156
156
|
<div class="sourcecode">
|
157
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
158
|
-
<div id="
|
157
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000039_source')" id="l_M000039_source">show source</a> ]</p>
|
158
|
+
<div id="M000039_source" class="dyn-source">
|
159
159
|
<pre>
|
160
160
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 43</span>
|
161
161
|
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">javascript_include_tag</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">sources</span> )
|
@@ -180,7 +180,7 @@ libraries in your application, pass :defaults as the source.
|
|
180
180
|
</div>
|
181
181
|
</div>
|
182
182
|
<h4 class="ruled">Public Instance method:
|
183
|
-
<strong><a name="
|
183
|
+
<strong><a name="M000041">link_to(name, address, options = {})</a></strong> <a href="#M000041"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: link_to" /></a></h4>
|
184
184
|
|
185
185
|
<p>
|
186
186
|
Creates a link tag of the given <tt>name</tt> using <tt>address</tt> has
|
@@ -213,8 +213,8 @@ You can mix and match the <tt>options</tt>.
|
|
213
213
|
</pre>
|
214
214
|
|
215
215
|
<div class="sourcecode">
|
216
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
217
|
-
<div id="
|
216
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000041_source')" id="l_M000041_source">show source</a> ]</p>
|
217
|
+
<div id="M000041_source" class="dyn-source">
|
218
218
|
<pre>
|
219
219
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 99</span>
|
220
220
|
99: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">address</span>, <span class="ruby-identifier">options</span> = {})
|
@@ -227,7 +227,7 @@ You can mix and match the <tt>options</tt>.
|
|
227
227
|
</div>
|
228
228
|
</div>
|
229
229
|
<h4 class="ruled">Public Instance method:
|
230
|
-
<strong><a name="
|
230
|
+
<strong><a name="M000038">stylesheet_link_tag( *data )</a></strong> <a href="#M000038"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: stylesheet_link_tag" /></a></h4>
|
231
231
|
|
232
232
|
<p>
|
233
233
|
Returns a stylesheet link tag for the sources specified as arguments. If
|
@@ -247,8 +247,8 @@ You can modify the link attributes by passing a hash as the last argument.
|
|
247
247
|
</pre>
|
248
248
|
|
249
249
|
<div class="sourcecode">
|
250
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
251
|
-
<div id="
|
250
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000038_source')" id="l_M000038_source">show source</a> ]</p>
|
251
|
+
<div id="M000038_source" class="dyn-source">
|
252
252
|
<pre>
|
253
253
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/html.rb, line 20</span>
|
254
254
|
20: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">stylesheet_link_tag</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">data</span> )
|
@@ -103,7 +103,7 @@ bivouac/helpers/view/html
|
|
103
103
|
|
104
104
|
<h2 class="ruled">Methods</h2>
|
105
105
|
<h4 class="ruled">Public Instance method:
|
106
|
-
<strong><a name="
|
106
|
+
<strong><a name="M000029">escape_javascript(javascript)</a></strong> <a href="#M000029"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: escape_javascript" /></a></h4>
|
107
107
|
|
108
108
|
<p>
|
109
109
|
Escape carrier returns and single and double quotes for JavaScript
|
@@ -111,8 +111,8 @@ segments.
|
|
111
111
|
</p>
|
112
112
|
|
113
113
|
<div class="sourcecode">
|
114
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
115
|
-
<div id="
|
114
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000029_source')" id="l_M000029_source">show source</a> ]</p>
|
115
|
+
<div id="M000029_source" class="dyn-source">
|
116
116
|
<pre>
|
117
117
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 202</span>
|
118
118
|
202: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape_javascript</span>(<span class="ruby-identifier">javascript</span>)
|
@@ -122,7 +122,7 @@ segments.
|
|
122
122
|
</div>
|
123
123
|
</div>
|
124
124
|
<h4 class="ruled">Public Instance method:
|
125
|
-
<strong><a name="
|
125
|
+
<strong><a name="M000030">javascript_tag( content, options = {} )</a></strong> <a href="#M000030"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: javascript_tag" /></a></h4>
|
126
126
|
|
127
127
|
<p>
|
128
128
|
Returns a JavaScript tag with the <tt>block</tt> inside. Example:
|
@@ -142,8 +142,8 @@ Returns:
|
|
142
142
|
</pre>
|
143
143
|
|
144
144
|
<div class="sourcecode">
|
145
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
146
|
-
<div id="
|
145
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000030_source')" id="l_M000030_source">show source</a> ]</p>
|
146
|
+
<div id="M000030_source" class="dyn-source">
|
147
147
|
<pre>
|
148
148
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 218</span>
|
149
149
|
218: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">javascript_tag</span>( <span class="ruby-identifier">content</span>, <span class="ruby-identifier">options</span> = {} )
|
@@ -156,7 +156,7 @@ Returns:
|
|
156
156
|
</div>
|
157
157
|
</div>
|
158
158
|
<h4 class="ruled">Public Instance method:
|
159
|
-
<strong><a name="
|
159
|
+
<strong><a name="M000033">link_to_function( name, *args, &block )</a></strong> <a href="#M000033"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: link_to_function" /></a></h4>
|
160
160
|
|
161
161
|
<p>
|
162
162
|
Returns a link that will trigger a JavaScript function using the onclick
|
@@ -164,7 +164,7 @@ handler and return false after the fact.
|
|
164
164
|
</p>
|
165
165
|
<p>
|
166
166
|
The function argument can be omitted in favor of an <a
|
167
|
-
href="JavaScriptView.html#
|
167
|
+
href="JavaScriptView.html#M000031">update_page</a> block, which evaluates
|
168
168
|
to a string when the template is rendered (instead of making an Ajax
|
169
169
|
request first).
|
170
170
|
</p>
|
@@ -213,8 +213,8 @@ Produces:
|
|
213
213
|
</pre>
|
214
214
|
|
215
215
|
<div class="sourcecode">
|
216
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
217
|
-
<div id="
|
216
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000033_source')" id="l_M000033_source">show source</a> ]</p>
|
217
|
+
<div id="M000033_source" class="dyn-source">
|
218
218
|
<pre>
|
219
219
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 273</span>
|
220
220
|
273: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to_function</span>( <span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
@@ -234,7 +234,7 @@ Produces:
|
|
234
234
|
</div>
|
235
235
|
</div>
|
236
236
|
<h4 class="ruled">Public Instance method:
|
237
|
-
<strong><a name="
|
237
|
+
<strong><a name="M000034">link_to_remote(name, options = {}, html_options = {})</a></strong> <a href="#M000034"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: link_to_remote" /></a></h4>
|
238
238
|
|
239
239
|
<p>
|
240
240
|
Returns a link to a remote action defined by <tt>options[:url]</tt>
|
@@ -358,8 +358,8 @@ the ID of a table row or any other DOM element.
|
|
358
358
|
</table>
|
359
359
|
|
360
360
|
<div class="sourcecode">
|
361
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
362
|
-
<div id="
|
361
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000034_source')" id="l_M000034_source">show source</a> ]</p>
|
362
|
+
<div id="M000034_source" class="dyn-source">
|
363
363
|
<pre>
|
364
364
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 371</span>
|
365
365
|
371: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_to_remote</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-identifier">html_options</span> = {})
|
@@ -369,7 +369,7 @@ the ID of a table row or any other DOM element.
|
|
369
369
|
</div>
|
370
370
|
</div>
|
371
371
|
<h4 class="ruled">Public Instance method:
|
372
|
-
<strong><a name="
|
372
|
+
<strong><a name="M000036">observe_field(field_id, options = {})</a></strong> <a href="#M000036"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: observe_field" /></a></h4>
|
373
373
|
|
374
374
|
<p>
|
375
375
|
Observes the field with the DOM ID specified by <tt>field_id</tt> and makes
|
@@ -419,12 +419,12 @@ radio buttons and checkboxes. With this, you can specify it instead to be
|
|
419
419
|
</table>
|
420
420
|
<p>
|
421
421
|
Additionally, you may specify any of the options documented in <a
|
422
|
-
href="JavaScriptView.html#
|
422
|
+
href="JavaScriptView.html#M000034">link_to_remote</a>.
|
423
423
|
</p>
|
424
424
|
|
425
425
|
<div class="sourcecode">
|
426
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
427
|
-
<div id="
|
426
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000036_source')" id="l_M000036_source">show source</a> ]</p>
|
427
|
+
<div id="M000036_source" class="dyn-source">
|
428
428
|
<pre>
|
429
429
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 420</span>
|
430
430
|
420: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">observe_field</span>(<span class="ruby-identifier">field_id</span>, <span class="ruby-identifier">options</span> = {})
|
@@ -438,7 +438,7 @@ href="JavaScriptView.html#M000032">link_to_remote</a>.
|
|
438
438
|
</div>
|
439
439
|
</div>
|
440
440
|
<h4 class="ruled">Public Instance method:
|
441
|
-
<strong><a name="
|
441
|
+
<strong><a name="M000035">periodically_call_remote(options = {})</a></strong> <a href="#M000035"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: periodically_call_remote" /></a></h4>
|
442
442
|
|
443
443
|
<p>
|
444
444
|
Periodically calls the specified url (<tt>options[:url]</tt>) every
|
@@ -446,12 +446,12 @@ Periodically calls the specified url (<tt>options[:url]</tt>) every
|
|
446
446
|
update a specified div (<tt>options[:update]</tt>) with the results of the
|
447
447
|
remote call. The options for specifying the target with :url and defining
|
448
448
|
callbacks is the same as <a
|
449
|
-
href="JavaScriptView.html#
|
449
|
+
href="JavaScriptView.html#M000034">link_to_remote</a>.
|
450
450
|
</p>
|
451
451
|
|
452
452
|
<div class="sourcecode">
|
453
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
454
|
-
<div id="
|
453
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000035_source')" id="l_M000035_source">show source</a> ]</p>
|
454
|
+
<div id="M000035_source" class="dyn-source">
|
455
455
|
<pre>
|
456
456
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 380</span>
|
457
457
|
380: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">periodically_call_remote</span>(<span class="ruby-identifier">options</span> = {})
|
@@ -463,11 +463,11 @@ href="JavaScriptView.html#M000032">link_to_remote</a>.
|
|
463
463
|
</div>
|
464
464
|
</div>
|
465
465
|
<h4 class="ruled">Public Instance method:
|
466
|
-
<strong><a name="
|
466
|
+
<strong><a name="M000037">remote_function(options)</a></strong> <a href="#M000037"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: remote_function" /></a></h4>
|
467
467
|
|
468
468
|
<p>
|
469
469
|
Returns the JavaScript needed for a remote function. Takes the same
|
470
|
-
arguments as <a href="JavaScriptView.html#
|
470
|
+
arguments as <a href="JavaScriptView.html#M000034">link_to_remote</a>.
|
471
471
|
</p>
|
472
472
|
<p>
|
473
473
|
Example:
|
@@ -486,8 +486,8 @@ Example:
|
|
486
486
|
</pre>
|
487
487
|
|
488
488
|
<div class="sourcecode">
|
489
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
490
|
-
<div id="
|
489
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000037_source')" id="l_M000037_source">show source</a> ]</p>
|
490
|
+
<div id="M000037_source" class="dyn-source">
|
491
491
|
<pre>
|
492
492
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 442</span>
|
493
493
|
442: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remote_function</span>(<span class="ruby-identifier">options</span>)
|
@@ -521,7 +521,7 @@ Example:
|
|
521
521
|
</div>
|
522
522
|
</div>
|
523
523
|
<h4 class="ruled">Public Instance method:
|
524
|
-
<strong><a name="
|
524
|
+
<strong><a name="M000031">update_page( &block )</a></strong> <a href="#M000031"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: update_page" /></a></h4>
|
525
525
|
|
526
526
|
<p>
|
527
527
|
Yields a <a href="../JavaScriptGenerator.html">JavaScriptGenerator</a> and
|
@@ -532,8 +532,8 @@ information.
|
|
532
532
|
</p>
|
533
533
|
|
534
534
|
<div class="sourcecode">
|
535
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
536
|
-
<div id="
|
535
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000031_source')" id="l_M000031_source">show source</a> ]</p>
|
536
|
+
<div id="M000031_source" class="dyn-source">
|
537
537
|
<pre>
|
538
538
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 228</span>
|
539
539
|
228: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_page</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
@@ -543,18 +543,18 @@ information.
|
|
543
543
|
</div>
|
544
544
|
</div>
|
545
545
|
<h4 class="ruled">Public Instance method:
|
546
|
-
<strong><a name="
|
546
|
+
<strong><a name="M000032">update_page_tag( options = {}, &block )</a></strong> <a href="#M000032"><img src="../../permalink.gif" border="0" title="Permalink to Public Instance method: update_page_tag" /></a></h4>
|
547
547
|
|
548
548
|
<p>
|
549
|
-
Works like <a href="JavaScriptView.html#
|
549
|
+
Works like <a href="JavaScriptView.html#M000031">update_page</a> but wraps
|
550
550
|
the generated JavaScript in a <script> tag. See <a
|
551
551
|
href="../JavaScriptGenerator.html">JavaScriptGenerator</a> for more
|
552
552
|
information.
|
553
553
|
</p>
|
554
554
|
|
555
555
|
<div class="sourcecode">
|
556
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
557
|
-
<div id="
|
556
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000032_source')" id="l_M000032_source">show source</a> ]</p>
|
557
|
+
<div id="M000032_source" class="dyn-source">
|
558
558
|
<pre>
|
559
559
|
<span class="ruby-comment cmt"># File lib/bivouac/helpers/view/goh/javascript.rb, line 234</span>
|
560
560
|
234: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">update_page_tag</span>( <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
data/doc/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Thu,
|
1
|
+
Thu, 11 Oct 2007 18:31:41 +0200
|
data/doc/rdoc/files/README.html
CHANGED
@@ -87,7 +87,7 @@ end</strong>
|
|
87
87
|
<div id="README" class="page_shade">
|
88
88
|
<div class="page">
|
89
89
|
<div class="header">
|
90
|
-
<div class="path">README /
|
90
|
+
<div class="path">README / Thu Oct 11 18:31:28 +0200 2007</div>
|
91
91
|
</div>
|
92
92
|
|
93
93
|
<h1>Bivouac</h1>
|
@@ -112,6 +112,35 @@ Bivouac is a simple generator for <a
|
|
112
112
|
href="http://code.whytheluckystiff.net/camping">camping</a>.
|
113
113
|
</p>
|
114
114
|
<h2>FEATURES/PROBLEMS:</h2>
|
115
|
+
<h3>0.0.9:</h3>
|
116
|
+
<ul>
|
117
|
+
<li>Upgrade to simple-daemon >=0.1.2
|
118
|
+
|
119
|
+
</li>
|
120
|
+
<li>Better migration support! And migrate is now migration ! That‘s
|
121
|
+
better no ?
|
122
|
+
|
123
|
+
</li>
|
124
|
+
<li>Add MySQL, PostgreSQL, … support. See
|
125
|
+
|
126
|
+
<pre>
|
127
|
+
$ bivouac -h
|
128
|
+
</pre>
|
129
|
+
</li>
|
130
|
+
<li>Add tests support with <a
|
131
|
+
href="http://mosquito.rubyforge.org/">mosquito</a> :
|
132
|
+
|
133
|
+
<pre>
|
134
|
+
$ ruby script/generate test my_test_name
|
135
|
+
</pre>
|
136
|
+
<p>
|
137
|
+
To run a test, juste do :
|
138
|
+
</p>
|
139
|
+
<pre>
|
140
|
+
$ ruby test/test_my_test_name.rb
|
141
|
+
</pre>
|
142
|
+
</li>
|
143
|
+
</ul>
|
115
144
|
<h3>0.0.8:</h3>
|
116
145
|
<ul>
|
117
146
|
<li>Bivouac now work with WEBrick — Bug correction
|
@@ -228,10 +257,7 @@ change <tt>do_GET(req, res)</tt> to <tt>do_GET(req, resp)</tt>
|
|
228
257
|
href="http://code.whytheluckystiff.net/camping/wiki/MosquitoForBugFreeCamping">mosquito</a>
|
229
258
|
|
230
259
|
</li>
|
231
|
-
<li>
|
232
|
-
|
233
|
-
</li>
|
234
|
-
<li>add mysql, postgresql, oracle, … support
|
260
|
+
<li>more helpers…
|
235
261
|
|
236
262
|
</li>
|
237
263
|
</ul>
|
@@ -87,7 +87,7 @@ end</strong>
|
|
87
87
|
<div id="lib/bivouac/helpers/view/goh/base.rb" class="page_shade">
|
88
88
|
<div class="page">
|
89
89
|
<div class="header">
|
90
|
-
<div class="path">lib/bivouac/helpers/view/goh/base.rb / Thu
|
90
|
+
<div class="path">lib/bivouac/helpers/view/goh/base.rb / Thu Oct 11 12:06:08 +0200 2007</div>
|
91
91
|
</div>
|
92
92
|
|
93
93
|
<p>
|
data/doc/rdoc/rdoc-style.css
CHANGED
@@ -91,16 +91,16 @@
|
|
91
91
|
|
92
92
|
}
|
93
93
|
.source-link { text-align: right; font-size: 8pt; }
|
94
|
-
.ruby-comment { color:
|
95
|
-
.ruby-constant { color: #
|
96
|
-
.ruby-identifier { color: #
|
97
|
-
.ruby-ivar { color:
|
98
|
-
.ruby-keyword { color:
|
94
|
+
.ruby-comment { color: black; font-style: italic }
|
95
|
+
.ruby-constant { color: #123456; font-weight: bold; }
|
96
|
+
.ruby-identifier { color: #005599; }
|
97
|
+
.ruby-ivar { color: orange; }
|
98
|
+
.ruby-keyword { color: red; font-weight: bold }
|
99
99
|
.ruby-node { color: #FFFFFF; }
|
100
|
-
.ruby-operator { color: #
|
100
|
+
.ruby-operator { color: #055005; }
|
101
101
|
.ruby-regexp { color: #DDFFDD; }
|
102
102
|
.ruby-value { color: #FFAAAA; font-style: italic }
|
103
|
-
.kw { color:
|
104
|
-
.cmt { color:
|
103
|
+
.kw { color: red; font-weight: bold }
|
104
|
+
.cmt { color: green; font-style: italic }
|
105
105
|
.str { color: #EECCCC; font-style: italic }
|
106
106
|
.re { color: #EECCCC; }
|
@@ -7,6 +7,8 @@ require 'optparse'
|
|
7
7
|
require 'ostruct'
|
8
8
|
require 'bivouac/template'
|
9
9
|
require 'active_support'
|
10
|
+
require 'active_record'
|
11
|
+
require 'find'
|
10
12
|
require File.dirname($0) + '/../config/environment.rb'
|
11
13
|
|
12
14
|
module Bivouac
|
@@ -14,17 +16,17 @@ module Bivouac
|
|
14
16
|
include Bivouac::Template
|
15
17
|
|
16
18
|
def initialize( argv )
|
17
|
-
# Generator type (controller, model,
|
19
|
+
# Generator type (controller, model, migration, view, ...)
|
18
20
|
@generator_type = argv.shift
|
19
21
|
|
20
22
|
# Generator options
|
21
|
-
@options = OpenStruct.new( :noview => false, :default_route => true, :routes => [] )
|
23
|
+
@options = OpenStruct.new( :noview => false, :notest => false, :default_route => true, :routes => [] )
|
22
24
|
@opts = OptionParser.new do |opts|
|
23
25
|
opts.banner = "Usage: script/generate generator [options] [args]"
|
24
26
|
|
25
27
|
opts.separator ""
|
26
28
|
opts.separator "Generators"
|
27
|
-
opts.separator " Builtin: controller, model,
|
29
|
+
opts.separator " Builtin: controller, model, migration, view, test, scaffold"
|
28
30
|
|
29
31
|
opts.separator ""
|
30
32
|
opts.separator "controller generator options:"
|
@@ -49,7 +51,14 @@ module Bivouac
|
|
49
51
|
end
|
50
52
|
@options.routes = routes.split(',')
|
51
53
|
}
|
52
|
-
|
54
|
+
opts.on("-t", "--no-test", "Do not generate any test for the controller") { |@options.notest|
|
55
|
+
if @generator_type != 'controller'
|
56
|
+
puts @opts
|
57
|
+
exit
|
58
|
+
end
|
59
|
+
@options.notest = true
|
60
|
+
}
|
61
|
+
|
53
62
|
opts.separator ""
|
54
63
|
opts.separator "Common options:"
|
55
64
|
opts.on_tail("-h", "--help", "Show this message") do
|
@@ -82,8 +91,16 @@ module Bivouac
|
|
82
91
|
# Application name for the generator, passed to the template
|
83
92
|
@generation_app_name = @app.environment.appname
|
84
93
|
|
94
|
+
@generation_app_dir = @app.environment.appdir
|
95
|
+
|
85
96
|
# Application organisation (goh, jof or erb)
|
86
97
|
@generation_type = @app.environment.orgtype
|
98
|
+
|
99
|
+
# Database configuration
|
100
|
+
@database_configuration = @app.environment.db
|
101
|
+
if @database_configuration[:adapter] =~ /sqlite/
|
102
|
+
@database_configuration[:database] = File.expand_path( File.dirname( $0 ) + "/../" + @database_configuration[:database] )
|
103
|
+
end
|
87
104
|
end
|
88
105
|
|
89
106
|
def run
|
@@ -102,10 +119,10 @@ module Bivouac
|
|
102
119
|
@destination_file = File.dirname( $0 ) + "/../app/controllers/" + @generation_file_name.underscore + ".rb"
|
103
120
|
@generation_view_name = @generation_class_name.underscore
|
104
121
|
|
105
|
-
default_route =
|
122
|
+
default_route = @generation_view_name
|
106
123
|
@options.routes << default_route if @options.default_route and @options.routes.include?( default_route ) == false
|
107
124
|
@generation_routes = if @options.routes.size > 0
|
108
|
-
" < R '" + @options.routes.join("', '") + "'"
|
125
|
+
" < R '/" + @options.routes.join("', '/") + "'"
|
109
126
|
else
|
110
127
|
""
|
111
128
|
end
|
@@ -115,14 +132,46 @@ module Bivouac
|
|
115
132
|
end
|
116
133
|
|
117
134
|
view( ) if @options.noview == false
|
135
|
+
test( ) if @options.notest == false
|
118
136
|
end
|
119
137
|
|
120
|
-
def
|
138
|
+
def migration( from_model = false )
|
139
|
+
# Get old and new version
|
140
|
+
old_version = 0.0
|
141
|
+
begin
|
142
|
+
ActiveRecord::Base.establish_connection @database_configuration
|
143
|
+
conn = ActiveRecord::Base.connection
|
144
|
+
table = nil
|
145
|
+
conn.tables.each { |t| table = t if t =~ /_schema_infos$/ }
|
146
|
+
version_info = conn.select_all( "select * from #{table}" )
|
147
|
+
old_version = version_info[0]['version'].to_f
|
148
|
+
rescue
|
149
|
+
end
|
150
|
+
@new_version = old_version + 1
|
151
|
+
|
152
|
+
# Get prefix for file
|
153
|
+
files = []
|
154
|
+
Find.find( File.dirname( $0 ) + "/../db/migrate/" ) do |f|
|
155
|
+
fn = File.basename( f )
|
156
|
+
files << fn if fn =~ /^\d\d\d/
|
157
|
+
end
|
158
|
+
file_prefix = "001"
|
159
|
+
if files.size > 0
|
160
|
+
files = files.sort {|x,y| y[0,3] <=> x[0,3]}
|
161
|
+
file_prefix = sprintf( "%03d", (files[0][0,3].to_i + 1) )
|
162
|
+
end
|
163
|
+
|
164
|
+
puts "\t* Migration from version #{old_version} to version #{@new_version}" if old_version > 0.0
|
165
|
+
|
121
166
|
@generation_table_name = (@generation_app_name.downcase + "_" + @generation_name).tableize
|
122
167
|
|
123
|
-
@destination_file = File.dirname( $0 ) + "/../db/migrate/" + @generation_file_name.underscore + ".rb"
|
168
|
+
@destination_file = File.dirname( $0 ) + "/../db/migrate/" + file_prefix + "_" + @generation_file_name.underscore + ".rb"
|
124
169
|
createFile( @destination_file ) do |io|
|
125
|
-
|
170
|
+
if from_model
|
171
|
+
io.puts template( "generate/migrate", binding )
|
172
|
+
else
|
173
|
+
io.puts template( "generate/migration", binding )
|
174
|
+
end
|
126
175
|
end
|
127
176
|
|
128
177
|
@destination_file = File.dirname( $0 ) + "/../db/create.rb"
|
@@ -137,7 +186,7 @@ module Bivouac
|
|
137
186
|
io.puts template( "generate/model", binding )
|
138
187
|
end
|
139
188
|
|
140
|
-
|
189
|
+
migration( true )
|
141
190
|
end
|
142
191
|
|
143
192
|
def view
|
@@ -153,6 +202,17 @@ module Bivouac
|
|
153
202
|
end
|
154
203
|
end
|
155
204
|
|
205
|
+
def test
|
206
|
+
@destination_file = File.dirname( $0 ) + "/../test/test_" + @generation_file_name.underscore + ".rb"
|
207
|
+
createFile( @destination_file ) do |io|
|
208
|
+
io.puts template( "generate/test_begin", binding )
|
209
|
+
@options.routes.each do |@test_route|
|
210
|
+
io.puts template( "generate/test_views", binding )
|
211
|
+
end
|
212
|
+
io.puts template( "generate/test_end", binding )
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
156
216
|
def scaffold
|
157
217
|
@generation_view_name = @generation_class_name.underscore
|
158
218
|
|
@@ -12,5 +12,24 @@ module BivouacHelpers
|
|
12
12
|
end
|
13
13
|
self.send( partial.to_sym )
|
14
14
|
end
|
15
|
+
|
16
|
+
alias_method :partial, :render
|
17
|
+
|
18
|
+
# Return the content of a public file as string
|
19
|
+
#
|
20
|
+
# public_to_str( "/stylesheets/autocomplete.css" )
|
21
|
+
# #=> "div.autocomplete {\n position:absolute;\n..."
|
22
|
+
def public_to_str( file )
|
23
|
+
if file.include? ".."
|
24
|
+
return nil
|
25
|
+
end
|
26
|
+
|
27
|
+
file = ENV['BIVOUAC_ROOT'] + "/public/" + file
|
28
|
+
open( file ) do |f|
|
29
|
+
data = f.read
|
30
|
+
end
|
31
|
+
|
32
|
+
return data
|
33
|
+
end
|
15
34
|
end
|
16
35
|
end
|
@@ -8,14 +8,20 @@
|
|
8
8
|
require 'simple-daemon'
|
9
9
|
|
10
10
|
DIRNAME = File.expand_path( File.dirname(__FILE__) )
|
11
|
-
SimpleDaemon::
|
11
|
+
SimpleDaemon::WORKING_DIRECTORY = DIRNAME + "/../log/"
|
12
|
+
|
12
13
|
class <%= @appname %>Daemon < SimpleDaemon::Base
|
13
14
|
@@server = nil
|
14
15
|
|
15
16
|
def self.start
|
16
17
|
config = Bivouac::Environment.new( )
|
17
18
|
|
18
|
-
|
19
|
+
database_connection = config.environment.db
|
20
|
+
if database_connection[:adapter] =~ /sqlite/
|
21
|
+
database_connection[:database] = DIRNAME + "/../" + database_connection[:database]
|
22
|
+
end
|
23
|
+
<%= @appname %>::Models::Base.establish_connection database_connection
|
24
|
+
# :adapter => 'sqlite3', :database => DIRNAME + "/../db/<%= @appname %>.db"
|
19
25
|
<%= @appname %>::Models::Base.logger = Logger.new(DIRNAME + "/../log/<%= @appname %>.log")
|
20
26
|
<%= @appname %>::Models::Base.threaded_connections = false
|
21
27
|
<%= @appname %>.create if <%= @appname %>.respond_to? :create
|
@@ -20,6 +20,9 @@ module Bivouac
|
|
20
20
|
# Application port
|
21
21
|
:port => <%= @conf.port %>,
|
22
22
|
|
23
|
+
# Database configuration
|
24
|
+
:db => <%= @conf.db %>,
|
25
|
+
|
23
26
|
# Name of the application
|
24
27
|
# DO NOT CHANGE IT, OR YOU REALLY KNOW WHAT YOU ARE DOING!
|
25
28
|
:appname => "<%= @conf.appname %>",
|
@@ -4,5 +4,6 @@ end
|
|
4
4
|
|
5
5
|
def <%= @generation_app_name %>.create
|
6
6
|
Camping::Models::Session.create_schema
|
7
|
-
<%= @generation_app_name %>::Models.create_schema
|
7
|
+
<%= @generation_app_name %>::Models.create_schema
|
8
|
+
# :assume => (<%= @generation_app_name %>::Models::<%= @generation_class_name %>.table_exists? ? 1.0 : 0.0)
|
8
9
|
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module <%= @generation_app_name %>::Models
|
2
|
-
class Create<%= @generation_class_name %> < V
|
2
|
+
class Create<%= @generation_class_name %> < V <%= @new_version %>
|
3
3
|
def self.up
|
4
4
|
create_table :<%= @generation_table_name %> do |t|
|
5
5
|
t.column :id, :integer, :null => false
|
6
6
|
# ...
|
7
7
|
end
|
8
8
|
end
|
9
|
+
|
9
10
|
def self.down
|
10
11
|
drop_table :<%= @generation_table_name %>
|
11
12
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'mosquito'
|
3
|
+
|
4
|
+
ENV['BIVOUAC_ROOT'] = File.expand_path( File.dirname(__FILE__) + "/../" )
|
5
|
+
require ENV['BIVOUAC_ROOT'] + "/app/<%= @generation_app_dir %>"
|
6
|
+
|
7
|
+
<%= @generation_app_name %>.create if <%= @generation_app_name %>.respond_to? :create
|
8
|
+
include <%= @generation_app_name %>::Models
|
9
|
+
|
10
|
+
class Test<%= @generation_app_name %> < Camping::FunctionalTest
|
@@ -0,0 +1 @@
|
|
1
|
+
end
|
data/lib/bivouac.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: bivouac
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.0.9
|
7
|
+
date: 2007-10-11 00:00:00 +02:00
|
8
8
|
summary: Developpe with Camping like you do with Rails
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/bivouac/template/generate/controller.rb
|
94
94
|
- lib/bivouac/template/generate/create.rb
|
95
95
|
- lib/bivouac/template/generate/migrate.rb
|
96
|
+
- lib/bivouac/template/generate/migration.rb
|
96
97
|
- lib/bivouac/template/generate/model.rb
|
97
98
|
- lib/bivouac/template/generate/scaffold_controller_create.rb
|
98
99
|
- lib/bivouac/template/generate/scaffold_controller_list.rb
|
@@ -103,6 +104,9 @@ files:
|
|
103
104
|
- lib/bivouac/template/generate/scaffold_view_list_goh.rb
|
104
105
|
- lib/bivouac/template/generate/scaffold_view_view_erb.rb
|
105
106
|
- lib/bivouac/template/generate/scaffold_view_view_goh.rb
|
107
|
+
- lib/bivouac/template/generate/test_begin.rb
|
108
|
+
- lib/bivouac/template/generate/test_end.rb
|
109
|
+
- lib/bivouac/template/generate/test_views.rb
|
106
110
|
- lib/bivouac/template/generate/view_erb.rb
|
107
111
|
- lib/bivouac/template/generate/view_goh.rb
|
108
112
|
- lib/bivouac/template/generate.rb
|
@@ -350,5 +354,14 @@ dependencies:
|
|
350
354
|
requirements:
|
351
355
|
- - ">="
|
352
356
|
- !ruby/object:Gem::Version
|
353
|
-
version: 0.1.
|
357
|
+
version: 0.1.2
|
358
|
+
version:
|
359
|
+
- !ruby/object:Gem::Dependency
|
360
|
+
name: mosquito
|
361
|
+
version_requirement:
|
362
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
363
|
+
requirements:
|
364
|
+
- - ">"
|
365
|
+
- !ruby/object:Gem::Version
|
366
|
+
version: 0.0.0
|
354
367
|
version:
|