sprout 1.1.11.pre → 1.1.13.pre

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sprout might be problematic. Click here for more details.

Files changed (105) hide show
  1. data/Gemfile.lock +3 -4
  2. data/VERSION +1 -1
  3. data/doc/Dir.html +288 -0
  4. data/doc/Rake/Task.html +184 -0
  5. data/doc/Sprout.html +740 -0
  6. data/doc/Sprout/ArchiveUnpacker.html +1246 -0
  7. data/doc/Sprout/CommandLine.html +520 -0
  8. data/doc/Sprout/Concern.html +351 -0
  9. data/doc/Sprout/Errors.html +101 -0
  10. data/doc/Sprout/Errors/ArchiveUnpackerError.html +125 -0
  11. data/doc/Sprout/Errors/DestinationExistsError.html +133 -0
  12. data/doc/Sprout/Errors/DuplicateMemberError.html +132 -0
  13. data/doc/Sprout/Errors/ExecutableError.html +125 -0
  14. data/doc/Sprout/Errors/ExecutableRegistrationError.html +132 -0
  15. data/doc/Sprout/Errors/ExecutionError.html +121 -0
  16. data/doc/Sprout/Errors/GeneratorError.html +125 -0
  17. data/doc/Sprout/Errors/InvalidArgumentError.html +132 -0
  18. data/doc/Sprout/Errors/LoadError.html +121 -0
  19. data/doc/Sprout/Errors/MissingArgumentError.html +132 -0
  20. data/doc/Sprout/Errors/MissingExecutableError.html +132 -0
  21. data/doc/Sprout/Errors/MissingGeneratorError.html +132 -0
  22. data/doc/Sprout/Errors/MissingTemplateError.html +132 -0
  23. data/doc/Sprout/Errors/ProcessRunnerError.html +121 -0
  24. data/doc/Sprout/Errors/RemoteFileLoaderError.html +110 -0
  25. data/doc/Sprout/Errors/SproutError.html +114 -0
  26. data/doc/Sprout/Errors/UnknownArchiveType.html +122 -0
  27. data/doc/Sprout/Errors/UsageError.html +121 -0
  28. data/doc/Sprout/Errors/ValidationError.html +121 -0
  29. data/doc/Sprout/Errors/VersionRequirementNotMetError.html +121 -0
  30. data/doc/Sprout/Executable.html +169 -0
  31. data/doc/Sprout/Executable/Base.html +2813 -0
  32. data/doc/Sprout/Executable/Boolean.html +534 -0
  33. data/doc/Sprout/Executable/CollectionParam.html +483 -0
  34. data/doc/Sprout/Executable/FileParam.html +484 -0
  35. data/doc/Sprout/Executable/Files.html +292 -0
  36. data/doc/Sprout/Executable/Number.html +141 -0
  37. data/doc/Sprout/Executable/Param.html +2874 -0
  38. data/doc/Sprout/Executable/ParameterFactory.html +232 -0
  39. data/doc/Sprout/Executable/Path.html +223 -0
  40. data/doc/Sprout/Executable/Paths.html +253 -0
  41. data/doc/Sprout/Executable/Session.html +1513 -0
  42. data/doc/Sprout/Executable/StringParam.html +213 -0
  43. data/doc/Sprout/Executable/Strings.html +167 -0
  44. data/doc/Sprout/Executable/Url.html +160 -0
  45. data/doc/Sprout/Executable/Urls.html +170 -0
  46. data/doc/Sprout/FileTarget.html +1109 -0
  47. data/doc/Sprout/Generator.html +750 -0
  48. data/doc/Sprout/Generator/Base.html +1902 -0
  49. data/doc/Sprout/Generator/Command.html +690 -0
  50. data/doc/Sprout/Generator/DirectoryManifest.html +476 -0
  51. data/doc/Sprout/Generator/FileManifest.html +643 -0
  52. data/doc/Sprout/Generator/Manifest.html +377 -0
  53. data/doc/Sprout/Generator/TemplateManifest.html +194 -0
  54. data/doc/Sprout/GeneratorGenerator.html +1115 -0
  55. data/doc/Sprout/Library.html +1146 -0
  56. data/doc/Sprout/LibraryGenerator.html +331 -0
  57. data/doc/Sprout/OutputBuffer.html +445 -0
  58. data/doc/Sprout/Platform.html +714 -0
  59. data/doc/Sprout/ProcessRunner.html +1707 -0
  60. data/doc/Sprout/ProgressBar.html +366 -0
  61. data/doc/Sprout/ProgressBarImpl.html +2109 -0
  62. data/doc/Sprout/ProgressBarManager.html +424 -0
  63. data/doc/Sprout/ProgressBarOutputStream.html +406 -0
  64. data/doc/Sprout/RDocParser.html +211 -0
  65. data/doc/Sprout/RemoteFileLoader.html +172 -0
  66. data/doc/Sprout/RemoteFileTarget.html +679 -0
  67. data/doc/Sprout/ReversedProgressBar.html +184 -0
  68. data/doc/Sprout/RubyFeature.html +155 -0
  69. data/doc/Sprout/RubyFeature/ClassMethods.html +1065 -0
  70. data/doc/Sprout/RubyGenerator.html +786 -0
  71. data/doc/Sprout/Specification.html +767 -0
  72. data/doc/Sprout/System.html +191 -0
  73. data/doc/Sprout/System/BaseSystem.html +1660 -0
  74. data/doc/Sprout/System/JavaSystem.html +122 -0
  75. data/doc/Sprout/System/OSXSystem.html +335 -0
  76. data/doc/Sprout/System/ThreadMock.html +183 -0
  77. data/doc/Sprout/System/UnixSystem.html +584 -0
  78. data/doc/Sprout/System/VistaSystem.html +251 -0
  79. data/doc/Sprout/System/WinNixSystem.html +325 -0
  80. data/doc/Sprout/System/WinSystem.html +571 -0
  81. data/doc/Sprout/TestHelper.html +2165 -0
  82. data/doc/Sprout/ToolGenerator.html +953 -0
  83. data/doc/Sprout/VERSION.html +118 -0
  84. data/doc/String.html +290 -0
  85. data/doc/_index.html +820 -0
  86. data/doc/class_list.html +36 -0
  87. data/doc/css/common.css +1 -0
  88. data/doc/css/full_list.css +53 -0
  89. data/doc/css/style.css +310 -0
  90. data/doc/file.README.html +96 -0
  91. data/doc/file_list.html +41 -0
  92. data/doc/frames.html +13 -0
  93. data/doc/index.html +96 -0
  94. data/doc/js/app.js +202 -0
  95. data/doc/js/full_list.js +149 -0
  96. data/doc/js/jquery.js +154 -0
  97. data/doc/method_list.html +3603 -0
  98. data/doc/top-level-namespace.html +192 -0
  99. data/lib/sprout.rb +1 -0
  100. data/lib/sprout/executable/base.rb +2 -5
  101. data/lib/sprout/executable/param.rb +15 -8
  102. data/lib/sprout/executable/session.rb +1 -1
  103. data/lib/sprout/library.rb +44 -2
  104. data/test/unit/executable_test.rb +3 -5
  105. metadata +99 -3
