sprout 1.0.35.pre → 1.1.2.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 (234) hide show
  1. data/Gemfile +1 -1
  2. data/Gemfile.lock +0 -2
  3. data/README.textile +1 -1
  4. data/VERSION +1 -1
  5. data/lib/sprout/concern.rb +5 -7
  6. data/lib/sprout/daemon.rb +183 -143
  7. data/lib/sprout/executable/base.rb +564 -0
  8. data/lib/sprout/executable.rb +1 -550
  9. data/lib/sprout/generator/base.rb +2 -3
  10. data/lib/sprout/generator.rb +2 -1
  11. data/lib/sprout/generators/ruby/templates/ruby_base.rb +1 -2
  12. data/lib/sprout/library.rb +3 -3
  13. data/lib/sprout/output_buffer.rb +35 -0
  14. data/lib/sprout/process_runner.rb +68 -17
  15. data/lib/sprout/progress_bar.rb +5 -5
  16. data/lib/sprout/remote_file_target.rb +1 -1
  17. data/lib/sprout/system/base_system.rb +3 -3
  18. data/lib/sprout/system/unix_system.rb +1 -1
  19. data/lib/sprout/{test/sprout_test_case.rb → test_helper.rb} +214 -14
  20. data/lib/sprout/version.rb +1 -1
  21. data/lib/sprout.rb +133 -2
  22. data/rakefile.rb +2 -0
  23. data/test/fixtures/examples/echo_inputs.rb +1 -2
  24. data/test/fixtures/executable/fdb.rb +7 -9
  25. data/test/fixtures/executable/flex3sdk_gem/fdb +49 -18
  26. data/test/fixtures/executable/mxmlc.rb +1 -2
  27. data/test/fixtures/executable/subclass/executable_subclass.rb +0 -1
  28. data/test/fixtures/executable/subclass/executable_superclass.rb +1 -2
  29. data/test/fixtures/specification/flex4sdk.rb +35 -24
  30. data/test/unit/archive_unpacker_test.rb +1 -1
  31. data/test/unit/boolean_param_test.rb +1 -1
  32. data/test/unit/daemon_test.rb +35 -3
  33. data/test/unit/executable_option_parser_test.rb +2 -3
  34. data/test/unit/executable_param_test.rb +1 -1
  35. data/test/unit/executable_test.rb +8 -15
  36. data/test/unit/fake_other_executable.rb +1 -2
  37. data/test/unit/file_param_test.rb +1 -1
  38. data/test/unit/file_target_test.rb +1 -1
  39. data/test/unit/files_param_test.rb +1 -1
  40. data/test/unit/generator_generator_test.rb +1 -1
  41. data/test/unit/generator_test.rb +1 -1
  42. data/test/unit/library_generator_test.rb +1 -1
  43. data/test/unit/library_test.rb +1 -1
  44. data/test/unit/osx_system_test.rb +1 -1
  45. data/test/unit/path_param_test.rb +1 -1
  46. data/test/unit/paths_param_test.rb +1 -1
  47. data/test/unit/platform_test.rb +1 -1
  48. data/test/unit/process_runner_test.rb +1 -1
  49. data/test/unit/rdoc_parser_test.rb +1 -1
  50. data/test/unit/remote_file_loader_test.rb +1 -1
  51. data/test/unit/remote_file_target_test.rb +1 -1
  52. data/test/unit/ruby_feature_test.rb +1 -1
  53. data/test/unit/ruby_generator_test.rb +1 -1
  54. data/test/unit/specification_test.rb +8 -1
  55. data/test/unit/sprout_test.rb +2 -2
  56. data/test/unit/string_param_test.rb +1 -1
  57. data/test/unit/string_test.rb +1 -1
  58. data/test/unit/strings_param_test.rb +1 -1
  59. data/test/unit/test_helper.rb +33 -1
  60. data/test/unit/tool_generator_test.rb +1 -1
  61. data/test/unit/unix_system_test.rb +1 -1
  62. data/test/unit/user_test.rb +1 -1
  63. data/test/unit/vista_system_test.rb +1 -1
  64. data/test/unit/win_nix_system_test.rb +1 -1
  65. data/test/unit/win_system_test.rb +1 -1
  66. data/test-stderr.log +1 -0
  67. data/test-stdout.log +237 -0
  68. metadata +15 -190
  69. data/doc/Dir.html +0 -288
  70. data/doc/Rake/Task.html +0 -184
  71. data/doc/Sprout/ArchiveUnpacker.html +0 -1246
  72. data/doc/Sprout/Base/ClassMethods.html +0 -434
  73. data/doc/Sprout/Base.html +0 -126
  74. data/doc/Sprout/Concern.html +0 -353
  75. data/doc/Sprout/Daemon/ClassMethods.html +0 -244
  76. data/doc/Sprout/Daemon/InstanceMethods.html +0 -601
  77. data/doc/Sprout/Daemon.html +0 -166
  78. data/doc/Sprout/Errors/ArchiveUnpackerError.html +0 -125
  79. data/doc/Sprout/Errors/DestinationExistsError.html +0 -133
  80. data/doc/Sprout/Errors/DuplicateMemberError.html +0 -132
  81. data/doc/Sprout/Errors/ExecutableError.html +0 -125
  82. data/doc/Sprout/Errors/ExecutableRegistrationError.html +0 -132
  83. data/doc/Sprout/Errors/ExecutionError.html +0 -121
  84. data/doc/Sprout/Errors/GeneratorError.html +0 -125
  85. data/doc/Sprout/Errors/InvalidArgumentError.html +0 -132
  86. data/doc/Sprout/Errors/LoadError.html +0 -121
  87. data/doc/Sprout/Errors/MissingArgumentError.html +0 -132
  88. data/doc/Sprout/Errors/MissingExecutableError.html +0 -132
  89. data/doc/Sprout/Errors/MissingGeneratorError.html +0 -132
  90. data/doc/Sprout/Errors/MissingTemplateError.html +0 -132
  91. data/doc/Sprout/Errors/ProcessRunnerError.html +0 -121
  92. data/doc/Sprout/Errors/RemoteFileLoaderError.html +0 -110
  93. data/doc/Sprout/Errors/SproutError.html +0 -114
  94. data/doc/Sprout/Errors/UnknownArchiveType.html +0 -122
  95. data/doc/Sprout/Errors/UsageError.html +0 -121
  96. data/doc/Sprout/Errors/ValidationError.html +0 -121
  97. data/doc/Sprout/Errors/VersionRequirementNotMetError.html +0 -121
  98. data/doc/Sprout/Errors.html +0 -101
  99. data/doc/Sprout/Executable/Boolean.html +0 -483
  100. data/doc/Sprout/Executable/ClassMethods.html +0 -417
  101. data/doc/Sprout/Executable/CollectionParam.html +0 -483
  102. data/doc/Sprout/Executable/FileParam.html +0 -484
  103. data/doc/Sprout/Executable/Files.html +0 -292
  104. data/doc/Sprout/Executable/InstanceMethods.html +0 -2006
  105. data/doc/Sprout/Executable/Number.html +0 -141
  106. data/doc/Sprout/Executable/Param.html +0 -2818
  107. data/doc/Sprout/Executable/ParameterFactory.html +0 -232
  108. data/doc/Sprout/Executable/Path.html +0 -223
  109. data/doc/Sprout/Executable/Paths.html +0 -253
  110. data/doc/Sprout/Executable/StringParam.html +0 -213
  111. data/doc/Sprout/Executable/Strings.html +0 -167
  112. data/doc/Sprout/Executable/Url.html +0 -160
  113. data/doc/Sprout/Executable/Urls.html +0 -170
  114. data/doc/Sprout/Executable.html +0 -173
  115. data/doc/Sprout/FileTarget.html +0 -1109
  116. data/doc/Sprout/Generator/Base.html +0 -1626
  117. data/doc/Sprout/Generator/Command.html +0 -690
  118. data/doc/Sprout/Generator/DirectoryManifest.html +0 -476
  119. data/doc/Sprout/Generator/FileManifest.html +0 -572
  120. data/doc/Sprout/Generator/Manifest.html +0 -377
  121. data/doc/Sprout/Generator/TemplateManifest.html +0 -196
  122. data/doc/Sprout/Generator.html +0 -689
  123. data/doc/Sprout/GeneratorGenerator.html +0 -1018
  124. data/doc/Sprout/Library.html +0 -1141
  125. data/doc/Sprout/LibraryGenerator.html +0 -309
  126. data/doc/Sprout/Log.html +0 -496
  127. data/doc/Sprout/MXMLC.html +0 -6373
  128. data/doc/Sprout/Platform.html +0 -714
  129. data/doc/Sprout/ProcessRunner.html +0 -1352
  130. data/doc/Sprout/ProgressBar.html +0 -376
  131. data/doc/Sprout/ProgressBarImpl.html +0 -2119
  132. data/doc/Sprout/ProgressBarManager.html +0 -434
  133. data/doc/Sprout/ProgressBarOutputStream.html +0 -416
  134. data/doc/Sprout/RDocParser.html +0 -211
  135. data/doc/Sprout/RemoteFileLoader.html +0 -172
  136. data/doc/Sprout/RemoteFileTarget.html +0 -679
  137. data/doc/Sprout/ReversedProgressBar.html +0 -194
  138. data/doc/Sprout/RubyFeature/ClassMethods.html +0 -1065
  139. data/doc/Sprout/RubyFeature.html +0 -155
  140. data/doc/Sprout/RubyGenerator.html +0 -764
  141. data/doc/Sprout/Specification.html +0 -767
  142. data/doc/Sprout/System/BaseSystem.html +0 -1455
  143. data/doc/Sprout/System/JavaSystem.html +0 -122
  144. data/doc/Sprout/System/OSXSystem.html +0 -335
  145. data/doc/Sprout/System/ThreadMock.html +0 -193
  146. data/doc/Sprout/System/UnixSystem.html +0 -584
  147. data/doc/Sprout/System/VistaSystem.html +0 -251
  148. data/doc/Sprout/System/WinNixSystem.html +0 -325
  149. data/doc/Sprout/System/WinSystem.html +0 -571
  150. data/doc/Sprout/System.html +0 -191
  151. data/doc/Sprout/ToolGenerator.html +0 -931
  152. data/doc/Sprout/VERSION.html +0 -128
  153. data/doc/Sprout.html +0 -144
  154. data/doc/SproutTestCase.html +0 -1412
  155. data/doc/String.html +0 -286
  156. data/doc/_index.html +0 -1035
  157. data/doc/class_list.html +0 -36
  158. data/doc/css/common.css +0 -1
  159. data/doc/css/full_list.css +0 -53
  160. data/doc/css/style.css +0 -310
  161. data/doc/file.README.html +0 -96
  162. data/doc/file.archive_unpacker.html +0 -288
  163. data/doc/file.base.html +0 -208
  164. data/doc/file.base_system.html +0 -278
  165. data/doc/file.boolean.html +0 -135
  166. data/doc/file.collection_param.html +0 -139
  167. data/doc/file.command.html +0 -126
  168. data/doc/file.concern.html +0 -136
  169. data/doc/file.daemon.html +0 -309
  170. data/doc/file.dir.html +0 -76
  171. data/doc/file.directory_manifest.html +0 -122
  172. data/doc/file.errors.html +0 -147
  173. data/doc/file.executable.html +0 -638
  174. data/doc/file.file_manifest.html +0 -109
  175. data/doc/file.file_param.html +0 -120
  176. data/doc/file.file_target.html +0 -140
  177. data/doc/file.files.html +0 -85
  178. data/doc/file.generator.html +0 -296
  179. data/doc/file.generator_class.html +0 -72
  180. data/doc/file.generator_generator.html +0 -137
  181. data/doc/file.generator_test.html +0 -92
  182. data/doc/file.generator_test_helper.html +0 -67
  183. data/doc/file.java_system.html +0 -62
  184. data/doc/file.library.html +0 -291
  185. data/doc/file.library_generator.html +0 -74
  186. data/doc/file.log.html +0 -100
  187. data/doc/file.manifest.html +0 -67
  188. data/doc/file.mxmlc.html +0 -740
  189. data/doc/file.number.html +0 -67
  190. data/doc/file.osx_system.html +0 -79
  191. data/doc/file.param.html +0 -491
  192. data/doc/file.parameter_factory.html +0 -119
  193. data/doc/file.path.html +0 -81
  194. data/doc/file.paths.html +0 -80
  195. data/doc/file.platform.html +0 -124
  196. data/doc/file.process_runner.html +0 -224
  197. data/doc/file.progress_bar.html +0 -390
  198. data/doc/file.rdoc_parser.html +0 -145
  199. data/doc/file.remote_file_loader.html +0 -117
  200. data/doc/file.remote_file_target.html +0 -176
  201. data/doc/file.ruby_base.html +0 -64
  202. data/doc/file.ruby_feature.html +0 -244
  203. data/doc/file.ruby_generator.html +0 -118
  204. data/doc/file.ruby_input.html +0 -62
  205. data/doc/file.ruby_test_case.html +0 -78
  206. data/doc/file.ruby_test_helper.html +0 -61
  207. data/doc/file.specification.html +0 -248
  208. data/doc/file.sprout.html +0 -64
  209. data/doc/file.sprout_test_case.html +0 -280
  210. data/doc/file.string.html +0 -72
  211. data/doc/file.string_param.html +0 -76
  212. data/doc/file.strings.html +0 -71
  213. data/doc/file.system.html +0 -86
  214. data/doc/file.template_manifest.html +0 -67
  215. data/doc/file.tool.html +0 -92
  216. data/doc/file.tool_generator.html +0 -90
  217. data/doc/file.unix_system.html +0 -128
  218. data/doc/file.url.html +0 -71
  219. data/doc/file.urls.html +0 -70
  220. data/doc/file.version.html +0 -71
  221. data/doc/file.vista_system.html +0 -69
  222. data/doc/file.win_nix_system.html +0 -88
  223. data/doc/file.win_system.html +0 -129
  224. data/doc/file_list.html +0 -230
  225. data/doc/frames.html +0 -13
  226. data/doc/index.html +0 -96
  227. data/doc/js/app.js +0 -202
  228. data/doc/js/full_list.js +0 -149
  229. data/doc/js/jquery.js +0 -154
  230. data/doc/method_list.html +0 -3355
  231. data/doc/top-level-namespace.html +0 -192
  232. data/lib/sprout/base.rb +0 -121
  233. data/lib/sprout/log.rb +0 -46
  234. data/test/unit/sprout_test_helper.rb +0 -33
