manalang-bdoc 0.1.3 → 0.1.4
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/History.txt +9 -1
- data/lib/bdoc.rb +16 -18
- data/templates/index.html +13 -2
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
+
== 0.1.4 2009-03-30
|
2
|
+
|
3
|
+
* 3 minor enhancements
|
4
|
+
* now scans all of the gems installed on your machine not just the
|
5
|
+
default gem path
|
6
|
+
* also shows gems without rdocs
|
7
|
+
* set window title to selected rdoc
|
8
|
+
|
1
9
|
== 0.1.3 2009-03-30
|
2
10
|
|
3
|
-
* 2 bug
|
11
|
+
* 2 bug fixes:
|
4
12
|
* require json/pure instead of native json parser
|
5
13
|
* changed require statement in bin file
|
6
14
|
|
data/lib/bdoc.rb
CHANGED
@@ -8,7 +8,7 @@ require 'launchy'
|
|
8
8
|
require 'json/pure'
|
9
9
|
|
10
10
|
module Bdoc
|
11
|
-
VERSION = '0.1.
|
11
|
+
VERSION = '0.1.4'
|
12
12
|
|
13
13
|
class << self
|
14
14
|
attr_accessor :output_dir
|
@@ -19,29 +19,27 @@ module Bdoc
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def gems_with_doc_index
|
22
|
-
|
23
|
-
|
24
|
-
if
|
25
|
-
g.name if g.has_rdoc?
|
26
|
-
end
|
22
|
+
installed_gems = Gem::SourceIndex.from_installed_gems.gems.map{|k,v|v}
|
23
|
+
gems = installed_gems.map { |g|
|
24
|
+
g.name if g.has_rdoc?
|
27
25
|
}.compact.uniq.sort{|x,y| x.downcase <=> y.downcase}
|
28
26
|
gems = gems.map do |g|
|
29
|
-
gem =
|
27
|
+
gem = installed_gems.find_all{|gem| gem.name == g}.last
|
30
28
|
{ :name => g,
|
31
29
|
:description => gem.description,
|
32
30
|
:homepage => gem.homepage,
|
33
|
-
:versions =>
|
34
|
-
gem.name == g
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
:versions => installed_gems.find_all{|gem|
|
32
|
+
gem.name == g
|
33
|
+
}.map{|gem|
|
34
|
+
rdoc_index = File.join(gem.full_gem_path,"..","..","doc",gem.full_name, "rdoc","index.html")
|
35
|
+
{ :version => gem.version.version,
|
36
|
+
:rdoc_index => (File.exist?(rdoc_index) ? rdoc_index : nil)
|
37
|
+
}
|
38
|
+
#removes dups since uniq doesn't work on array of hashes
|
39
|
+
}.compact.sort_by{|g|g[:version]}.inject([]){|result,h|
|
40
|
+
result << h unless result.include?(h)
|
41
|
+
result
|
39
42
|
}
|
40
|
-
#removes dups since uniq doesn't work on array of hashes
|
41
|
-
}.compact.sort_by{|g|g[:version]}.inject([]){|result,h|
|
42
|
-
result << h unless result.include?(h)
|
43
|
-
result
|
44
|
-
}
|
45
43
|
}
|
46
44
|
end
|
47
45
|
end
|
data/templates/index.html
CHANGED
@@ -24,11 +24,13 @@
|
|
24
24
|
function(n) {
|
25
25
|
var selected = '';
|
26
26
|
if(n.version==selectedVer) {
|
27
|
-
selected = ' selected';
|
27
|
+
selected = ' selected';
|
28
|
+
}
|
28
29
|
return ("<a href='" + n.rdoc_index + "' class='version"+ selected +"'>" + n.version + "</a>")
|
29
30
|
});
|
30
31
|
$('#current').html($(this).clone()).append(" <span class='quiet'>" + versions.join(" ") + "</span>");
|
31
32
|
$('#current a.gemname').attr('href',$(this).attr('rel')).click(function(){window.open(this.href);return false;});
|
33
|
+
document.title = $(this).clone().text() + "-" + selectedVer + " - Bdoc";
|
32
34
|
return false;
|
33
35
|
};
|
34
36
|
$(function(){
|
@@ -39,6 +41,7 @@
|
|
39
41
|
$(this).siblings('a.version').removeClass('selected');
|
40
42
|
$(this).addClass('selected');
|
41
43
|
$('#viewport iframe').attr('src',this.href);
|
44
|
+
document.title = $(this).parent().siblings('a.gemname').text() +"-"+ $(this).text() + " - Bdoc";
|
42
45
|
return false;
|
43
46
|
});
|
44
47
|
});
|
@@ -56,8 +59,16 @@
|
|
56
59
|
</div>
|
57
60
|
<div id="nav">
|
58
61
|
<% @gems.each do |gem| %>
|
59
|
-
<span class="gem"
|
62
|
+
<span class="gem">
|
63
|
+
<% if gem[:versions].last[:rdoc_index] %>
|
64
|
+
<a href="<%= gem[:versions].last[:rdoc_index] %>" class="gemname" title="<%= gem[:description] %>" rel="<%= gem[:homepage] %>"><%= gem[:name] %></a>
|
65
|
+
<% else %>
|
66
|
+
<span class="gemname quiet" title="<%= gem[:description] %>">*<%= gem[:name] %></span>
|
67
|
+
<% end %>
|
68
|
+
<span class="version hide"><%= gem[:versions].last[:version] %></span>
|
69
|
+
</span>
|
60
70
|
<% end %>
|
71
|
+
<p><em class="quiet">* Rdocs for these Gems are not installed</em></p>
|
61
72
|
</div>
|
62
73
|
</body>
|
63
74
|
</html>
|