@@ -0,0 +1,750 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta name="Content-Type" content="text/html; charset=utf-8" />
6
+ <title>Module: Sprout::Generator</title>
7
+ <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '..';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="../_index.html">Index (G)</a> &raquo;
27
+ <span class='title'><span class='object_link'><a href="../Sprout.html" title="Sprout (module)">Sprout</a></span></span>
28
+ &raquo;
29
+ <span class="title">Generator</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Module: Sprout::Generator
47
+
48
+
49
+
50
+ </h1>
51
+
52
+ <dl class="box">
53
+
54
+
55
+
56
+
57
+
58
+ <dt class="r1">Includes:</dt>
59
+ <dd class="r1"><span class='object_link'><a href="RubyFeature.html" title="Sprout::RubyFeature (module)">RubyFeature</a></span></dd>
60
+
61
+
62
+
63
+
64
+
65
+ <dt class="r2 last">Defined in:</dt>
66
+ <dd class="r2 last">lib/sprout/generator.rb<span class="defines">,<br />
67
+ lib/sprout/generator/base.rb,<br /> lib/sprout/generator/command.rb,<br /> lib/sprout/generator/manifest.rb,<br /> lib/sprout/generator/file_manifest.rb,<br /> lib/sprout/generator/template_manifest.rb,<br /> lib/sprout/generator/directory_manifest.rb</span>
68
+ </dd>
69
+
70
+ </dl>
71
+ <div class="clear"></div>
72
+
73
+ <h2>Overview</h2><div class="docstring">
74
+ <div class="discussion">
75
+
76
+ <h1>Introduction</h1>
77
+
78
+ <p>Sprout Generators are command line applications that are installed by
79
+ RubyGems and should universally provide the following features:</p>
80
+ <ul><li>
81
+ <p>Terminal tab completion to discover generators</p>
82
+ </li><li>
83
+ <p>Call with no arguments to see help output</p>
84
+ </li><li>
85
+ <p>Call with an <tt>--input</tt> (or trailing) argument to create</p>
86
+ </li><li>
87
+ <p>Call with a collection of arguments given on a previous run plus
88
+ <tt>--delete</tt> to undo a previous <tt>create</tt></p>
89
+ </li></ul>
90
+
91
+ <h1>Usage</h1>
92
+
93
+ <h2>Discovery</h2>
94
+
95
+ <p>Sprout generators should be installed by RubyGems as command line
96
+ applications on your system. After installing the flashsdk gem, you should
97
+ have access to a variety of generators. You can find out what generators
98
+ are available by typing: sprout- followed by pressing the &lt;TAB&gt; key.</p>
99
+
100
+ <p>Your terminal should list out all available applications that match this
101
+ name.</p>
102
+
103
+ <p>Some generators are expected to create new projects, others expect to run
104
+ within existing projects. You should be able to infer the kind of
105
+ generator you're looking at by the name, but if you can't just run the
106
+ generator with no arguments to see it's usage guidelines.</p>
107
+
108
+ <p>Generators that expect to be run from within a project will usually expect
109
+ a file named <tt>Gemfile</tt> to exist in the project root. If you're
110
+ trying to run Sprout generators in a project that wasn't created using
111
+ Sprouts, create this file and add the Rubygems that include the generators
112
+ that you want to use.</p>
113
+
114
+ <h2>Execution</h2>
115
+
116
+ <p>Generators are created by human beings and sometimes they have different
117
+ assumptions than you do. If you're running a generator within a project
118
+ (especially for the first time - or since updating a gem), be sure to get
119
+ your project checked into version control before running anything.</p>
120
+
121
+ <p>Non-application generators should always be executed at the project root
122
+ (where you store your Rakefile, Gemfile or build.xml).</p>
123
+
124
+ <h2>Deletion</h2>
125
+
126
+ <p>Any generator that inherits from the provided Sprout::Generators::Base
127
+ includes support for deletion. If you run a generator and realize that you
128
+ don't want the files that it created, you can always run the same
129
+ generator again with the same arguments, but add the --delete (or -d)
130
+ argument.</p>
131
+
132
+ <h2>Templates</h2>
133
+
134
+ <p>Each time a generator is asked to locate a template, it begins a lookup
135
+ process. This process is designed to make it easy for you to modify any
136
+ template at the scope you desire.</p>
137
+
138
+ <p>The lookup process will end at the first location where the expected file
139
+ is found.</p>
140
+
141
+ <p>The search will begin with the location specified by the
142
+ <tt>-templates</tt> option (if provided) and will continue by adding
143
+ '/templates' to the end of each location specified by the listing for
144
+ Sprout::Generator#search_paths .</p>
145
+
146
+ <h1>Creation</h1>
147
+
148
+ <p>The core Sprout gem comes with a Sprout::GeneratorGenerator. This command
149
+ line application is intended to be executed within a project and given the
150
+ name of a generator that you'd like to create.</p>
151
+
152
+ <p>Try experimenting with this, and please <a
153
+ href="http://groups.google.com/group/projectsprouts/">suggest</a> any
154
+ improvements to the Google Group.</p>
155
+ <hr style="height: 1px">
156
+
157
+ <p>Back to Home: <a href="../index.html" title="README.textile">README.textile</a></p>
158
+
159
+ <p>Next Topic: <span class='object_link'><a href="Library.html" title="Sprout::Library (class)">Library</a></span></p>
160
+ <hr style="height: 1px">
161
+
162
+
163
+ </div>
164
+ </div>
165
+ <div class="tags">
166
+
167
+ <h3>See Also:</h3>
168
+ <ul class="see">
169
+
170
+ <li><span class='object_link'><a href="GeneratorGenerator.html" title="Sprout::GeneratorGenerator (class)">GeneratorGenerator</a></span></li>
171
+
172
+ <li><span class='object_link'><a href="Library.html" title="Sprout::Library (class)">Library</a></span></li>
173
+
174
+ <li><span class='object_link'><a href="Executable.html" title="Sprout::Executable (module)">Executable</a></span></li>
175
+
176
+ <li><span class='object_link'><a href="Specification.html" title="Sprout::Specification (class)">Specification</a></span></li>
177
+
178
+ <li><span class='object_link'><a href="RubyFeature.html" title="Sprout::RubyFeature (module)">RubyFeature</a></span></li>
179
+
180
+ <li><span class='object_link'><a href="System.html" title="Sprout::System (module)">System</a></span></li>
181
+
182
+ </ul>
183
+
184
+ </div><h2>Defined Under Namespace</h2>
185
+ <p class="children">
186
+
187
+
188
+
189
+
190
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Generator/Base.html" title="Sprout::Generator::Base (class)">Base</a></span>, <span class='object_link'><a href="Generator/Command.html" title="Sprout::Generator::Command (class)">Command</a></span>, <span class='object_link'><a href="Generator/DirectoryManifest.html" title="Sprout::Generator::DirectoryManifest (class)">DirectoryManifest</a></span>, <span class='object_link'><a href="Generator/FileManifest.html" title="Sprout::Generator::FileManifest (class)">FileManifest</a></span>, <span class='object_link'><a href="Generator/Manifest.html" title="Sprout::Generator::Manifest (class)">Manifest</a></span>, <span class='object_link'><a href="Generator/TemplateManifest.html" title="Sprout::Generator::TemplateManifest (class)">TemplateManifest</a></span>
191
+
192
+
193
+ </p>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+ <h2>
207
+ Class Method Summary
208
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
209
+ </h2>
210
+
211
+ <ul class="summary">
212
+
213
+ <li class="public ">
214
+ <span class="summary_signature">
215
+
216
+ <a href="#create_instance-class_method" title="create_instance (class method)">+ (Object) <strong>create_instance</strong>(type, options = nil) </a>
217
+
218
+
219
+
220
+ </span>
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+ <span class="summary_desc"><div class='inline'>
230
+ <p>Create an instance of a concrete Generator using a <tt>type</tt> argument.</p>
231
+ </div></span>
232
+
233
+ </li>
234
+
235
+
236
+ <li class="public ">
237
+ <span class="summary_signature">
238
+
239
+ <a href="#create_search_paths-class_method" title="create_search_paths (class method)">+ (Object) <strong>create_search_paths</strong> </a>
240
+
241
+
242
+
243
+ </span>
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ <span class="summary_desc"><div class='inline'></div></span>
253
+
254
+ </li>
255
+
256
+
257
+ <li class="public ">
258
+ <span class="summary_signature">
259
+
260
+ <a href="#register-class_method" title="register (class method)">+ (Hash) <strong>register</strong>(generator_class, templates_path = nil) </a>
261
+
262
+
263
+
264
+ </span>
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+ <span class="summary_desc"><div class='inline'>
274
+ <p>Register a generator class and template path for future use.</p>
275
+ </div></span>
276
+
277
+ </li>
278
+
279
+
280
+ <li class="public ">
281
+ <span class="summary_signature">
282
+
283
+ <a href="#search_paths-class_method" title="search_paths (class method)">+ (Array) <strong>search_paths</strong> </a>
284
+
285
+
286
+
287
+ </span>
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+ <span class="summary_desc"><div class='inline'>
297
+ <p>Returns a new collection of paths to search within for generator
298
+ declarations and more importantly, folders named, 'templates'.</p>
299
+ </div></span>
300
+
301
+ </li>
302
+
303
+
304
+ <li class="public ">
305
+ <span class="summary_signature">
306
+
307
+ <a href="#template_folder_for-class_method" title="template_folder_for (class method)">+ (Object) <strong>template_folder_for</strong>(clazz) </a>
308
+
309
+
310
+
311
+ </span>
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+ <span class="summary_desc"><div class='inline'>
321
+ <p>Retrieve the root template folder for the provided Class.</p>
322
+ </div></span>
323
+
324
+ </li>
325
+
326
+
327
+ </ul>
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+
338
+
339
+
340
+
341
+
342
+
343
+ <h3 class="inherited">Methods included from <span class='object_link'><a href="Concern.html" title="Sprout::Concern (module)">Concern</a></span></h3>
344
+ <p class="inherited"><span class='object_link'><a href="Concern.html#append_features-instance_method" title="Sprout::Concern#append_features (method)">#append_features</a></span>, <span class='object_link'><a href="Concern.html#extended-class_method" title="Sprout::Concern.extended (method)">extended</a></span>, <span class='object_link'><a href="Concern.html#included-instance_method" title="Sprout::Concern#included (method)">#included</a></span></p>
345
+
346
+
347
+ <div id="class_method_details" class="method_details_list">
348
+ <h2>Class Method Details</h2>
349
+
350
+
351
+ <div class="method_details first">
352
+ <p class="signature first" id="create_instance-class_method">
353
+
354
+ + (<tt>Object</tt>) <strong>create_instance</strong>(type, options = nil)
355
+
356
+
357
+
358
+ </p><div class="docstring">
359
+ <div class="discussion">
360
+
361
+ <p>Create an instance of a concrete Generator using a <tt>type</tt> argument.</p>
362
+
363
+ <p>The idea is that libraries may register a generator class named,</p>
364
+
365
+ <pre class="code">+TestGenerator+, and other generators can instantiate it without
366
+ including it's Class by reference with:
367
+
368
+ Sprout::Generator.create_instance :test</pre>
369
+
370
+
371
+ </div>
372
+ </div>
373
+ <div class="tags">
374
+ <h3>Parameters:</h3>
375
+ <ul class="param">
376
+
377
+ <li>
378
+
379
+ <span class='type'>(<tt>Symbol</tt>)</span>
380
+
381
+
382
+ <span class='name'>type</span>
383
+
384
+
385
+
386
+ &mdash;
387
+ <div class='inline'>
388
+ <p>A snake-cased name of the class without the Generator suffix. for example,
389
+ to instantiate a generator named, <tt>TestSuiteGenerator</tt>, this
390
+ argument would be <tt>:test_suite</tt></p>
391
+ </div>
392
+
393
+ </li>
394
+
395
+ <li>
396
+
397
+ <span class='type'>(<tt>Hash</tt>)</span>
398
+
399
+
400
+ <span class='name'>options</span>
401
+
402
+
403
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
404
+
405
+
406
+ &mdash;
407
+ <div class='inline'>
408
+ <p>deprecated - please remove this argument wherever it's found.</p>
409
+ </div>
410
+
411
+ </li>
412
+
413
+ </ul>
414
+
415
+ </div><table class="source_code">
416
+ <tr>
417
+ <td>
418
+ <pre class="lines">
419
+
420
+
421
+ 149
422
+ 150
423
+ 151
424
+ 152
425
+ 153
426
+ 154
427
+ 155
428
+ 156
429
+ 157</pre>
430
+ </td>
431
+ <td>
432
+ <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 149</span>
433
+
434
+ <span class='kw'>def</span> <span class='id create_instance'>create_instance</span> <span class='id type'>type</span><span class='comma'>,</span> <span class='id options'>options</span><span class='op'>=</span><span class='kw'>nil</span>
435
+ <span class='id class_name'>class_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id type'>type</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id camel_case'>camel_case</span><span class='rbrace'>}</span><span class='tstring_content'>Generator</span><span class='tstring_end'>&quot;</span></span>
436
+ <span class='id registered_entities'>registered_entities</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id entity'>entity</span><span class='op'>|</span>
437
+ <span class='kw'>if</span><span class='lparen'>(</span><span class='id entity'>entity</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>::</span><span class='embexpr_beg'>#{</span><span class='id class_name'>class_name</span><span class='rbrace'>}</span><span class='tstring_content'>$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id entity'>entity</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='period'>.</span><span class='id match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^</span><span class='embexpr_beg'>#{</span><span class='id class_name'>class_name</span><span class='rbrace'>}</span><span class='tstring_content'>$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
438
+ <span class='kw'>return</span> <span class='id entity'>entity</span><span class='period'>.</span><span class='id new'>new</span>
439
+ <span class='kw'>end</span>
440
+ <span class='kw'>end</span>
441
+ <span class='id raise'>raise</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Errors</span><span class='op'>::</span><span class='const'>MissingGeneratorError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Could not find any generator named: (</span><span class='embexpr_beg'>#{</span><span class='id class_name'>class_name</span><span class='rbrace'>}</span><span class='tstring_content'>). Perhaps you need to add a RubyGem to your Gemfile?</span><span class='tstring_end'>&quot;</span></span>
442
+ <span class='kw'>end</span></pre>
443
+ </td>
444
+ </tr>
445
+ </table>
446
+ </div>
447
+
448
+ <div class="method_details ">
449
+ <p class="signature " id="create_search_paths-class_method">
450
+
451
+ + (<tt>Object</tt>) <strong>create_search_paths</strong>
452
+
453
+
454
+
455
+ </p><table class="source_code">
456
+ <tr>
457
+ <td>
458
+ <pre class="lines">
459
+
460
+
461
+ 212
462
+ 213
463
+ 214
464
+ 215
465
+ 216
466
+ 217
467
+ 218
468
+ 219
469
+ 220</pre>
470
+ </td>
471
+ <td>
472
+ <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 212</span>
473
+
474
+ <span class='kw'>def</span> <span class='id create_search_paths'>create_search_paths</span>
475
+ <span class='id paths'>paths</span> <span class='op'>=</span> <span class='lbracket'>[</span>
476
+ <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>config</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>generators</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span>
477
+ <span class='const'>File</span><span class='period'>.</span><span class='id join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>vendor</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>generators</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='comma'>,</span>
478
+ <span class='const'>Sprout</span><span class='period'>.</span><span class='id generator_cache'>generator_cache</span>
479
+ <span class='rbracket'>]</span>
480
+ <span class='id paths'>paths</span> <span class='op'>&lt;&lt;</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SPROUT_GENERATORS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SPROUT_GENERATORS</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span>
481
+ <span class='id paths'>paths</span>
482
+ <span class='kw'>end</span></pre>
483
+ </td>
484
+ </tr>
485
+ </table>
486
+ </div>
487
+
488
+ <div class="method_details ">
489
+ <p class="signature " id="register-class_method">
490
+
491
+ + (<tt>Hash</tt>) <strong>register</strong>(generator_class, templates_path = nil)
492
+
493
+
494
+
495
+ </p><div class="docstring">
496
+ <div class="discussion">
497
+
498
+ <p>Register a generator class and template path for future use. Generator
499
+ class names must end with "Generator", and everything to the left will be
500
+ used for future lookups.</p>
501
+
502
+ <p>The following example will register a TestGenerator that can be retrieved
503
+ as <tt>:test</tt>.</p>
504
+
505
+ <pre class="code"><span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Generator</span><span class='period'>.</span><span class='id register'>register</span> <span class='const'>TestGenerator</span></pre>
506
+
507
+
508
+ </div>
509
+ </div>
510
+ <div class="tags">
511
+ <h3>Parameters:</h3>
512
+ <ul class="param">
513
+
514
+ <li>
515
+
516
+ <span class='type'>(<tt>Class</tt>)</span>
517
+
518
+
519
+ <span class='name'>generator_class</span>
520
+
521
+
522
+
523
+ &mdash;
524
+ <div class='inline'>
525
+ <p>A reference to the concrete Generator class. Usually these classes extend
526
+ Sprout::Generator::Base.</p>
527
+ </div>
528
+
529
+ </li>
530
+
531
+ <li>
532
+
533
+ <span class='type'>(<tt>Directory</tt>)</span>
534
+
535
+
536
+ <span class='name'>templates_path</span>
537
+
538
+
539
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
540
+
541
+
542
+ &mdash;
543
+ <div class='inline'>
544
+ <p>The path to the default templates that should be used for this generator.
545
+ By default, a folder named <tt>templates</tt> relative to the class
546
+ definition will be used. Templates will also be searched for in a variety
547
+ of locations depending on the user system. This path is simply the final
548
+ searching point.</p>
549
+ </div>
550
+
551
+ </li>
552
+
553
+ </ul>
554
+ <h3>Returns:</h3>
555
+ <ul class="return">
556
+
557
+ <li>
558
+
559
+ <span class='type'>(<tt>Hash</tt>)</span>
560
+
561
+
562
+
563
+
564
+ &mdash;
565
+ <div class='inline'>
566
+ <p>the entity that was stored to represent the provided Generator. The entity
567
+ will generally have the keys, :class and :templates.</p>
568
+ </div>
569
+
570
+ </li>
571
+
572
+ </ul>
573
+
574
+ </div><table class="source_code">
575
+ <tr>
576
+ <td>
577
+ <pre class="lines">
578
+
579
+
580
+ 131
581
+ 132
582
+ 133
583
+ 134</pre>
584
+ </td>
585
+ <td>
586
+ <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 131</span>
587
+
588
+ <span class='kw'>def</span> <span class='id register'>register</span> <span class='id generator_class'>generator_class</span><span class='comma'>,</span> <span class='id templates_path'>templates_path</span><span class='op'>=</span><span class='kw'>nil</span>
589
+ <span class='id generator_paths'>generator_paths</span> <span class='op'>&lt;&lt;</span> <span class='lbrace'>{</span> <span class='symbol'>:class</span> <span class='op'>=&gt;</span> <span class='id generator_class'>generator_class</span><span class='comma'>,</span> <span class='symbol'>:templates</span> <span class='op'>=&gt;</span> <span class='id templates_path'>templates_path</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='id templates_path'>templates_path</span><span class='period'>.</span><span class='id nil?'>nil?</span>
590
+ <span class='kw'>super</span><span class='lparen'>(</span><span class='id generator_class'>generator_class</span><span class='rparen'>)</span>
591
+ <span class='kw'>end</span></pre>
592
+ </td>
593
+ </tr>
594
+ </table>
595
+ </div>
596
+
597
+ <div class="method_details ">
598
+ <p class="signature " id="search_paths-class_method">
599
+
600
+ + (<tt>Array</tt>) <strong>search_paths</strong>
601
+
602
+
603
+
604
+ </p><div class="docstring">
605
+ <div class="discussion">
606
+
607
+ <p>Returns a new collection of paths to search within for generator
608
+ declarations and more importantly, folders named, 'templates'.</p>
609
+
610
+ <p>The collection of search_paths will be a subset of the following that will
611
+ include only those directories that exist:</p>
612
+
613
+ <pre class="code">./config/generators
614
+ ./vendor/generators
615
+ ~/Library/Sprouts/1.0/generators # OS X only
616
+ ~/.sprouts/1.0/generators # Unix only
617
+ [USER_HOME]/Application Data/Sprouts/cache/1.0/generators # Windows only
618
+ ENV['SPROUT_GENERATORS'] # Only if defined
619
+ [Generator Declaration __FILE__]
620
+ [Generator SUPER-class declaration __FILE__]
621
+ [Repeat step above until there is no super-class]</pre>
622
+
623
+ <p>When the generators attempt to resolve templates, each of the preceding
624
+ folders will be scanned for a child directory named 'templates'. Within
625
+ that directory, the requested template name will be scanned and the first
626
+ found template file will be used. This process will be repeated for each
627
+ template file that is requested.</p>
628
+
629
+ <p>The results of this search are not cached, so you can override a single
630
+ template and leave the rest wherever the generator has defined them.</p>
631
+
632
+
633
+ </div>
634
+ </div>
635
+ <div class="tags">
636
+ <h3>Returns:</h3>
637
+ <ul class="return">
638
+
639
+ <li>
640
+
641
+ <span class='type'>(<tt>Array</tt>)</span>
642
+
643
+
644
+
645
+
646
+ &mdash;
647
+ <div class='inline'>
648
+ <p>of paths</p>
649
+ </div>
650
+
651
+ </li>
652
+
653
+ </ul>
654
+
655
+ </div><table class="source_code">
656
+ <tr>
657
+ <td>
658
+ <pre class="lines">
659
+
660
+
661
+ 206
662
+ 207
663
+ 208
664
+ 209
665
+ 210</pre>
666
+ </td>
667
+ <td>
668
+ <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 206</span>
669
+
670
+ <span class='kw'>def</span> <span class='id search_paths'>search_paths</span>
671
+ <span class='comment'># NOTE: Do not cache this list, specific generators
672
+ </span> <span class='comment'># will modify it with their own lookups
673
+ </span> <span class='id create_search_paths'>create_search_paths</span><span class='period'>.</span><span class='id select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id path'>path</span><span class='op'>|</span> <span class='const'>File</span><span class='period'>.</span><span class='id directory?'>directory?</span><span class='lparen'>(</span><span class='id path'>path</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
674
+ <span class='kw'>end</span></pre>
675
+ </td>
676
+ </tr>
677
+ </table>
678
+ </div>
679
+
680
+ <div class="method_details ">
681
+ <p class="signature " id="template_folder_for-class_method">
682
+
683
+ + (<tt>Object</tt>) <strong>template_folder_for</strong>(clazz)
684
+
685
+
686
+
687
+ </p><div class="docstring">
688
+ <div class="discussion">
689
+
690
+ <p>Retrieve the root template folder for the provided Class.</p>
691
+
692
+ <p>This method will look for a templates folder next to each superclass in the
693
+ inheritance chain.</p>
694
+
695
+
696
+ </div>
697
+ </div>
698
+ <div class="tags">
699
+
700
+ </div><table class="source_code">
701
+ <tr>
702
+ <td>
703
+ <pre class="lines">
704
+
705
+
706
+ 165
707
+ 166
708
+ 167
709
+ 168
710
+ 169
711
+ 170
712
+ 171
713
+ 172
714
+ 173
715
+ 174
716
+ 175
717
+ 176</pre>
718
+ </td>
719
+ <td>
720
+ <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 165</span>
721
+
722
+ <span class='kw'>def</span> <span class='id template_folder_for'>template_folder_for</span> <span class='id clazz'>clazz</span>
723
+ <span class='comment'># Search the potential matches in reverse order
724
+ </span> <span class='comment'># because subclasses have registered AFTER their
725
+ </span> <span class='comment'># superclasses and superclasses match the ===
726
+ </span> <span class='comment'># check...
727
+ </span> <span class='id generator_paths'>generator_paths</span><span class='period'>.</span><span class='id reverse'>reverse</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id options'>options</span><span class='op'>|</span>
728
+ <span class='kw'>if</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:class</span><span class='rbracket'>]</span> <span class='op'>===</span> <span class='id clazz'>clazz</span>
729
+ <span class='kw'>return</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:templates</span><span class='rbracket'>]</span>
730
+ <span class='kw'>end</span>
731
+ <span class='kw'>end</span>
732
+ <span class='kw'>nil</span>
733
+ <span class='kw'>end</span></pre>
734
+ </td>
735
+ </tr>
736
+ </table>
737
+ </div>
738
+
739
+ </div>
740
+
741
+ </div>
742
+
743
+ <div id="footer">
744
+ Generated on Fri Apr 29 18:33:05 2011 by
745
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
746
+ 0.6.3 (ruby-1.9.2).
747
+ </div>
748
+
749
+ </body>
750
+ </html>