@@ -1,689 +0,0 @@
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="#register-class_method" title="register (class method)">+ (Hash) <strong>register</strong>(generator_class, templates_path = nil) </a>
240
-
241
-
242
-
243
- </span>
244
-
245
-
246
-
247
-
248
-
249
-
250
-
251
-
252
- <span class="summary_desc"><div class='inline'>
253
- <p>Register a generator class and template path for future use.</p>
254
- </div></span>
255
-
256
- </li>
257
-
258
-
259
- <li class="public ">
260
- <span class="summary_signature">
261
-
262
- <a href="#search_paths-class_method" title="search_paths (class method)">+ (Array) <strong>search_paths</strong> </a>
263
-
264
-
265
-
266
- </span>
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
- <span class="summary_desc"><div class='inline'>
276
- <p>Returns a new collection of paths to search within for generator
277
- declarations and more importantly, folders named, 'templates'.</p>
278
- </div></span>
279
-
280
- </li>
281
-
282
-
283
- <li class="public ">
284
- <span class="summary_signature">
285
-
286
- <a href="#template_folder_for-class_method" title="template_folder_for (class method)">+ (Object) <strong>template_folder_for</strong>(clazz) </a>
287
-
288
-
289
-
290
- </span>
291
-
292
-
293
-
294
-
295
-
296
-
297
-
298
-
299
- <span class="summary_desc"><div class='inline'>
300
- <p>Retrieve the root template folder for the provided Class.</p>
301
- </div></span>
302
-
303
- </li>
304
-
305
-
306
- </ul>
307
-
308
-
309
-
310
-
311
-
312
-
313
-
314
-
315
-
316
-
317
-
318
-
319
-
320
-
321
-
322
- <h3 class="inherited">Methods included from <span class='object_link'><a href="Concern.html" title="Sprout::Concern (module)">Concern</a></span></h3>
323
- <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>
324
-
325
-
326
- <div id="class_method_details" class="method_details_list">
327
- <h2>Class Method Details</h2>
328
-
329
-
330
- <div class="method_details first">
331
- <p class="signature first" id="create_instance-class_method">
332
-
333
- + (<tt>Object</tt>) <strong>create_instance</strong>(type, options = nil)
334
-
335
-
336
-
337
- </p><div class="docstring">
338
- <div class="discussion">
339
-
340
- <p>Create an instance of a concrete Generator using a <tt>type</tt> argument.</p>
341
-
342
- <p>The idea is that libraries may register a generator class named,</p>
343
-
344
- <pre class="code">+TestGenerator+, and other generators can instantiate it without
345
- including it's Class by reference with:
346
-
347
- Sprout::Generator.create_instance :test</pre>
348
-
349
-
350
- </div>
351
- </div>
352
- <div class="tags">
353
- <h3>Parameters:</h3>
354
- <ul class="param">
355
-
356
- <li>
357
-
358
- <span class='type'>(<tt>Symbol</tt>)</span>
359
-
360
-
361
- <span class='name'>type</span>
362
-
363
-
364
-
365
- &mdash;
366
- <div class='inline'>
367
- <p>A snake-cased name of the class without the Generator suffix. for example,
368
- to instantiate a generator named, <tt>TestSuiteGenerator</tt>, this
369
- argument would be <tt>:test_suite</tt></p>
370
- </div>
371
-
372
- </li>
373
-
374
- <li>
375
-
376
- <span class='type'>(<tt>Hash</tt>)</span>
377
-
378
-
379
- <span class='name'>options</span>
380
-
381
-
382
- <em class="default">(defaults to: <tt>nil</tt>)</em>
383
-
384
-
385
- &mdash;
386
- <div class='inline'>
387
- <p>deprecated - please remove this argument wherever it's found.</p>
388
- </div>
389
-
390
- </li>
391
-
392
- </ul>
393
-
394
- </div><table class="source_code">
395
- <tr>
396
- <td>
397
- <pre class="lines">
398
-
399
-
400
- 148
401
- 149
402
- 150
403
- 151
404
- 152
405
- 153
406
- 154
407
- 155
408
- 156</pre>
409
- </td>
410
- <td>
411
- <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 148</span>
412
-
413
- <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>
414
- <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>
415
- <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>
416
- <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>
417
- <span class='kw'>return</span> <span class='id entity'>entity</span><span class='period'>.</span><span class='id new'>new</span>
418
- <span class='kw'>end</span>
419
- <span class='kw'>end</span>
420
- <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>
421
- <span class='kw'>end</span></pre>
422
- </td>
423
- </tr>
424
- </table>
425
- </div>
426
-
427
- <div class="method_details ">
428
- <p class="signature " id="register-class_method">
429
-
430
- + (<tt>Hash</tt>) <strong>register</strong>(generator_class, templates_path = nil)
431
-
432
-
433
-
434
- </p><div class="docstring">
435
- <div class="discussion">
436
-
437
- <p>Register a generator class and template path for future use. Generator
438
- class names must end with "Generator", and everything to the left will be
439
- used for future lookups.</p>
440
-
441
- <p>The following example will register a TestGenerator that can be retrieved
442
- as <tt>:test</tt>.</p>
443
-
444
- <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>
445
-
446
-
447
- </div>
448
- </div>
449
- <div class="tags">
450
- <h3>Parameters:</h3>
451
- <ul class="param">
452
-
453
- <li>
454
-
455
- <span class='type'>(<tt>Class</tt>)</span>
456
-
457
-
458
- <span class='name'>generator_class</span>
459
-
460
-
461
-
462
- &mdash;
463
- <div class='inline'>
464
- <p>A reference to the concrete Generator class. Usually these classes extend
465
- Sprout::Generator::Base.</p>
466
- </div>
467
-
468
- </li>
469
-
470
- <li>
471
-
472
- <span class='type'>(<tt>Directory</tt>)</span>
473
-
474
-
475
- <span class='name'>templates_path</span>
476
-
477
-
478
- <em class="default">(defaults to: <tt>nil</tt>)</em>
479
-
480
-
481
- &mdash;
482
- <div class='inline'>
483
- <p>The path to the default templates that should be used for this generator.
484
- By default, a folder named <tt>templates</tt> relative to the class
485
- definition will be used. Templates will also be searched for in a variety
486
- of locations depending on the user system. This path is simply the final
487
- searching point.</p>
488
- </div>
489
-
490
- </li>
491
-
492
- </ul>
493
- <h3>Returns:</h3>
494
- <ul class="return">
495
-
496
- <li>
497
-
498
- <span class='type'>(<tt>Hash</tt>)</span>
499
-
500
-
501
-
502
-
503
- &mdash;
504
- <div class='inline'>
505
- <p>the entity that was stored to represent the provided Generator. The entity
506
- will generally have the keys, :class and :templates.</p>
507
- </div>
508
-
509
- </li>
510
-
511
- </ul>
512
-
513
- </div><table class="source_code">
514
- <tr>
515
- <td>
516
- <pre class="lines">
517
-
518
-
519
- 130
520
- 131
521
- 132
522
- 133</pre>
523
- </td>
524
- <td>
525
- <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 130</span>
526
-
527
- <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>
528
- <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>
529
- <span class='kw'>super</span><span class='lparen'>(</span><span class='id generator_class'>generator_class</span><span class='rparen'>)</span>
530
- <span class='kw'>end</span></pre>
531
- </td>
532
- </tr>
533
- </table>
534
- </div>
535
-
536
- <div class="method_details ">
537
- <p class="signature " id="search_paths-class_method">
538
-
539
- + (<tt>Array</tt>) <strong>search_paths</strong>
540
-
541
-
542
-
543
- </p><div class="docstring">
544
- <div class="discussion">
545
-
546
- <p>Returns a new collection of paths to search within for generator
547
- declarations and more importantly, folders named, 'templates'.</p>
548
-
549
- <p>The collection of search_paths will be a subset of the following that will
550
- include only those directories that exist:</p>
551
-
552
- <pre class="code">./config/generators
553
- ./vendor/generators
554
- ~/Library/Sprouts/1.0/generators # OS X only
555
- ~/.sprouts/1.0/generators # Unix only
556
- [USER_HOME]/Application Data/Sprouts/cache/1.0/generators # Windows only
557
- ENV['SPROUT_GENERATORS'] # Only if defined
558
- [Generator Declaration __FILE__]
559
- [Generator SUPER-class declaration __FILE__]
560
- [Repeat step above until there is no super-class]</pre>
561
-
562
- <p>When the generators attempt to resolve templates, each of the preceding
563
- folders will be scanned for a child directory named 'templates'. Within
564
- that directory, the requested template name will be scanned and the first
565
- found template file will be used. This process will be repeated for each
566
- template file that is requested.</p>
567
-
568
- <p>The results of this search are not cached, so you can override a single
569
- template and leave the rest wherever the generator has defined them.</p>
570
-
571
-
572
- </div>
573
- </div>
574
- <div class="tags">
575
- <h3>Returns:</h3>
576
- <ul class="return">
577
-
578
- <li>
579
-
580
- <span class='type'>(<tt>Array</tt>)</span>
581
-
582
-
583
-
584
-
585
- &mdash;
586
- <div class='inline'>
587
- <p>of paths</p>
588
- </div>
589
-
590
- </li>
591
-
592
- </ul>
593
-
594
- </div><table class="source_code">
595
- <tr>
596
- <td>
597
- <pre class="lines">
598
-
599
-
600
- 205
601
- 206
602
- 207
603
- 208
604
- 209</pre>
605
- </td>
606
- <td>
607
- <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 205</span>
608
-
609
- <span class='kw'>def</span> <span class='id search_paths'>search_paths</span>
610
- <span class='comment'># NOTE: Do not cache this list, specific generators
611
- </span> <span class='comment'># will modify it with their own lookups
612
- </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>
613
- <span class='kw'>end</span></pre>
614
- </td>
615
- </tr>
616
- </table>
617
- </div>
618
-
619
- <div class="method_details ">
620
- <p class="signature " id="template_folder_for-class_method">
621
-
622
- + (<tt>Object</tt>) <strong>template_folder_for</strong>(clazz)
623
-
624
-
625
-
626
- </p><div class="docstring">
627
- <div class="discussion">
628
-
629
- <p>Retrieve the root template folder for the provided Class.</p>
630
-
631
- <p>This method will look for a templates folder next to each superclass in the
632
- inheritance chain.</p>
633
-
634
-
635
- </div>
636
- </div>
637
- <div class="tags">
638
-
639
- </div><table class="source_code">
640
- <tr>
641
- <td>
642
- <pre class="lines">
643
-
644
-
645
- 164
646
- 165
647
- 166
648
- 167
649
- 168
650
- 169
651
- 170
652
- 171
653
- 172
654
- 173
655
- 174
656
- 175</pre>
657
- </td>
658
- <td>
659
- <pre class="code"><span class="info file"># File 'lib/sprout/generator.rb', line 164</span>
660
-
661
- <span class='kw'>def</span> <span class='id template_folder_for'>template_folder_for</span> <span class='id clazz'>clazz</span>
662
- <span class='comment'># Search the potential matches in reverse order
663
- </span> <span class='comment'># because subclasses have registered AFTER their
664
- </span> <span class='comment'># superclasses and superclasses match the ===
665
- </span> <span class='comment'># check...
666
- </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>
667
- <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>
668
- <span class='kw'>return</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:templates</span><span class='rbracket'>]</span>
669
- <span class='kw'>end</span>
670
- <span class='kw'>end</span>
671
- <span class='kw'>nil</span>
672
- <span class='kw'>end</span></pre>
673
- </td>
674
- </tr>
675
- </table>
676
- </div>
677
-
678
- </div>
679
-
680
- </div>
681
-
682
- <div id="footer">
683
- Generated on Wed Dec 22 11:58:33 2010 by
684
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
685
- 0.6.3 (ruby-1.9.2).
686
- </div>
687
-
688
- </body>
689
- </html>