prepor-erlapi 0.1.8
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.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +15 -0
- data/Rakefile +56 -0
- data/VERSION +1 -0
- data/bin/erlapi +26 -0
- data/erlapi.gemspec +138 -0
- data/lib/erlapi/generator/shtml.rb +353 -0
- data/lib/erlapi/generator/template/direct/_context.rhtml +172 -0
- data/lib/erlapi/generator/template/direct/class.rhtml +40 -0
- data/lib/erlapi/generator/template/direct/file.rhtml +30 -0
- data/lib/erlapi/generator/template/direct/index.rhtml +14 -0
- data/lib/erlapi/generator/template/direct/resources/apple-touch-icon.png +0 -0
- data/lib/erlapi/generator/template/direct/resources/css/main.css +263 -0
- data/lib/erlapi/generator/template/direct/resources/css/panel.css +383 -0
- data/lib/erlapi/generator/template/direct/resources/css/reset.css +53 -0
- data/lib/erlapi/generator/template/direct/resources/favicon.ico +0 -0
- data/lib/erlapi/generator/template/direct/resources/i/arrows.png +0 -0
- data/lib/erlapi/generator/template/direct/resources/i/results_bg.png +0 -0
- data/lib/erlapi/generator/template/direct/resources/i/tree_bg.png +0 -0
- data/lib/erlapi/generator/template/direct/resources/js/jquery-1.3.2.min.js +19 -0
- data/lib/erlapi/generator/template/direct/resources/js/jquery-effect.js +593 -0
- data/lib/erlapi/generator/template/direct/resources/js/main.js +22 -0
- data/lib/erlapi/generator/template/direct/resources/js/searchdoc.js +628 -0
- data/lib/erlapi/generator/template/direct/resources/panel/index.html +71 -0
- data/lib/erlapi/generator/template/merge/index.rhtml +14 -0
- data/lib/erlapi/generator/template/shtml/_context.rhtml +164 -0
- data/lib/erlapi/generator/template/shtml/class.rhtml +46 -0
- data/lib/erlapi/generator/template/shtml/file.rhtml +37 -0
- data/lib/erlapi/generator/template/shtml/index.rhtml +14 -0
- data/lib/erlapi/generator/template/shtml/resources/apple-touch-icon.png +0 -0
- data/lib/erlapi/generator/template/shtml/resources/css/main.css +191 -0
- data/lib/erlapi/generator/template/shtml/resources/css/panel.css +383 -0
- data/lib/erlapi/generator/template/shtml/resources/css/reset.css +53 -0
- data/lib/erlapi/generator/template/shtml/resources/favicon.ico +0 -0
- data/lib/erlapi/generator/template/shtml/resources/i/arrows.png +0 -0
- data/lib/erlapi/generator/template/shtml/resources/i/results_bg.png +0 -0
- data/lib/erlapi/generator/template/shtml/resources/i/tree_bg.png +0 -0
- data/lib/erlapi/generator/template/shtml/resources/js/jquery-1.3.2.min.js +19 -0
- data/lib/erlapi/generator/template/shtml/resources/js/main.js +34 -0
- data/lib/erlapi/generator/template/shtml/resources/js/searchdoc.js +628 -0
- data/lib/erlapi/generator/template/shtml/resources/panel/index.html +71 -0
- data/lib/erlapi/generator.rb +194 -0
- data/lib/erlapi/helpers.rb +26 -0
- data/lib/erlapi/merge.rb +217 -0
- data/lib/erlapi/parser.rb +134 -0
- data/lib/erlapi/shtml.rb +351 -0
- data/lib/erlapi/templatable.rb +51 -0
- data/lib/erlapi/templates/html/direct/_context.rhtml +172 -0
- data/lib/erlapi/templates/html/direct/class.rhtml +40 -0
- data/lib/erlapi/templates/html/direct/file.rhtml +30 -0
- data/lib/erlapi/templates/html/direct/index.rhtml +14 -0
- data/lib/erlapi/templates/html/direct/resources/apple-touch-icon.png +0 -0
- data/lib/erlapi/templates/html/direct/resources/css/main.css +263 -0
- data/lib/erlapi/templates/html/direct/resources/css/panel.css +383 -0
- data/lib/erlapi/templates/html/direct/resources/css/reset.css +53 -0
- data/lib/erlapi/templates/html/direct/resources/favicon.ico +0 -0
- data/lib/erlapi/templates/html/direct/resources/i/arrows.png +0 -0
- data/lib/erlapi/templates/html/direct/resources/i/results_bg.png +0 -0
- data/lib/erlapi/templates/html/direct/resources/i/tree_bg.png +0 -0
- data/lib/erlapi/templates/html/direct/resources/js/jquery-1.3.2.min.js +19 -0
- data/lib/erlapi/templates/html/direct/resources/js/jquery-effect.js +593 -0
- data/lib/erlapi/templates/html/direct/resources/js/main.js +22 -0
- data/lib/erlapi/templates/html/direct/resources/js/searchdoc.js +628 -0
- data/lib/erlapi/templates/html/direct/resources/panel/index.html +71 -0
- data/lib/erlapi/templates/html/merge/index.rhtml +14 -0
- data/lib/erlapi/templates/html/shtml/_context.rhtml +63 -0
- data/lib/erlapi/templates/html/shtml/class.rhtml +25 -0
- data/lib/erlapi/templates/html/shtml/file.rhtml +37 -0
- data/lib/erlapi/templates/html/shtml/index.rhtml +14 -0
- data/lib/erlapi/templates/html/shtml/resources/apple-touch-icon.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources/css/main.css +263 -0
- data/lib/erlapi/templates/html/shtml/resources/css/panel.css +383 -0
- data/lib/erlapi/templates/html/shtml/resources/css/reset.css +53 -0
- data/lib/erlapi/templates/html/shtml/resources/favicon.ico +0 -0
- data/lib/erlapi/templates/html/shtml/resources/i/arrows.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources/i/results_bg.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources/i/tree_bg.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources/js/jquery-1.3.2.min.js +19 -0
- data/lib/erlapi/templates/html/shtml/resources/js/jquery-effect.js +593 -0
- data/lib/erlapi/templates/html/shtml/resources/js/main.js +22 -0
- data/lib/erlapi/templates/html/shtml/resources/js/searchdoc.js +620 -0
- data/lib/erlapi/templates/html/shtml/resources/panel/index.html +71 -0
- data/lib/erlapi/templates/html/shtml/resources copy/apple-touch-icon.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources copy/css/main.css +195 -0
- data/lib/erlapi/templates/html/shtml/resources copy/css/panel.css +383 -0
- data/lib/erlapi/templates/html/shtml/resources copy/css/reset.css +53 -0
- data/lib/erlapi/templates/html/shtml/resources copy/favicon.ico +0 -0
- data/lib/erlapi/templates/html/shtml/resources copy/i/arrows.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources copy/i/results_bg.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources copy/i/tree_bg.png +0 -0
- data/lib/erlapi/templates/html/shtml/resources copy/js/jquery-1.3.2.min.js +19 -0
- data/lib/erlapi/templates/html/shtml/resources copy/js/main.js +34 -0
- data/lib/erlapi/templates/html/shtml/resources copy/js/searchdoc.js +628 -0
- data/lib/erlapi/templates/html/shtml/resources copy/panel/index.html +71 -0
- data/lib/erlapi.rb +38 -0
- data/test/erlapi_test.rb +7 -0
- data/test/test_helper.rb +10 -0
- metadata +154 -0
data/.document
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009 Andrew Rudenko
|
|
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.
|
data/README.rdoc
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
= erlapi
|
|
2
|
+
|
|
3
|
+
Generate searchable api docs for elang libs.
|
|
4
|
+
|
|
5
|
+
Based on http://railsapi.com/.
|
|
6
|
+
|
|
7
|
+
Result for all Erlang OTP sources – http://erlapi.prepor.ru/docs/
|
|
8
|
+
|
|
9
|
+
== Usage
|
|
10
|
+
|
|
11
|
+
erlapi -o ~/Docs/erlang -s dir/to/erlang/sources
|
|
12
|
+
|
|
13
|
+
== Copyright
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2009 Andrew Rudenko. See LICENSE for details.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
require 'jeweler'
|
|
6
|
+
Jeweler::Tasks.new do |gem|
|
|
7
|
+
gem.name = "erlapi"
|
|
8
|
+
gem.summary = %Q{TODO}
|
|
9
|
+
gem.email = "ceo@prepor.ru"
|
|
10
|
+
gem.homepage = "http://github.com/prepor/erlapi"
|
|
11
|
+
gem.authors = ["Andrew Rudenko"]
|
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
rescue LoadError
|
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
require 'rake/testtask'
|
|
20
|
+
Rake::TestTask.new(:test) do |test|
|
|
21
|
+
test.libs << 'lib' << 'test'
|
|
22
|
+
test.pattern = 'test/**/*_test.rb'
|
|
23
|
+
test.verbose = true
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
begin
|
|
27
|
+
require 'rcov/rcovtask'
|
|
28
|
+
Rcov::RcovTask.new do |test|
|
|
29
|
+
test.libs << 'test'
|
|
30
|
+
test.pattern = 'test/**/*_test.rb'
|
|
31
|
+
test.verbose = true
|
|
32
|
+
end
|
|
33
|
+
rescue LoadError
|
|
34
|
+
task :rcov do
|
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
task :default => :test
|
|
41
|
+
|
|
42
|
+
require 'rake/rdoctask'
|
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
|
44
|
+
if File.exist?('VERSION.yml')
|
|
45
|
+
config = YAML.load(File.read('VERSION.yml'))
|
|
46
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
|
47
|
+
else
|
|
48
|
+
version = ""
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
52
|
+
rdoc.title = "erlapi #{version}"
|
|
53
|
+
rdoc.rdoc_files.include('README*')
|
|
54
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
55
|
+
end
|
|
56
|
+
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.8
|
data/bin/erlapi
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + '/../lib/erlapi'
|
|
4
|
+
|
|
5
|
+
require 'optparse'
|
|
6
|
+
|
|
7
|
+
options = {}
|
|
8
|
+
OptionParser.new do |opts|
|
|
9
|
+
opts.banner = "Usage: erlapi -o [output_dir] -s [source_dir]"
|
|
10
|
+
|
|
11
|
+
opts.on("-o", "--output OUTPUT_DIR", "Output dir") do |o|
|
|
12
|
+
options[:output_dir] = o
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
opts.on("-s", "--source SOURCE_DIR", "Source dir with erlang docs") do |s|
|
|
16
|
+
options[:source_dir] = s
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
|
20
|
+
puts opts
|
|
21
|
+
exit
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end.parse!
|
|
25
|
+
|
|
26
|
+
Erlapi::Cmd.start!(options)
|
data/erlapi.gemspec
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = %q{erlapi}
|
|
5
|
+
s.version = "0.1.8"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Andrew Rudenko"]
|
|
9
|
+
s.date = %q{2009-08-08}
|
|
10
|
+
s.default_executable = %q{erlapi}
|
|
11
|
+
s.email = %q{ceo@prepor.ru}
|
|
12
|
+
s.executables = ["erlapi"]
|
|
13
|
+
s.extra_rdoc_files = [
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.rdoc"
|
|
16
|
+
]
|
|
17
|
+
s.files = [
|
|
18
|
+
".document",
|
|
19
|
+
".gitignore",
|
|
20
|
+
"LICENSE",
|
|
21
|
+
"README.rdoc",
|
|
22
|
+
"Rakefile",
|
|
23
|
+
"VERSION",
|
|
24
|
+
"bin/erlapi",
|
|
25
|
+
"erlapi.gemspec",
|
|
26
|
+
"lib/erlapi.rb",
|
|
27
|
+
"lib/erlapi/generator.rb",
|
|
28
|
+
"lib/erlapi/generator/shtml.rb",
|
|
29
|
+
"lib/erlapi/generator/template/direct/_context.rhtml",
|
|
30
|
+
"lib/erlapi/generator/template/direct/class.rhtml",
|
|
31
|
+
"lib/erlapi/generator/template/direct/file.rhtml",
|
|
32
|
+
"lib/erlapi/generator/template/direct/index.rhtml",
|
|
33
|
+
"lib/erlapi/generator/template/direct/resources/apple-touch-icon.png",
|
|
34
|
+
"lib/erlapi/generator/template/direct/resources/css/main.css",
|
|
35
|
+
"lib/erlapi/generator/template/direct/resources/css/panel.css",
|
|
36
|
+
"lib/erlapi/generator/template/direct/resources/css/reset.css",
|
|
37
|
+
"lib/erlapi/generator/template/direct/resources/favicon.ico",
|
|
38
|
+
"lib/erlapi/generator/template/direct/resources/i/arrows.png",
|
|
39
|
+
"lib/erlapi/generator/template/direct/resources/i/results_bg.png",
|
|
40
|
+
"lib/erlapi/generator/template/direct/resources/i/tree_bg.png",
|
|
41
|
+
"lib/erlapi/generator/template/direct/resources/js/jquery-1.3.2.min.js",
|
|
42
|
+
"lib/erlapi/generator/template/direct/resources/js/jquery-effect.js",
|
|
43
|
+
"lib/erlapi/generator/template/direct/resources/js/main.js",
|
|
44
|
+
"lib/erlapi/generator/template/direct/resources/js/searchdoc.js",
|
|
45
|
+
"lib/erlapi/generator/template/direct/resources/panel/index.html",
|
|
46
|
+
"lib/erlapi/generator/template/merge/index.rhtml",
|
|
47
|
+
"lib/erlapi/generator/template/shtml/_context.rhtml",
|
|
48
|
+
"lib/erlapi/generator/template/shtml/class.rhtml",
|
|
49
|
+
"lib/erlapi/generator/template/shtml/file.rhtml",
|
|
50
|
+
"lib/erlapi/generator/template/shtml/index.rhtml",
|
|
51
|
+
"lib/erlapi/generator/template/shtml/resources/apple-touch-icon.png",
|
|
52
|
+
"lib/erlapi/generator/template/shtml/resources/css/main.css",
|
|
53
|
+
"lib/erlapi/generator/template/shtml/resources/css/panel.css",
|
|
54
|
+
"lib/erlapi/generator/template/shtml/resources/css/reset.css",
|
|
55
|
+
"lib/erlapi/generator/template/shtml/resources/favicon.ico",
|
|
56
|
+
"lib/erlapi/generator/template/shtml/resources/i/arrows.png",
|
|
57
|
+
"lib/erlapi/generator/template/shtml/resources/i/results_bg.png",
|
|
58
|
+
"lib/erlapi/generator/template/shtml/resources/i/tree_bg.png",
|
|
59
|
+
"lib/erlapi/generator/template/shtml/resources/js/jquery-1.3.2.min.js",
|
|
60
|
+
"lib/erlapi/generator/template/shtml/resources/js/main.js",
|
|
61
|
+
"lib/erlapi/generator/template/shtml/resources/js/searchdoc.js",
|
|
62
|
+
"lib/erlapi/generator/template/shtml/resources/panel/index.html",
|
|
63
|
+
"lib/erlapi/helpers.rb",
|
|
64
|
+
"lib/erlapi/merge.rb",
|
|
65
|
+
"lib/erlapi/parser.rb",
|
|
66
|
+
"lib/erlapi/shtml.rb",
|
|
67
|
+
"lib/erlapi/templatable.rb",
|
|
68
|
+
"lib/erlapi/templates/html/direct/_context.rhtml",
|
|
69
|
+
"lib/erlapi/templates/html/direct/class.rhtml",
|
|
70
|
+
"lib/erlapi/templates/html/direct/file.rhtml",
|
|
71
|
+
"lib/erlapi/templates/html/direct/index.rhtml",
|
|
72
|
+
"lib/erlapi/templates/html/direct/resources/apple-touch-icon.png",
|
|
73
|
+
"lib/erlapi/templates/html/direct/resources/css/main.css",
|
|
74
|
+
"lib/erlapi/templates/html/direct/resources/css/panel.css",
|
|
75
|
+
"lib/erlapi/templates/html/direct/resources/css/reset.css",
|
|
76
|
+
"lib/erlapi/templates/html/direct/resources/favicon.ico",
|
|
77
|
+
"lib/erlapi/templates/html/direct/resources/i/arrows.png",
|
|
78
|
+
"lib/erlapi/templates/html/direct/resources/i/results_bg.png",
|
|
79
|
+
"lib/erlapi/templates/html/direct/resources/i/tree_bg.png",
|
|
80
|
+
"lib/erlapi/templates/html/direct/resources/js/jquery-1.3.2.min.js",
|
|
81
|
+
"lib/erlapi/templates/html/direct/resources/js/jquery-effect.js",
|
|
82
|
+
"lib/erlapi/templates/html/direct/resources/js/main.js",
|
|
83
|
+
"lib/erlapi/templates/html/direct/resources/js/searchdoc.js",
|
|
84
|
+
"lib/erlapi/templates/html/direct/resources/panel/index.html",
|
|
85
|
+
"lib/erlapi/templates/html/merge/index.rhtml",
|
|
86
|
+
"lib/erlapi/templates/html/shtml/_context.rhtml",
|
|
87
|
+
"lib/erlapi/templates/html/shtml/class.rhtml",
|
|
88
|
+
"lib/erlapi/templates/html/shtml/file.rhtml",
|
|
89
|
+
"lib/erlapi/templates/html/shtml/index.rhtml",
|
|
90
|
+
"lib/erlapi/templates/html/shtml/resources copy/apple-touch-icon.png",
|
|
91
|
+
"lib/erlapi/templates/html/shtml/resources copy/css/main.css",
|
|
92
|
+
"lib/erlapi/templates/html/shtml/resources copy/css/panel.css",
|
|
93
|
+
"lib/erlapi/templates/html/shtml/resources copy/css/reset.css",
|
|
94
|
+
"lib/erlapi/templates/html/shtml/resources copy/favicon.ico",
|
|
95
|
+
"lib/erlapi/templates/html/shtml/resources copy/i/arrows.png",
|
|
96
|
+
"lib/erlapi/templates/html/shtml/resources copy/i/results_bg.png",
|
|
97
|
+
"lib/erlapi/templates/html/shtml/resources copy/i/tree_bg.png",
|
|
98
|
+
"lib/erlapi/templates/html/shtml/resources copy/js/jquery-1.3.2.min.js",
|
|
99
|
+
"lib/erlapi/templates/html/shtml/resources copy/js/main.js",
|
|
100
|
+
"lib/erlapi/templates/html/shtml/resources copy/js/searchdoc.js",
|
|
101
|
+
"lib/erlapi/templates/html/shtml/resources copy/panel/index.html",
|
|
102
|
+
"lib/erlapi/templates/html/shtml/resources/apple-touch-icon.png",
|
|
103
|
+
"lib/erlapi/templates/html/shtml/resources/css/main.css",
|
|
104
|
+
"lib/erlapi/templates/html/shtml/resources/css/panel.css",
|
|
105
|
+
"lib/erlapi/templates/html/shtml/resources/css/reset.css",
|
|
106
|
+
"lib/erlapi/templates/html/shtml/resources/favicon.ico",
|
|
107
|
+
"lib/erlapi/templates/html/shtml/resources/i/arrows.png",
|
|
108
|
+
"lib/erlapi/templates/html/shtml/resources/i/results_bg.png",
|
|
109
|
+
"lib/erlapi/templates/html/shtml/resources/i/tree_bg.png",
|
|
110
|
+
"lib/erlapi/templates/html/shtml/resources/js/jquery-1.3.2.min.js",
|
|
111
|
+
"lib/erlapi/templates/html/shtml/resources/js/jquery-effect.js",
|
|
112
|
+
"lib/erlapi/templates/html/shtml/resources/js/main.js",
|
|
113
|
+
"lib/erlapi/templates/html/shtml/resources/js/searchdoc.js",
|
|
114
|
+
"lib/erlapi/templates/html/shtml/resources/panel/index.html",
|
|
115
|
+
"test/erlapi_test.rb",
|
|
116
|
+
"test/test_helper.rb"
|
|
117
|
+
]
|
|
118
|
+
s.has_rdoc = true
|
|
119
|
+
s.homepage = %q{http://github.com/prepor/erlapi}
|
|
120
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
121
|
+
s.require_paths = ["lib"]
|
|
122
|
+
s.rubygems_version = %q{1.3.1}
|
|
123
|
+
s.summary = %q{TODO}
|
|
124
|
+
s.test_files = [
|
|
125
|
+
"test/erlapi_test.rb",
|
|
126
|
+
"test/test_helper.rb"
|
|
127
|
+
]
|
|
128
|
+
|
|
129
|
+
if s.respond_to? :specification_version then
|
|
130
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
131
|
+
s.specification_version = 2
|
|
132
|
+
|
|
133
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
134
|
+
else
|
|
135
|
+
end
|
|
136
|
+
else
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
gem "rdoc", ">= 2.4.2"
|
|
3
|
+
if Gem.available? "json"
|
|
4
|
+
gem "json", ">= 1.1.3"
|
|
5
|
+
else
|
|
6
|
+
gem "json_pure", ">= 1.1.3"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
require 'iconv'
|
|
10
|
+
require 'json'
|
|
11
|
+
require 'pathname'
|
|
12
|
+
require 'fileutils'
|
|
13
|
+
require 'erb'
|
|
14
|
+
|
|
15
|
+
require 'rdoc/rdoc'
|
|
16
|
+
require 'rdoc/generator'
|
|
17
|
+
require 'rdoc/generator/markup'
|
|
18
|
+
|
|
19
|
+
require 'sdoc/github'
|
|
20
|
+
require 'sdoc/templatable'
|
|
21
|
+
require 'sdoc/helpers'
|
|
22
|
+
|
|
23
|
+
class RDoc::ClassModule
|
|
24
|
+
def document_self_or_methods
|
|
25
|
+
document_self || method_list.any?{ |m| m.document_self }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def with_documentation?
|
|
29
|
+
document_self_or_methods || classes_and_modules.any?{ |c| c.with_documentation? }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class Erlapi::Generator::SHtml
|
|
34
|
+
include ERB::Util
|
|
35
|
+
include Erlapi::Templatable
|
|
36
|
+
include Erlapi::Helpers
|
|
37
|
+
|
|
38
|
+
GENERATOR_DIRS = [File.join('erlapi', 'generator')]
|
|
39
|
+
|
|
40
|
+
# Used in js to reduce index sizes
|
|
41
|
+
TYPE_CLASS = 1
|
|
42
|
+
TYPE_METHOD = 2
|
|
43
|
+
TYPE_FILE = 3
|
|
44
|
+
|
|
45
|
+
TREE_FILE = File.join 'panel', 'tree.js'
|
|
46
|
+
SEARCH_INDEX_FILE = File.join 'panel', 'search_index.js'
|
|
47
|
+
|
|
48
|
+
FILE_DIR = 'files'
|
|
49
|
+
CLASS_DIR = 'classes'
|
|
50
|
+
|
|
51
|
+
RESOURCES_DIR = File.join('resources', '.')
|
|
52
|
+
|
|
53
|
+
attr_reader :basedir
|
|
54
|
+
|
|
55
|
+
def self.for(options)
|
|
56
|
+
self.new(options)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.template_dir template
|
|
60
|
+
$LOAD_PATH.map do |path|
|
|
61
|
+
GENERATOR_DIRS.map do |dir|
|
|
62
|
+
File.join path, dir, 'template', template
|
|
63
|
+
end
|
|
64
|
+
end.flatten.find do |dir|
|
|
65
|
+
File.directory? dir
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def initialize(options)
|
|
70
|
+
@options = options
|
|
71
|
+
@options.diagram = false
|
|
72
|
+
@github_url_cache = {}
|
|
73
|
+
|
|
74
|
+
template = @options.template || 'direct'
|
|
75
|
+
|
|
76
|
+
templ_dir = self.class.template_dir template
|
|
77
|
+
|
|
78
|
+
raise "Could not find template #{template.inspect}" unless
|
|
79
|
+
templ_dir
|
|
80
|
+
|
|
81
|
+
@template_dir = Pathname.new File.expand_path(templ_dir)
|
|
82
|
+
@basedir = Pathname.pwd.expand_path
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def generate( top_levels )
|
|
86
|
+
@outputdir = Pathname.new( @options.op_dir ).expand_path( @basedir )
|
|
87
|
+
@files = top_levels.sort
|
|
88
|
+
@classes = RDoc::TopLevel.all_classes_and_modules.sort
|
|
89
|
+
|
|
90
|
+
# Now actually write the output
|
|
91
|
+
copy_resources
|
|
92
|
+
# generate_class_tree
|
|
93
|
+
generate_search_index
|
|
94
|
+
# generate_file_files
|
|
95
|
+
# generate_class_files
|
|
96
|
+
# generate_index_file
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def class_dir
|
|
100
|
+
CLASS_DIR
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def file_dir
|
|
104
|
+
FILE_DIR
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
protected
|
|
109
|
+
### Output progress information if debugging is enabled
|
|
110
|
+
def debug_msg( *msg )
|
|
111
|
+
return unless $DEBUG_RDOC
|
|
112
|
+
$stderr.puts( *msg )
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
### Create class tree structure and write it as json
|
|
116
|
+
def generate_class_tree
|
|
117
|
+
debug_msg "Generating class tree"
|
|
118
|
+
topclasses = @classes.select {|klass| !(RDoc::ClassModule === klass.parent) }
|
|
119
|
+
tree = generate_file_tree + generate_class_tree_level(topclasses)
|
|
120
|
+
debug_msg " writing class tree to %s" % TREE_FILE
|
|
121
|
+
File.open(TREE_FILE, "w", 0644) do |f|
|
|
122
|
+
f.write('var tree = '); f.write(tree.to_json)
|
|
123
|
+
end unless $dryrun
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
### Recursivly build class tree structure
|
|
127
|
+
def generate_class_tree_level(classes)
|
|
128
|
+
tree = []
|
|
129
|
+
classes.select{|c| c.with_documentation? }.sort.each do |klass|
|
|
130
|
+
item = [
|
|
131
|
+
klass.name,
|
|
132
|
+
klass.document_self_or_methods ? klass.path : '',
|
|
133
|
+
klass.module? ? '' : (klass.superclass ? " < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}" : ''),
|
|
134
|
+
generate_class_tree_level(klass.classes_and_modules)
|
|
135
|
+
]
|
|
136
|
+
tree << item
|
|
137
|
+
end
|
|
138
|
+
tree
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
### Create search index for all classes, methods and files
|
|
142
|
+
### Wite it as json
|
|
143
|
+
def generate_search_index
|
|
144
|
+
debug_msg "Generating search index"
|
|
145
|
+
|
|
146
|
+
index = {
|
|
147
|
+
:searchIndex => [],
|
|
148
|
+
:longSearchIndex => [],
|
|
149
|
+
:info => []
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
add_class_search_index(index)
|
|
153
|
+
add_method_search_index(index)
|
|
154
|
+
add_file_search_index(index)
|
|
155
|
+
|
|
156
|
+
debug_msg " writing search index to %s" % SEARCH_INDEX_FILE
|
|
157
|
+
data = {
|
|
158
|
+
:index => index
|
|
159
|
+
}
|
|
160
|
+
File.open(SEARCH_INDEX_FILE, "w", 0644) do |f|
|
|
161
|
+
f.write('var search_data = '); f.write(data.to_json)
|
|
162
|
+
end unless $dryrun
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
### Add files to search +index+ array
|
|
166
|
+
def add_file_search_index(index)
|
|
167
|
+
debug_msg " generating file search index"
|
|
168
|
+
|
|
169
|
+
@files.select { |file|
|
|
170
|
+
file.document_self
|
|
171
|
+
}.sort.each do |file|
|
|
172
|
+
index[:searchIndex].push( search_string(file.name) )
|
|
173
|
+
index[:longSearchIndex].push( search_string(file.path) )
|
|
174
|
+
index[:info].push([
|
|
175
|
+
file.name,
|
|
176
|
+
file.path,
|
|
177
|
+
file.path,
|
|
178
|
+
'',
|
|
179
|
+
snippet(file.comment),
|
|
180
|
+
TYPE_FILE
|
|
181
|
+
])
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
### Add classes to search +index+ array
|
|
186
|
+
def add_class_search_index(index)
|
|
187
|
+
debug_msg " generating class search index"
|
|
188
|
+
|
|
189
|
+
@classes.select { |klass|
|
|
190
|
+
klass.document_self_or_methods
|
|
191
|
+
}.sort.each do |klass|
|
|
192
|
+
index[:searchIndex].push( search_string(klass.name) )
|
|
193
|
+
index[:longSearchIndex].push( search_string(klass.parent.name) )
|
|
194
|
+
index[:info].push([
|
|
195
|
+
klass.name,
|
|
196
|
+
klass.parent.full_name,
|
|
197
|
+
klass.path,
|
|
198
|
+
klass.module? ? '' : (klass.superclass ? " < #{String === klass.superclass ? klass.superclass : klass.superclass.full_name}" : ''),
|
|
199
|
+
snippet(klass.comment),
|
|
200
|
+
TYPE_CLASS
|
|
201
|
+
])
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
### Add methods to search +index+ array
|
|
206
|
+
def add_method_search_index(index)
|
|
207
|
+
debug_msg " generating method search index"
|
|
208
|
+
|
|
209
|
+
list = @classes.map { |klass|
|
|
210
|
+
klass.method_list
|
|
211
|
+
}.flatten.sort{ |a, b| a.name == b.name ? a.parent.full_name <=> b.parent.full_name : a.name <=> b.name }.select { |method|
|
|
212
|
+
method.document_self
|
|
213
|
+
}
|
|
214
|
+
unless @options.show_all
|
|
215
|
+
list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
list.each do |method|
|
|
219
|
+
index[:searchIndex].push( search_string(method.name) + '()' )
|
|
220
|
+
index[:longSearchIndex].push( search_string(method.parent.name) )
|
|
221
|
+
index[:info].push([
|
|
222
|
+
method.name,
|
|
223
|
+
method.parent.full_name,
|
|
224
|
+
method.path,
|
|
225
|
+
method.params,
|
|
226
|
+
snippet(method.comment),
|
|
227
|
+
TYPE_METHOD
|
|
228
|
+
])
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
### Generate a documentation file for each class
|
|
233
|
+
def generate_class_files
|
|
234
|
+
debug_msg "Generating class documentation in #@outputdir"
|
|
235
|
+
templatefile = @template_dir + 'class.rhtml'
|
|
236
|
+
|
|
237
|
+
@classes.each do |klass|
|
|
238
|
+
debug_msg " working on %s (%s)" % [ klass.full_name, klass.path ]
|
|
239
|
+
outfile = @outputdir + klass.path
|
|
240
|
+
rel_prefix = @outputdir.relative_path_from( outfile.dirname )
|
|
241
|
+
|
|
242
|
+
debug_msg " rendering #{outfile}"
|
|
243
|
+
self.render_template( templatefile, binding(), outfile )
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
### Generate a documentation file for each file
|
|
248
|
+
def generate_file_files
|
|
249
|
+
debug_msg "Generating file documentation in #@outputdir"
|
|
250
|
+
templatefile = @template_dir + 'file.rhtml'
|
|
251
|
+
|
|
252
|
+
@files.each do |file|
|
|
253
|
+
outfile = @outputdir + file.path
|
|
254
|
+
debug_msg " working on %s (%s)" % [ file.full_name, outfile ]
|
|
255
|
+
rel_prefix = @outputdir.relative_path_from( outfile.dirname )
|
|
256
|
+
|
|
257
|
+
debug_msg " rendering #{outfile}"
|
|
258
|
+
self.render_template( templatefile, binding(), outfile )
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def index_file
|
|
263
|
+
if @options.main_page && file = @files.find { |f| f.full_name == @options.main_page }
|
|
264
|
+
file
|
|
265
|
+
else
|
|
266
|
+
@files.first
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
### Create index.html with frameset
|
|
271
|
+
def generate_index_file
|
|
272
|
+
debug_msg "Generating index file in #@outputdir"
|
|
273
|
+
templatefile = @template_dir + 'index.rhtml'
|
|
274
|
+
outfile = @outputdir + 'index.html'
|
|
275
|
+
index_path = index_file.path
|
|
276
|
+
|
|
277
|
+
self.render_template( templatefile, binding(), outfile )
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
### Strip comments on a space after 100 chars
|
|
281
|
+
def snippet(str)
|
|
282
|
+
str ||= ''
|
|
283
|
+
if str =~ /^(?>\s*)[^\#]/
|
|
284
|
+
content = str
|
|
285
|
+
else
|
|
286
|
+
content = str.gsub(/^\s*(#+)\s*/, '')
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
content = content.sub(/^(.{100,}?)\s.*/m, "\\1").gsub(/\r?\n/m, ' ')
|
|
290
|
+
|
|
291
|
+
begin
|
|
292
|
+
content.to_json
|
|
293
|
+
rescue # might fail on non-unicode string
|
|
294
|
+
begin
|
|
295
|
+
content = Iconv.conv('latin1//ignore', "UTF8", content) # remove all non-unicode chars
|
|
296
|
+
content.to_json
|
|
297
|
+
rescue
|
|
298
|
+
content = '' # something hugely wrong happend
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
content
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
### Build search index key
|
|
305
|
+
def search_string(string)
|
|
306
|
+
string ||= ''
|
|
307
|
+
string.downcase.gsub(/\s/,'')
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
### Copy all the resource files to output dir
|
|
311
|
+
def copy_resources
|
|
312
|
+
resoureces_path = @template_dir + RESOURCES_DIR
|
|
313
|
+
debug_msg "Copying #{resoureces_path}/** to #{@outputdir}/**"
|
|
314
|
+
FileUtils.cp_r resoureces_path.to_s, @outputdir.to_s, :preserve => true unless $dryrun
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
class FilesTree
|
|
318
|
+
attr_reader :children
|
|
319
|
+
def add(path, url)
|
|
320
|
+
path = path.split(File::SEPARATOR) unless Array === path
|
|
321
|
+
@children ||= {}
|
|
322
|
+
if path.length == 1
|
|
323
|
+
@children[path.first] = url
|
|
324
|
+
else
|
|
325
|
+
@children[path.first] ||= FilesTree.new
|
|
326
|
+
@children[path.first].add(path[1, path.length], url)
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
def generate_file_tree
|
|
332
|
+
if @files.length > 1
|
|
333
|
+
@files_tree = FilesTree.new
|
|
334
|
+
@files.each do |file|
|
|
335
|
+
@files_tree.add(file.relative_name, file.path)
|
|
336
|
+
end
|
|
337
|
+
[['', '', 'files', generate_file_tree_level(@files_tree)]]
|
|
338
|
+
else
|
|
339
|
+
[]
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def generate_file_tree_level(tree)
|
|
344
|
+
tree.children.keys.sort.map do |name|
|
|
345
|
+
child = tree.children[name]
|
|
346
|
+
if String === child
|
|
347
|
+
[name, child, '', []]
|
|
348
|
+
else
|
|
349
|
+
['', '', name, generate_file_tree_level(child)]
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
end
|
|
353
|
+
end
|