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