dtf 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. data/.rspec +1 -1
  2. data/.travis.yml +7 -2
  3. data/Gemfile +3 -2
  4. data/README.md +105 -6
  5. data/Rakefile +2 -0
  6. data/app/models/analysis_case.rb +1 -1
  7. data/app/models/case_test.rb +1 -1
  8. data/app/models/user.rb +3 -2
  9. data/app/models/verification_suite.rb +1 -1
  10. data/bin/dtf +23 -20
  11. data/db/seeds.rb +4 -0
  12. data/doc/AnalysisCase.html +123 -0
  13. data/doc/CaseTest.html +123 -0
  14. data/doc/Dtf.html +129 -0
  15. data/doc/Dtf/DtfCommands.html +471 -0
  16. data/doc/User.html +123 -0
  17. data/doc/VerificationSuite.html +123 -0
  18. data/doc/_index.html +171 -0
  19. data/doc/class_list.html +53 -0
  20. data/doc/css/common.css +1 -0
  21. data/doc/css/full_list.css +57 -0
  22. data/doc/css/style.css +328 -0
  23. data/doc/file.README.html +256 -0
  24. data/doc/file_list.html +55 -0
  25. data/doc/frames.html +28 -0
  26. data/doc/index.html +256 -0
  27. data/doc/js/app.js +214 -0
  28. data/doc/js/full_list.js +173 -0
  29. data/doc/js/jquery.js +4 -0
  30. data/doc/method_list.html +100 -0
  31. data/doc/top-level-namespace.html +274 -0
  32. data/dtf.gemspec +3 -1
  33. data/lib/config/environment.rb +1 -1
  34. data/lib/dtf.rb +85 -2
  35. data/lib/dtf/dtf_error_system.rb +16 -0
  36. data/lib/dtf/dtf_help_system.rb +55 -0
  37. data/lib/dtf/version.rb +2 -2
  38. data/lib/tasks/setup.thor +5 -3
  39. data/spec/acceptance/create_basic_associations.feature +13 -0
  40. data/spec/acceptance/implement_help_system.feature +16 -0
  41. data/spec/fabricators/analysis_case_fabricator.rb +1 -1
  42. data/spec/fabricators/case_test_fabricator.rb +1 -1
  43. data/spec/fabricators/user_fabricator.rb +4 -4
  44. data/spec/fabricators/verification_suite_fabricator.rb +1 -1
  45. data/spec/models/analysis_case_spec.rb +53 -11
  46. data/spec/models/case_test_spec.rb +57 -11
  47. data/spec/models/user_spec.rb +46 -11
  48. data/spec/models/verification_suite_spec.rb +52 -12
  49. data/spec/spec_helper.rb +21 -1
  50. data/spec/steps/feature_steps.rb +14 -12
  51. data/spec/support/custom_matchers/model_steps.rb +17 -18
  52. metadata +77 -18
  53. data/bin/dtf-create_user +0 -11
  54. data/bin/dtf-create_vs +0 -10
  55. data/bin/dtf-delete_user +0 -18
  56. data/bin/dtf-delete_vs +0 -14
  57. data/bin/dtf-setup +0 -7
  58. data/spec/acceptance/0001_create_basic_models.feature +0 -9
  59. data/spec/acceptance/0002_create_basic_associations.feature +0 -11
  60. data/spec/acceptance/0003_execute_help_switch.feature +0 -7
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <base id="base_target" target="_parent" />
19
+ </head>
20
+ <body>
21
+ <script type="text/javascript" charset="utf-8">
22
+ if (window.top.frames.main) {
23
+ document.getElementById('base_target').target = 'main';
24
+ document.body.className = 'frames';
25
+ }
26
+ </script>
27
+ <div id="content">
28
+ <h1 id="full_list_header">File List</h1>
29
+ <div id="nav">
30
+
31
+ <span><a target="_self" href="class_list.html">
32
+ Classes
33
+ </a></span>
34
+
35
+ <span><a target="_self" href="method_list.html">
36
+ Methods
37
+ </a></span>
38
+
39
+ <span><a target="_self" href="file_list.html">
40
+ Files
41
+ </a></span>
42
+
43
+ </div>
44
+ <div id="search">Search: <input type="text" /></div>
45
+
46
+ <ul id="full_list" class="file">
47
+
48
+
49
+ <li class="r1"><a href="index.html" title="README">README</a></li>
50
+
51
+
52
+ </ul>
53
+ </div>
54
+ </body>
55
+ </html>
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.8.2.1</title>
8
+ </head>
9
+ <script type="text/javascript" charset="utf-8">
10
+ window.onload = function() {
11
+ var match = window.location.hash.match(/^#!(.+)/);
12
+ var name = 'index.html';
13
+ if (match) {
14
+ name = unescape(match[1]);
15
+ }
16
+ document.writeln('<frameset cols="20%,*">' +
17
+ '<frame name="list" src="class_list.html" />' +
18
+ '<frame name="main" src="' + name + '" />' +
19
+ '</frameset>');
20
+ }
21
+ </script>
22
+ <noscript>
23
+ <frameset cols="20%,*">
24
+ <frame name="list" src="class_list.html" />
25
+ <frame name="main" src="index.html" />
26
+ </frameset>
27
+ </noscript>
28
+ </html>
@@ -0,0 +1,256 @@
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
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
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> &raquo;
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'><h1>Deryls Testing Framework</h1>
65
+
66
+ <p>DTF is designed to be a modular framework for testing everything from shell scripts, to Ruby, to Rails apps.</p>
67
+
68
+ <p>DTF is an umbrella which is designed to incorporate multiple sub-gems, each of which provides additional
69
+ functionality to DTF. DTF is the master skeleton within which all other dtf-* gems integrate.</p>
70
+
71
+ <h2>Internal architecture</h2>
72
+
73
+ <p>DTF is designed in such a way that, with the master skeleton in place, one has only to load additional plugins
74
+ from any available DTF extension gem to add additional functionality. This can be anything ranging from
75
+ additional languages such as Ruby, Python, C, C++, etc, to testing methods and methodologies.</p>
76
+
77
+ <h2>Current Status</h2>
78
+
79
+ <p>DTF is 100% Alpha quality right now. For those that don&#39;t know what that means, generally this means DTF is
80
+ comprised of code with a vastly high potential for buggy code that may or may not even run. Consider DTF
81
+ to be experimental until further notice. This README will be updated to reflect when DTF reaches a
82
+ &#39;stable&#39; quality.</p>
83
+
84
+ <pre class="code ruby"><code>DTF will gladly, and willingly, review any Pull Requests sent to us, and incorporate them as they fit with
85
+ the mission goal of DTF. Please bear in mind that DTF is a rolling Project. This means that the definition
86
+ of what DTF is, and how that is implemented is not firmly etched in stone yet, so both of those can, and
87
+ most likely will, change as time passes. If you can deal with that, please, by all means, feel free to
88
+ contribute.
89
+
90
+ **NOTE: DTF was originally released with a soon-to-be 100% different codebase, and gemified. This version
91
+ will be gemified as well, _but_ in order to ensure that we can continue to use the 'dtf' name on
92
+ rubygems.org we have to bump the version number by .1 and go from there. So, that changes our new
93
+ numbering scheme a bit. The next release of 'dtf' that will be 100% the _new_ codebase will be 0.2.2. The
94
+ last 'dtf' that is the original code base is: dtf-0.2.1 on rubygems.org. Thanks for bearing with DTF while
95
+ the codebase change is swapped over.
96
+ </code></pre>
97
+
98
+ <h2>Branches</h2>
99
+
100
+ <pre class="code ruby"><code>DTF has a branching and tagging topology as follows, and applies to DTF and _all_ sub-module gems:
101
+
102
+ * master - This branch on the DTF control gem, and _all_ dtf-&lt;blah&gt; sub-module gems is for **development**
103
+
104
+ * stable - This branch on the DTF gem, and _all_ dtf-&lt;blah&gt; sub-modules, is 'stable' or 'production'
105
+ quality. Anything on this branch is to be considered safe and usable for everyday stuff.
106
+
107
+ * hotfix/&gt;blah&gt; branches are **stable** quality only. These are for running fixes to a particular stable
108
+ branch and will usually result in generating a new version tag. For example, if the hotfix was applied
109
+ against v2.3.4, then a tag of v2.3.5 would be generated once that hotfix was proven to be tested and
110
+ stable.
111
+
112
+ * feature/&lt;blah&gt; branches are **development** quality only. This is for work on individual new features
113
+ that _will_ be rolled into DTF or sub-module gems.
114
+
115
+ * playground/&lt;blah&gt; branches are **alpha** quality only. These are for developers to work out either
116
+ feasibilty of way-in-the-future ideas or to try something out that may, or may not, be incorporated into
117
+ the DTF or its sub-modules. _These are 100% to9 be considered throw-aways. They could disappear at any
118
+ moment, and any user of the DTF framework that relies on these branches is on their own. NO SUPPORT will
119
+ be provided of any kind for these branches_ so everyone is clear on that.
120
+
121
+ * All 'stable' production releases will be tagged. Only those releases will be tagged starting with a v,
122
+ and a series like #.#.# where the first '#' starts with 1 going to whatever, in progressive order. This
123
+ represents an industry standard versioning format. NOTE: v0.#.# is NOT considered a 'stable' release!
124
+ This is normal in the industry for Projects just starting out. When a version is reached that we believe
125
+ to be of sufficient quality to be denoted, and tagged, as our first Stable release, it will be marked as
126
+ v1.#.# and NOT v0.#.#. The remaining '#' in the example denote our Minor, and Change '#' levels. For
127
+ example, #.#.# is Major.Minor.Change_Number_within_Minor. This means the following. Given a 'v2.3.4' tag,
128
+ this would denote:
129
+
130
+ * The 2nd official 'stable' release.
131
+ * The 3rd Minor change to the 2.x series
132
+ * The 4th applied change within the 3rd Minor series.
133
+ </code></pre>
134
+
135
+ <p>Until such time as the first official stable release is made, all v0.#.# tags up to but not including v0.5.0
136
+ are of Alpha quality. Tags v0.5.# up to but not including v1.0.0 are to be considered Beta quality. This gives
137
+ us plenty of room for Alpha <em>and</em> Beta work before an official &#39;stable&#39; release within the numbering system.
138
+ ** This applies to the DTF control gem, and <em>all</em> dtf-<blah> sub-module gems! Please bear this in mind! **</p>
139
+
140
+ <p>We are making this a uniform policy across all levels of DTF to ensure that what you think something is,
141
+ really is when it comes to version numbers and what they mean. This <em>will</em> be a <em>strictly</em> enforced policy.</p>
142
+
143
+ <h2>Installation</h2>
144
+
145
+ <p>DTF uses Thor for setup and configuration, and has 3 possible sub-tasks under task name &#39;dtf_setup&#39;:</p>
146
+
147
+ <pre class="code sh"><code>∴ thor list
148
+ dtf_setup
149
+ ---------
150
+ thor dtf_setup:config [NAME] # Copy db configuration file(s)
151
+ thor dtf_setup:install # Installs database migrations, the main schema, and configuration files
152
+ </code></pre>
153
+
154
+ <p>As you can see, you can copy just the db config files, and/or the migrations, and main schema.</p>
155
+
156
+ <pre class="code sh"><code>∴ thor help dtf_setup
157
+ Tasks:
158
+ thor dtf_setup:config [NAME] # Copy db configuration file(s)
159
+ thor dtf_setup:help [TASK] # Describe available tasks or one specific task
160
+ thor dtf_setup:install # Installs database migrations, the main schema, and configuration files
161
+ </code></pre>
162
+
163
+ <p>To see how to install everything you would run the following command:</p>
164
+
165
+ <pre class="code sh"><code>∴ thor dtf_setup:help install
166
+ Usage:
167
+ thor dtf_setup:install
168
+
169
+ Options:
170
+ [--force]
171
+
172
+ Installs database migrations, the main schema, and configuration files
173
+ </code></pre>
174
+
175
+ <p>To see how to install just the configuration files for accessing the database(s), you would run:</p>
176
+
177
+ <pre class="code sh"><code>∴ thor dtf_setup:help config
178
+ Usage:
179
+ thor dtf_setup:config [NAME]
180
+
181
+ Options:
182
+ [--force]
183
+
184
+ Copy db configuration file(s)
185
+ </code></pre>
186
+
187
+ <p>Once the configuration files and/or database migrations are in place, the remaining setup is handled by &#39;rake&#39;.
188
+ To see all possible commands, you would run &#39;rake -T&#39;, and pick the one(s) you need.</p>
189
+
190
+ <pre class="code sh"><code>∴ rake -T
191
+ rake build # Build dtf-0.2.2.gem into the pkg directory
192
+ rake db:create # Create the database from config/database.yml for the current Rails.env (use db:create:all to create all dbs i...
193
+ rake db:drop # Drops the database for the current Rails.env (use db:drop:all to drop all databases)
194
+ rake db:fixtures:load # Load fixtures into the current environment's database.
195
+ rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false).
196
+ rake db:migrate:status # Display status of migrations
197
+ rake db:new_migration # Create a new migration
198
+ rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
199
+ rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
200
+ rake db:schema:load # Load a schema.rb file into the database
201
+ rake db:seed # Load the seed data from db/seeds.rb
202
+ rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
203
+ rake db:structure:dump # Dump the database structure to db/structure.sql. Specify another file with DB_STRUCTURE=db/my_structure.sql
204
+ rake db:version # Retrieves the current schema version number
205
+ rake install # Build and install dtf-0.2.2.gem into system gems
206
+ rake release # Create tag v0.2.2 and build and push dtf-0.2.2.gem to Rubygems
207
+ </code></pre>
208
+
209
+ <h2>Usage</h2>
210
+
211
+ <p>Once you have finished configuring your database(s) and applying all migrations, you are now ready to work with
212
+ DTF directly. The following is a summary of all current possible commands, and their expected options/parameters:</p>
213
+
214
+ <pre class="code sh"><code>dtf -v|--version -h|--help [[sub_cmds &lt;options&gt;] -h|--help]
215
+
216
+ Valid [sub_cmds] are: create_(user|vs), delete_(user|vs)
217
+ See 'dtf [sub_cmd] -h' for each sub_cmd's details and options
218
+
219
+ dtf create_user -h
220
+ Options:
221
+ --user-name, -u &lt;s&gt;: Username for new TF user - REQUIRED
222
+ --full-name, -n &lt;s&gt;: Real name for new TF user - REQUIRED
223
+ --email-address, -e &lt;s&gt;: Email address for new TF user - REQUIRED
224
+ --help, -h: Show this message
225
+
226
+ dtf delete_user -h
227
+ Options:
228
+ --user-name, -u &lt;s&gt;: Username of TF user to delete - REQUIRED
229
+ --delete-all, --no-delete-all, -d: Delete _all_ VSs this user owns (default: true)
230
+ --help, -h: Show this message
231
+
232
+ dtf create_vs -h
233
+ Options:
234
+ --user-name, -u &lt;s&gt;: TF user to associate this VS with - REQUIRED
235
+ --name, -n &lt;s&gt;: Name for new VS - REQUIRED
236
+ --description, -d &lt;s&gt;: Description of VS's intended use - OPTIONAL (default: )
237
+ --help, -h: Show this message
238
+
239
+ dtf delete_vs -h
240
+ Options:
241
+ --user-name, -u &lt;s&gt;: Username of VS owner - REQUIRED
242
+ --id, -i &lt;i&gt;: ID of VS to be deleted - REQUIRED
243
+ --help, -h: Show this message
244
+ </code></pre>
245
+
246
+ <p>Enjoy!</p>
247
+ </div></div>
248
+
249
+ <div id="footer">
250
+ Generated on Fri Sep 14 22:41:20 2012 by
251
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
252
+ 0.8.2.1 (ruby-1.9.3).
253
+ </div>
254
+
255
+ </body>
256
+ </html>
@@ -0,0 +1,214 @@
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
+ window.top.document.title = $('html head title').text();
82
+ }
83
+ else {
84
+ $('#menu .noframes a').text('frames').attr('href', framesUrl);
85
+ }
86
+ }
87
+
88
+ function keyboardShortcuts() {
89
+ if (window.top.frames.main) return;
90
+ $(document).keypress(function(evt) {
91
+ if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
92
+ if (typeof evt.target !== "undefined" &&
93
+ (evt.target.nodeName == "INPUT" ||
94
+ evt.target.nodeName == "TEXTAREA")) return;
95
+ switch (evt.charCode) {
96
+ case 67: case 99: $('#class_list_link').click(); break; // 'c'
97
+ case 77: case 109: $('#method_list_link').click(); break; // 'm'
98
+ case 70: case 102: $('#file_list_link').click(); break; // 'f'
99
+ default: break;
100
+ }
101
+ });
102
+ }
103
+
104
+ function summaryToggle() {
105
+ $('.summary_toggle').click(function() {
106
+ if (localStorage) {
107
+ localStorage.summaryCollapsed = $(this).text();
108
+ }
109
+ $('.summary_toggle').each(function() {
110
+ $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
111
+ var next = $(this).parent().parent().nextAll('ul.summary').first();
112
+ if (next.hasClass('compact')) {
113
+ next.toggle();
114
+ next.nextAll('ul.summary').first().toggle();
115
+ }
116
+ else if (next.hasClass('summary')) {
117
+ var list = $('<ul class="summary compact" />');
118
+ list.html(next.html());
119
+ list.find('.summary_desc, .note').remove();
120
+ list.find('a').each(function() {
121
+ $(this).html($(this).find('strong').html());
122
+ $(this).parent().html($(this)[0].outerHTML);
123
+ });
124
+ next.before(list);
125
+ next.toggle();
126
+ }
127
+ });
128
+ return false;
129
+ });
130
+ if (localStorage) {
131
+ if (localStorage.summaryCollapsed == "collapse") {
132
+ $('.summary_toggle').first().click();
133
+ }
134
+ else localStorage.summaryCollapsed = "expand";
135
+ }
136
+ }
137
+
138
+ function fixOutsideWorldLinks() {
139
+ $('a').each(function() {
140
+ if (window.location.host != this.host) this.target = '_parent';
141
+ });
142
+ }
143
+
144
+ function generateTOC() {
145
+ if ($('#filecontents').length === 0) return;
146
+ var _toc = $('<ol class="top"></ol>');
147
+ var show = false;
148
+ var toc = _toc;
149
+ var counter = 0;
150
+ var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
151
+ var i;
152
+ if ($('#filecontents h1').length > 1) tags.unshift('h1');
153
+ for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
154
+ var lastTag = parseInt(tags[0][1], 10);
155
+ $(tags.join(', ')).each(function() {
156
+ if ($(this).parents('.method_details .docstring').length != 0) return;
157
+ if (this.id == "filecontents") return;
158
+ show = true;
159
+ var thisTag = parseInt(this.tagName[1], 10);
160
+ if (this.id.length === 0) {
161
+ var proposedId = $(this).attr('toc-id');
162
+ if (typeof(proposedId) != "undefined") this.id = proposedId;
163
+ else {
164
+ var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
165
+ if ($('#' + proposedId).length > 0) { proposedId += counter; counter++; }
166
+ this.id = proposedId;
167
+ }
168
+ }
169
+ if (thisTag > lastTag) {
170
+ for (i = 0; i < thisTag - lastTag; i++) {
171
+ var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
172
+ }
173
+ }
174
+ if (thisTag < lastTag) {
175
+ for (i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
176
+ }
177
+ var title = $(this).attr('toc-title');
178
+ if (typeof(title) == "undefined") title = $(this).text();
179
+ toc.append('<li><a href="#' + this.id + '">' + title + '</a></li>');
180
+ lastTag = thisTag;
181
+ });
182
+ if (!show) return;
183
+ 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>';
184
+ $('#content').prepend(html);
185
+ $('#toc').append(_toc);
186
+ $('#toc .hide_toc').toggle(function() {
187
+ $('#toc .top').slideUp('fast');
188
+ $('#toc').toggleClass('hidden');
189
+ $('#toc .title small').toggle();
190
+ }, function() {
191
+ $('#toc .top').slideDown('fast');
192
+ $('#toc').toggleClass('hidden');
193
+ $('#toc .title small').toggle();
194
+ });
195
+ $('#toc .float_toc').toggle(function() {
196
+ $(this).text('float');
197
+ $('#toc').toggleClass('nofloat');
198
+ }, function() {
199
+ $(this).text('left');
200
+ $('#toc').toggleClass('nofloat');
201
+ });
202
+ }
203
+
204
+ $(framesInit);
205
+ $(createSourceLinks);
206
+ $(createDefineLinks);
207
+ $(createFullTreeLinks);
208
+ $(fixBoxInfoHeights);
209
+ $(searchFrameLinks);
210
+ $(linkSummaries);
211
+ $(keyboardShortcuts);
212
+ $(summaryToggle);
213
+ $(fixOutsideWorldLinks);
214
+ $(generateTOC);