genosaurus 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,302 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Apr 22 17:04:13 -0400 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>Hello, and welcome to <a href="../classes/Genosaurus.html">Genosaurus</a>!</h1>
73
+ <p>
74
+ <a href="../classes/Genosaurus.html">Genosaurus</a> is meant to be a very,
75
+ very easy to use generation system for Ruby. It&#8216;s simple and
76
+ straightforward, yet offers plenty of flexibility in it&#8216;s use. People
77
+ use &#8216;generators&#8217; all the time, and you either have to roll your
78
+ own, or use some really cumbersome generator that some one else wrote, that
79
+ is just way too difficult to use. Enter <a
80
+ href="../classes/Genosaurus.html">Genosaurus</a>!
81
+ </p>
82
+ <h2>Installation</h2>
83
+ <pre>
84
+ $ sudo gem install genosaurus
85
+ </pre>
86
+ <h2>Getting Started</h2>
87
+ <h3>Implied Manifests</h3>
88
+ <p>
89
+ The easiest way to use <a href="../classes/Genosaurus.html">Genosaurus</a>
90
+ is to let it do the work for you. Let&#8216;s looked at what&#8216;s called
91
+ an &#8216;implied&#8217; manifest:
92
+ </p>
93
+ <pre>
94
+ dir:
95
+ simple_generator.rb
96
+ templates:
97
+ hello_world.txt.template
98
+ </pre>
99
+ <p>
100
+ That&#8216;s our folder structure. Now let&#8216;s look at
101
+ simple_generator.rb:
102
+ </p>
103
+ <pre>
104
+ require 'rubygems'
105
+ require 'genosaurus'
106
+
107
+ class SimpleGenerator &lt; Genosaurus
108
+ end
109
+ </pre>
110
+ <p>
111
+ Now if we run that generator:
112
+ </p>
113
+ <pre>
114
+ $irb: SimpleGenerator.run
115
+ </pre>
116
+ <p>
117
+ We should get a file called hello_world.txt generated in the current
118
+ directory. Yes, it truly is that simple!
119
+ </p>
120
+ <p>
121
+ With implied manifests our directory structure under
122
+ &#8216;templates&#8217; tells the whole story, and <a
123
+ href="../classes/Genosaurus.html">Genosaurus</a> is smart enough to figure
124
+ it out. All the file names, and the same goes for folders, need to end in
125
+ .template, and <a href="../classes/Genosaurus.html">Genosaurus</a> will do
126
+ the rest.
127
+ </p>
128
+ <p>
129
+ All the files will go through ERB before they generated, so you can put all
130
+ your lovely little dynamic goodies in there. File, and folder, names also
131
+ get run through ERB so you can even make the file name dynamic too!
132
+ </p>
133
+ <p>
134
+ Let&#8216;s look at a more complex example:
135
+ </p>
136
+ <pre>
137
+ dir:
138
+ complex_generator.rb
139
+ templates:
140
+ app:
141
+ views:
142
+ &lt;%=param(:name).plural%&gt;.template:
143
+ hello_world.html.erb
144
+ models:
145
+ &lt;%=param(:name)%&gt;.rb.template
146
+ </pre>
147
+ <p>
148
+ Let&#8216;s run our complex_generator.rb file:
149
+ </p>
150
+ <pre>
151
+ require 'rubygems'
152
+ require 'genosaurus'
153
+
154
+ class ComplexGenerator &lt; Genosaurus
155
+ require_param: name
156
+ end
157
+ </pre>
158
+ <p>
159
+ Now if we run that generator:
160
+ </p>
161
+ <pre>
162
+ $irb: ComplexGenerator.run(&quot;name&quot; =&gt; &quot;user&quot;)
163
+ </pre>
164
+ <p>
165
+ Now you should end up with the following:
166
+ </p>
167
+ <pre>
168
+ app:
169
+ views:
170
+ users:
171
+ hello_world.html.erb
172
+ models:
173
+ user.rb.template
174
+ </pre>
175
+ <p>
176
+ In the ComplexGenerator we told <a
177
+ href="../classes/Genosaurus.html">Genosaurus</a> that we are requiring that
178
+ the parameter, name, be passed into it. We are then using that parameter to
179
+ generate the names of some files and folders. Pretty cool, eh? See how
180
+ simple that is.
181
+ </p>
182
+ <p>
183
+ Let&#8216;s look at the manifest.yml file for our simple_generator example:
184
+ </p>
185
+ <pre>
186
+ template_1:
187
+ type: file
188
+ template_path: &lt;%= File.join(templates_directory_path, &quot;templates&quot;, &quot;hello_world.txt.template&quot;)
189
+ output_path: hello_world.txt
190
+ </pre>
191
+ <p>
192
+ Pretty simple. We give the template a name, template_1, it really
193
+ doesn&#8216;t matter what it is, but Hash objects need keys. The
194
+ &#8216;type&#8217; parameter is either file or directory. The template_path
195
+ is the path to the template. Finally, the output_path is the where you want
196
+ the file to be generated.
197
+ </p>
198
+ <p>
199
+ Let&#8216;s look at our more complex example. We can change the directory
200
+ structure a bit, since we really don&#8216;t need ERB in the file names
201
+ now:
202
+ </p>
203
+ <pre>
204
+ dir:
205
+ complex_generator.rb
206
+ templates:
207
+ hello_world.html.erb.template
208
+ model.rb.template
209
+ </pre>
210
+ <p>
211
+ Our manifest.yml file would look like this:
212
+ </p>
213
+ <pre>
214
+ hello_world_template:
215
+ type: file
216
+ template_path: &lt;%= File.join(templates_directory_path, &quot;templates&quot;, &quot;hello_world.html.erb&quot;)
217
+ output_path: &lt;%= File.join(&quot;app&quot;, &quot;views&quot;, param(:name).plural, &quot;hello_world.html.erb&quot;) %&gt;
218
+ model_template:
219
+ type: file
220
+ template_path: &lt;%= File.join(templates_directory_path, &quot;templates&quot;, &quot;model.html.erb&quot;)
221
+ output_path: &lt;%= File.join(&quot;app&quot;, &quot;models&quot;, &quot;#{param(:name)}.rb&quot;) %&gt;
222
+ </pre>
223
+ <p>
224
+ This will generate the exact same thing as our implied manifest.
225
+ </p>
226
+ <h3>Explicit Manifests</h3>
227
+ <p>
228
+ Explicit manifests are used when there is a manifest.yml supplied at the
229
+ same level as the generator. If there is a manifest.yml file then implied
230
+ manifests are not used. This means you have to define the entire generation
231
+ process. This is great if you have a pretty complicated generator, as the
232
+ manifest.yml is also sent through ERB before being loaded.
233
+ </p>
234
+ <h2>Contact</h2>
235
+ <p>
236
+ Please mail bugs, suggestions and patches to
237
+ &lt;bugs@mackframework.com&gt;.
238
+ </p>
239
+ <p>
240
+ On the web at: <a
241
+ href="http://www.mackframework.com">www.mackframework.com</a>
242
+ </p>
243
+ <h2>License and Copyright</h2>
244
+ <p>
245
+ Copyright (C) 2008 Mark Bates, <a
246
+ href="http://www.mackframework.com">www.mackframework.com</a>
247
+ </p>
248
+ <p>
249
+ Permission is hereby granted, free of charge, to any person obtaining a
250
+ copy of this software and associated documentation files (the
251
+ &quot;Software&quot;), to deal in the Software without restriction,
252
+ including without limitation the rights to use, copy, modify, merge,
253
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
254
+ permit persons to whom the Software is furnished to do so, subject to the
255
+ following conditions:
256
+ </p>
257
+ <p>
258
+ The above copyright notice and this permission notice shall be included in
259
+ all copies or substantial portions of the Software.
260
+ </p>
261
+ <p>
262
+ THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
263
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
264
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
265
+ NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
266
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
267
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
268
+ DEALINGS IN THE SOFTWARE.
269
+ </p>
270
+
271
+ </div>
272
+
273
+
274
+ </div>
275
+
276
+
277
+ </div>
278
+
279
+
280
+ <!-- if includes -->
281
+
282
+ <div id="section">
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+ <!-- if method_list -->
292
+
293
+
294
+ </div>
295
+
296
+
297
+ <div id="validator-badges">
298
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
299
+ </div>
300
+
301
+ </body>
302
+ </html>
@@ -0,0 +1,112 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: genosaurus.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>genosaurus.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/genosaurus.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Apr 22 17:04:13 -0400 2008</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ rubygems&nbsp;&nbsp;
77
+ mack_ruby_core_extensions&nbsp;&nbsp;
78
+ fileutils&nbsp;&nbsp;
79
+ erb&nbsp;&nbsp;
80
+ yaml&nbsp;&nbsp;
81
+ </div>
82
+ </div>
83
+
84
+ </div>
85
+
86
+
87
+ </div>
88
+
89
+
90
+ <!-- if includes -->
91
+
92
+ <div id="section">
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <!-- if method_list -->
102
+
103
+
104
+ </div>
105
+
106
+
107
+ <div id="validator-badges">
108
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
109
+ </div>
110
+
111
+ </body>
112
+ </html>
@@ -0,0 +1,27 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Classes
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Classes</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Classes</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/Genosaurus.html">Genosaurus</a><br />
24
+ </div>
25
+ </div>
26
+ </body>
27
+ </html>
@@ -0,0 +1,28 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Files
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Files</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Files</h1>
22
+ <div id="index-entries">
23
+ <a href="files/README.html">README</a><br />
24
+ <a href="files/lib/genosaurus_rb.html">lib/genosaurus.rb</a><br />
25
+ </div>
26
+ </div>
27
+ </body>
28
+ </html>
@@ -0,0 +1,40 @@
1
+
2
+ <?xml version="1.0" encoding="iso-8859-1"?>
3
+ <!DOCTYPE html
4
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
5
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6
+
7
+ <!--
8
+
9
+ Methods
10
+
11
+ -->
12
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
13
+ <head>
14
+ <title>Methods</title>
15
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
16
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
17
+ <base target="docwin" />
18
+ </head>
19
+ <body>
20
+ <div id="index">
21
+ <h1 class="section-bar">Methods</h1>
22
+ <div id="index-entries">
23
+ <a href="classes/Genosaurus.html#M000007">after_generate (Genosaurus)</a><br />
24
+ <a href="classes/Genosaurus.html#M000006">before_generate (Genosaurus)</a><br />
25
+ <a href="classes/Genosaurus.html#M000013">directory (Genosaurus)</a><br />
26
+ <a href="classes/Genosaurus.html#M000014">generate (Genosaurus)</a><br />
27
+ <a href="classes/Genosaurus.html#M000008">manifest (Genosaurus)</a><br />
28
+ <a href="classes/Genosaurus.html#M000004">manifest_path (Genosaurus)</a><br />
29
+ <a href="classes/Genosaurus.html#M000002">new (Genosaurus)</a><br />
30
+ <a href="classes/Genosaurus.html#M000011">param (Genosaurus)</a><br />
31
+ <a href="classes/Genosaurus.html#M000009">require_param (Genosaurus)</a><br />
32
+ <a href="classes/Genosaurus.html#M000010">required_params (Genosaurus)</a><br />
33
+ <a href="classes/Genosaurus.html#M000001">run (Genosaurus)</a><br />
34
+ <a href="classes/Genosaurus.html#M000005">setup (Genosaurus)</a><br />
35
+ <a href="classes/Genosaurus.html#M000012">template (Genosaurus)</a><br />
36
+ <a href="classes/Genosaurus.html#M000003">templates_directory_path (Genosaurus)</a><br />
37
+ </div>
38
+ </div>
39
+ </body>
40
+ </html>
data/doc/index.html ADDED
@@ -0,0 +1,24 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
5
+
6
+ <!--
7
+
8
+ genosaurus
9
+
10
+ -->
11
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
12
+ <head>
13
+ <title>genosaurus</title>
14
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
15
+ </head>
16
+ <frameset rows="20%, 80%">
17
+ <frameset cols="25%,35%,45%">
18
+ <frame src="fr_file_index.html" title="Files" name="Files" />
19
+ <frame src="fr_class_index.html" name="Classes" />
20
+ <frame src="fr_method_index.html" name="Methods" />
21
+ </frameset>
22
+ <frame src="files/README.html" name="docwin" />
23
+ </frameset>
24
+ </html>