yard-components 0.0.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.
- data/.document +5 -0
- data/.rspec +1 -0
- data/.yardopts +1 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +40 -0
- data/LICENSE.txt +20 -0
- data/README.md +14 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/example/multi-component-system.rb +25 -0
- data/lib/yard-components.rb +20 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/yard-components_spec.rb +7 -0
- data/templates/default/component/html/body.erb +23 -0
- data/templates/default/component/html/header.erb +1 -0
- data/templates/default/component/html/setup.rb +3 -0
- data/templates/default/fulldoc/html/full_list.erb +35 -0
- data/templates/default/fulldoc/html/full_list_components.erb +5 -0
- data/templates/default/fulldoc/html/js/app.js +196 -0
- data/templates/default/fulldoc/html/setup.rb +47 -0
- data/templates/default/layout/html/search.erb +6 -0
- data/templates/default/layout/html/setup.rb +6 -0
- metadata +193 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-e lib/yard-components.rb
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
bluecloth (2.1.0)
|
5
|
+
columnize (0.3.2)
|
6
|
+
diff-lcs (1.1.2)
|
7
|
+
git (1.2.5)
|
8
|
+
jeweler (1.5.2)
|
9
|
+
bundler (~> 1.0.0)
|
10
|
+
git (>= 1.2.5)
|
11
|
+
rake
|
12
|
+
linecache (0.43)
|
13
|
+
rake (0.8.7)
|
14
|
+
rcov (0.9.9)
|
15
|
+
rspec (2.3.0)
|
16
|
+
rspec-core (~> 2.3.0)
|
17
|
+
rspec-expectations (~> 2.3.0)
|
18
|
+
rspec-mocks (~> 2.3.0)
|
19
|
+
rspec-core (2.3.1)
|
20
|
+
rspec-expectations (2.3.0)
|
21
|
+
diff-lcs (~> 1.1.2)
|
22
|
+
rspec-mocks (2.3.0)
|
23
|
+
ruby-debug (0.10.4)
|
24
|
+
columnize (>= 0.1)
|
25
|
+
ruby-debug-base (~> 0.10.4.0)
|
26
|
+
ruby-debug-base (0.10.4)
|
27
|
+
linecache (>= 0.3)
|
28
|
+
yard (0.6.5)
|
29
|
+
|
30
|
+
PLATFORMS
|
31
|
+
ruby
|
32
|
+
|
33
|
+
DEPENDENCIES
|
34
|
+
bluecloth
|
35
|
+
bundler (~> 1.0.0)
|
36
|
+
jeweler (~> 1.5.2)
|
37
|
+
rcov
|
38
|
+
rspec (~> 2.3.0)
|
39
|
+
ruby-debug
|
40
|
+
yard
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Daniel Higginbotham
|
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.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Yard Components
|
2
|
+
===============
|
3
|
+
This is a YARD plugin to generate a documentation page for each component in your system.
|
4
|
+
The page lists all classes and methods tagged with `@component`, along with their
|
5
|
+
descriptions.
|
6
|
+
|
7
|
+
To try, run
|
8
|
+
|
9
|
+
yardoc -e lib/yard-components.rb example/multi-component-system.rb
|
10
|
+
|
11
|
+
The file example/multi-component-system.rb uses the `@component` tag.
|
12
|
+
|
13
|
+
Copyright (c) 2011 Daniel Higginbotham. See LICENSE.txt for
|
14
|
+
further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "yard-components"
|
16
|
+
gem.homepage = "http://github.com/flyingmachine/yard-components"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Add the concept of 'components' to YARD}
|
19
|
+
gem.description = %Q{Allows use of the @component tag to pull related methods and classes into one file}
|
20
|
+
gem.email = "daniel@flyingmachinestudios.com"
|
21
|
+
gem.authors = ["Daniel Higginbotham"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "yard-components #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class MultiComponentSystem
|
2
|
+
|
3
|
+
# This description should appear in the component docs
|
4
|
+
# @component first
|
5
|
+
class FirstComponent
|
6
|
+
end
|
7
|
+
|
8
|
+
# This description should also appear in the component docs
|
9
|
+
# @component second
|
10
|
+
class SecondComponent
|
11
|
+
end
|
12
|
+
|
13
|
+
# This description should not appear in the component docs
|
14
|
+
class Integration
|
15
|
+
# This method description should appear in "first" component docs
|
16
|
+
# @component first
|
17
|
+
def interact_with_first_component
|
18
|
+
end
|
19
|
+
|
20
|
+
# This method description should appear in "second" component docs
|
21
|
+
# @component second
|
22
|
+
def interact_with_second_component
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
YARD::Tags::Library.define_tag("For Gathering Scattered Components on One Page", :component)
|
2
|
+
YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../templates'
|
3
|
+
|
4
|
+
# Add a method to facilitate linking to components
|
5
|
+
module YARD::Templates::Helpers::BaseHelper
|
6
|
+
alias_method :linkify_pre_yard_components, :linkify
|
7
|
+
|
8
|
+
def linkify(*args)
|
9
|
+
if args.first.is_a?(String) && args.first =~ /^component:(.*)/
|
10
|
+
link_component($1)
|
11
|
+
else
|
12
|
+
linkify_pre_yard_components(*args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param [String] component_name
|
17
|
+
def link_component(component_name)
|
18
|
+
link_file("component-#{component_name}", component_name)
|
19
|
+
end
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'yard-components'
|
5
|
+
|
6
|
+
# Requires supporting files with custom matchers and macros, etc,
|
7
|
+
# in ./support/ and its subdirectories.
|
8
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<% if options[:component][:code_objects][:classes_and_modules].size > 0 %>
|
2
|
+
<h2>Classes and Modules</h2>
|
3
|
+
<ul>
|
4
|
+
<% options[:component][:code_objects][:classes_and_modules].each do |code_object| %>
|
5
|
+
<li>
|
6
|
+
<%= linkify(code_object, format_object_title(code_object)) %>
|
7
|
+
<%= yieldall :object => code_object %>
|
8
|
+
</li>
|
9
|
+
<% end %>
|
10
|
+
</ul>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<% if options[:component][:code_objects][:other].size > 0 %>
|
14
|
+
<h2>Methods</h2>
|
15
|
+
<ul>
|
16
|
+
<% options[:component][:code_objects][:other].each do |code_object| %>
|
17
|
+
<li>
|
18
|
+
<%= linkify(code_object, format_object_title(code_object)) %>
|
19
|
+
<%= yieldall :object => code_object %>
|
20
|
+
</li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|
23
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Component: <%= options[:component][:name] %></h1>
|
@@ -0,0 +1,35 @@
|
|
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 name="Content-Type" content="text/html; charset=<%= charset %>" />
|
6
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
7
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
9
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
10
|
+
<base id="base_target" target="_parent" />
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<script type="text/javascript" charset="utf-8">
|
14
|
+
if (window.top.frames.main) {
|
15
|
+
document.getElementById('base_target').target = 'main';
|
16
|
+
document.body.className = 'frames';
|
17
|
+
}
|
18
|
+
</script>
|
19
|
+
<div id="content">
|
20
|
+
<h1 id="full_list_header"><%= @list_title %></h1>
|
21
|
+
<div id="nav">
|
22
|
+
<a target="_self" href="class_list.html">Classes</a> |
|
23
|
+
<a target="_self" href="method_list.html">Methods</a> |
|
24
|
+
<a target="_self" href="file_list.html">Files</a>
|
25
|
+
<a target="_self" href="component_list.html">Files</a>
|
26
|
+
</div>
|
27
|
+
<div id="search">Search: <input type="text" /></div>
|
28
|
+
|
29
|
+
<ul id="full_list" class="<%= @list_type %>">
|
30
|
+
<%= erb "full_list_#{@list_type}" %>
|
31
|
+
</ul>
|
32
|
+
</div>
|
33
|
+
</body>
|
34
|
+
</html>
|
35
|
+
|
@@ -0,0 +1,196 @@
|
|
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().next().slideDown(100);
|
6
|
+
$(this).text("Hide source");
|
7
|
+
},
|
8
|
+
function() {
|
9
|
+
$(this).parent().next().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
|
+
$('#search a').click(function() {
|
53
|
+
var filename = this.id.replace("_link", "") + ".html"
|
54
|
+
toggleSearchFrame(this, relpath + filename);
|
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 (window.top.frames.main) {
|
79
|
+
document.body.className = 'frames';
|
80
|
+
$('#menu .noframes a').attr('href', document.location);
|
81
|
+
$('html head title', window.parent.document).text($('html head title').text());
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
function keyboardShortcuts() {
|
86
|
+
if (window.top.frames.main) return;
|
87
|
+
$(document).keypress(function(evt) {
|
88
|
+
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) return;
|
89
|
+
if (typeof evt.orignalTarget !== "undefined" &&
|
90
|
+
(evt.originalTarget.nodeName == "INPUT" ||
|
91
|
+
evt.originalTarget.nodeName == "TEXTAREA")) return;
|
92
|
+
switch (evt.charCode) {
|
93
|
+
case 67: case 99: $('#class_list_link').click(); break; // 'c'
|
94
|
+
case 77: case 109: $('#method_list_link').click(); break; // 'm'
|
95
|
+
case 70: case 102: $('#file_list_link').click(); break; // 'f'
|
96
|
+
}
|
97
|
+
});
|
98
|
+
}
|
99
|
+
|
100
|
+
function summaryToggle() {
|
101
|
+
$('.summary_toggle').click(function() {
|
102
|
+
localStorage.summaryCollapsed = $(this).text();
|
103
|
+
$(this).text($(this).text() == "collapse" ? "expand" : "collapse");
|
104
|
+
var next = $(this).parent().parent().next();
|
105
|
+
if (next.hasClass('compact')) {
|
106
|
+
next.toggle();
|
107
|
+
next.next().toggle();
|
108
|
+
}
|
109
|
+
else if (next.hasClass('summary')) {
|
110
|
+
var list = $('<ul class="summary compact" />');
|
111
|
+
list.html(next.html());
|
112
|
+
list.find('.summary_desc, .note').remove();
|
113
|
+
list.find('a').each(function() {
|
114
|
+
$(this).html($(this).find('strong').html());
|
115
|
+
$(this).parent().html($(this)[0].outerHTML);
|
116
|
+
});
|
117
|
+
next.before(list);
|
118
|
+
next.toggle();
|
119
|
+
}
|
120
|
+
return false;
|
121
|
+
});
|
122
|
+
if (localStorage) {
|
123
|
+
if (localStorage.summaryCollapsed == "collapse") $('.summary_toggle').click();
|
124
|
+
else localStorage.summaryCollapsed = "expand";
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
function fixOutsideWorldLinks() {
|
129
|
+
$('a').each(function() {
|
130
|
+
if (window.location.host != this.host) this.target = '_parent';
|
131
|
+
});
|
132
|
+
}
|
133
|
+
|
134
|
+
function generateTOC() {
|
135
|
+
if ($('#filecontents').length == 0) return;
|
136
|
+
var _toc = $('<ol class="top"></ol>');
|
137
|
+
var show = false;
|
138
|
+
var toc = _toc;
|
139
|
+
var counter = 0;
|
140
|
+
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
141
|
+
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
142
|
+
for (i in tags) { tags[i] = '#filecontents ' + tags[i] }
|
143
|
+
var lastTag = parseInt(tags[0][1]);
|
144
|
+
$(tags.join(', ')).each(function() {
|
145
|
+
if (this.id == "filecontents") return;
|
146
|
+
show = true;
|
147
|
+
var thisTag = parseInt(this.tagName[1]);
|
148
|
+
if (this.id.length == 0) {
|
149
|
+
var proposedId = $(this).text().replace(/[^a-z0-9-]/ig, '_');
|
150
|
+
if ($('#' + proposedId).length > 0) proposedId += counter++;
|
151
|
+
this.id = proposedId;
|
152
|
+
}
|
153
|
+
if (thisTag > lastTag) {
|
154
|
+
for (var i = 0; i < thisTag - lastTag; i++) {
|
155
|
+
var tmp = $('<ol/>'); toc.append(tmp); toc = tmp;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
if (thisTag < lastTag) {
|
159
|
+
for (var i = 0; i < lastTag - thisTag; i++) toc = toc.parent();
|
160
|
+
}
|
161
|
+
toc.append('<li><a href="#' + this.id + '">' + $(this).text() + '</a></li>');
|
162
|
+
lastTag = thisTag;
|
163
|
+
});
|
164
|
+
if (!show) return;
|
165
|
+
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>';
|
166
|
+
$('#content').prepend(html);
|
167
|
+
$('#toc').append(_toc);
|
168
|
+
$('#toc .hide_toc').toggle(function() {
|
169
|
+
$('#toc .top').slideUp('fast');
|
170
|
+
$('#toc').toggleClass('hidden');
|
171
|
+
$('#toc .title small').toggle();
|
172
|
+
}, function() {
|
173
|
+
$('#toc .top').slideDown('fast');
|
174
|
+
$('#toc').toggleClass('hidden');
|
175
|
+
$('#toc .title small').toggle();
|
176
|
+
});
|
177
|
+
$('#toc .float_toc').toggle(function() {
|
178
|
+
$(this).text('float');
|
179
|
+
$('#toc').toggleClass('nofloat');
|
180
|
+
}, function() {
|
181
|
+
$(this).text('left')
|
182
|
+
$('#toc').toggleClass('nofloat');
|
183
|
+
});
|
184
|
+
}
|
185
|
+
|
186
|
+
$(framesInit);
|
187
|
+
$(createSourceLinks);
|
188
|
+
$(createDefineLinks);
|
189
|
+
$(createFullTreeLinks);
|
190
|
+
$(fixBoxInfoHeights);
|
191
|
+
$(searchFrameLinks);
|
192
|
+
$(linkSummaries);
|
193
|
+
$(keyboardShortcuts);
|
194
|
+
$(summaryToggle);
|
195
|
+
$(fixOutsideWorldLinks);
|
196
|
+
$(generateTOC);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
include Helpers::ModuleHelper
|
2
|
+
|
3
|
+
def init
|
4
|
+
super
|
5
|
+
serialize_components
|
6
|
+
end
|
7
|
+
|
8
|
+
def generate_assets
|
9
|
+
super
|
10
|
+
generate_component_list
|
11
|
+
end
|
12
|
+
|
13
|
+
def generate_component_list
|
14
|
+
@items = components.keys
|
15
|
+
@list_title = "Component List"
|
16
|
+
@list_type = "components"
|
17
|
+
asset('component_list.html', erb(:full_list))
|
18
|
+
end
|
19
|
+
|
20
|
+
def serialize_components
|
21
|
+
components.each do |component_name, component_code_objects|
|
22
|
+
options[:component] = {
|
23
|
+
:name => component_name,
|
24
|
+
:code_objects => component_code_objects
|
25
|
+
}
|
26
|
+
options[:title] = "Component: #{component_name}"
|
27
|
+
serialized_path = "file.component-#{component_name}.html"
|
28
|
+
Templates::Engine.with_serializer(serialized_path, options[:serializer]) do
|
29
|
+
T('layout').run(options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def components
|
35
|
+
return @components if @components
|
36
|
+
@components = Hash.new{|h,k| h[k] = Hash.new{|h2, k2| h2[k2] = []}}
|
37
|
+
Registry.each do |code_object|
|
38
|
+
code_object.tags.select{|t| t.tag_name == 'component'}.each do |tag|
|
39
|
+
if [:class, :module].include?(code_object.type)
|
40
|
+
@components[tag.tag_name][:classes_and_modules] << code_object
|
41
|
+
else
|
42
|
+
@components[tag.tag_name][:other] << code_object
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
@components
|
47
|
+
end
|
metadata
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-components
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 0.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Daniel Higginbotham
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-24 00:00:00 -04:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
type: :runtime
|
24
|
+
name: yard
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
prerelease: false
|
37
|
+
type: :runtime
|
38
|
+
name: bluecloth
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
requirement: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
prerelease: false
|
51
|
+
type: :development
|
52
|
+
name: rspec
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 2
|
61
|
+
- 3
|
62
|
+
- 0
|
63
|
+
version: 2.3.0
|
64
|
+
requirement: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
prerelease: false
|
67
|
+
type: :development
|
68
|
+
name: bundler
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ~>
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 23
|
75
|
+
segments:
|
76
|
+
- 1
|
77
|
+
- 0
|
78
|
+
- 0
|
79
|
+
version: 1.0.0
|
80
|
+
requirement: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
|
+
name: jeweler
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 7
|
91
|
+
segments:
|
92
|
+
- 1
|
93
|
+
- 5
|
94
|
+
- 2
|
95
|
+
version: 1.5.2
|
96
|
+
requirement: *id005
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
prerelease: false
|
99
|
+
type: :development
|
100
|
+
name: rcov
|
101
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
hash: 3
|
107
|
+
segments:
|
108
|
+
- 0
|
109
|
+
version: "0"
|
110
|
+
requirement: *id006
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
prerelease: false
|
113
|
+
type: :development
|
114
|
+
name: ruby-debug
|
115
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 3
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
124
|
+
requirement: *id007
|
125
|
+
description: Allows use of the @component tag to pull related methods and classes into one file
|
126
|
+
email: daniel@flyingmachinestudios.com
|
127
|
+
executables: []
|
128
|
+
|
129
|
+
extensions: []
|
130
|
+
|
131
|
+
extra_rdoc_files:
|
132
|
+
- LICENSE.txt
|
133
|
+
- README.md
|
134
|
+
files:
|
135
|
+
- .document
|
136
|
+
- .rspec
|
137
|
+
- .yardopts
|
138
|
+
- Gemfile
|
139
|
+
- Gemfile.lock
|
140
|
+
- LICENSE.txt
|
141
|
+
- README.md
|
142
|
+
- Rakefile
|
143
|
+
- VERSION
|
144
|
+
- example/multi-component-system.rb
|
145
|
+
- lib/yard-components.rb
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
- spec/yard-components_spec.rb
|
148
|
+
- templates/default/component/html/body.erb
|
149
|
+
- templates/default/component/html/header.erb
|
150
|
+
- templates/default/component/html/setup.rb
|
151
|
+
- templates/default/fulldoc/html/full_list.erb
|
152
|
+
- templates/default/fulldoc/html/full_list_components.erb
|
153
|
+
- templates/default/fulldoc/html/js/app.js
|
154
|
+
- templates/default/fulldoc/html/setup.rb
|
155
|
+
- templates/default/layout/html/search.erb
|
156
|
+
- templates/default/layout/html/setup.rb
|
157
|
+
has_rdoc: true
|
158
|
+
homepage: http://github.com/flyingmachine/yard-components
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
post_install_message:
|
162
|
+
rdoc_options: []
|
163
|
+
|
164
|
+
require_paths:
|
165
|
+
- lib
|
166
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
none: false
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
hash: 3
|
172
|
+
segments:
|
173
|
+
- 0
|
174
|
+
version: "0"
|
175
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
hash: 3
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
version: "0"
|
184
|
+
requirements: []
|
185
|
+
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 1.3.7
|
188
|
+
signing_key:
|
189
|
+
specification_version: 3
|
190
|
+
summary: Add the concept of 'components' to YARD
|
191
|
+
test_files:
|
192
|
+
- spec/spec_helper.rb
|
193
|
+
- spec/yard-components_spec.rb
|