sdoc_local_editor 0.3.17

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.
Files changed (59) hide show
  1. data/.gitignore +3 -0
  2. data/.rake_tasks~ +20 -0
  3. data/LICENSE +110 -0
  4. data/README.rdoc +37 -0
  5. data/Rakefile +12 -0
  6. data/bin/sdoc_local_editor +27 -0
  7. data/bin/sdoc_local_editor_merge +24 -0
  8. data/lib/rdoc/discover.rb +5 -0
  9. data/lib/rdoc/generator/template/merge/index.rhtml +14 -0
  10. data/lib/rdoc/generator/template/rails/_context.rhtml +210 -0
  11. data/lib/rdoc/generator/template/rails/_head.rhtml +7 -0
  12. data/lib/rdoc/generator/template/rails/class.rhtml +39 -0
  13. data/lib/rdoc/generator/template/rails/file.rhtml +37 -0
  14. data/lib/rdoc/generator/template/rails/index.rhtml +13 -0
  15. data/lib/rdoc/generator/template/rails/resources/apple-touch-icon.png +0 -0
  16. data/lib/rdoc/generator/template/rails/resources/css/github.css +129 -0
  17. data/lib/rdoc/generator/template/rails/resources/css/main.css +346 -0
  18. data/lib/rdoc/generator/template/rails/resources/css/panel.css +389 -0
  19. data/lib/rdoc/generator/template/rails/resources/css/reset.css +48 -0
  20. data/lib/rdoc/generator/template/rails/resources/favicon.ico +0 -0
  21. data/lib/rdoc/generator/template/rails/resources/i/arrows.png +0 -0
  22. data/lib/rdoc/generator/template/rails/resources/i/results_bg.png +0 -0
  23. data/lib/rdoc/generator/template/rails/resources/i/tree_bg.png +0 -0
  24. data/lib/rdoc/generator/template/rails/resources/js/highlight.pack.js +1 -0
  25. data/lib/rdoc/generator/template/rails/resources/js/jquery-1.3.2.min.js +19 -0
  26. data/lib/rdoc/generator/template/rails/resources/js/jquery-effect.js +593 -0
  27. data/lib/rdoc/generator/template/rails/resources/js/main.js +20 -0
  28. data/lib/rdoc/generator/template/rails/resources/js/searchdoc.js +441 -0
  29. data/lib/rdoc/generator/template/rails/resources/panel/index.html +73 -0
  30. data/lib/rdoc/generator/template/rails/se_index.rhtml +8 -0
  31. data/lib/rdoc/generator/template/sdoc/_context.rhtml +221 -0
  32. data/lib/rdoc/generator/template/sdoc/_head.rhtml +7 -0
  33. data/lib/rdoc/generator/template/sdoc/class.rhtml +39 -0
  34. data/lib/rdoc/generator/template/sdoc/file.rhtml +29 -0
  35. data/lib/rdoc/generator/template/sdoc/index.rhtml +13 -0
  36. data/lib/rdoc/generator/template/sdoc/resources/apple-touch-icon.png +0 -0
  37. data/lib/rdoc/generator/template/sdoc/resources/css/github.css +129 -0
  38. data/lib/rdoc/generator/template/sdoc/resources/css/main.css +333 -0
  39. data/lib/rdoc/generator/template/sdoc/resources/css/panel.css +384 -0
  40. data/lib/rdoc/generator/template/sdoc/resources/css/reset.css +48 -0
  41. data/lib/rdoc/generator/template/sdoc/resources/favicon.ico +0 -0
  42. data/lib/rdoc/generator/template/sdoc/resources/i/arrows.png +0 -0
  43. data/lib/rdoc/generator/template/sdoc/resources/i/results_bg.png +0 -0
  44. data/lib/rdoc/generator/template/sdoc/resources/i/tree_bg.png +0 -0
  45. data/lib/rdoc/generator/template/sdoc/resources/js/highlight.pack.js +1 -0
  46. data/lib/rdoc/generator/template/sdoc/resources/js/jquery-1.3.2.min.js +19 -0
  47. data/lib/rdoc/generator/template/sdoc/resources/js/jquery-effect.js +593 -0
  48. data/lib/rdoc/generator/template/sdoc/resources/js/main.js +24 -0
  49. data/lib/rdoc/generator/template/sdoc/resources/js/searchdoc.js +442 -0
  50. data/lib/rdoc/generator/template/sdoc/resources/panel/index.html +73 -0
  51. data/lib/rdoc/generator/template/sdoc/se_index.rhtml +8 -0
  52. data/lib/sdoc_local_editor.rb +9 -0
  53. data/lib/sdoc_local_editor/generator.rb +418 -0
  54. data/lib/sdoc_local_editor/github.rb +61 -0
  55. data/lib/sdoc_local_editor/helpers.rb +26 -0
  56. data/lib/sdoc_local_editor/merge.rb +223 -0
  57. data/lib/sdoc_local_editor/templatable.rb +60 -0
  58. data/sdoc_local_editor.gemspec +31 -0
  59. metadata +139 -0
