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.
- data/Gemfile +1 -1
- data/Gemfile.lock +0 -2
- data/README.textile +1 -1
- data/VERSION +1 -1
- data/lib/sprout/concern.rb +5 -7
- data/lib/sprout/daemon.rb +183 -143
- data/lib/sprout/executable/base.rb +564 -0
- data/lib/sprout/executable.rb +1 -550
- data/lib/sprout/generator/base.rb +2 -3
- data/lib/sprout/generator.rb +2 -1
- data/lib/sprout/generators/ruby/templates/ruby_base.rb +1 -2
- data/lib/sprout/library.rb +3 -3
- data/lib/sprout/output_buffer.rb +35 -0
- data/lib/sprout/process_runner.rb +68 -17
- data/lib/sprout/progress_bar.rb +5 -5
- data/lib/sprout/remote_file_target.rb +1 -1
- data/lib/sprout/system/base_system.rb +3 -3
- data/lib/sprout/system/unix_system.rb +1 -1
- data/lib/sprout/{test/sprout_test_case.rb → test_helper.rb} +214 -14
- data/lib/sprout/version.rb +1 -1
- data/lib/sprout.rb +133 -2
- data/rakefile.rb +2 -0
- data/test/fixtures/examples/echo_inputs.rb +1 -2
- data/test/fixtures/executable/fdb.rb +7 -9
- data/test/fixtures/executable/flex3sdk_gem/fdb +49 -18
- data/test/fixtures/executable/mxmlc.rb +1 -2
- data/test/fixtures/executable/subclass/executable_subclass.rb +0 -1
- data/test/fixtures/executable/subclass/executable_superclass.rb +1 -2
- data/test/fixtures/specification/flex4sdk.rb +35 -24
- data/test/unit/archive_unpacker_test.rb +1 -1
- data/test/unit/boolean_param_test.rb +1 -1
- data/test/unit/daemon_test.rb +35 -3
- data/test/unit/executable_option_parser_test.rb +2 -3
- data/test/unit/executable_param_test.rb +1 -1
- data/test/unit/executable_test.rb +8 -15
- data/test/unit/fake_other_executable.rb +1 -2
- data/test/unit/file_param_test.rb +1 -1
- data/test/unit/file_target_test.rb +1 -1
- data/test/unit/files_param_test.rb +1 -1
- data/test/unit/generator_generator_test.rb +1 -1
- data/test/unit/generator_test.rb +1 -1
- data/test/unit/library_generator_test.rb +1 -1
- data/test/unit/library_test.rb +1 -1
- data/test/unit/osx_system_test.rb +1 -1
- data/test/unit/path_param_test.rb +1 -1
- data/test/unit/paths_param_test.rb +1 -1
- data/test/unit/platform_test.rb +1 -1
- data/test/unit/process_runner_test.rb +1 -1
- data/test/unit/rdoc_parser_test.rb +1 -1
- data/test/unit/remote_file_loader_test.rb +1 -1
- data/test/unit/remote_file_target_test.rb +1 -1
- data/test/unit/ruby_feature_test.rb +1 -1
- data/test/unit/ruby_generator_test.rb +1 -1
- data/test/unit/specification_test.rb +8 -1
- data/test/unit/sprout_test.rb +2 -2
- data/test/unit/string_param_test.rb +1 -1
- data/test/unit/string_test.rb +1 -1
- data/test/unit/strings_param_test.rb +1 -1
- data/test/unit/test_helper.rb +33 -1
- data/test/unit/tool_generator_test.rb +1 -1
- data/test/unit/unix_system_test.rb +1 -1
- data/test/unit/user_test.rb +1 -1
- data/test/unit/vista_system_test.rb +1 -1
- data/test/unit/win_nix_system_test.rb +1 -1
- data/test/unit/win_system_test.rb +1 -1
- data/test-stderr.log +1 -0
- data/test-stdout.log +237 -0
- metadata +15 -190
- data/doc/Dir.html +0 -288
- data/doc/Rake/Task.html +0 -184
- data/doc/Sprout/ArchiveUnpacker.html +0 -1246
- data/doc/Sprout/Base/ClassMethods.html +0 -434
- data/doc/Sprout/Base.html +0 -126
- data/doc/Sprout/Concern.html +0 -353
- data/doc/Sprout/Daemon/ClassMethods.html +0 -244
- data/doc/Sprout/Daemon/InstanceMethods.html +0 -601
- data/doc/Sprout/Daemon.html +0 -166
- data/doc/Sprout/Errors/ArchiveUnpackerError.html +0 -125
- data/doc/Sprout/Errors/DestinationExistsError.html +0 -133
- data/doc/Sprout/Errors/DuplicateMemberError.html +0 -132
- data/doc/Sprout/Errors/ExecutableError.html +0 -125
- data/doc/Sprout/Errors/ExecutableRegistrationError.html +0 -132
- data/doc/Sprout/Errors/ExecutionError.html +0 -121
- data/doc/Sprout/Errors/GeneratorError.html +0 -125
- data/doc/Sprout/Errors/InvalidArgumentError.html +0 -132
- data/doc/Sprout/Errors/LoadError.html +0 -121
- data/doc/Sprout/Errors/MissingArgumentError.html +0 -132
- data/doc/Sprout/Errors/MissingExecutableError.html +0 -132
- data/doc/Sprout/Errors/MissingGeneratorError.html +0 -132
- data/doc/Sprout/Errors/MissingTemplateError.html +0 -132
- data/doc/Sprout/Errors/ProcessRunnerError.html +0 -121
- data/doc/Sprout/Errors/RemoteFileLoaderError.html +0 -110
- data/doc/Sprout/Errors/SproutError.html +0 -114
- data/doc/Sprout/Errors/UnknownArchiveType.html +0 -122
- data/doc/Sprout/Errors/UsageError.html +0 -121
- data/doc/Sprout/Errors/ValidationError.html +0 -121
- data/doc/Sprout/Errors/VersionRequirementNotMetError.html +0 -121
- data/doc/Sprout/Errors.html +0 -101
- data/doc/Sprout/Executable/Boolean.html +0 -483
- data/doc/Sprout/Executable/ClassMethods.html +0 -417
- data/doc/Sprout/Executable/CollectionParam.html +0 -483
- data/doc/Sprout/Executable/FileParam.html +0 -484
- data/doc/Sprout/Executable/Files.html +0 -292
- data/doc/Sprout/Executable/InstanceMethods.html +0 -2006
- data/doc/Sprout/Executable/Number.html +0 -141
- data/doc/Sprout/Executable/Param.html +0 -2818
- data/doc/Sprout/Executable/ParameterFactory.html +0 -232
- data/doc/Sprout/Executable/Path.html +0 -223
- data/doc/Sprout/Executable/Paths.html +0 -253
- data/doc/Sprout/Executable/StringParam.html +0 -213
- data/doc/Sprout/Executable/Strings.html +0 -167
- data/doc/Sprout/Executable/Url.html +0 -160
- data/doc/Sprout/Executable/Urls.html +0 -170
- data/doc/Sprout/Executable.html +0 -173
- data/doc/Sprout/FileTarget.html +0 -1109
- data/doc/Sprout/Generator/Base.html +0 -1626
- data/doc/Sprout/Generator/Command.html +0 -690
- data/doc/Sprout/Generator/DirectoryManifest.html +0 -476
- data/doc/Sprout/Generator/FileManifest.html +0 -572
- data/doc/Sprout/Generator/Manifest.html +0 -377
- data/doc/Sprout/Generator/TemplateManifest.html +0 -196
- data/doc/Sprout/Generator.html +0 -689
- data/doc/Sprout/GeneratorGenerator.html +0 -1018
- data/doc/Sprout/Library.html +0 -1141
- data/doc/Sprout/LibraryGenerator.html +0 -309
- data/doc/Sprout/Log.html +0 -496
- data/doc/Sprout/MXMLC.html +0 -6373
- data/doc/Sprout/Platform.html +0 -714
- data/doc/Sprout/ProcessRunner.html +0 -1352
- data/doc/Sprout/ProgressBar.html +0 -376
- data/doc/Sprout/ProgressBarImpl.html +0 -2119
- data/doc/Sprout/ProgressBarManager.html +0 -434
- data/doc/Sprout/ProgressBarOutputStream.html +0 -416
- data/doc/Sprout/RDocParser.html +0 -211
- data/doc/Sprout/RemoteFileLoader.html +0 -172
- data/doc/Sprout/RemoteFileTarget.html +0 -679
- data/doc/Sprout/ReversedProgressBar.html +0 -194
- data/doc/Sprout/RubyFeature/ClassMethods.html +0 -1065
- data/doc/Sprout/RubyFeature.html +0 -155
- data/doc/Sprout/RubyGenerator.html +0 -764
- data/doc/Sprout/Specification.html +0 -767
- data/doc/Sprout/System/BaseSystem.html +0 -1455
- data/doc/Sprout/System/JavaSystem.html +0 -122
- data/doc/Sprout/System/OSXSystem.html +0 -335
- data/doc/Sprout/System/ThreadMock.html +0 -193
- data/doc/Sprout/System/UnixSystem.html +0 -584
- data/doc/Sprout/System/VistaSystem.html +0 -251
- data/doc/Sprout/System/WinNixSystem.html +0 -325
- data/doc/Sprout/System/WinSystem.html +0 -571
- data/doc/Sprout/System.html +0 -191
- data/doc/Sprout/ToolGenerator.html +0 -931
- data/doc/Sprout/VERSION.html +0 -128
- data/doc/Sprout.html +0 -144
- data/doc/SproutTestCase.html +0 -1412
- data/doc/String.html +0 -286
- data/doc/_index.html +0 -1035
- data/doc/class_list.html +0 -36
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -53
- data/doc/css/style.css +0 -310
- data/doc/file.README.html +0 -96
- data/doc/file.archive_unpacker.html +0 -288
- data/doc/file.base.html +0 -208
- data/doc/file.base_system.html +0 -278
- data/doc/file.boolean.html +0 -135
- data/doc/file.collection_param.html +0 -139
- data/doc/file.command.html +0 -126
- data/doc/file.concern.html +0 -136
- data/doc/file.daemon.html +0 -309
- data/doc/file.dir.html +0 -76
- data/doc/file.directory_manifest.html +0 -122
- data/doc/file.errors.html +0 -147
- data/doc/file.executable.html +0 -638
- data/doc/file.file_manifest.html +0 -109
- data/doc/file.file_param.html +0 -120
- data/doc/file.file_target.html +0 -140
- data/doc/file.files.html +0 -85
- data/doc/file.generator.html +0 -296
- data/doc/file.generator_class.html +0 -72
- data/doc/file.generator_generator.html +0 -137
- data/doc/file.generator_test.html +0 -92
- data/doc/file.generator_test_helper.html +0 -67
- data/doc/file.java_system.html +0 -62
- data/doc/file.library.html +0 -291
- data/doc/file.library_generator.html +0 -74
- data/doc/file.log.html +0 -100
- data/doc/file.manifest.html +0 -67
- data/doc/file.mxmlc.html +0 -740
- data/doc/file.number.html +0 -67
- data/doc/file.osx_system.html +0 -79
- data/doc/file.param.html +0 -491
- data/doc/file.parameter_factory.html +0 -119
- data/doc/file.path.html +0 -81
- data/doc/file.paths.html +0 -80
- data/doc/file.platform.html +0 -124
- data/doc/file.process_runner.html +0 -224
- data/doc/file.progress_bar.html +0 -390
- data/doc/file.rdoc_parser.html +0 -145
- data/doc/file.remote_file_loader.html +0 -117
- data/doc/file.remote_file_target.html +0 -176
- data/doc/file.ruby_base.html +0 -64
- data/doc/file.ruby_feature.html +0 -244
- data/doc/file.ruby_generator.html +0 -118
- data/doc/file.ruby_input.html +0 -62
- data/doc/file.ruby_test_case.html +0 -78
- data/doc/file.ruby_test_helper.html +0 -61
- data/doc/file.specification.html +0 -248
- data/doc/file.sprout.html +0 -64
- data/doc/file.sprout_test_case.html +0 -280
- data/doc/file.string.html +0 -72
- data/doc/file.string_param.html +0 -76
- data/doc/file.strings.html +0 -71
- data/doc/file.system.html +0 -86
- data/doc/file.template_manifest.html +0 -67
- data/doc/file.tool.html +0 -92
- data/doc/file.tool_generator.html +0 -90
- data/doc/file.unix_system.html +0 -128
- data/doc/file.url.html +0 -71
- data/doc/file.urls.html +0 -70
- data/doc/file.version.html +0 -71
- data/doc/file.vista_system.html +0 -69
- data/doc/file.win_nix_system.html +0 -88
- data/doc/file.win_system.html +0 -129
- data/doc/file_list.html +0 -230
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -96
- data/doc/js/app.js +0 -202
- data/doc/js/full_list.js +0 -149
- data/doc/js/jquery.js +0 -154
- data/doc/method_list.html +0 -3355
- data/doc/top-level-namespace.html +0 -192
- data/lib/sprout/base.rb +0 -121
- data/lib/sprout/log.rb +0 -46
- data/test/unit/sprout_test_helper.rb +0 -33
data/doc/file.executable.html
DELETED
@@ -1,638 +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>File: executable</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" title="Index">Index</a> »
|
27
|
-
<span class="title">File: executable</span>
|
28
|
-
|
29
|
-
|
30
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
31
|
-
</div>
|
32
|
-
|
33
|
-
<div id="search">
|
34
|
-
<a id="class_list_link" href="#">Class List</a>
|
35
|
-
<a id="method_list_link" href="#">Method List</a>
|
36
|
-
<a id ="file_list_link" href="#">File List</a>
|
37
|
-
</div>
|
38
|
-
|
39
|
-
<div class="clear"></div>
|
40
|
-
</div>
|
41
|
-
|
42
|
-
<iframe id="search_frame"></iframe>
|
43
|
-
|
44
|
-
<div id="content"><div id='filecontents'>
|
45
|
-
<p>require ‘sprout/executable/param’ require
|
46
|
-
‘sprout/executable/collection_param’ require ‘sprout/executable/boolean’
|
47
|
-
require ‘sprout/executable/number’ require ‘sprout/executable/string_param’
|
48
|
-
require ‘sprout/executable/strings’ require ‘sprout/executable/file_param’
|
49
|
-
require ‘sprout/executable/files’ require ‘sprout/executable/path’ require
|
50
|
-
‘sprout/executable/paths’ require ‘sprout/executable/url’ require
|
51
|
-
‘sprout/executable/urls’ require ‘sprout/executable/parameter_factory’
|
52
|
-
require ‘rake/clean’</p>
|
53
|
-
|
54
|
-
<p>module Sprout</p>
|
55
|
-
|
56
|
-
<pre class="code"><span class='comment'>##
|
57
|
-
</span><span class='comment'># The Sprout::Executable module exposes a Domain Specific Language
|
58
|
-
</span><span class='comment'># for describing Command Line Interface (CLI) applications.
|
59
|
-
</span><span class='comment'>#
|
60
|
-
</span><span class='comment'># This module can be included by any class, and depending on how that class
|
61
|
-
</span><span class='comment'># is used, one can either parse command line arguments into meaningful,
|
62
|
-
</span><span class='comment'># structured data, or delegate ruby code and configuration to an existing,
|
63
|
-
</span><span class='comment'># external command line process.
|
64
|
-
</span><span class='comment'>#
|
65
|
-
</span><span class='comment'># Following is an example of how one could define an executable Ruby
|
66
|
-
</span><span class='comment'># application using this module:
|
67
|
-
</span><span class='comment'>#
|
68
|
-
</span><span class='comment'># :include: ../../test/fixtures/examples/echo_inputs.rb
|
69
|
-
</span><span class='comment'>#
|
70
|
-
</span><span class='kw'>module</span> <span class='const'>Executable</span>
|
71
|
-
<span class='id include'>include</span> <span class='const'>RubyFeature</span>
|
72
|
-
|
73
|
-
<span class='const'>DEFAULT_FILE_EXPRESSION</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/**/**/*</span><span class='tstring_end'>'</span></span>
|
74
|
-
<span class='const'>DEFAULT_PREFIX</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--</span><span class='tstring_end'>'</span></span>
|
75
|
-
<span class='const'>DEFAULT_SHORT_PREFIX</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>-</span><span class='tstring_end'>'</span></span>
|
76
|
-
|
77
|
-
<span class='id extend'>extend</span> <span class='const'>Concern</span>
|
78
|
-
|
79
|
-
<span class='kw'>module</span> <span class='const'>ClassMethods</span>
|
80
|
-
<span class='comment'>##
|
81
|
-
</span> <span class='comment'># +add_param+ is the workhorse of the Task.
|
82
|
-
</span> <span class='comment'># This method is used to add new shell parameters to the executable interface.
|
83
|
-
</span> <span class='comment'>#
|
84
|
-
</span> <span class='comment'># +name+ is a symbol or string that represents the parameter that you would like to add
|
85
|
-
</span> <span class='comment'># such as :debug or :source_path.
|
86
|
-
</span> <span class='comment'>#
|
87
|
-
</span> <span class='comment'># +type+ is a class reference of the Executable::Param that you'd like to use.
|
88
|
-
</span> <span class='comment'># At the time of this writing, add_param will accept 2 class references that
|
89
|
-
</span> <span class='comment'># do not extend Param - String and File. The ParameterFactory will automatically
|
90
|
-
</span> <span class='comment'># resolve these to the correct data type when they are created.
|
91
|
-
</span> <span class='comment'>#
|
92
|
-
</span> <span class='comment'># Boolean true or false
|
93
|
-
</span> <span class='comment'># File Path to a file
|
94
|
-
</span> <span class='comment'># Number Any number
|
95
|
-
</span> <span class='comment'># Path Path to a directory
|
96
|
-
</span> <span class='comment'># String Any string value
|
97
|
-
</span> <span class='comment'># Url Basic URL
|
98
|
-
</span> <span class='comment'>#
|
99
|
-
</span> <span class='comment'># Files Collection of files
|
100
|
-
</span> <span class='comment'># Paths Collection of directories
|
101
|
-
</span> <span class='comment'># Strings Collection of arbitrary strings
|
102
|
-
</span> <span class='comment'># Urls Collection of URLs
|
103
|
-
</span> <span class='comment'>#
|
104
|
-
</span> <span class='comment'># Be sure to check out the Sprout::Executable::Param class to learn more about
|
105
|
-
</span> <span class='comment'># working with executable parameters.
|
106
|
-
</span> <span class='comment'>#
|
107
|
-
</span> <span class='comment'># Once parameters have been added using the +add_param+ method, clients
|
108
|
-
</span> <span class='comment'># can set and get those parameters from any newly created executable instance,
|
109
|
-
</span> <span class='comment'># or from the command line.
|
110
|
-
</span> <span class='comment'>#
|
111
|
-
</span> <span class='comment'># In the case of an executable delegate, parameter values will be sent to the
|
112
|
-
</span> <span class='comment'># command line executable in the order they are added using +add_param+.
|
113
|
-
</span> <span class='comment'>#
|
114
|
-
</span> <span class='comment'># In the case of a Ruby executable, command line parameters will be interpreted
|
115
|
-
</span> <span class='comment'># in the order they are defined using +add_param+.
|
116
|
-
</span> <span class='comment'>#
|
117
|
-
</span> <span class='kw'>def</span> <span class='id add_param'>add_param</span><span class='lparen'>(</span><span class='id name'>name</span><span class='comma'>,</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><span class='rparen'>)</span> <span class='comment'># :yields: Sprout::Executable::Param
|
118
|
-
</span> <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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[DEPRECATED] add_param no longer uses closures, you can provide the same values as a hash in the optional last argument.</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
119
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The first parameter (name:SymbolOrString) is required</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id name'>name</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
120
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The second parameter (type:Class) is required</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id type'>type</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
121
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The type parameter must be a Class by reference</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='op'>!</span><span class='id type'>type</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Class</span><span class='rparen'>)</span>
|
122
|
-
|
123
|
-
<span class='id options'>options</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
124
|
-
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id name'>name</span>
|
125
|
-
<span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id type'>type</span>
|
126
|
-
<span class='comment'># TODO: Integrate the RDOC-parsed parameter description here:
|
127
|
-
</span> <span class='comment'>#options[:description] ||= Sprout::RDocParser.description_for_caller caller.shift
|
128
|
-
</span>
|
129
|
-
<span class='id create_param_accessors'>create_param_accessors</span> <span class='id options'>options</span>
|
130
|
-
<span class='id static_parameter_collection'>static_parameter_collection</span> <span class='op'><<</span> <span class='id options'>options</span>
|
131
|
-
<span class='id options'>options</span>
|
132
|
-
<span class='kw'>end</span>
|
133
|
-
|
134
|
-
<span class='kw'>def</span> <span class='id add_param_alias'>add_param_alias</span> <span class='id new_name'>new_name</span><span class='comma'>,</span> <span class='id old_name'>old_name</span>
|
135
|
-
<span class='id create_param_accessors'>create_param_accessors</span> <span class='symbol'>:name</span> <span class='op'>=></span> <span class='id new_name'>new_name</span><span class='comma'>,</span> <span class='symbol'>:real_name</span> <span class='op'>=></span> <span class='id old_name'>old_name</span>
|
136
|
-
<span class='kw'>end</span>
|
137
|
-
|
138
|
-
<span class='kw'>def</span> <span class='id static_parameter_collection'>static_parameter_collection</span>
|
139
|
-
<span class='ivar'>@static_parameter_collection</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
140
|
-
<span class='kw'>end</span>
|
141
|
-
|
142
|
-
<span class='kw'>def</span> <span class='id static_default_value_collection'>static_default_value_collection</span>
|
143
|
-
<span class='ivar'>@static_default_value_collection</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
144
|
-
<span class='kw'>end</span>
|
145
|
-
|
146
|
-
<span class='kw'>def</span> <span class='id set'>set</span> <span class='id key'>key</span><span class='comma'>,</span> <span class='id value'>value</span>
|
147
|
-
<span class='id set_default_value'>set_default_value</span> <span class='id key'>key</span><span class='comma'>,</span> <span class='id value'>value</span>
|
148
|
-
<span class='kw'>end</span>
|
149
|
-
|
150
|
-
<span class='id private'>private</span>
|
151
|
-
|
152
|
-
<span class='kw'>def</span> <span class='id accessor_can_be_defined_at'>accessor_can_be_defined_at</span> <span class='id name'>name</span>
|
153
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id instance_defines?'>instance_defines?</span> <span class='id name'>name</span><span class='rparen'>)</span>
|
154
|
-
<span class='id message'>message</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>add_param called with a name that is already in use (</span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>=) on (</span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
155
|
-
<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'>DuplicateMemberError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='id message'>message</span><span class='rparen'>)</span>
|
156
|
-
<span class='kw'>end</span>
|
157
|
-
<span class='kw'>end</span>
|
158
|
-
|
159
|
-
<span class='kw'>def</span> <span class='id create_param_accessors'>create_param_accessors</span> <span class='id options'>options</span>
|
160
|
-
<span class='id name'>name</span> <span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span>
|
161
|
-
<span class='id real_name'>real_name</span> <span class='op'>=</span> <span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:real_name</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id name'>name</span>
|
162
|
-
<span class='id accessor_can_be_defined_at'>accessor_can_be_defined_at</span> <span class='id name'>name</span>
|
163
|
-
|
164
|
-
<span class='comment'># define the writer:
|
165
|
-
</span> <span class='id define_method'>define_method</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id value'>value</span><span class='op'>|</span>
|
166
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='op'>!</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:writer</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span><span class='rparen'>)</span>
|
167
|
-
<span class='id value'>value</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:writer</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id value'>value</span><span class='rparen'>)</span>
|
168
|
-
<span class='kw'>end</span>
|
169
|
-
<span class='id param_hash'>param_hash</span><span class='lbracket'>[</span><span class='id real_name'>real_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id value'>value</span> <span class='op'>=</span> <span class='id value'>value</span>
|
170
|
-
<span class='id instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id value'>value</span><span class='rparen'>)</span>
|
171
|
-
<span class='kw'>end</span>
|
172
|
-
|
173
|
-
<span class='comment'># define the reader:
|
174
|
-
</span> <span class='id define_method'>define_method</span><span class='lparen'>(</span><span class='id name'>name</span><span class='rparen'>)</span> <span class='kw'>do</span>
|
175
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:reader</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span><span class='rparen'>)</span>
|
176
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id param_hash'>param_hash</span><span class='lbracket'>[</span><span class='id real_name'>real_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id nil?'>nil?</span><span class='rparen'>)</span>
|
177
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unable to use requested parameter (</span><span class='embexpr_beg'>#{</span><span class='id real_name'>real_name</span><span class='rbrace'>}</span><span class='tstring_content'>) try adding it using:\n\n add_param :</span><span class='embexpr_beg'>#{</span><span class='id real_name'>real_name</span><span class='rbrace'>}</span><span class='tstring_content'>, String\n\n</span><span class='tstring_end'>"</span></span>
|
178
|
-
<span class='kw'>end</span>
|
179
|
-
<span class='id param_hash'>param_hash</span><span class='lbracket'>[</span><span class='id real_name'>real_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id value'>value</span>
|
180
|
-
<span class='kw'>else</span>
|
181
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='id options'>options</span><span class='lbracket'>[</span><span class='symbol'>:reader</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
182
|
-
<span class='kw'>end</span>
|
183
|
-
<span class='kw'>end</span>
|
184
|
-
<span class='kw'>end</span>
|
185
|
-
|
186
|
-
<span class='kw'>def</span> <span class='id instance_defines?'>instance_defines?</span> <span class='id name'>name</span>
|
187
|
-
<span class='comment'># In Ruby 1.9.1 instance_methods are symbols,
|
188
|
-
</span> <span class='comment'># In Ruby 1.8.7 instance_methods are strings.
|
189
|
-
</span> <span class='comment'># Boo.
|
190
|
-
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id instance_methods'>instance_methods</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id name'>name</span><span class='period'>.</span><span class='id to_s'>to_s</span><span class='rparen'>)</span> <span class='op'>||</span>
|
191
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id instance_methods'>instance_methods</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id name'>name</span><span class='rparen'>)</span>
|
192
|
-
<span class='kw'>end</span>
|
193
|
-
|
194
|
-
<span class='kw'>def</span> <span class='id set_default_value'>set_default_value</span> <span class='id key'>key</span><span class='comma'>,</span> <span class='id value'>value</span>
|
195
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='op'>!</span><span class='kw'>defined?</span> <span class='id key'>key</span><span class='rparen'>)</span>
|
196
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot set default value (</span><span class='embexpr_beg'>#{</span><span class='id value'>value</span><span class='rbrace'>}</span><span class='tstring_content'>) for unknown parameter (</span><span class='embexpr_beg'>#{</span><span class='id key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
197
|
-
<span class='kw'>end</span>
|
198
|
-
<span class='id static_default_value_collection'>static_default_value_collection</span> <span class='op'><<</span> <span class='lbrace'>{</span> <span class='symbol'>:name</span> <span class='op'>=></span> <span class='id key'>key</span><span class='comma'>,</span> <span class='symbol'>:value</span> <span class='op'>=></span> <span class='id value'>value</span> <span class='rbrace'>}</span>
|
199
|
-
<span class='kw'>end</span>
|
200
|
-
<span class='kw'>end</span>
|
201
|
-
|
202
|
-
<span class='kw'>module</span> <span class='const'>InstanceMethods</span>
|
203
|
-
<span class='comment'>##
|
204
|
-
</span> <span class='comment'># The default RubyGem that we will use when requesting our executable.
|
205
|
-
</span> <span class='comment'>#
|
206
|
-
</span> <span class='comment'># Classes that include the Executable can set the default value for this property
|
207
|
-
</span> <span class='comment'># at the class level with:
|
208
|
-
</span> <span class='comment'>#
|
209
|
-
</span> <span class='comment'># set :pkg_name, 'sprout-sometoolname'
|
210
|
-
</span> <span class='comment'>#
|
211
|
-
</span> <span class='comment'># But that value can be overridden on each instance like:
|
212
|
-
</span> <span class='comment'>#
|
213
|
-
</span> <span class='comment'># executable = SomeToolTask.new
|
214
|
-
</span> <span class='comment'># executable.pkg_name = 'sprout-othertoolname'
|
215
|
-
</span> <span class='comment'>#
|
216
|
-
</span> <span class='comment'># This parameter is required - either from the including class or instance
|
217
|
-
</span> <span class='comment'># configuration.
|
218
|
-
</span> <span class='comment'>#
|
219
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:pkg_name</span>
|
220
|
-
|
221
|
-
<span class='comment'>##
|
222
|
-
</span> <span class='comment'># The default RubyGem version that we will use when requesting our executable.
|
223
|
-
</span> <span class='comment'>#
|
224
|
-
</span> <span class='comment'># Classes that include the Task can set the default value for this property
|
225
|
-
</span> <span class='comment'># at the class level with:
|
226
|
-
</span> <span class='comment'>#
|
227
|
-
</span> <span class='comment'># set :pkg_version, '>= 1.0.3'
|
228
|
-
</span> <span class='comment'>#
|
229
|
-
</span> <span class='comment'># But that value can be overriden on each instance like:
|
230
|
-
</span> <span class='comment'>#
|
231
|
-
</span> <span class='comment'># executable = SomeToolTask.new
|
232
|
-
</span> <span class='comment'># too.pkg_version = '>= 2.0.0'
|
233
|
-
</span> <span class='comment'>#
|
234
|
-
</span> <span class='comment'># This parameter is required - either from the including class or instance
|
235
|
-
</span> <span class='comment'># configuration.
|
236
|
-
</span> <span class='comment'>#
|
237
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:pkg_version</span>
|
238
|
-
|
239
|
-
<span class='comment'>##
|
240
|
-
</span> <span class='comment'># The default command line prefix that should be used in front of parameter
|
241
|
-
</span> <span class='comment'># names.
|
242
|
-
</span> <span class='comment'>#
|
243
|
-
</span> <span class='comment'># The default value for this parameter is '--', but some command line
|
244
|
-
</span> <span class='comment'># applications (like MXMLC) prefer '-'.
|
245
|
-
</span> <span class='comment'>#
|
246
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:default_prefix</span>
|
247
|
-
|
248
|
-
<span class='comment'>##
|
249
|
-
</span> <span class='comment'># The default command line prefix for short name parameters.
|
250
|
-
</span> <span class='comment'>#
|
251
|
-
</span> <span class='comment'># This value defaults to '-', but can be changed to whatever a particular
|
252
|
-
</span> <span class='comment'># tool prefers.
|
253
|
-
</span> <span class='comment'>#
|
254
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:default_short_prefix</span>
|
255
|
-
|
256
|
-
<span class='comment'>##
|
257
|
-
</span> <span class='comment'># The default Sprout executable that we will use for this executable.
|
258
|
-
</span> <span class='comment'>#
|
259
|
-
</span> <span class='comment'># Classes that include the Task can set the default value for this property
|
260
|
-
</span> <span class='comment'># at the class level with:
|
261
|
-
</span> <span class='comment'>#
|
262
|
-
</span> <span class='comment'># set :executable, :mxmlc
|
263
|
-
</span> <span class='comment'>#
|
264
|
-
</span> <span class='comment'># But that value can be overriden on each instance like:
|
265
|
-
</span> <span class='comment'>#
|
266
|
-
</span> <span class='comment'># executable = SomeToolTask.new
|
267
|
-
</span> <span class='comment'># too.executable :compc
|
268
|
-
</span> <span class='comment'>#
|
269
|
-
</span> <span class='comment'># This parameter is required - either from the including class or instance
|
270
|
-
</span> <span class='comment'># configuration.
|
271
|
-
</span> <span class='comment'>#
|
272
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:executable</span>
|
273
|
-
|
274
|
-
<span class='comment'>##
|
275
|
-
</span> <span class='comment'># Configure the executable instance to output failure messages to
|
276
|
-
</span> <span class='comment'># stderr and abort with non-zero response.
|
277
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:abort_on_failure</span>
|
278
|
-
|
279
|
-
<span class='comment'>##
|
280
|
-
</span> <span class='comment'># If the executable is configured as a Rake::Task, it will extract the
|
281
|
-
</span> <span class='comment'># Rake::Task[:name] property and apply it to this field.
|
282
|
-
</span> <span class='comment'>#
|
283
|
-
</span> <span class='comment'># Concrete parameters can pull this value from their +belongs_to+
|
284
|
-
</span> <span class='comment'># parameter.
|
285
|
-
</span> <span class='id attr_accessor'>attr_accessor</span> <span class='symbol'>:rake_task_name</span>
|
286
|
-
|
287
|
-
<span class='id attr_reader'>attr_reader</span> <span class='symbol'>:param_hash</span>
|
288
|
-
<span class='id attr_reader'>attr_reader</span> <span class='symbol'>:params</span>
|
289
|
-
<span class='id attr_reader'>attr_reader</span> <span class='symbol'>:prerequisites</span>
|
290
|
-
|
291
|
-
<span class='kw'>def</span> <span class='id initialize'>initialize</span>
|
292
|
-
<span class='kw'>super</span>
|
293
|
-
<span class='ivar'>@abort_on_failure</span> <span class='op'>=</span> <span class='kw'>true</span>
|
294
|
-
<span class='ivar'>@appended_args</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
295
|
-
<span class='ivar'>@prepended_args</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
296
|
-
<span class='ivar'>@param_hash</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
297
|
-
<span class='ivar'>@params</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
298
|
-
<span class='ivar'>@prerequisites</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
299
|
-
<span class='ivar'>@option_parser</span> <span class='op'>=</span> <span class='const'>OptionParser</span><span class='period'>.</span><span class='id new'>new</span>
|
300
|
-
<span class='ivar'>@default_prefix</span> <span class='op'>=</span> <span class='const'>DEFAULT_PREFIX</span>
|
301
|
-
<span class='ivar'>@default_short_prefix</span> <span class='op'>=</span> <span class='const'>DEFAULT_SHORT_PREFIX</span>
|
302
|
-
<span class='id initialize_defaults'>initialize_defaults</span>
|
303
|
-
<span class='id initialize_parameters'>initialize_parameters</span>
|
304
|
-
<span class='kw'>end</span>
|
305
|
-
|
306
|
-
<span class='kw'>def</span> <span class='id parse!'>parse!</span> <span class='id commandline_options'>commandline_options</span>
|
307
|
-
<span class='kw'>begin</span>
|
308
|
-
<span class='id option_parser'>option_parser</span><span class='period'>.</span><span class='id parse!'>parse!</span> <span class='id commandline_options'>commandline_options</span>
|
309
|
-
<span class='id parse_extra_options!'>parse_extra_options!</span> <span class='id commandline_options'>commandline_options</span>
|
310
|
-
<span class='id validate'>validate</span> <span class='kw'>unless</span> <span class='id help_requested?'>help_requested?</span> <span class='id commandline_options'>commandline_options</span>
|
311
|
-
<span class='kw'>rescue</span> <span class='const'>StandardError</span> <span class='op'>=></span> <span class='id e'>e</span>
|
312
|
-
<span class='id handle_parse_error'>handle_parse_error</span> <span class='id e'>e</span>
|
313
|
-
<span class='kw'>end</span>
|
314
|
-
<span class='kw'>end</span>
|
315
|
-
|
316
|
-
<span class='comment'>##
|
317
|
-
</span> <span class='comment'># Execute the feature after calling parse
|
318
|
-
</span> <span class='comment'># with command line arguments.
|
319
|
-
</span> <span class='comment'>#
|
320
|
-
</span> <span class='comment'># Subclasses will generally override this method
|
321
|
-
</span> <span class='comment'># if they are a Ruby executable, but if you're
|
322
|
-
</span> <span class='comment'># just delegating to an external CLI application,
|
323
|
-
</span> <span class='comment'># calling execute will wind up executing the
|
324
|
-
</span> <span class='comment'># external process.
|
325
|
-
</span> <span class='kw'>def</span> <span class='id execute'>execute</span>
|
326
|
-
<span class='id execute_delegate'>execute_delegate</span>
|
327
|
-
<span class='kw'>end</span>
|
328
|
-
|
329
|
-
<span class='comment'>##
|
330
|
-
</span> <span class='comment'># Call the provided executable delegate.
|
331
|
-
</span> <span class='comment'>#
|
332
|
-
</span> <span class='comment'># This method is generally called from Rake task wrappers.
|
333
|
-
</span> <span class='comment'>#
|
334
|
-
</span> <span class='kw'>def</span> <span class='id execute_delegate'>execute_delegate</span>
|
335
|
-
<span class='id system_execute'>system_execute</span> <span class='id binary_path'>binary_path</span><span class='comma'>,</span> <span class='id to_shell'>to_shell</span>
|
336
|
-
<span class='kw'>end</span>
|
337
|
-
|
338
|
-
<span class='kw'>def</span> <span class='id prepare'>prepare</span>
|
339
|
-
<span class='id params'>params</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id param'>param</span><span class='op'>|</span>
|
340
|
-
<span class='id param'>param</span><span class='period'>.</span><span class='id prepare'>prepare</span>
|
341
|
-
<span class='kw'>end</span>
|
342
|
-
<span class='kw'>end</span>
|
343
|
-
|
344
|
-
<span class='kw'>def</span> <span class='id to_rake'>to_rake</span> <span class='op'>*</span><span class='id args'>args</span>
|
345
|
-
<span class='comment'># Define the file task first - so that
|
346
|
-
</span> <span class='comment'># desc blocks hook up to it...
|
347
|
-
</span> <span class='id outer_task'>outer_task</span> <span class='op'>=</span> <span class='id create_outer_task'>create_outer_task</span> <span class='op'>*</span><span class='id args'>args</span>
|
348
|
-
<span class='id update_rake_task_name_from_args'>update_rake_task_name_from_args</span> <span class='op'>*</span><span class='id args'>args</span>
|
349
|
-
<span class='kw'>yield</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id block_given?'>block_given?</span>
|
350
|
-
<span class='id prepare'>prepare</span>
|
351
|
-
|
352
|
-
<span class='comment'># TODO: Tried auto-updating with library
|
353
|
-
</span> <span class='comment'># prerequisites, but this led to strange
|
354
|
-
</span> <span class='comment'># behavior with multiple registrations.
|
355
|
-
</span> <span class='id handle_library_prerequisites'>handle_library_prerequisites</span> <span class='id outer_task'>outer_task</span><span class='period'>.</span><span class='id prerequisites'>prerequisites</span>
|
356
|
-
|
357
|
-
<span class='comment'># Add the library resolution rake task
|
358
|
-
</span> <span class='comment'># as a prerequisite
|
359
|
-
</span> <span class='id outer_task'>outer_task</span><span class='period'>.</span><span class='id prerequisites'>prerequisites</span> <span class='op'><<</span> <span class='id task'>task</span><span class='lparen'>(</span><span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Library</span><span class='op'>::</span><span class='const'>TASK_NAME</span><span class='rparen'>)</span>
|
360
|
-
<span class='id prerequisites'>prerequisites</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id prereq'>prereq</span><span class='op'>|</span>
|
361
|
-
<span class='id outer_task'>outer_task</span><span class='period'>.</span><span class='id prerequisites'>prerequisites</span> <span class='op'><<</span> <span class='id prereq'>prereq</span>
|
362
|
-
<span class='kw'>end</span>
|
363
|
-
<span class='id outer_task'>outer_task</span>
|
364
|
-
<span class='kw'>end</span>
|
365
|
-
|
366
|
-
<span class='comment'>##
|
367
|
-
</span> <span class='comment'># This will create a hash of ONLY values that are created
|
368
|
-
</span> <span class='comment'># using +add_param+, properties that are created with
|
369
|
-
</span> <span class='comment'># attr_accessor must be handled manually, or patches are welcome!
|
370
|
-
</span> <span class='kw'>def</span> <span class='id to_hash'>to_hash</span>
|
371
|
-
<span class='id result'>result</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
372
|
-
<span class='id params'>params</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id param'>param</span><span class='op'>|</span>
|
373
|
-
<span class='id result'>result</span><span class='lbracket'>[</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='rparen'>)</span>
|
374
|
-
<span class='kw'>end</span>
|
375
|
-
<span class='id result'>result</span>
|
376
|
-
<span class='kw'>end</span>
|
377
|
-
|
378
|
-
<span class='comment'>##
|
379
|
-
</span> <span class='comment'># This will ignore unknown parameters, because our very
|
380
|
-
</span> <span class='comment'># first use case, is when generators call other generators
|
381
|
-
</span> <span class='comment'># and generator A might have different parameters than
|
382
|
-
</span> <span class='comment'># generator B.
|
383
|
-
</span> <span class='kw'>def</span> <span class='id from_hash'>from_hash</span> <span class='id hash'>hash</span>
|
384
|
-
<span class='id hash'>hash</span><span class='period'>.</span><span class='id each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id key'>key</span><span class='comma'>,</span> <span class='id value'>value</span><span class='op'>|</span>
|
385
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id key'>key</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
386
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id value'>value</span>
|
387
|
-
<span class='kw'>end</span>
|
388
|
-
<span class='kw'>end</span>
|
389
|
-
<span class='kw'>end</span>
|
390
|
-
|
391
|
-
<span class='kw'>def</span> <span class='id to_help'>to_help</span>
|
392
|
-
<span class='id option_parser'>option_parser</span><span class='period'>.</span><span class='id to_s'>to_s</span>
|
393
|
-
<span class='kw'>end</span>
|
394
|
-
|
395
|
-
<span class='comment'># Create a string that represents this configured executable for shell execution
|
396
|
-
</span> <span class='kw'>def</span> <span class='id to_shell'>to_shell</span>
|
397
|
-
<span class='kw'>return</span> <span class='ivar'>@to_shell_proc</span><span class='period'>.</span><span class='id call'>call</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@to_shell_proc</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
398
|
-
|
399
|
-
<span class='id result'>result</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
400
|
-
<span class='id result'>result</span> <span class='op'><<</span> <span class='ivar'>@prepended_args</span> <span class='kw'>unless</span> <span class='ivar'>@prepended_args</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
401
|
-
<span class='id params'>params</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id param'>param</span><span class='op'>|</span>
|
402
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id param'>param</span><span class='period'>.</span><span class='id visible?'>visible?</span><span class='rparen'>)</span>
|
403
|
-
<span class='id result'>result</span> <span class='op'><<</span> <span class='id param'>param</span><span class='period'>.</span><span class='id to_shell'>to_shell</span>
|
404
|
-
<span class='kw'>end</span>
|
405
|
-
<span class='kw'>end</span>
|
406
|
-
<span class='id result'>result</span> <span class='op'><<</span> <span class='ivar'>@appended_args</span> <span class='kw'>unless</span> <span class='ivar'>@appended_args</span><span class='period'>.</span><span class='id nil?'>nil?</span>
|
407
|
-
<span class='kw'>return</span> <span class='id result'>result</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'> </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
408
|
-
<span class='kw'>end</span>
|
409
|
-
|
410
|
-
<span class='comment'>##
|
411
|
-
</span> <span class='comment'># Called by Parameters like :path and :paths
|
412
|
-
</span> <span class='comment'>#
|
413
|
-
</span> <span class='kw'>def</span> <span class='id default_file_expression'>default_file_expression</span>
|
414
|
-
<span class='ivar'>@default_file_expression</span> <span class='op'>||=</span> <span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Executable</span><span class='op'>::</span><span class='const'>DEFAULT_FILE_EXPRESSION</span>
|
415
|
-
<span class='kw'>end</span>
|
416
|
-
|
417
|
-
<span class='id protected'>protected</span>
|
418
|
-
|
419
|
-
<span class='comment'>##
|
420
|
-
</span> <span class='comment'># Create the outer rake task.
|
421
|
-
</span> <span class='comment'># For most executables, this will be a Rake::File task,
|
422
|
-
</span> <span class='comment'># This is a template method that should be overridden
|
423
|
-
</span> <span class='comment'># for executables that do not result in the creation of
|
424
|
-
</span> <span class='comment'># a file.
|
425
|
-
</span> <span class='comment'>#
|
426
|
-
</span> <span class='comment'># @see update_rake_task_name_from_args
|
427
|
-
</span> <span class='kw'>def</span> <span class='id create_outer_task'>create_outer_task</span> <span class='op'>*</span><span class='id args'>args</span>
|
428
|
-
<span class='id file'>file</span> <span class='op'>*</span><span class='id args'>args</span> <span class='kw'>do</span>
|
429
|
-
<span class='id execute'>execute</span>
|
430
|
-
<span class='kw'>end</span>
|
431
|
-
<span class='kw'>end</span>
|
432
|
-
|
433
|
-
<span class='comment'>##
|
434
|
-
</span> <span class='comment'># This method will add the current task to the Rake CLEAN
|
435
|
-
</span> <span class='comment'># collection.
|
436
|
-
</span> <span class='comment'>#
|
437
|
-
</span> <span class='comment'># Any Executable that does not create a Rake::File task
|
438
|
-
</span> <span class='comment'># should also override this method and prevent it from
|
439
|
-
</span> <span class='comment'># calling +CLEAN.add+.
|
440
|
-
</span> <span class='comment'>#
|
441
|
-
</span> <span class='comment'># @see create_outer_task
|
442
|
-
</span> <span class='kw'>def</span> <span class='id update_rake_task_name_from_args'>update_rake_task_name_from_args</span> <span class='op'>*</span><span class='id args'>args</span>
|
443
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id rake_task_name'>rake_task_name</span> <span class='op'>=</span> <span class='id parse_rake_task_arg'>parse_rake_task_arg</span> <span class='id args'>args</span><span class='period'>.</span><span class='id last'>last</span>
|
444
|
-
<span class='const'>CLEAN</span><span class='period'>.</span><span class='id add'>add</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id rake_task_name'>rake_task_name</span><span class='rparen'>)</span>
|
445
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id rake_task_name'>rake_task_name</span>
|
446
|
-
<span class='kw'>end</span>
|
447
|
-
|
448
|
-
<span class='kw'>def</span> <span class='id parse_rake_task_arg'>parse_rake_task_arg</span> <span class='id arg'>arg</span>
|
449
|
-
<span class='kw'>return</span> <span class='id arg'>arg</span> <span class='kw'>if</span> <span class='id arg'>arg</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id arg'>arg</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
450
|
-
<span class='id arg'>arg</span><span class='period'>.</span><span class='id each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id key'>key</span><span class='comma'>,</span> <span class='id value'>value</span><span class='op'>|</span>
|
451
|
-
<span class='kw'>return</span> <span class='id key'>key</span>
|
452
|
-
<span class='kw'>end</span>
|
453
|
-
<span class='kw'>nil</span>
|
454
|
-
<span class='kw'>end</span>
|
455
|
-
|
456
|
-
<span class='kw'>def</span> <span class='id parse_extra_options!'>parse_extra_options!</span> <span class='id options'>options</span>
|
457
|
-
<span class='id options'>options</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id value'>value</span><span class='op'>|</span>
|
458
|
-
<span class='id params'>params</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id param'>param</span><span class='op'>|</span>
|
459
|
-
<span class='kw'>if</span> <span class='id param'>param</span><span class='period'>.</span><span class='id hidden_name?'>hidden_name?</span>
|
460
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id value'>value</span>
|
461
|
-
<span class='kw'>break</span>
|
462
|
-
<span class='kw'>end</span>
|
463
|
-
<span class='kw'>end</span>
|
464
|
-
<span class='kw'>end</span>
|
465
|
-
<span class='kw'>end</span>
|
466
|
-
|
467
|
-
<span class='comment'>##
|
468
|
-
</span> <span class='comment'># This method will generally be overridden
|
469
|
-
</span> <span class='comment'># by subclasses and they can do whatever customization
|
470
|
-
</span> <span class='comment'># is necessary for a particular library type.
|
471
|
-
</span> <span class='comment'>#
|
472
|
-
</span> <span class='comment'># It's important to note that this value can be
|
473
|
-
</span> <span class='comment'># a String path to a file (or folder), or it can
|
474
|
-
</span> <span class='comment'># be an Array of paths to files (or folders).
|
475
|
-
</span> <span class='kw'>def</span> <span class='id library_added'>library_added</span> <span class='id path_or_paths'>path_or_paths</span>
|
476
|
-
<span class='kw'>end</span>
|
477
|
-
|
478
|
-
<span class='kw'>def</span> <span class='id system_execute'>system_execute</span> <span class='id binary'>binary</span><span class='comma'>,</span> <span class='id params'>params</span>
|
479
|
-
<span class='const'>Sprout</span><span class='period'>.</span><span class='id current_system'>current_system</span><span class='period'>.</span><span class='id execute'>execute</span> <span class='id binary'>binary</span><span class='comma'>,</span> <span class='id params'>params</span>
|
480
|
-
<span class='kw'>end</span>
|
481
|
-
|
482
|
-
<span class='id private'>private</span>
|
483
|
-
|
484
|
-
<span class='kw'>def</span> <span class='id binary_path'>binary_path</span>
|
485
|
-
<span class='const'>Sprout</span><span class='op'>::</span><span class='const'>Executable</span><span class='period'>.</span><span class='id load'>load</span><span class='lparen'>(</span><span class='id executable'>executable</span><span class='comma'>,</span> <span class='id pkg_name'>pkg_name</span><span class='comma'>,</span> <span class='id pkg_version'>pkg_version</span><span class='rparen'>)</span><span class='period'>.</span><span class='id path'>path</span>
|
486
|
-
<span class='kw'>end</span>
|
487
|
-
|
488
|
-
<span class='kw'>def</span> <span class='id handle_library_prerequisites'>handle_library_prerequisites</span> <span class='id items'>items</span>
|
489
|
-
<span class='id items'>items</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id task_name'>task_name</span><span class='op'>|</span>
|
490
|
-
<span class='id t'>t</span> <span class='op'>=</span> <span class='const'>Rake</span><span class='period'>.</span><span class='id application'>application</span><span class='lbracket'>[</span><span class='id task_name'>task_name</span><span class='rbracket'>]</span>
|
491
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='op'>!</span><span class='id t'>t</span><span class='period'>.</span><span class='id sprout_entity'>sprout_entity</span><span class='period'>.</span><span class='id nil?'>nil?</span><span class='rparen'>)</span>
|
492
|
-
<span class='id library_added'>library_added</span> <span class='id t'>t</span><span class='period'>.</span><span class='id sprout_entity'>sprout_entity</span><span class='period'>.</span><span class='id installed_project_path'>installed_project_path</span>
|
493
|
-
<span class='kw'>end</span>
|
494
|
-
<span class='kw'>end</span>
|
495
|
-
<span class='kw'>end</span>
|
496
|
-
|
497
|
-
<span class='kw'>def</span> <span class='id help_requested?'>help_requested?</span> <span class='id options'>options</span>
|
498
|
-
<span class='id options'>options</span><span class='period'>.</span><span class='id include?'>include?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span>
|
499
|
-
<span class='kw'>end</span>
|
500
|
-
|
501
|
-
<span class='kw'>def</span> <span class='id handle_parse_error'>handle_parse_error</span> <span class='id error'>error</span>
|
502
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id abort_on_failure'>abort_on_failure</span><span class='rparen'>)</span>
|
503
|
-
<span class='id parts'>parts</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
504
|
-
<span class='id parts'>parts</span> <span class='op'><<</span> <span class='kw'>nil</span>
|
505
|
-
<span class='id parts'>parts</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>[ERROR - </span><span class='embexpr_beg'>#{</span><span class='id error'>error</span><span class='period'>.</span><span class='id class'>class</span><span class='period'>.</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>] </span><span class='embexpr_beg'>#{</span><span class='id error'>error</span><span class='period'>.</span><span class='id message'>message</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
506
|
-
<span class='id parts'>parts</span> <span class='op'><<</span> <span class='kw'>nil</span>
|
507
|
-
<span class='id parts'>parts</span> <span class='op'><<</span> <span class='id option_parser'>option_parser</span><span class='period'>.</span><span class='id to_s'>to_s</span>
|
508
|
-
<span class='id parts'>parts</span> <span class='op'><<</span> <span class='kw'>nil</span>
|
509
|
-
<span class='id abort'>abort</span> <span class='id parts'>parts</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'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
510
|
-
<span class='kw'>else</span>
|
511
|
-
<span class='id raise'>raise</span> <span class='id error'>error</span>
|
512
|
-
<span class='kw'>end</span>
|
513
|
-
<span class='kw'>end</span>
|
514
|
-
|
515
|
-
<span class='kw'>def</span> <span class='id initialize_parameters'>initialize_parameters</span>
|
516
|
-
<span class='id add_help_param'>add_help_param</span>
|
517
|
-
<span class='id assembled_parameter_collection'>assembled_parameter_collection</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id declaration'>declaration</span><span class='op'>|</span>
|
518
|
-
<span class='id param'>param</span> <span class='op'>=</span> <span class='id initialize_parameter'>initialize_parameter</span> <span class='id declaration'>declaration</span>
|
519
|
-
<span class='id short'>short</span> <span class='op'>=</span> <span class='id param'>param</span><span class='period'>.</span><span class='id option_parser_short_name'>option_parser_short_name</span>
|
520
|
-
|
521
|
-
<span class='id option_parser'>option_parser</span><span class='period'>.</span><span class='id on'>on</span> <span class='id short'>short</span><span class='comma'>,</span>
|
522
|
-
<span class='id param'>param</span><span class='period'>.</span><span class='id option_parser_declaration'>option_parser_declaration</span><span class='comma'>,</span>
|
523
|
-
<span class='id param'>param</span><span class='period'>.</span><span class='id description'>description</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id value'>value</span><span class='op'>|</span>
|
524
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id param'>param</span><span class='period'>.</span><span class='id is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>CollectionParam</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id param'>param</span><span class='period'>.</span><span class='id delimiter'>delimiter</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>+=</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
525
|
-
<span class='id eval'>eval</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>self.</span><span class='embexpr_beg'>#{</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> << '</span><span class='embexpr_beg'>#{</span><span class='id value'>value</span><span class='rbrace'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
526
|
-
<span class='kw'>else</span>
|
527
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id value'>value</span>
|
528
|
-
<span class='kw'>end</span>
|
529
|
-
<span class='kw'>end</span>
|
530
|
-
<span class='kw'>end</span>
|
531
|
-
<span class='kw'>end</span>
|
532
|
-
|
533
|
-
<span class='kw'>def</span> <span class='id initialize_defaults'>initialize_defaults</span>
|
534
|
-
<span class='id assembled_default_parameter_collection'>assembled_default_parameter_collection</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 option'>option</span><span class='op'>|</span>
|
535
|
-
<span class='comment'>#puts ">> updating default on: #{self} for: #{option[:name]} with: #{option[:value]}"
|
536
|
-
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id option'>option</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id option'>option</span><span class='lbracket'>[</span><span class='symbol'>:value</span><span class='rbracket'>]</span>
|
537
|
-
<span class='kw'>end</span>
|
538
|
-
<span class='kw'>end</span>
|
539
|
-
|
540
|
-
<span class='kw'>def</span> <span class='id assembled_parameter_collection'>assembled_parameter_collection</span>
|
541
|
-
<span class='id assembled_static_collection'>assembled_static_collection</span> <span class='symbol'>:static_parameter_collection</span>
|
542
|
-
<span class='kw'>end</span>
|
543
|
-
|
544
|
-
<span class='kw'>def</span> <span class='id assembled_default_parameter_collection'>assembled_default_parameter_collection</span>
|
545
|
-
<span class='id assembled_static_collection'>assembled_static_collection</span> <span class='symbol'>:static_default_value_collection</span>
|
546
|
-
<span class='kw'>end</span>
|
547
|
-
|
548
|
-
<span class='kw'>def</span> <span class='id assembled_static_collection'>assembled_static_collection</span> <span class='id collection_name'>collection_name</span>
|
549
|
-
<span class='id collection'>collection</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
550
|
-
<span class='id inheritance_chain'>inheritance_chain</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 clazz'>clazz</span><span class='op'>|</span>
|
551
|
-
<span class='kw'>if</span><span class='lparen'>(</span><span class='id clazz'>clazz</span><span class='period'>.</span><span class='id respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='id collection_name'>collection_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
552
|
-
<span class='id collection'>collection</span><span class='period'>.</span><span class='id concat'>concat</span> <span class='id clazz'>clazz</span><span class='period'>.</span><span class='id send'>send</span><span class='lparen'>(</span><span class='id collection_name'>collection_name</span><span class='rparen'>)</span>
|
553
|
-
<span class='kw'>end</span>
|
554
|
-
<span class='kw'>end</span>
|
555
|
-
<span class='id collection'>collection</span>
|
556
|
-
<span class='kw'>end</span>
|
557
|
-
|
558
|
-
<span class='kw'>def</span> <span class='id inheritance_chain'>inheritance_chain</span>
|
559
|
-
<span class='id chain'>chain</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
560
|
-
<span class='id clazz'>clazz</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id class'>class</span>
|
561
|
-
<span class='kw'>while</span> <span class='id clazz'>clazz</span> <span class='kw'>do</span>
|
562
|
-
<span class='id chain'>chain</span> <span class='op'><<</span> <span class='id clazz'>clazz</span>
|
563
|
-
<span class='id clazz'>clazz</span> <span class='op'>=</span> <span class='id clazz'>clazz</span><span class='period'>.</span><span class='id superclass'>superclass</span>
|
564
|
-
<span class='kw'>end</span>
|
565
|
-
<span class='id chain'>chain</span>
|
566
|
-
<span class='kw'>end</span>
|
567
|
-
|
568
|
-
<span class='kw'>def</span> <span class='id add_help_param'>add_help_param</span>
|
569
|
-
<span class='id option_parser'>option_parser</span><span class='period'>.</span><span class='id on'>on</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>--help</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Display this help message</span><span class='tstring_end'>'</span></span> <span class='kw'>do</span>
|
570
|
-
<span class='id puts'>puts</span> <span class='id option_parser'>option_parser</span><span class='period'>.</span><span class='id to_s'>to_s</span>
|
571
|
-
<span class='id exit'>exit</span>
|
572
|
-
<span class='kw'>end</span>
|
573
|
-
<span class='kw'>end</span>
|
574
|
-
|
575
|
-
<span class='kw'>def</span> <span class='id initialize_parameter'>initialize_parameter</span> <span class='id declaration'>declaration</span>
|
576
|
-
<span class='id name'>name</span> <span class='op'>=</span> <span class='id declaration'>declaration</span><span class='lbracket'>[</span><span class='symbol'>:name</span><span class='rbracket'>]</span>
|
577
|
-
<span class='id name_s'>name_s</span> <span class='op'>=</span> <span class='id name'>name</span><span class='period'>.</span><span class='id to_s'>to_s</span>
|
578
|
-
<span class='id type'>type</span> <span class='op'>=</span> <span class='id declaration'>declaration</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span>
|
579
|
-
|
580
|
-
<span class='comment'># First ensure the named accessor doesn't yet exist...
|
581
|
-
</span> <span class='kw'>if</span><span class='lparen'>(</span><span class='id parameter_hash_includes?'>parameter_hash_includes?</span> <span class='id name'>name</span><span class='rparen'>)</span>
|
582
|
-
<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'>ExecutableError</span><span class='period'>.</span><span class='id new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>ToolTask.add_param called with existing parameter name: </span><span class='embexpr_beg'>#{</span><span class='id name_s'>name_s</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
583
|
-
<span class='kw'>end</span>
|
584
|
-
|
585
|
-
<span class='id create_parameter'>create_parameter</span> <span class='id declaration'>declaration</span>
|
586
|
-
<span class='kw'>end</span>
|
587
|
-
|
588
|
-
<span class='kw'>def</span> <span class='id create_parameter'>create_parameter</span> <span class='id declaration'>declaration</span>
|
589
|
-
<span class='id param'>param</span> <span class='op'>=</span> <span class='const'>ParameterFactory</span><span class='period'>.</span><span class='id create'>create</span> <span class='id declaration'>declaration</span><span class='lbracket'>[</span><span class='symbol'>:type</span><span class='rbracket'>]</span>
|
590
|
-
<span class='id param'>param</span><span class='period'>.</span><span class='id belongs_to'>belongs_to</span> <span class='op'>=</span> <span class='kw'>self</span>
|
591
|
-
|
592
|
-
<span class='kw'>begin</span>
|
593
|
-
<span class='id declaration'>declaration</span><span class='period'>.</span><span class='id each_pair'>each_pair</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id key'>key</span><span class='comma'>,</span> <span class='id value'>value</span><span class='op'>|</span>
|
594
|
-
<span class='id param'>param</span><span class='period'>.</span><span class='id send'>send</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>=</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id value'>value</span>
|
595
|
-
<span class='kw'>end</span>
|
596
|
-
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span>
|
597
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unexpected parameter option encountered with: </span><span class='embexpr_beg'>#{</span><span class='id key'>key</span><span class='rbrace'>}</span><span class='tstring_content'> and value: </span><span class='embexpr_beg'>#{</span><span class='id value'>value</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span>
|
598
|
-
<span class='kw'>end</span>
|
599
|
-
|
600
|
-
<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'>UsageError</span><span class='period'>.</span><span class='id new'>new</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Parameter name is required</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span><span class='lparen'>(</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='period'>.</span><span class='id nil?'>nil?</span><span class='rparen'>)</span>
|
601
|
-
|
602
|
-
<span class='id param_hash'>param_hash</span><span class='lbracket'>[</span><span class='id param'>param</span><span class='period'>.</span><span class='id name'>name</span><span class='period'>.</span><span class='id to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id param'>param</span>
|
603
|
-
<span class='id params'>params</span> <span class='op'><<</span> <span class='id param'>param</span>
|
604
|
-
|
605
|
-
<span class='comment'># Expose this parameter to command line arguments:
|
606
|
-
</span> <span class='comment'>#add_commandline_param param
|
607
|
-
</span>
|
608
|
-
<span class='id param'>param</span>
|
609
|
-
<span class='kw'>end</span>
|
610
|
-
|
611
|
-
<span class='kw'>def</span> <span class='id parameter_hash_includes?'>parameter_hash_includes?</span> <span class='id name'>name</span>
|
612
|
-
<span class='id param_hash'>param_hash</span><span class='period'>.</span><span class='id has_key?'>has_key?</span> <span class='id name'>name</span><span class='period'>.</span><span class='id to_sym'>to_sym</span>
|
613
|
-
<span class='kw'>end</span>
|
614
|
-
|
615
|
-
<span class='kw'>def</span> <span class='id validate'>validate</span>
|
616
|
-
<span class='id params'>params</span><span class='period'>.</span><span class='id each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id param'>param</span><span class='op'>|</span>
|
617
|
-
<span class='id param'>param</span><span class='period'>.</span><span class='id validate'>validate</span>
|
618
|
-
<span class='kw'>end</span>
|
619
|
-
<span class='kw'>end</span>
|
620
|
-
|
621
|
-
<span class='kw'>def</span> <span class='id option_parser'>option_parser</span>
|
622
|
-
<span class='ivar'>@option_parser</span>
|
623
|
-
<span class='kw'>end</span>
|
624
|
-
|
625
|
-
<span class='kw'>end</span>
|
626
|
-
<span class='kw'>end</span></pre>
|
627
|
-
|
628
|
-
<p>end</p>
|
629
|
-
</div></div>
|
630
|
-
|
631
|
-
<div id="footer">
|
632
|
-
Generated on Wed Dec 22 11:58:32 2010 by
|
633
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
634
|
-
0.6.3 (ruby-1.9.2).
|
635
|
-
</div>
|
636
|
-
|
637
|
-
</body>
|
638
|
-
</html>
|