rumodule 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.rdoc +11 -0
- data/LICENSE +20 -0
- data/README.rdoc +218 -0
- data/bin/rumodule +1069 -0
- data/doc/CmdAdd.html +837 -0
- data/doc/CmdDisplay.html +260 -0
- data/doc/CmdHelp.html +304 -0
- data/doc/CmdList.html +258 -0
- data/doc/CmdRm.html +832 -0
- data/doc/CmdSadd.html +300 -0
- data/doc/CmdSlist.html +258 -0
- data/doc/CmdSrm.html +283 -0
- data/doc/CmdWhich.html +258 -0
- data/doc/EnvVar.html +1351 -0
- data/doc/Rumodule.html +841 -0
- data/doc/RumoduleCommon.html +151 -0
- data/doc/RumoduleMod.html +202 -0
- data/doc/Utility.html +1403 -0
- data/doc/_index.html +202 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.CHANGELOG.html +87 -0
- data/doc/file.README.html +303 -0
- data/doc/file_list.html +63 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +303 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +423 -0
- data/doc/top-level-namespace.html +130 -0
- data/lib/version.rb +6 -0
- data/test/run_fish +3 -0
- data/test/run_zsh_sh_bash +3 -0
- data/test/test_fish +70 -0
- data/test/test_fish.log +60 -0
- data/test/test_golden.log +60 -0
- data/test/test_rumodule.rb +39 -0
- data/test/test_zsh_sh_bash +72 -0
- data/test/test_zsh_sh_bash.log +60 -0
- metadata +110 -0
data/doc/index.html
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.6
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!file.README.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index</a> »
|
35
|
+
<span class="title">File: README</span>
|
36
|
+
|
37
|
+
|
38
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">
|
42
|
+
|
43
|
+
<a class="full_list_link" id="class_list_link"
|
44
|
+
href="class_list.html">
|
45
|
+
Class List
|
46
|
+
</a>
|
47
|
+
|
48
|
+
<a class="full_list_link" id="method_list_link"
|
49
|
+
href="method_list.html">
|
50
|
+
Method List
|
51
|
+
</a>
|
52
|
+
|
53
|
+
<a class="full_list_link" id="file_list_link"
|
54
|
+
href="file_list.html">
|
55
|
+
File List
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><div id='filecontents'>
|
65
|
+
<h1 id="label-Content">Content</h1>
|
66
|
+
<ul><li>
|
67
|
+
<p>Introduction</p>
|
68
|
+
</li><li>
|
69
|
+
<p>Command Line Usage</p>
|
70
|
+
</li><li>
|
71
|
+
<p>Rumodule File Commands</p>
|
72
|
+
</li><li>
|
73
|
+
<p>Shell Function</p>
|
74
|
+
</li><li>
|
75
|
+
<p>Environment Setup</p>
|
76
|
+
</li><li>
|
77
|
+
<p>Summary</p>
|
78
|
+
</li></ul>
|
79
|
+
|
80
|
+
<h1 id="label-Introduction">Introduction</h1>
|
81
|
+
|
82
|
+
<p>Rumodule is used to manage shell environment variables by adding/removing
|
83
|
+
modules. By adding a module using Rumodule, for example the PATH
|
84
|
+
environment variable can be setup so that the executable is found.</p>
|
85
|
+
|
86
|
+
<p>Modules exist per tool or per tool version. Rumodule makes it easy to
|
87
|
+
maintain and provide tool setups between multiple users.</p>
|
88
|
+
|
89
|
+
<p>The commands are called User Commands. Modules are called Rumodule files
|
90
|
+
and they include Rumodule File Commands.</p>
|
91
|
+
|
92
|
+
<p>Rumodule refers to modules through RUMODULE environment variable. RUMODULE
|
93
|
+
includes a list of directories where Rumodule Files reside.</p>
|
94
|
+
|
95
|
+
<p>Rumodule command is not convenient to be used directly. The user should
|
96
|
+
setup a shell function which is used to utilize Rumodule. Recommended name
|
97
|
+
is “rumo”. See: Shell Function.</p>
|
98
|
+
|
99
|
+
<p>Supported shells: zsh, sh, bash, fish</p>
|
100
|
+
|
101
|
+
<h1 id="label-Command+Line+Usage">Command Line Usage</h1>
|
102
|
+
|
103
|
+
<h2 id="label-Overview">Overview</h2>
|
104
|
+
|
105
|
+
<p>The most common User Commands are: “add” and “rm”. “add” adds modules
|
106
|
+
content to the shell environment and “rm” removes the same content (or its
|
107
|
+
effects).</p>
|
108
|
+
|
109
|
+
<p>Execution examples:</p>
|
110
|
+
|
111
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_rumo'>rumo</span> <span class='id identifier rubyid_add'>add</span> <span class='id identifier rubyid_my_module'>my_module</span>
|
112
|
+
<span class='id identifier rubyid_rumo'>rumo</span> <span class='id identifier rubyid_rm'>rm</span> <span class='id identifier rubyid_my_module'>my_module</span>
|
113
|
+
</code></pre>
|
114
|
+
|
115
|
+
<p>Other common commands are “list” and “avail”. “list” displays a list of
|
116
|
+
loaded modules and “avail” lists all modules found, defined by the RUMODULE
|
117
|
+
env variable.</p>
|
118
|
+
|
119
|
+
<h2 id="label-List+of+User+Commands">List of User Commands</h2>
|
120
|
+
<ul><li>
|
121
|
+
<p>add: add (load) one or many modules</p>
|
122
|
+
</li><li>
|
123
|
+
<p>sadd: add (load) one or many system modules</p>
|
124
|
+
</li><li>
|
125
|
+
<p>rm: remove (unload) one or many modules</p>
|
126
|
+
</li><li>
|
127
|
+
<p>srm: remove (unload) one or many system modules</p>
|
128
|
+
</li><li>
|
129
|
+
<p>list: list loaded modules</p>
|
130
|
+
</li><li>
|
131
|
+
<p>slist: list loaded system modules</p>
|
132
|
+
</li><li>
|
133
|
+
<p>which: display module that would be selected from module directory</p>
|
134
|
+
</li><li>
|
135
|
+
<p>display: display module content</p>
|
136
|
+
</li><li>
|
137
|
+
<p>avail: list all available modules</p>
|
138
|
+
</li><li>
|
139
|
+
<p>savail: list all available modules (including system modules)</p>
|
140
|
+
</li><li>
|
141
|
+
<p>help: display rumodule commands or module help if module given</p>
|
142
|
+
</li></ul>
|
143
|
+
|
144
|
+
<h1 id="label-Rumodule+File+Commands">Rumodule File Commands</h1>
|
145
|
+
|
146
|
+
<h2 id="label-Overview">Overview</h2>
|
147
|
+
|
148
|
+
<p>The Rumodule files include commands to setup a tool for usage. Rumodule
|
149
|
+
files are normal Ruby files, except a set of Rumodule commands are
|
150
|
+
available in the top namespace. The Rumodule File Commands are semantically
|
151
|
+
defined for the “add” command. For “rm” they have the opposite meaning.</p>
|
152
|
+
|
153
|
+
<p>The most common commands are “setenv”, “append_path”, and “prepend_path”.</p>
|
154
|
+
|
155
|
+
<p>“append_path” adds an entry to the end of existing env variable (or new is
|
156
|
+
created). “prepend_path” adds an entry to the beginning of existing env
|
157
|
+
variable. New var is created if it doesn't exist.</p>
|
158
|
+
|
159
|
+
<p>New env variable is created with “setenv” command. Existing env var can be
|
160
|
+
removed with “unsetenv” command.</p>
|
161
|
+
|
162
|
+
<p>Rumodule example:</p>
|
163
|
+
|
164
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_help'>help</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>This module is used for tool</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
165
|
+
<span class='id identifier rubyid_tool_path'>tool_path</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>TOOL_PATH</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
166
|
+
<span class='id identifier rubyid_append_path'>append_path</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>PATH</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_tool_path'>tool_path</span><span class='embexpr_end'>}</span><span class='tstring_content'>/bin</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
167
|
+
<span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>tool_setup</span><span class='tstring_end'>"</span></span> <span class='rparen'>)</span>
|
168
|
+
</code></pre>
|
169
|
+
|
170
|
+
<h2 id="label-List+of+Rumodule+File+Commands">List of Rumodule File Commands</h2>
|
171
|
+
<dl class="rdoc-list label-list"><dt> setenv( var, value )
|
172
|
+
<dd>
|
173
|
+
<p>Set env var “var” to “value”.</p>
|
174
|
+
</dd><dt> unsetenv( var )
|
175
|
+
<dd>
|
176
|
+
<p>Unset env var “var”.</p>
|
177
|
+
</dd><dt> append_path( var, value )
|
178
|
+
<dd>
|
179
|
+
<p>Append “value” to env var “var”.</p>
|
180
|
+
</dd><dt> prepend_path( var, value )
|
181
|
+
<dd>
|
182
|
+
<p>Prepend “value” to env var “var”.</p>
|
183
|
+
</dd><dt> remove_path( var, value )
|
184
|
+
<dd>
|
185
|
+
<p>Remove “value” from env var “var”.</p>
|
186
|
+
</dd><dt> pushenv( var, value )
|
187
|
+
<dd>
|
188
|
+
<p>Set env var “var” to “value” and save the old value of “var” for future.
|
189
|
+
When module is removed, the old value is returned.</p>
|
190
|
+
</dd><dt> prereq( mod )
|
191
|
+
<dd>
|
192
|
+
<p>Check that module “mod” is loaded, or abort. It is recommended to check for
|
193
|
+
other modules before performing any other operation within the module
|
194
|
+
command. Otherwise the Shell Function should check for “rumodule” return
|
195
|
+
codes, and prevent shell env changes when aborting.</p>
|
196
|
+
</dd><dt> conflict( mod )
|
197
|
+
<dd>
|
198
|
+
<p>Check that module “mod” is not loaded, or abort. See “prereq” usage
|
199
|
+
recommendations.</p>
|
200
|
+
</dd><dt> is_loaded( mod )
|
201
|
+
<dd>
|
202
|
+
<p>Check if module “mod” is loaded.</p>
|
203
|
+
</dd><dt> add( mod )
|
204
|
+
<dd>
|
205
|
+
<p>Add a module “mod” from Rumodule file.</p>
|
206
|
+
</dd></dl>
|
207
|
+
|
208
|
+
<h1 id="label-Shell+Function">Shell Function</h1>
|
209
|
+
|
210
|
+
<h2 id="label-Overview">Overview</h2>
|
211
|
+
|
212
|
+
<p>Rumodule user must setup a shell function to use Rumodule easily.
|
213
|
+
Recommended name for the function is “rumo”. The purpose of the function is
|
214
|
+
to map user arguments to “rumodule” command and pass “rumodule” output to
|
215
|
+
shell for evaluation. This enables the user command to change the shell
|
216
|
+
environment variable contents.</p>
|
217
|
+
|
218
|
+
<p>NOTE: If you are using a Ruby version which takes a long time to load into
|
219
|
+
memory, please consider referencing directly into suitable Ruby version in
|
220
|
+
“rumo”.</p>
|
221
|
+
|
222
|
+
<h2 id="label-Shell+Function+examples">Shell Function examples</h2>
|
223
|
+
|
224
|
+
<p>Setup “rumo” command for sh, zsh, or bash shells:</p>
|
225
|
+
|
226
|
+
<pre class="code ruby"><code class="ruby">rumo () {
|
227
|
+
cmd=$1
|
228
|
+
shift
|
229
|
+
if test $# -gt 0; then
|
230
|
+
eval `rumodule -s zsh -c $cmd -m $*`
|
231
|
+
else
|
232
|
+
eval `rumodule -c $cmd`
|
233
|
+
fi
|
234
|
+
}</code></pre>
|
235
|
+
|
236
|
+
<p>Setup “rumo” command for fish shell:</p>
|
237
|
+
|
238
|
+
<pre class="code ruby"><code class="ruby">function rumo
|
239
|
+
if test (count $argv) -gt 1
|
240
|
+
set cmd (rumodule -s fish -c $argv[1] -m $argv[2..-1])
|
241
|
+
else
|
242
|
+
set cmd (rumodule -s fish -c $argv[1])
|
243
|
+
end
|
244
|
+
eval $cmd
|
245
|
+
end</code></pre>
|
246
|
+
|
247
|
+
<h1 id="label-Environment+Setup">Environment Setup</h1>
|
248
|
+
|
249
|
+
<p>Rumodule requires the RUMODULE env var to be set to the root directory or
|
250
|
+
directories where the Rumodule Files reside.</p>
|
251
|
+
|
252
|
+
<p>Lets assume the “$HOME/usr/share/rumodule” directory is used to store the
|
253
|
+
modules.</p>
|
254
|
+
|
255
|
+
<p>The directory content could be the following:</p>
|
256
|
+
|
257
|
+
<pre class="code ruby"><code class="ruby">tool1
|
258
|
+
tool2
|
259
|
+
tool3/1.2.3
|
260
|
+
/1.2.6
|
261
|
+
tool4
|
262
|
+
system-</code></pre>
|
263
|
+
|
264
|
+
<p>“tool1,2,4” are module files and “tool3” is a subdirectory including module
|
265
|
+
files “1.2.3” and “1.2.6”. “system-” is a system module file, which is
|
266
|
+
visible only with “savail” command. System module files are used to
|
267
|
+
separate between compulsory module files vs user selectable.</p>
|
268
|
+
|
269
|
+
<p>“tool3” has two versions and it could be referred for example with:</p>
|
270
|
+
|
271
|
+
<pre class="code ruby"><code class="ruby">rumo add tool3
|
272
|
+
rumo add tool3/1.2.6</code></pre>
|
273
|
+
|
274
|
+
<p>If version is left out, Rumodule uses one of the version. The selection is
|
275
|
+
performed by first sorting the directory entries and then selecting the
|
276
|
+
last.</p>
|
277
|
+
|
278
|
+
<p>Usually the user should specify the actual version requested when adding
|
279
|
+
the module and when removing the directory is enough.</p>
|
280
|
+
|
281
|
+
<p>Rumodule files can be hidden from the system by using the “.” prefix to
|
282
|
+
filename (as for “ls” shell utility“).</p>
|
283
|
+
|
284
|
+
<h1 id="label-Summary">Summary</h1>
|
285
|
+
|
286
|
+
<p>These steps are required to take Rumodule into use:</p>
|
287
|
+
<ul><li>
|
288
|
+
<p>Create Rumodule Files to dir.</p>
|
289
|
+
</li><li>
|
290
|
+
<p>Set RUMODULE env var to dir.</p>
|
291
|
+
</li><li>
|
292
|
+
<p>Setup rumo Shell Function.</p>
|
293
|
+
</li></ul>
|
294
|
+
</div></div>
|
295
|
+
|
296
|
+
<div id="footer">
|
297
|
+
Generated on Sat Mar 19 10:38:05 2016 by
|
298
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
299
|
+
0.8.7.6 (ruby-2.1.2).
|
300
|
+
</div>
|
301
|
+
|
302
|
+
</body>
|
303
|
+
</html>
|
data/doc/js/app.js
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
function createSourceLinks() {
|
2
|
+
$('.method_details_list .source_code').
|
3
|
+
before("<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>");
|
4
|
+
$('.toggleSource').toggle(function() {
|
5
|
+
$(this).parent().nextAll('.source_code').slideDown(100);
|
6
|
+
$(this).text("Hide source");
|
7
|
+
},
|
8
|
+
function() {
|
9
|
+
$(this).parent().nextAll('.source_code').slideUp(100);
|
10
|
+
$(this).text("View source");
|
11
|
+
});
|
12
|
+
}
|
13
|
+
|
14
|
+
function createDefineLinks() {
|
15
|
+
var tHeight = 0;
|
16
|
+
$('.defines').after(" <a href='#' class='toggleDefines'>more...</a>");
|
17
|
+
$('.toggleDefines').toggle(function() {
|
18
|
+
tHeight = $(this).parent().prev().height();
|
19
|
+
$(this).prev().show();
|
20
|
+
$(this).parent().prev().height($(this).parent().height());
|
21
|
+
$(this).text("(less)");
|
22
|
+
},
|
23
|
+
function() {
|
24
|
+
$(this).prev().hide();
|
25
|
+
$(this).parent().prev().height(tHeight);
|
26
|
+
$(this).text("more...");
|
27
|
+
});
|
28
|
+
}
|
29
|
+
|
30
|
+
function createFullTreeLinks() {
|
31
|
+
var tHeight = 0;
|
32
|
+
$('.inheritanceTree').toggle(function() {
|
33
|
+
tHeight = $(this).parent().prev().height();
|
34
|
+
$(this).parent().toggleClass('showAll');
|
35
|
+
$(this).text("(hide)");
|
36
|
+
$(this).parent().prev().height($(this).parent().height());
|
37
|
+
},
|
38
|
+
function() {
|
39
|
+
$(this).parent().toggleClass('showAll');
|
40
|
+
$(this).parent().prev().height(tHeight);
|
41
|
+
$(this).text("show all");
|
42
|
+
});
|
43
|
+
}
|
44
|
+
|
45
|
+
function fixBoxInfoHeights() {
|
46
|
+
$('dl.box dd.r1, dl.box dd.r2').each(function() {
|
47
|
+
$(this).prev().height($(this).height());
|
48
|
+
});
|
49
|
+
}
|
50
|
+
|
51
|
+
function searchFrameLinks() {
|
52
|
+
$('.full_list_link').click(function() {
|
53
|
+
toggleSearchFrame(this, $(this).attr('href'));
|
54
|
+
return false;
|
55
|
+
});
|
56
|
+
}
|
57
|
+
|
58
|
+
function toggleSearchFrame(id, link) {
|
59
|
+
var frame = $('#search_frame');
|
60
|
+
$('#search a').removeClass('active').addClass('inactive');
|
61
|
+
if (frame.attr('src') == link && frame.css('display') != "none") {
|
62
|
+
frame.slideUp(100);
|
63
|
+
$('#search a').removeClass('active inactive');
|
64
|
+
}
|
65
|
+
else {
|
66
|
+
$(id).addClass('active').removeClass('inactive');
|
67
|
+
frame.attr('src', link).slideDown(100);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
function linkSummaries() {
|
72
|
+
$('.summary_signature').click(function() {
|
73
|
+
document.location = $(this).find('a').attr('href');
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
function framesInit() {
|
78
|
+
if (hasFrames) {
|
79
|
+
document.body.className = 'frames';
|
80
|
+
$('#menu .noframes a').attr('href', document.location);
|
81
|
+
try {
|
82
|
+
window.top.document.title = $('html head title').text();
|
83
|
+
} catch(error) {
|
84
|
+
// some browsers will not allow this when serving from file://
|
85
|
+
// but we don't want to stop the world.
|
86
|
+
}
|
87
|
+
}
|
88
|
+
else {
|
89
|
+
$('#menu .noframes a').text('frames').attr('href', framesUrl);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
function keyboardShortcuts() {
|
94
|
+
if (window.top.frames.main) return;
|
95
|
+
$(document).keypress(function(evt) {
|
96
|
+
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
|
97
|
+
if (typeof evt.target !== "undefined" &&
|
98
|
+
(evt.target.nodeName == "INPUT" ||
|
99
|
+
evt.target.nodeName == "TEXTAREA")) return;
|
100
|
+
switch (evt.charCode) {
|
101
|
+
case 67: case 99: $('#class_list_link').click(); break; // 'c'
|
102
|
+
case 77: case 109: $('#method_list_link').click(); break; // 'm'
|
103
|
+
case 70: case 102: $('#file_list_link').click(); break; // 'f'
|
104
|
+
default: break;
|
105
|
+
}
|
106
|
+
});
|
107
|
+
}
|
108
|
+
|
109
|
+
function summaryToggle() {
|
110
|
+
$('.summary_toggle').click(function() {
|
111
|
+
if (localStorage) {
|
112
|
+
localStorage.summaryCollapsed = $(this).text();
|
113
|
+
}
|
114
|
+
$('.summary_toggle').each(function() {
|
115
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
116
|
+
var next = $(this).parent().parent().nextAll('ul.summary').first();
|
117
|
+
if (next.hasClass('compact')) {
|
118
|
+
next.toggle();
|
119
|
+
next.nextAll('ul.summary').first().toggle();
|
120
|
+
}
|
121
|
+
else if (next.hasClass('summary')) {
|
122
|
+
var list = $('<ul class="summary compact" />');
|
123
|
+
list.html(next.html());
|
124
|
+
list.find('.summary_desc, .note').remove();
|
125
|
+
list.find('a').each(function() {
|
126
|
+
$(this).html($(this).find('strong').html());
|
127
|
+
$(this).parent().html($(this)[0].outerHTML);
|
128
|
+
});
|
129
|
+
next.before(list);
|
130
|
+
next.toggle();
|
131
|
+
}
|
132
|
+
});
|
133
|
+
return false;
|
134
|
+
});
|
135
|
+
if (localStorage) {
|
136
|
+
if (localStorage.summaryCollapsed == "collapse") {
|
137
|
+
$('.summary_toggle').first().click();
|
138
|
+
}
|
139
|
+
else localStorage.summaryCollapsed = "expand";
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
function fixOutsideWorldLinks() {
|
144
|
+
$('a').each(function() {
|
145
|
+
if (window.location.host != this.host) this.target = '_parent';
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
function generateTOC() {
|
150
|
+
if ($('#filecontents').length === 0) return;
|
151
|
+
var _toc = $('<ol class="top"></ol>');
|
152
|
+
var show = false;
|
153
|
+
var toc = _toc;
|
154
|
+
var counter = 0;
|
155
|
+
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
156
|
+
var i;
|
157
|
+
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
158
|
+
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
|
159
|
+
var lastTag = parseInt(tags[0][1], 10);
|
160
|
+
$(tags.join(', ')).each(function() {
|
161
|
+
if ($(this).parents('.method_details .docstring').length != 0) return;
|
162
|
+
if (this.id == "filecontents") return;
|
163
|
+
show = true;
|
164
|
+
var thisTag = parseInt(this.tagName[1], 10);
|
165
|
+
if (this.id.length === 0) {
|
166
|
+
var proposedId = $(this).attr('toc-id');
|
167
|
+
if (typeof(proposedId) != "undefined") this.id = proposedId;
|
168
|
+
else {
|
169
|
+
var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
|
170
|
+
if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
|
171
|
+
this.id = proposedId;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
if (thisTag > lastTag) {
|
175
|
+
for (i = 0; i < thisTag - lastTag; i++) {
|
176
|
+
var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
if (thisTag < lastTag) {
|
180
|
+
for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
|
181
|
+
}
|
182
|
+
var title = $(this).attr('toc-title');
|
183
|
+
if (typeof(title) == "undefined") title = $(this).text();
|
184
|
+
toc.append('<li><a href="#' + this.id + '">' + title + '</a></li>');
|
185
|
+
lastTag = thisTag;
|
186
|
+
});
|
187
|
+
if (!show) return;
|
188
|
+
html = '<div id="toc"><p class="title"><a class="hide_toc" href="#"><strong>Table of Contents</strong></a> <small>(<a href="#" class="float_toc">left</a>)</small></p></div>';
|
189
|
+
$('#content').prepend(html);
|
190
|
+
$('#toc').append(_toc);
|
191
|
+
$('#toc .hide_toc').toggle(function() {
|
192
|
+
$('#toc .top').slideUp('fast');
|
193
|
+
$('#toc').toggleClass('hidden');
|
194
|
+
$('#toc .title small').toggle();
|
195
|
+
}, function() {
|
196
|
+
$('#toc .top').slideDown('fast');
|
197
|
+
$('#toc').toggleClass('hidden');
|
198
|
+
$('#toc .title small').toggle();
|
199
|
+
});
|
200
|
+
$('#toc .float_toc').toggle(function() {
|
201
|
+
$(this).text('float');
|
202
|
+
$('#toc').toggleClass('nofloat');
|
203
|
+
}, function() {
|
204
|
+
$(this).text('left');
|
205
|
+
$('#toc').toggleClass('nofloat');
|
206
|
+
});
|
207
|
+
}
|
208
|
+
|
209
|
+
$(framesInit);
|
210
|
+
$(createSourceLinks);
|
211
|
+
$(createDefineLinks);
|
212
|
+
$(createFullTreeLinks);
|
213
|
+
$(fixBoxInfoHeights);
|
214
|
+
$(searchFrameLinks);
|
215
|
+
$(linkSummaries);
|
216
|
+
$(keyboardShortcuts);
|
217
|
+
$(summaryToggle);
|
218
|
+
$(fixOutsideWorldLinks);
|
219
|
+
$(generateTOC);
|