rubybreaker 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +5 -0
- data/NOTES +9 -0
- data/README.md +100 -183
- data/Rakefile +21 -6
- data/VERSION +1 -1
- data/bin/rubybreaker +34 -50
- data/lib/rubybreaker/debug/debug.rb +6 -0
- data/lib/rubybreaker/doc/rdoc.rb +37 -0
- data/lib/rubybreaker/doc.rb +3 -0
- data/lib/rubybreaker/runtime/inspector.rb +6 -28
- data/lib/rubybreaker/runtime/monitor.rb +21 -17
- data/lib/rubybreaker/runtime/object_wrapper.rb +7 -2
- data/lib/rubybreaker/runtime/type_system.rb +3 -5
- data/lib/rubybreaker/runtime/typesig_unparser.rb +1 -4
- data/lib/rubybreaker/runtime.rb +64 -105
- data/lib/rubybreaker/task.rb +97 -0
- data/lib/rubybreaker/test/rspec.rb +1 -1
- data/lib/rubybreaker/test/testcase.rb +13 -28
- data/lib/rubybreaker/type/type.rb +1 -1
- data/lib/rubybreaker/typing/subtyping.rb +10 -5
- data/lib/rubybreaker/util.rb +0 -1
- data/lib/rubybreaker.rb +163 -115
- data/test/integrated/tc_both_broken_breakable.rb +5 -4
- data/test/integrated/tc_class_methods.rb +4 -3
- data/test/integrated/tc_inherit_broken.rb +4 -3
- data/test/integrated/tc_method_missing.rb +4 -4
- data/test/integrated/tc_namespace.rb +4 -2
- data/test/integrated/tc_simple1.rb +4 -3
- data/test/runtime/tc_obj_wrapper.rb +25 -6
- data/test/runtime/tc_typesig_parser.rb +0 -1
- data/test/testtask/sample.rb +10 -0
- data/test/testtask/tc_testtask.rb +25 -0
- data/test/ts_rspec.rb +21 -15
- data/test/typing/tc_typing.rb +2 -3
- data/webpage/index.html +105 -193
- data/webpage/rdoc/Kernel.html +286 -0
- data/webpage/rdoc/Object.html +17 -11
- data/webpage/rdoc/Rake/RubyBreakerTestTask.html +374 -0
- data/webpage/rdoc/Rake.html +212 -0
- data/webpage/rdoc/RubyBreaker/Breakable.html +24 -40
- data/webpage/rdoc/RubyBreaker/Broken.html +21 -69
- data/webpage/rdoc/RubyBreaker/Context.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors/InternalError.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors/InvalidSubtypeCheck.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors/InvalidTypeConstruction.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors/SubtypeFailure.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors/TypeError.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors/UserError.html +16 -10
- data/webpage/rdoc/RubyBreaker/Errors.html +16 -10
- data/webpage/rdoc/RubyBreaker/ObjectPosition.html +16 -10
- data/webpage/rdoc/RubyBreaker/Position.html +16 -10
- data/webpage/rdoc/RubyBreaker/{TestCase.html → RDocSupport.html} +81 -82
- data/webpage/rdoc/RubyBreaker/RubyTypeUtils.html +16 -10
- data/webpage/rdoc/RubyBreaker/Runtime/Inspector.html +25 -44
- data/webpage/rdoc/RubyBreaker/Runtime/MethodInfo.html +16 -10
- data/webpage/rdoc/RubyBreaker/Runtime/Monitor.html +19 -13
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorInstaller.html +37 -25
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorSwitch.html +20 -14
- data/webpage/rdoc/RubyBreaker/Runtime/MonitorUtils.html +21 -15
- data/webpage/rdoc/RubyBreaker/Runtime/ObjectWrapper.html +23 -12
- data/webpage/rdoc/RubyBreaker/Runtime/Pluggable.html +16 -10
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSigParser.html +16 -10
- data/webpage/rdoc/RubyBreaker/Runtime/{TypesigUnparser.html → TypeSigUnparser.html} +19 -16
- data/webpage/rdoc/RubyBreaker/Runtime/TypeSystem.html +18 -14
- data/webpage/rdoc/RubyBreaker/Runtime.html +145 -11
- data/webpage/rdoc/RubyBreaker/TypeComparer.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/AnyType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/BlockType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/DuckType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/FusionType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodListType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/MethodType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/NilType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/NominalType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/OptionalType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/OrType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs/SelfType.html +17 -11
- data/webpage/rdoc/RubyBreaker/TypeDefs/Type.html +17 -11
- data/webpage/rdoc/RubyBreaker/TypeDefs/VarLengthType.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeDefs.html +16 -10
- data/webpage/rdoc/RubyBreaker/TypeUnparser.html +16 -10
- data/webpage/rdoc/RubyBreaker/Typing.html +17 -11
- data/webpage/rdoc/RubyBreaker/Util.html +16 -10
- data/webpage/rdoc/RubyBreaker.html +167 -34
- data/webpage/rdoc/{RubyBreaker/Runtime/TypePlaceholder.html → Test/Unit/TestCase.html} +68 -39
- data/webpage/rdoc/Test/Unit.html +211 -0
- data/webpage/rdoc/Test.html +211 -0
- data/webpage/rdoc/created.rid +18 -17
- data/webpage/rdoc/index.html +16 -10
- data/webpage/rdoc/js/search_index.js +1 -1
- data/webpage/rdoc/table_of_contents.html +61 -48
- metadata +21 -12
- data/lib/rubybreaker/rubylib/core.rb +0 -2483
- data/lib/rubybreaker/rubylib.rb +0 -3
- data/lib/rubybreaker/runtime/type_placeholder.rb +0 -23
- data/webpage/rdoc/RubyBreaker/Broken/BrokenEigen.html +0 -305
- data/webpage/rdoc/RubyBreaker/Main.html +0 -458
@@ -1,458 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
-
|
7
|
-
<title>module RubyBreaker::Main - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
-
|
11
|
-
<script type="text/javascript">
|
12
|
-
var rdoc_rel_prefix = "../";
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
-
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
-
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
-
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
-
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
-
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
-
|
22
|
-
|
23
|
-
<body id="top" class="module">
|
24
|
-
<nav id="metadata">
|
25
|
-
<nav id="home-section" class="section">
|
26
|
-
<h3 class="section-header">
|
27
|
-
<a href="../index.html">Home</a>
|
28
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
-
</h3>
|
31
|
-
</nav>
|
32
|
-
|
33
|
-
|
34
|
-
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
-
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<h3 class="section-header">
|
37
|
-
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</h3>
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
44
|
-
|
45
|
-
|
46
|
-
<div id="file-metadata">
|
47
|
-
<nav id="file-list-section" class="section">
|
48
|
-
<h3 class="section-header">Defined In</h3>
|
49
|
-
<ul>
|
50
|
-
<li>lib/rubybreaker.rb
|
51
|
-
</ul>
|
52
|
-
</nav>
|
53
|
-
|
54
|
-
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<div id="class-metadata">
|
58
|
-
|
59
|
-
|
60
|
-
<!-- Included Modules -->
|
61
|
-
<nav id="includes-section" class="section">
|
62
|
-
<h3 class="section-header">Included Modules</h3>
|
63
|
-
|
64
|
-
<ul class="link-list">
|
65
|
-
|
66
|
-
|
67
|
-
<li><a class="include" href="TypeDefs.html">RubyBreaker::TypeDefs</a>
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
<li><a class="include" href="Runtime.html">RubyBreaker::Runtime</a>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</nav>
|
76
|
-
|
77
|
-
<!-- Method Quickref -->
|
78
|
-
<nav id="method-list-section" class="section">
|
79
|
-
<h3 class="section-header">Methods</h3>
|
80
|
-
|
81
|
-
<ul class="link-list">
|
82
|
-
|
83
|
-
<li><a href="#method-c-input">::input</a>
|
84
|
-
|
85
|
-
<li><a href="#method-c-output">::output</a>
|
86
|
-
|
87
|
-
<li><a href="#method-c-run">::run</a>
|
88
|
-
|
89
|
-
<li><a href="#method-c-setup">::setup</a>
|
90
|
-
|
91
|
-
</ul>
|
92
|
-
</nav>
|
93
|
-
|
94
|
-
</div>
|
95
|
-
|
96
|
-
<div id="project-metadata">
|
97
|
-
|
98
|
-
<nav id="classindex-section" class="section project-section">
|
99
|
-
<h3 class="section-header">Class and Module Index</h3>
|
100
|
-
|
101
|
-
<ul class="link-list">
|
102
|
-
|
103
|
-
<li><a href="../RubyBreaker.html">RubyBreaker</a>
|
104
|
-
|
105
|
-
<li><a href="../RubyBreaker/Breakable.html">RubyBreaker::Breakable</a>
|
106
|
-
|
107
|
-
<li><a href="../RubyBreaker/Broken.html">RubyBreaker::Broken</a>
|
108
|
-
|
109
|
-
<li><a href="../RubyBreaker/Broken/BrokenEigen.html">RubyBreaker::Broken::BrokenEigen</a>
|
110
|
-
|
111
|
-
<li><a href="../RubyBreaker/Context.html">RubyBreaker::Context</a>
|
112
|
-
|
113
|
-
<li><a href="../RubyBreaker/Errors.html">RubyBreaker::Errors</a>
|
114
|
-
|
115
|
-
<li><a href="../RubyBreaker/Errors/InternalError.html">RubyBreaker::Errors::InternalError</a>
|
116
|
-
|
117
|
-
<li><a href="../RubyBreaker/Errors/InvalidSubtypeCheck.html">RubyBreaker::Errors::InvalidSubtypeCheck</a>
|
118
|
-
|
119
|
-
<li><a href="../RubyBreaker/Errors/InvalidTypeConstruction.html">RubyBreaker::Errors::InvalidTypeConstruction</a>
|
120
|
-
|
121
|
-
<li><a href="../RubyBreaker/Errors/SubtypeFailure.html">RubyBreaker::Errors::SubtypeFailure</a>
|
122
|
-
|
123
|
-
<li><a href="../RubyBreaker/Errors/TypeError.html">RubyBreaker::Errors::TypeError</a>
|
124
|
-
|
125
|
-
<li><a href="../RubyBreaker/Errors/UserError.html">RubyBreaker::Errors::UserError</a>
|
126
|
-
|
127
|
-
<li><a href="../RubyBreaker/Main.html">RubyBreaker::Main</a>
|
128
|
-
|
129
|
-
<li><a href="../RubyBreaker/ObjectPosition.html">RubyBreaker::ObjectPosition</a>
|
130
|
-
|
131
|
-
<li><a href="../RubyBreaker/Position.html">RubyBreaker::Position</a>
|
132
|
-
|
133
|
-
<li><a href="../RubyBreaker/RubyTypeUtils.html">RubyBreaker::RubyTypeUtils</a>
|
134
|
-
|
135
|
-
<li><a href="../RubyBreaker/Runtime.html">RubyBreaker::Runtime</a>
|
136
|
-
|
137
|
-
<li><a href="../RubyBreaker/Runtime/Inspector.html">RubyBreaker::Runtime::Inspector</a>
|
138
|
-
|
139
|
-
<li><a href="../RubyBreaker/Runtime/MethodInfo.html">RubyBreaker::Runtime::MethodInfo</a>
|
140
|
-
|
141
|
-
<li><a href="../RubyBreaker/Runtime/Monitor.html">RubyBreaker::Runtime::Monitor</a>
|
142
|
-
|
143
|
-
<li><a href="../RubyBreaker/Runtime/MonitorInstaller.html">RubyBreaker::Runtime::MonitorInstaller</a>
|
144
|
-
|
145
|
-
<li><a href="../RubyBreaker/Runtime/MonitorSwitch.html">RubyBreaker::Runtime::MonitorSwitch</a>
|
146
|
-
|
147
|
-
<li><a href="../RubyBreaker/Runtime/MonitorUtils.html">RubyBreaker::Runtime::MonitorUtils</a>
|
148
|
-
|
149
|
-
<li><a href="../RubyBreaker/Runtime/ObjectWrapper.html">RubyBreaker::Runtime::ObjectWrapper</a>
|
150
|
-
|
151
|
-
<li><a href="../RubyBreaker/Runtime/Pluggable.html">RubyBreaker::Runtime::Pluggable</a>
|
152
|
-
|
153
|
-
<li><a href="../RubyBreaker/Runtime/TypePlaceholder.html">RubyBreaker::Runtime::TypePlaceholder</a>
|
154
|
-
|
155
|
-
<li><a href="../RubyBreaker/Runtime/TypeSigParser.html">RubyBreaker::Runtime::TypeSigParser</a>
|
156
|
-
|
157
|
-
<li><a href="../RubyBreaker/Runtime/TypeSystem.html">RubyBreaker::Runtime::TypeSystem</a>
|
158
|
-
|
159
|
-
<li><a href="../RubyBreaker/Runtime/TypesigUnparser.html">RubyBreaker::Runtime::TypesigUnparser</a>
|
160
|
-
|
161
|
-
<li><a href="../RubyBreaker/TestCase.html">RubyBreaker::TestCase</a>
|
162
|
-
|
163
|
-
<li><a href="../RubyBreaker/TypeComparer.html">RubyBreaker::TypeComparer</a>
|
164
|
-
|
165
|
-
<li><a href="../RubyBreaker/TypeDefs.html">RubyBreaker::TypeDefs</a>
|
166
|
-
|
167
|
-
<li><a href="../RubyBreaker/TypeDefs/AnyType.html">RubyBreaker::TypeDefs::AnyType</a>
|
168
|
-
|
169
|
-
<li><a href="../RubyBreaker/TypeDefs/BlockType.html">RubyBreaker::TypeDefs::BlockType</a>
|
170
|
-
|
171
|
-
<li><a href="../RubyBreaker/TypeDefs/DuckType.html">RubyBreaker::TypeDefs::DuckType</a>
|
172
|
-
|
173
|
-
<li><a href="../RubyBreaker/TypeDefs/FusionType.html">RubyBreaker::TypeDefs::FusionType</a>
|
174
|
-
|
175
|
-
<li><a href="../RubyBreaker/TypeDefs/MethodListType.html">RubyBreaker::TypeDefs::MethodListType</a>
|
176
|
-
|
177
|
-
<li><a href="../RubyBreaker/TypeDefs/MethodType.html">RubyBreaker::TypeDefs::MethodType</a>
|
178
|
-
|
179
|
-
<li><a href="../RubyBreaker/TypeDefs/NilType.html">RubyBreaker::TypeDefs::NilType</a>
|
180
|
-
|
181
|
-
<li><a href="../RubyBreaker/TypeDefs/NominalType.html">RubyBreaker::TypeDefs::NominalType</a>
|
182
|
-
|
183
|
-
<li><a href="../RubyBreaker/TypeDefs/OptionalType.html">RubyBreaker::TypeDefs::OptionalType</a>
|
184
|
-
|
185
|
-
<li><a href="../RubyBreaker/TypeDefs/OrType.html">RubyBreaker::TypeDefs::OrType</a>
|
186
|
-
|
187
|
-
<li><a href="../RubyBreaker/TypeDefs/SelfType.html">RubyBreaker::TypeDefs::SelfType</a>
|
188
|
-
|
189
|
-
<li><a href="../RubyBreaker/TypeDefs/Type.html">RubyBreaker::TypeDefs::Type</a>
|
190
|
-
|
191
|
-
<li><a href="../RubyBreaker/TypeDefs/VarLengthType.html">RubyBreaker::TypeDefs::VarLengthType</a>
|
192
|
-
|
193
|
-
<li><a href="../RubyBreaker/TypeUnparser.html">RubyBreaker::TypeUnparser</a>
|
194
|
-
|
195
|
-
<li><a href="../RubyBreaker/Typing.html">RubyBreaker::Typing</a>
|
196
|
-
|
197
|
-
<li><a href="../RubyBreaker/Util.html">RubyBreaker::Util</a>
|
198
|
-
|
199
|
-
<li><a href="../Object.html">Object</a>
|
200
|
-
|
201
|
-
</ul>
|
202
|
-
</nav>
|
203
|
-
|
204
|
-
</div>
|
205
|
-
</nav>
|
206
|
-
|
207
|
-
<div id="documentation">
|
208
|
-
<h1 class="module">module RubyBreaker::Main</h1>
|
209
|
-
|
210
|
-
<div id="description" class="description">
|
211
|
-
|
212
|
-
<p>This module has a set of entry points to the program and misc. methods for
|
213
|
-
running <a href="../RubyBreaker.html">RubyBreaker</a>.</p>
|
214
|
-
|
215
|
-
</div><!-- description -->
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
<!-- Methods -->
|
230
|
-
|
231
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
232
|
-
<h3 class="section-header">Public Class Methods</h3>
|
233
|
-
|
234
|
-
|
235
|
-
<div id="method-c-input" class="method-detail ">
|
236
|
-
|
237
|
-
<div class="method-heading">
|
238
|
-
<span class="method-name">input</span><span
|
239
|
-
class="method-args">()</span>
|
240
|
-
<span class="method-click-advice">click to toggle source</span>
|
241
|
-
</div>
|
242
|
-
|
243
|
-
|
244
|
-
<div class="method-description">
|
245
|
-
|
246
|
-
<p>Reads the input file if specified or exists</p>
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
<div class="method-source-code" id="input-source">
|
251
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 69</span>
|
252
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">input</span>()
|
253
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
|
254
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"RubyBreaker input file exists...loading"</span>)
|
255
|
-
<span class="ruby-identifier">eval</span> <span class="ruby-node">"load \"#{OPTIONS[:io_file]}\""</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>
|
256
|
-
<span class="ruby-keyword">end</span></pre>
|
257
|
-
</div><!-- input-source -->
|
258
|
-
|
259
|
-
</div>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
</div><!-- input-method -->
|
265
|
-
|
266
|
-
|
267
|
-
<div id="method-c-output" class="method-detail ">
|
268
|
-
|
269
|
-
<div class="method-heading">
|
270
|
-
<span class="method-name">output</span><span
|
271
|
-
class="method-args">()</span>
|
272
|
-
<span class="method-click-advice">click to toggle source</span>
|
273
|
-
</div>
|
274
|
-
|
275
|
-
|
276
|
-
<div class="method-description">
|
277
|
-
|
278
|
-
<p>This method will generate the output.</p>
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
<div class="method-source-code" id="output-source">
|
283
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 76</span>
|
284
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">output</span>()
|
285
|
-
|
286
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Generating type documentation"</span>)
|
287
|
-
|
288
|
-
<span class="ruby-identifier">io_exist</span> = <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
|
289
|
-
|
290
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-string">""</span>
|
291
|
-
<span class="ruby-comment"># Document each module that was monitored</span>
|
292
|
-
<span class="ruby-constant">INSTALLED</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
|
293
|
-
<span class="ruby-identifier">str</span> = <span class="ruby-constant">Runtime</span><span class="ruby-operator">::</span><span class="ruby-constant">TypesigUnparser</span>.<span class="ruby-identifier">unparse</span>(<span class="ruby-identifier">mod</span>)
|
294
|
-
<span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
295
|
-
<span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:mode</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:lib</span>
|
296
|
-
<span class="ruby-identifier">print</span> <span class="ruby-identifier">str</span>
|
297
|
-
<span class="ruby-keyword">end</span>
|
298
|
-
}
|
299
|
-
|
300
|
-
<span class="ruby-comment"># If this was a library mode run, exit now. </span>
|
301
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:mode</span>] <span class="ruby-operator">==</span> <span class="ruby-value">:lib</span>
|
302
|
-
|
303
|
-
<span class="ruby-comment"># Append the result to the input file (or create a new file)</span>
|
304
|
-
<span class="ruby-identifier">open</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>],<span class="ruby-string">"a"</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
305
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">io_exist</span>
|
306
|
-
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"# This file is auto-generated by RubyBreaker"</span>
|
307
|
-
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">"require \"rubybreaker\""</span>
|
308
|
-
<span class="ruby-keyword">end</span>
|
309
|
-
<span class="ruby-identifier">f</span>.<span class="ruby-identifier">print</span> <span class="ruby-identifier">code</span>
|
310
|
-
<span class="ruby-keyword">end</span>
|
311
|
-
|
312
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Done generating type documentation"</span>)
|
313
|
-
<span class="ruby-keyword">end</span></pre>
|
314
|
-
</div><!-- output-source -->
|
315
|
-
|
316
|
-
</div>
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
</div><!-- output-method -->
|
322
|
-
|
323
|
-
|
324
|
-
<div id="method-c-run" class="method-detail ">
|
325
|
-
|
326
|
-
<div class="method-heading">
|
327
|
-
<span class="method-name">run</span><span
|
328
|
-
class="method-args">()</span>
|
329
|
-
<span class="method-click-advice">click to toggle source</span>
|
330
|
-
</div>
|
331
|
-
|
332
|
-
|
333
|
-
<div class="method-description">
|
334
|
-
|
335
|
-
<p>This method will run do things in the following order:</p>
|
336
|
-
|
337
|
-
<pre class="ruby">* <span class="ruby-constant">Checks</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">see</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">user</span> <span class="ruby-identifier">program</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">an</span> <span class="ruby-identifier">input</span> <span class="ruby-identifier">file</span> <span class="ruby-identifier">exists</span>
|
338
|
-
* <span class="ruby-constant">Loads</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">documentation</span> <span class="ruby-keyword">for</span> <span class="ruby-constant">Ruby</span> <span class="ruby-constant">Core</span> <span class="ruby-constant">Library</span> (<span class="ruby-constant">TODO</span>)
|
339
|
-
* <span class="ruby-constant">Reads</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">input</span> <span class="ruby-identifier">type</span> <span class="ruby-identifier">documentation</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">any</span>
|
340
|
-
* <span class="ruby-constant">Reads</span> (<span class="ruby-identifier">require</span><span class="ruby-string">'s) the user program
|
341
|
-
</span></pre>
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
<div class="method-source-code" id="run-source">
|
346
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 114</span>
|
347
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">run</span>()
|
348
|
-
|
349
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">setup_logger</span>()
|
350
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Running RubyBreaker"</span>)
|
351
|
-
|
352
|
-
<span class="ruby-comment"># First, take care of the program file.</span>
|
353
|
-
<span class="ruby-identifier">argv0</span> = <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:file</span>]
|
354
|
-
<span class="ruby-identifier">prog_file</span> = <span class="ruby-identifier">argv0</span>
|
355
|
-
<span class="ruby-identifier">prog_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">prog_file</span>)
|
356
|
-
|
357
|
-
<span class="ruby-comment"># It is ok to omit .rb extension. So try to see if prog_file.rb exists</span>
|
358
|
-
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">prog_file</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">prog_file</span>) <span class="ruby-operator">==</span> <span class="ruby-string">".rb"</span>
|
359
|
-
<span class="ruby-identifier">prog_file</span> = <span class="ruby-node">"#{prog_file}.rb"</span>
|
360
|
-
<span class="ruby-keyword">end</span>
|
361
|
-
|
362
|
-
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">prog_file</span>)
|
363
|
-
<span class="ruby-identifier">fatal</span>(<span class="ruby-node">"#{argv0} is an invalid file."</span>)
|
364
|
-
<span class="ruby-identifier">exit</span>(<span class="ruby-value">1</span>)
|
365
|
-
<span class="ruby-keyword">end</span>
|
366
|
-
|
367
|
-
<span class="ruby-comment"># Then, input/output file if specified</span>
|
368
|
-
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>].<span class="ruby-identifier">empty?</span>
|
369
|
-
<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] = <span class="ruby-node">"#{File.basename(argv0, ".rb")}.#{EXTENSION}"</span>
|
370
|
-
<span class="ruby-keyword">end</span>
|
371
|
-
<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:io_file</span>])
|
372
|
-
|
373
|
-
<span class="ruby-keyword">if</span> <span class="ruby-constant">OPTIONS</span>[<span class="ruby-value">:rubylib</span>]
|
374
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Loading RubyBreaker's Ruby Core Library documentation"</span>)
|
375
|
-
<span class="ruby-comment"># Load the core library type documentation</span>
|
376
|
-
<span class="ruby-identifier">eval</span>(<span class="ruby-string">"require \"rubybreaker/rubylib\""</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>)
|
377
|
-
<span class="ruby-keyword">end</span>
|
378
|
-
|
379
|
-
<span class="ruby-comment"># Read the input file first (as it might contain type documentation</span>
|
380
|
-
<span class="ruby-comment"># already)</span>
|
381
|
-
<span class="ruby-constant">Main</span>.<span class="ruby-identifier">input</span>()
|
382
|
-
|
383
|
-
<span class="ruby-comment"># Finally, require the program file! Let it run! Wheeee!</span>
|
384
|
-
<span class="ruby-identifier">eval</span>(<span class="ruby-node">"require '#{prog_file}'"</span>, <span class="ruby-constant">TOPLEVEL_BINDING</span>)
|
385
|
-
|
386
|
-
<span class="ruby-constant">RubyBreaker</span>.<span class="ruby-identifier">verbose</span>(<span class="ruby-string">"Done running the input program"</span>)
|
387
|
-
|
388
|
-
<span class="ruby-keyword">end</span></pre>
|
389
|
-
</div><!-- run-source -->
|
390
|
-
|
391
|
-
</div>
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
</div><!-- run-method -->
|
397
|
-
|
398
|
-
|
399
|
-
<div id="method-c-setup" class="method-detail ">
|
400
|
-
|
401
|
-
<div class="method-heading">
|
402
|
-
<span class="method-name">setup</span><span
|
403
|
-
class="method-args">()</span>
|
404
|
-
<span class="method-click-advice">click to toggle source</span>
|
405
|
-
</div>
|
406
|
-
|
407
|
-
|
408
|
-
<div class="method-description">
|
409
|
-
|
410
|
-
<p>This method is the trigger point to install a monitor in each module/class.</p>
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
<div class="method-source-code" id="setup-source">
|
415
|
-
<pre><span class="ruby-comment"># File lib/rubybreaker.rb, line 47</span>
|
416
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">setup</span>()
|
417
|
-
|
418
|
-
<span class="ruby-constant">BREAKABLE</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">mod</span><span class="ruby-operator">|</span>
|
419
|
-
|
420
|
-
<span class="ruby-comment"># Remember, RubyBreaker now supports a hybrid of Breakable and</span>
|
421
|
-
<span class="ruby-comment"># Broken module. Just check if the module has already been</span>
|
422
|
-
<span class="ruby-comment"># instrumented.</span>
|
423
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-constant">INSTALLED</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">mod</span>)
|
424
|
-
<span class="ruby-constant">MonitorInstaller</span>.<span class="ruby-identifier">install_module_monitor</span>(<span class="ruby-identifier">mod</span>)
|
425
|
-
<span class="ruby-constant">INSTALLED</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">mod</span>
|
426
|
-
<span class="ruby-keyword">end</span>
|
427
|
-
|
428
|
-
<span class="ruby-keyword">end</span>
|
429
|
-
|
430
|
-
<span class="ruby-comment"># At the end, we generate an output of the type information.</span>
|
431
|
-
<span class="ruby-identifier">at_exit</span> <span class="ruby-keyword">do</span>
|
432
|
-
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">output</span>
|
433
|
-
<span class="ruby-keyword">end</span>
|
434
|
-
|
435
|
-
<span class="ruby-keyword">end</span></pre>
|
436
|
-
</div><!-- setup-source -->
|
437
|
-
|
438
|
-
</div>
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
</div><!-- setup-method -->
|
444
|
-
|
445
|
-
|
446
|
-
</section><!-- public-class-method-details -->
|
447
|
-
|
448
|
-
</section><!-- 5Buntitled-5D -->
|
449
|
-
|
450
|
-
</div><!-- documentation -->
|
451
|
-
|
452
|
-
|
453
|
-
<footer id="validator-badges">
|
454
|
-
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
455
|
-
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
456
|
-
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
457
|
-
</footer>
|
458
|
-
|