pietern-bdoc 0.3.0

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.
@@ -0,0 +1,70 @@
1
+ == 0.3.0 2009-06-22
2
+ * 1 major rewrite
3
+ * Searching gems
4
+ * Searching API for a gem
5
+ * Multiple rdocs opened at the same time
6
+
7
+ == 0.2.2 2009-06-08
8
+
9
+ * 1 new feature from csexton -- Thanks!
10
+ * Ability to specify an output directory
11
+
12
+ == 0.2.1 2009-04-06
13
+
14
+ * 2 bug fixes from vesan
15
+ * Fix CSS to prevent gem list from blowing up in Safari 4 Beta
16
+ * HTML escape gem descriptions
17
+
18
+ == 0.1.9 2009-04-02
19
+
20
+ * 1 bug fix
21
+ * more path issues... yet again.
22
+
23
+ == 0.1.8 2009-03-30
24
+
25
+ * 1 bug fix
26
+ * more path issues... wasn't copying bdoc.css
27
+
28
+ == 0.1.7 2009-03-30
29
+
30
+ * 1 bug fix
31
+ * don't display versions without rdocs
32
+
33
+ == 0.1.6 2009-03-30
34
+
35
+ * 1 bug fix
36
+ * layout issues
37
+
38
+ == 0.1.5 2009-03-30
39
+
40
+ * 1 bug fix
41
+ * file path issues with templates
42
+
43
+ == 0.1.4 2009-03-30
44
+
45
+ * 3 minor enhancements
46
+ * now scans all of the gems installed on your machine not just the
47
+ default gem path
48
+ * also shows gems without rdocs
49
+ * set window title to selected rdoc
50
+
51
+ == 0.1.3 2009-03-30
52
+
53
+ * 2 bug fixes:
54
+ * require json/pure instead of native json parser
55
+ * changed require statement in bin file
56
+
57
+ == 0.1.2 2009-03-30
58
+
59
+ * 1 bug fix:
60
+ * have to user absolute path when writing out index.html
61
+
62
+ == 0.1.1 2009-03-29
63
+
64
+ * 1 bux fix:
65
+ * forgot to include a stylesheet
66
+
67
+ == 0.1.0 2009-03-29
68
+
69
+ * 1 major enhancement:
70
+ * Initial release
@@ -0,0 +1,16 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bdoc.gemspec
6
+ bin/bdoc
7
+ lib/bdoc.rb
8
+ public/app/gdoc.css
9
+ public/app/gdoc.js
10
+ public/app/jquery.js
11
+ public/app/liquidmetal.js
12
+ public/app/screen.css
13
+ public/app/selector.js
14
+ templates/index.html
15
+ test/test_bdoc.rb
16
+ test/test_helper.rb
@@ -0,0 +1,80 @@
1
+ = Bdoc
2
+
3
+ Bdoc is a simple replacement for gem server. All it does is look at all of
4
+ the Gems you have installed locally and creates a nice iframe based
5
+ browser that makes it easy to navigate between gem docs. IT DOES NOT REQUIRE
6
+ A SERVER FOR VIEWING... not like gem server does!
7
+
8
+ If you use this, I highly suggest also using
9
+ Hanna[http://github.com/mislav/hanna/tree/master] (a beautiful rdoc theme).
10
+
11
+ This fork of bdoc uses the LiquidMetal scoring algorithm so you don't have to
12
+ worry about typo's in your search queries (http://github.com/rmm5t/liquidmetal/tree/master).
13
+
14
+ Other features include:
15
+ * Search your local gems (instead of browsing through a list)
16
+ * Multiple rdocs open simultaneously
17
+ * Search the API of every gem
18
+
19
+ http://img.skitch.com/20090622-p54f7sd3xn8caiu49yk3pq9ueb.png
20
+ http://img.skitch.com/20090622-faejc7qc4qgi5qme3yd4pdwqf.png
21
+
22
+ == Install
23
+
24
+ [sudo] gem install pietern-bdoc
25
+
26
+ == Usage
27
+
28
+ bdoc
29
+
30
+ That's it! This will create an index of all your local gems then launch your
31
+ default browser. Enjoy!
32
+
33
+ == Controls
34
+
35
+ When bdoc is loaded, press space to search for a gem.
36
+ When a gem is loaded, just start typing to find the file/class/method you're looking for.
37
+ To switch between different tabs use Shift+→ and Shift+←.
38
+
39
+ === Specify output directory
40
+
41
+ Optionally you can specify the output directory on the command line:
42
+
43
+ bdoc /path/to/bdoc
44
+
45
+ === Hints
46
+
47
+ For even easier access to the docs of your local gems, create a Fluid.app instance
48
+ for bdoc. Then, edit your <tt>Bdoc.app/Contents/Resources/Config.plist</tt> to point
49
+ to some location on your drive (e.g. <tt>/Users/<yourname>/.bdoc/index.html</tt>) and
50
+ schedule a cronjob to recreate the bdoc index every once in a while. At least, this works
51
+ for me.
52
+
53
+ == Authors
54
+ * Rich Manalang (original author of bdoc)
55
+ * Pieter Noordhuis
56
+
57
+ == LICENSE:
58
+
59
+ (The MIT License)
60
+
61
+ Copyright (c) 2009 Rich Manalang
62
+
63
+ Permission is hereby granted, free of charge, to any person obtaining
64
+ a copy of this software and associated documentation files (the
65
+ 'Software'), to deal in the Software without restriction, including
66
+ without limitation the rights to use, copy, modify, merge, publish,
67
+ distribute, sublicense, and/or sell copies of the Software, and to
68
+ permit persons to whom the Software is furnished to do so, subject to
69
+ the following conditions:
70
+
71
+ The above copyright notice and this permission notice shall be
72
+ included in all copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
75
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
76
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
77
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
78
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
79
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
80
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/bdoc'
4
+ Bdoc.open
@@ -0,0 +1,81 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'rubygems'
5
+ require 'erb'
6
+ require 'tmpdir'
7
+ require 'launchy'
8
+ require 'json'
9
+
10
+ module Bdoc
11
+ VERSION = '0.3.0'
12
+
13
+ class << self
14
+ attr_accessor :output_dir
15
+ attr_accessor :output_index
16
+
17
+ def root
18
+ File.expand_path File.join(File.dirname(__FILE__), '..')
19
+ end
20
+
21
+ def rdoc_file(gem_name)
22
+ File.join(Gem.dir, "doc", gem_name, "rdoc", "index.html")
23
+ end
24
+
25
+ def gems_with_doc_index
26
+ installed_gems = Gem::SourceIndex.from_installed_gems.gems.map{|k,v|v}
27
+ gems = installed_gems.map { |g|
28
+ g.name if g.has_rdoc?
29
+ }.compact.uniq.sort{|x,y| x.downcase <=> y.downcase}
30
+ gems = gems.map do |g|
31
+ gem = installed_gems.find_all{|gem| gem.name == g}.last
32
+ { :name => g,
33
+ :description => gem.description,
34
+ :homepage => gem.homepage,
35
+ :versions => installed_gems.find_all{|gem|
36
+ gem.name == g
37
+ }.map{|gem|
38
+ rdoc_index = File.join(gem.full_gem_path,"..","..","doc",gem.full_name, "rdoc","index.html")
39
+ { :version => gem.version.version,
40
+ :rdoc_index => (File.exist?(rdoc_index) ? rdoc_index : nil)
41
+ }
42
+ #removes dups since uniq doesn't work on array of hashes
43
+ }.compact.sort_by{|g|g[:version]}.inject([]){|result,h|
44
+ result << h unless result.include?(h)
45
+ result
46
+ }
47
+ }
48
+ end
49
+ end
50
+
51
+ def render
52
+ ERB.new(File.read(File.join(File.dirname(__FILE__), '..', "templates","index.html"))).result(binding)
53
+ end
54
+
55
+ def generate_index
56
+ Dir.mkdir(output_dir) unless File.exists?(output_dir)
57
+
58
+ # First just link the path
59
+ if true
60
+ Dir[File.join(public_path, '*')].each do |d|
61
+ symlink_path = File.join(output_dir, File.basename(d))
62
+ File.symlink(d, symlink_path) unless File.symlink? symlink_path
63
+ end
64
+ end
65
+
66
+ File.open(output_index,"w") {|f| f.write(render)}
67
+ end
68
+
69
+ def public_path
70
+ File.join(root, 'public')
71
+ end
72
+
73
+ def open
74
+ generate_index
75
+ Launchy::Browser.run(output_index)
76
+ end
77
+ end
78
+
79
+ self.output_dir = ARGV[0] || File.join(Dir.tmpdir, "bdoc")
80
+ self.output_index = File.join(@output_dir,"index.html")
81
+ end
@@ -0,0 +1,210 @@
1
+ body {
2
+ background-color: #aaa;
3
+ }
4
+
5
+ #navbar {
6
+ margin: 4px 5px;
7
+ }
8
+ #navbar strong {
9
+ background-color: #555;
10
+ padding: 3px 5px;
11
+ -moz-border-radius: 3px;
12
+ -webkit-border-radius: 3px;
13
+ }
14
+
15
+ #navbar strong a {
16
+ color: #fff;
17
+ text-decoration: none;
18
+ }
19
+
20
+ ul#tabs {
21
+ position: absolute;
22
+ top: 6px;
23
+ right: 0;
24
+ list-style: none;
25
+ z-index: 2;
26
+ }
27
+
28
+ ul#tabs li {
29
+ display: inline;
30
+ margin-left: 0.5em;
31
+ }
32
+
33
+ ul#tabs li > a {
34
+ background-color: #555;
35
+ padding: 4px 6px 4px;
36
+ text-decoration: none;
37
+ color: #fff;
38
+ font-weight: bold;
39
+ -moz-border-radius: 5px;
40
+ -webkit-border-radius: 5px;
41
+ -moz-border-radius-bottomleft: 0;
42
+ -moz-border-radius-bottomright: 0;
43
+ -webkit-border-bottom-left-radius: 0;
44
+ -webkit-border-bottom-right-radius: 0;
45
+ }
46
+
47
+ ul#tabs li.active > a,
48
+ ul#tabs li > a:hover {
49
+ background-color: #000;
50
+ color: #fff;
51
+ }
52
+
53
+ #versionbar {
54
+ background-color: #000;
55
+ position: relative;
56
+ height: 22px;
57
+ }
58
+
59
+ #versionbar div.g {
60
+ padding: 2px 0.5em;
61
+ }
62
+
63
+ #versionbar a.homepage {
64
+ float: left;
65
+ color: #fff;
66
+ text-decoration: none;
67
+ }
68
+
69
+ #versionbar .versions {
70
+ }
71
+
72
+ #versionbar .versions a {
73
+ font-weight: bold;
74
+ color: #888;
75
+ margin: 2px 0.5em 0;
76
+ text-decoration: none;
77
+ }
78
+
79
+ #versionbar .versions a.active {
80
+ color: #fff;
81
+ }
82
+
83
+ #versionbar .versions a.disabled {
84
+ color: #D40705;
85
+ }
86
+
87
+ #versionbar .close {
88
+ float: right;
89
+ color: #D40705;
90
+ cursor: pointer;
91
+ }
92
+
93
+ #frames {
94
+ clear: both;
95
+ position: relative;
96
+ width: 100%;
97
+ }
98
+
99
+ #frames iframe {
100
+ border: 0;
101
+ width: 100%;
102
+ height: 100%;
103
+ }
104
+
105
+ #overlay {
106
+ position: absolute;
107
+ top: 0;
108
+ left: 0;
109
+ background-color: #000;
110
+ opacity: 0.5;
111
+ z-index: 2;
112
+ width: 100%;
113
+ height: 100%;
114
+ display: none;
115
+ }
116
+
117
+ #popup {
118
+ position: absolute;
119
+ top: 80px;
120
+ width: 100%;
121
+ z-index: 3;
122
+ display: none;
123
+ }
124
+
125
+ #popup > div {
126
+ position: relative;
127
+ width: 480px;
128
+ margin: 0 auto;
129
+
130
+ background-color: #aaa;
131
+ -moz-border-radius: 20px;
132
+ -webkit-border-radius: 20px;
133
+
134
+ padding: 10px;
135
+ text-align: center;
136
+ display: none;
137
+ }
138
+
139
+ #popup div.search {
140
+ background-color: #fff;
141
+ padding: 20px;
142
+ -moz-border-radius: 10px;
143
+ -webkit-border-radius: 10px;
144
+ }
145
+
146
+ #popup div.search h1 {
147
+ letter-spacing: 3px;
148
+ }
149
+
150
+ #popup div.search input {
151
+ font-size: 17pt;
152
+ border: 0px;
153
+ background-color: #ddd;
154
+ width: 400px;
155
+ padding: 4px;
156
+ font-family: Monaco, Courier;
157
+ }
158
+
159
+ #popup div.results {
160
+ display: inline-block;
161
+ margin-top: 4px;
162
+ height: 150px;
163
+ width: 400px;
164
+ overflow-x: hidden;
165
+ overflow-y: auto;
166
+ }
167
+
168
+ #popup div.results ul {
169
+ padding: 0;
170
+ margin: 0;
171
+ list-style: none;
172
+ text-align: left;
173
+ font-size: 12pt;
174
+ }
175
+
176
+ #popup div.results li {
177
+ padding: 0 1em;
178
+ height: 30px;
179
+ font-family: Monaco, Courier;
180
+ overflow: hidden;
181
+ }
182
+
183
+ #popup div.results li.qs_selected{
184
+ background-color: #333 !important;
185
+ color: #fff !important;
186
+ }
187
+
188
+ #popup div.results li:nth-child(odd) {
189
+ background-color: #eee;
190
+ }
191
+
192
+ #popup div#searchapi div.results {
193
+ height: 200px;
194
+ }
195
+
196
+ #popup div#searchapi div.results ul {
197
+ font-size: 9pt;
198
+ }
199
+
200
+
201
+ #popup div#searchapi div.results li {
202
+ height: 20px;
203
+ }
204
+
205
+
206
+ /* Facebox-Blueprint fix */
207
+ #facebox table {
208
+ border-collapse: collapse;
209
+ width: auto;
210
+ }