@@ -0,0 +1,3 @@
1
+ pkg
2
+ doc
3
+ /test.rb
@@ -0,0 +1,20 @@
1
+ build
2
+ check_dependencies
3
+ check_dependencies:development
4
+ check_dependencies:runtime
5
+ gem_file_list
6
+ gemspec
7
+ gemspec:debug
8
+ gemspec:generate
9
+ gemspec:validate
10
+ ghost
11
+ git:release
12
+ github:release
13
+ install
14
+ release
15
+ test
16
+ version
17
+ version:bump:major
18
+ version:bump:minor
19
+ version:bump:patch
20
+ version:write
data/LICENSE ADDED
@@ -0,0 +1,110 @@
1
+ Copyright (c) 2011 Vladimir Kolesnikov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+
23
+
24
+ Darkfish RDoc HTML Generator
25
+
26
+ Copyright (c) 2007, 2008, Michael Granger. All rights reserved.
27
+
28
+ Redistribution and use in source and binary forms, with or without
29
+ modification, are permitted provided that the following conditions are met:
30
+
31
+ * Redistributions of source code must retain the above copyright notice,
32
+ this list of conditions and the following disclaimer.
33
+
34
+ * Redistributions in binary form must reproduce the above copyright notice,
35
+ this list of conditions and the following disclaimer in the documentation
36
+ and/or other materials provided with the distribution.
37
+
38
+ * Neither the name of the author/s, nor the names of the project's
39
+ contributors may be used to endorse or promote products derived from this
40
+ software without specific prior written permission.
41
+
42
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
46
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
51
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52
+
53
+
54
+ RDoc is copyrighted free software.
55
+
56
+ You can redistribute it and/or modify it under either the terms of the GPL
57
+ version 2 (see the file GPL), or the conditions below:
58
+
59
+ 1. You may make and give away verbatim copies of the source form of the
60
+ software without restriction, provided that you duplicate all of the
61
+ original copyright notices and associated disclaimers.
62
+
63
+ 2. You may modify your copy of the software in any way, provided that
64
+ you do at least ONE of the following:
65
+
66
+ a) place your modifications in the Public Domain or otherwise
67
+ make them Freely Available, such as by posting said
68
+ modifications to Usenet or an equivalent medium, or by allowing
69
+ the author to include your modifications in the software.
70
+
71
+ b) use the modified software only within your corporation or
72
+ organization.
73
+
74
+ c) give non-standard binaries non-standard names, with
75
+ instructions on where to get the original software distribution.
76
+
77
+ d) make other distribution arrangements with the author.
78
+
79
+ 3. You may distribute the software in object code or binary form,
80
+ provided that you do at least ONE of the following:
81
+
82
+ a) distribute the binaries and library files of the software,
83
+ together with instructions (in the manual page or equivalent)
84
+ on where to get the original distribution.
85
+
86
+ b) accompany the distribution with the machine-readable source of
87
+ the software.
88
+
89
+ c) give non-standard binaries non-standard names, with
90
+ instructions on where to get the original software distribution.
91
+
92
+ d) make other distribution arrangements with the author.
93
+
94
+ 4. You may modify and include the part of the software into any other
95
+ software (possibly commercial). But some files in the distribution
96
+ are not written by the author, so that they are not under these terms.
97
+
98
+ For the list of those files and their copying conditions, see the
99
+ file LEGAL.
100
+
101
+ 5. The scripts and library files supplied as input to or produced as
102
+ output from the software do not automatically fall under the
103
+ copyright of the software, but belong to whomever generated them,
104
+ and may be sold commercially, and may be aggregated with this
105
+ software.
106
+
107
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
108
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
109
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
110
+ PURPOSE.
@@ -0,0 +1,37 @@
1
+ = SDoc
2
+ == What's in?
3
+ - shtml - RDoc's generator to build searchable documentation
4
+ - <tt>sdoc-merge</tt> - comand line tool to build merge multiple sdoc documentations
5
+ packages into a single one
6
+ - <tt>sdoc</tt> - command line tool to run rdoc with generator=shtml
7
+
8
+ == Getting Started
9
+ sudo gem install sdoc
10
+ sdoc -N projectdir
11
+
12
+ == Command line sdoc
13
+ sdoc is simply a wrapper to rdoc command line tool. see <tt>sdoc --help </tt>
14
+ for more details. <tt>--fmt</tt> is set to shtml by default.
15
+ Default template <tt>-T</tt> is shtml. You can also use 'direct' template.
16
+ Example:
17
+ <tt>sdoc -o doc/rails -T direct rails</tt>
18
+
19
+ == Rake
20
+ # Rakefile
21
+ require 'sdoc' # and use your RDoc task the same way you used it before
22
+
23
+ Rake::RDocTask.new do |rdoc|
24
+ rdoc.rdoc_dir = 'doc/rdoc'
25
+ rdoc.options << '--fmt' << 'shtml' # explictly set shtml generator
26
+ rdoc.template = 'direct' # lighter template used on railsapi.com
27
+ ...
28
+ end
29
+
30
+ == sdoc-merge
31
+ Usage: sdoc-merge [options] directories
32
+ -n, --names [NAMES] Names of merged repositories. Comma separated
33
+ -o, --op [DIRECTORY] Set the output directory
34
+ -t, --title [TITLE] Set the title of merged file
35
+
36
+ Example:
37
+ <tt>sdoc-merge --title "Ruby v1.9, Rails v2.3.2.1" --op merged --names "Ruby,Rails" ruby-v1.9 rails-v2.3.2.1</tt>
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ gem 'rspec', '>= 2.5.0'
7
+ require 'rspec/core/rake_task'
8
+
9
+ desc "Run all specs"
10
+ RSpec::Core::RakeTask.new(:spec)
11
+ task :default => :spec
12
+ task :test => :spec
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby -KU
2
+ require 'sdoc_local_editor'
3
+
4
+ begin
5
+ ARGV.push('--format=sdoc') if ARGV.grep(/\A(-f|--fmt|--format|-r|-R|--ri|--ri-site)\b/).empty?
6
+ r = RDoc::RDoc.new
7
+ r.document ARGV
8
+ rescue SystemExit
9
+ raise
10
+ rescue Exception => e
11
+ if $DEBUG_RDOC then
12
+ $stderr.puts e.message
13
+ $stderr.puts "#{e.backtrace.join "\n\t"}"
14
+ $stderr.puts
15
+ elsif Interrupt === e then
16
+ $stderr.puts
17
+ $stderr.puts 'Interrupted'
18
+ else
19
+ $stderr.puts "uh-oh! RDoc had a problem:"
20
+ $stderr.puts e.message
21
+ $stderr.puts
22
+ $stderr.puts "run with --debug for full backtrace"
23
+ end
24
+
25
+ exit 1
26
+ end
27
+
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby -KU
2
+ require File.dirname(__FILE__) + '/../lib/sdoc_local_editor' # add extensions
3
+ require 'sdoc_local_editor/merge'
4
+
5
+ begin
6
+ m = SDoc::Merge.new
7
+ m.merge(ARGV)
8
+ rescue SystemExit
9
+ raise
10
+ rescue Exception => e
11
+ if $DEBUG_RDOC then
12
+ $stderr.puts e.message
13
+ $stderr.puts "#{e.backtrace.join "\n\t"}"
14
+ $stderr.puts
15
+ elsif Interrupt === e then
16
+ $stderr.puts
17
+ $stderr.puts 'Interrupted'
18
+ else
19
+ $stderr.puts "uh-oh! SDoc merge had a problem:"
20
+ $stderr.puts e.message
21
+ end
22
+ exit 1
23
+ end
24
+
@@ -0,0 +1,5 @@
1
+ begin
2
+ gem 'rdoc', '~> 3'
3
+ require File.join(File.dirname(__FILE__), '/../sdoc_local_editor')
4
+ rescue Gem::LoadError
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html
2
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
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
+
8
+ <title><%= @title %></title>
9
+ </head>
10
+ <frameset cols="300,*" frameborder="1" border="1" bordercolor="#999999" framespacing="1">
11
+ <frame src="panel/index.html" title="Search" name="panel" />
12
+ <frame src="<%= index_path %>" name="docwin" />
13
+ </frameset>
14
+ </html>
@@ -0,0 +1,210 @@
1
+ <div id="content">
2
+ <% unless (description = context.description).empty? %>
3
+ <div class="description">
4
+ <%= description %>
5
+ </div>
6
+ <% end %>
7
+
8
+
9
+ <% unless context.requires.empty? %>
10
+ <!-- File only: requires -->
11
+ <div class="sectiontitle">Required Files</div>
12
+ <ul>
13
+ <% context.requires.each do |req| %>
14
+ <li><%= h req.name %></li>
15
+ <% end %>
16
+ </ul>
17
+ <% end %>
18
+
19
+
20
+ <% sections = context.sections.select { |s| s.title }.sort_by{ |s| s.title.to_s } %>
21
+ <% unless sections.empty? then %>
22
+ <!-- Sections -->
23
+ <div class="sectiontitle">Sections</div>
24
+ <ul>
25
+ <% sections.each do |section| %>
26
+ <li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
27
+ <% end %>
28
+ </ul>
29
+ <% end %>
30
+
31
+
32
+ <% unless context.classes_and_modules.empty? %>
33
+ <!-- Namespace -->
34
+ <div class="sectiontitle">Namespace</div>
35
+ <ul>
36
+ <% (context.modules.sort + context.classes.sort).each do |mod| %>
37
+ <li>
38
+ <span class="type"><%= mod.type.upcase %></span>
39
+ <a href="<%= context.aref_to mod.path %>"><%= mod.full_name %></a>
40
+ </li>
41
+ <% end %>
42
+ </ul>
43
+ <% end %>
44
+
45
+
46
+ <% unless context.method_list.empty? %>
47
+ <!-- Method ref -->
48
+ <div class="sectiontitle">Methods</div>
49
+ <dl class="methods">
50
+ <% each_letter_group(context.method_list) do |group| %>
51
+ <dt><%= group[:name] %></dt>
52
+ <dd>
53
+ <ul>
54
+ <% group[:methods].each_with_index do |method, i| %>
55
+ <%
56
+ comma = group[:methods].size == i+1 ? '' : ','
57
+ %>
58
+ <li>
59
+ <a href="#<%= method.aref %>"><%= h method.name %></a><%= comma %>
60
+ </li>
61
+ <% end %>
62
+ </ul>
63
+ </dd>
64
+ <% end %>
65
+ </dl>
66
+ <% end %>
67
+
68
+ <% unless context.includes.empty? %>
69
+ <!-- Includes -->
70
+ <div class="sectiontitle">Included Modules</div>
71
+ <ul>
72
+ <% context.includes.each do |inc| %>
73
+ <li>
74
+ <% unless String === inc.module %>
75
+ <a href="<%= context.aref_to inc.module.path %>">
76
+ <%= h inc.module.full_name %>
77
+ </a>
78
+ <% else %>
79
+ <%= h inc.name %>
80
+ <% end %>
81
+ </li>
82
+ <% end %>
83
+ </ul>
84
+ <% end %>
85
+
86
+
87
+
88
+ <% context.each_section do |section, constants, attributes| %>
89
+
90
+ <% if section.title then %>
91
+ <div class="contenttitle" id="<%= h section.aref %>">
92
+ <%= h section.title %>
93
+ </div>
94
+ <% end %>
95
+
96
+ <% if section.comment then %>
97
+ <div class="description">
98
+ <%= section.description %>
99
+ </div>
100
+ <% end %>
101
+
102
+ <% unless constants.empty? %>
103
+ <!-- Section constants -->
104
+ <div class="sectiontitle">Constants</div>
105
+ <table border='0' cellpadding='5'>
106
+ <% context.each_constant do |const| %>
107
+ <tr valign='top'>
108
+ <td class="attr-name"><%= h const.name %></td>
109
+ <td>=</td>
110
+ <td class="attr-value"><%= h const.value %></td>
111
+ </tr>
112
+ <% if const.comment %>
113
+ <tr valign='top'>
114
+ <td>&nbsp;</td>
115
+ <td colspan="2" class="attr-desc"><%= const.description.strip %></td>
116
+ </tr>
117
+ <% end %>
118
+ <% end %>
119
+ </table>
120
+ <% end %>
121
+
122
+
123
+ <% unless attributes.empty? %>
124
+ <!-- Section attributes -->
125
+ <div class="sectiontitle">Attributes</div>
126
+ <table border='0' cellpadding='5'>
127
+ <% attributes.each do |attrib| %>
128
+ <tr valign='top'>
129
+ <td class='attr-rw'>
130
+ [<%= attrib.rw %>]
131
+ </td>
132
+ <td class='attr-name'><%= h attrib.name %></td>
133
+ <td class='attr-desc'><%= attrib.description.strip %></td>
134
+ </tr>
135
+ <% end %>
136
+ </table>
137
+ <% end %>
138
+
139
+
140
+ <!-- Methods -->
141
+ <%
142
+ context.methods_by_type(section).each do |type, visibilities|
143
+ next if visibilities.empty?
144
+
145
+ visibilities.each do |visibility, methods|
146
+ next if methods.empty?
147
+ %>
148
+ <div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
149
+ <% methods.each do |method| %>
150
+ <div class="method">
151
+ <div class="title method-title" id="<%= method.aref %>">
152
+ <% if method.call_seq %>
153
+ <b><%= method.call_seq.gsub(/->/, '&rarr;') %></b>
154
+ <% else %>
155
+ <b><%= h method.name %></b><%= h method.params %>
156
+ <% end %>
157
+ <a href="<%= "#{rel_prefix}/#{context.path}##{method.aref}"%>" name="<%= method.aref %>" class="permalink">Link</a>
158
+ </div>
159
+
160
+ <% if method.comment %>
161
+ <div class="description">
162
+ <%= method.description.strip %>
163
+ </div>
164
+ <% end %>
165
+
166
+ <% unless method.aliases.empty? %>
167
+ <div class="aka">
168
+ Also aliased as: <%= method.aliases.map do |aka|
169
+ if aka.parent then # HACK lib/rexml/encodings
170
+ %{<a href="#{context.aref_to aka.path}">#{h aka.name}</a>}
171
+ else
172
+ h aka.name
173
+ end
174
+ end.join ", " %>
175
+ </div>
176
+ <% end %>
177
+
178
+ <% if method.token_stream %>
179
+ <% markup = method.sdoc_markup_code %>
180
+ <div class="sourcecode">
181
+ <%
182
+ # generate github link
183
+ github = if options.github
184
+ if markup =~ /File\s(\S+), line (\d+)/
185
+ path = $1
186
+ line = $2.to_i
187
+ end
188
+ path && github_url(path)
189
+ else
190
+ false
191
+ end
192
+ %>
193
+ <p class="source-link">
194
+ Source:
195
+ <a href="javascript:toggleSource('<%= method.aref %>_source')" id="l_<%= method.aref %>_source">show</a>
196
+ <% if github %>
197
+ | <a href="<%= "#{github}#L#{line}" %>" target="_blank" class="github_url">on GitHub</a>
198
+ <% end %>
199
+ </p>
200
+ <div id="<%= method.aref %>_source" class="dyn-source">
201
+ <pre><%= markup %></pre>
202
+ </div>
203
+ </div>
204
+ <% end %>
205
+ </div>
206
+ <% end #methods.each %>
207
+ <% end #visibilities.each %>
208
+ <% end #context.methods_by_type %>
209
+ <% end #context.each_section %>
210
+ </div>