yard 0.8.2.1 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/ChangeLog +246 -0
- data/README.md +12 -2
- data/Rakefile +19 -51
- data/benchmarks/format_args.rb +3 -3
- data/benchmarks/pathname_vs_string.rb +4 -4
- data/benchmarks/template_format.rb +1 -1
- data/docs/Templates.md +21 -21
- data/docs/WhatsNew.md +16 -2
- data/lib/yard.rb +23 -3
- data/lib/yard/autoload.rb +14 -13
- data/lib/yard/cli/command.rb +11 -3
- data/lib/yard/cli/command_parser.rb +4 -4
- data/lib/yard/cli/config.rb +2 -2
- data/lib/yard/cli/diff.rb +60 -16
- data/lib/yard/cli/graph.rb +5 -2
- data/lib/yard/cli/help.rb +1 -1
- data/lib/yard/cli/list.rb +2 -2
- data/lib/yard/cli/server.rb +80 -13
- data/lib/yard/cli/stats.rb +8 -8
- data/lib/yard/cli/yardoc.rb +32 -78
- data/lib/yard/cli/yardopts_command.rb +109 -0
- data/lib/yard/cli/yri.rb +2 -2
- data/lib/yard/code_objects/base.rb +3 -1
- data/lib/yard/code_objects/extra_file_object.rb +45 -6
- data/lib/yard/core_ext/file.rb +1 -1
- data/lib/yard/docstring.rb +10 -1
- data/lib/yard/i18n/locale.rb +11 -3
- data/lib/yard/i18n/message.rb +1 -1
- data/lib/yard/logging.rb +32 -7
- data/lib/yard/parser/ruby/ruby_parser.rb +8 -3
- data/lib/yard/parser/source_parser.rb +1 -2
- data/lib/yard/rake/yardoc_task.rb +1 -2
- data/lib/yard/registry.rb +20 -1
- data/lib/yard/registry_store.rb +15 -1
- data/lib/yard/rubygems/backports/gem.rb +6 -5
- data/lib/yard/rubygems/backports/source_index.rb +17 -0
- data/lib/yard/rubygems/doc_manager.rb +1 -1
- data/lib/yard/server/commands/static_file_command.rb +17 -10
- data/lib/yard/server/library_version.rb +2 -2
- data/lib/yard/server/rack_adapter.rb +3 -3
- data/lib/yard/server/templates/default/layout/html/setup.rb +1 -1
- data/lib/yard/tags/directives.rb +1 -1
- data/lib/yard/templates/helpers/html_helper.rb +6 -4
- data/lib/yard/templates/template.rb +13 -1
- data/lib/yard/version.rb +3 -0
- data/spec/cli/config_spec.rb +2 -2
- data/spec/cli/diff_spec.rb +110 -23
- data/spec/cli/graph_spec.rb +12 -5
- data/spec/cli/help_spec.rb +1 -1
- data/spec/cli/server_spec.rb +243 -153
- data/spec/cli/stats_spec.rb +1 -1
- data/spec/cli/yardoc_spec.rb +36 -0
- data/spec/code_objects/base_spec.rb +15 -0
- data/spec/code_objects/constants_spec.rb +1 -1
- data/spec/code_objects/extra_file_object_spec.rb +15 -3
- data/spec/docstring_parser_spec.rb +4 -0
- data/spec/docstring_spec.rb +18 -0
- data/spec/handlers/module_function_handler_spec.rb +23 -0
- data/spec/i18n/locale_spec.rb +7 -1
- data/spec/parser/ruby/ruby_parser_spec.rb +26 -0
- data/spec/parser/source_parser_spec.rb +18 -6
- data/spec/rake/yardoc_task_spec.rb +28 -19
- data/spec/registry_spec.rb +34 -0
- data/spec/registry_store_spec.rb +10 -0
- data/spec/rubygems/doc_manager_spec.rb +1 -1
- data/spec/server/commands/static_file_command_spec.rb +3 -3
- data/spec/spec_helper.rb +22 -3
- data/spec/templates/helpers/html_helper_spec.rb +10 -8
- data/templates/default/fulldoc/html/frames.erb +1 -1
- data/templates/default/fulldoc/html/setup.rb +1 -1
- data/yard.gemspec +24 -0
- metadata +7 -5
@@ -11,7 +11,7 @@ describe Gem::DocManager do
|
|
11
11
|
|
12
12
|
YARD::CLI::Yardoc.stub(:run)
|
13
13
|
|
14
|
-
@spec_file = File.join(YARD::ROOT, '
|
14
|
+
@spec_file = File.join(YARD::ROOT, '..', 'yard.gemspec')
|
15
15
|
@spec = Gem::SourceIndex.load_specification(@spec_file)
|
16
16
|
@spec.has_yardoc = false # no yardoc docs for now
|
17
17
|
@yardopts = File.join(@spec.full_gem_path, '.yardopts')
|
@@ -24,10 +24,10 @@ describe YARD::Server::Commands::StaticFileCommand do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should return file contents if found" do
|
27
|
-
|
27
|
+
tpl = Templates::Engine.template(:default, :fulldoc, :html)
|
28
28
|
File.should_receive(:exist?).with('/c/path/to/file.txt').and_return(false)
|
29
|
-
|
30
|
-
File.should_receive(:read).with(path).and_return('FOO')
|
29
|
+
tpl.should_receive(:find_file).with('/path/to/file.txt').and_return('/path/to/foo')
|
30
|
+
File.should_receive(:read).with('/path/to/foo').and_return('FOO')
|
31
31
|
run('/path/to/file.txt', 200, 'FOO')
|
32
32
|
end
|
33
33
|
|
data/spec/spec_helper.rb
CHANGED
@@ -5,6 +5,25 @@ rescue LoadError
|
|
5
5
|
require "spec"
|
6
6
|
end
|
7
7
|
|
8
|
+
begin
|
9
|
+
require 'bundler'
|
10
|
+
Bundler.setup
|
11
|
+
rescue LoadError
|
12
|
+
end
|
13
|
+
|
14
|
+
begin
|
15
|
+
require 'simplecov'
|
16
|
+
SimpleCov.start
|
17
|
+
# TODO: hide some rb files from cov report
|
18
|
+
# hide = '_spec\.rb$,spec_helper\.rb$,ruby_lex\.rb$,autoload\.rb$'
|
19
|
+
# if YARD::Parser::SourceParser.parser_type == :ruby
|
20
|
+
# hide += ',legacy\/.+_handler'
|
21
|
+
# else
|
22
|
+
# hide += ',ruby_parser\.rb$,ast_node\.rb$,handlers\/ruby\/[^\/]+\.rb$'
|
23
|
+
# end
|
24
|
+
rescue LoadError
|
25
|
+
end if ENV['COVERAGE']
|
26
|
+
|
8
27
|
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'yard'))
|
9
28
|
|
10
29
|
unless defined?(HAVE_RIPPER)
|
@@ -33,7 +52,7 @@ def described_in_docs(klass, meth, file = nil)
|
|
33
52
|
else
|
34
53
|
underscore = klass.class_name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase.gsub('::', '/')
|
35
54
|
$".find_all {|p| p.include? underscore }.each do |filename|
|
36
|
-
next unless File.
|
55
|
+
next unless File.exist? filename
|
37
56
|
YARD::Parser::SourceParser.new.parse(filename)
|
38
57
|
end
|
39
58
|
end
|
@@ -65,7 +84,7 @@ def docspec(objname = self.class.description, klass = self.class.described_type)
|
|
65
84
|
underscore = klass.class_name.gsub(/([a-z])([A-Z])/, '\1_\2').downcase.gsub('::', '/')
|
66
85
|
$".find_all {|p| p.include? underscore }.each do |filename|
|
67
86
|
filename = File.join(YARD::ROOT, filename)
|
68
|
-
next unless File.
|
87
|
+
next unless File.exist? filename
|
69
88
|
YARD::Parser::SourceParser.new.parse(filename)
|
70
89
|
end
|
71
90
|
|
@@ -96,7 +115,7 @@ module Kernel
|
|
96
115
|
args.first
|
97
116
|
end
|
98
117
|
|
99
|
-
def puts(str)
|
118
|
+
def puts(str = '')
|
100
119
|
STDOUT.puts str + "<br/>\n"
|
101
120
|
str
|
102
121
|
end
|
@@ -22,14 +22,14 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
22
22
|
|
23
23
|
describe '#charset' do
|
24
24
|
it "should return foo if LANG=foo" do
|
25
|
-
ENV.should_receive(:[]).with('LANG').and_return('shift_jis') if
|
25
|
+
ENV.should_receive(:[]).with('LANG').and_return('shift_jis') if YARD.ruby18?
|
26
26
|
Encoding.default_external.should_receive(:name).and_return('shift_jis') if defined?(Encoding)
|
27
27
|
charset.should == 'shift_jis'
|
28
28
|
end
|
29
29
|
|
30
30
|
['US-ASCII', 'ASCII-7BIT', 'ASCII-8BIT'].each do |type|
|
31
31
|
it "should convert #{type} to iso-8859-1" do
|
32
|
-
ENV.should_receive(:[]).with('LANG').and_return(type) if
|
32
|
+
ENV.should_receive(:[]).with('LANG').and_return(type) if YARD.ruby18?
|
33
33
|
Encoding.default_external.should_receive(:name).and_return(type) if defined?(Encoding)
|
34
34
|
charset.should == 'iso-8859-1'
|
35
35
|
end
|
@@ -37,7 +37,7 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
37
37
|
|
38
38
|
it "should support utf8 as an encoding value for utf-8" do
|
39
39
|
type = 'utf8'
|
40
|
-
ENV.should_receive(:[]).with('LANG').and_return(type) if
|
40
|
+
ENV.should_receive(:[]).with('LANG').and_return(type) if YARD.ruby18?
|
41
41
|
Encoding.default_external.should_receive(:name).and_return(type) if defined?(Encoding)
|
42
42
|
charset.should == 'utf-8'
|
43
43
|
end
|
@@ -46,15 +46,15 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
46
46
|
@file = OpenStruct.new(:contents => 'foo'.force_encoding('sjis'))
|
47
47
|
# not the correct charset name, but good enough
|
48
48
|
['Shift_JIS', 'Windows-31J'].should include(charset)
|
49
|
-
end if
|
49
|
+
end if YARD.ruby19?
|
50
50
|
|
51
51
|
it "should take file encoding if there is a file" do
|
52
|
-
ENV.stub!(:[]).with('LANG').and_return('utf-8') if
|
52
|
+
ENV.stub!(:[]).with('LANG').and_return('utf-8') if YARD.ruby18?
|
53
53
|
@file = OpenStruct.new(:contents => 'foo')
|
54
54
|
charset.should == 'utf-8'
|
55
|
-
end if
|
55
|
+
end if YARD.ruby18?
|
56
56
|
|
57
|
-
if
|
57
|
+
if YARD.ruby18?
|
58
58
|
it "should return utf-8 if no LANG env is set" do
|
59
59
|
ENV.should_receive(:[]).with('LANG').and_return(nil)
|
60
60
|
charset.should == 'utf-8'
|
@@ -145,7 +145,9 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
145
145
|
|
146
146
|
it "should autolink URLs (markdown specific)" do
|
147
147
|
log.enter_level(Logger::FATAL) do
|
148
|
-
|
148
|
+
unless markup_class(:markdown).to_s == "RedcarpetCompat"
|
149
|
+
pending 'This test depends on a markdown engine that supports autolinking'
|
150
|
+
end
|
149
151
|
end
|
150
152
|
htmlify('http://example.com', :markdown).chomp.gsub('/', '/').should ==
|
151
153
|
'<p><a href="http://example.com">http://example.com</a></p>'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
5
|
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=<%= charset %>"/>
|
7
7
|
<title><%= options.title %></title>
|
8
8
|
</head>
|
9
9
|
<script type="text/javascript" charset="utf-8">
|
@@ -186,7 +186,7 @@ def class_list(root = Registry.root)
|
|
186
186
|
children.reject {|c| c.nil? }.sort_by {|child| child.path }.map do |child|
|
187
187
|
if child.is_a?(CodeObjects::NamespaceObject)
|
188
188
|
name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name
|
189
|
-
has_children = child.children.any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
|
189
|
+
has_children = run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) }
|
190
190
|
out << "<li>"
|
191
191
|
out << "<a class='toggle'></a> " if has_children
|
192
192
|
out << linkify(child, name)
|
data/yard.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require File.expand_path('../lib/yard/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "yard"
|
5
|
+
s.summary = "Documentation tool for consistent and usable documentation in Ruby."
|
6
|
+
s.description = <<-eof
|
7
|
+
YARD is a documentation generation tool for the Ruby programming language.
|
8
|
+
It enables the user to generate consistent, usable documentation that can be
|
9
|
+
exported to a number of formats very easily, and also supports extending for
|
10
|
+
custom Ruby constructs such as custom class level definitions.
|
11
|
+
eof
|
12
|
+
s.version = YARD::VERSION
|
13
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
14
|
+
s.author = "Loren Segal"
|
15
|
+
s.email = "lsegal@soen.ca"
|
16
|
+
s.homepage = "http://yardoc.org"
|
17
|
+
s.platform = Gem::Platform::RUBY
|
18
|
+
s.files = Dir.glob("{docs,bin,lib,spec,templates,benchmarks}/**/*") +
|
19
|
+
['ChangeLog', 'LICENSE', 'LEGAL', 'README.md', 'Rakefile', '.yardopts', __FILE__]
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
s.executables = ['yard', 'yardoc', 'yri']
|
22
|
+
s.has_rdoc = 'yard'
|
23
|
+
s.rubyforge_project = 'yard'
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
default_executable:
|
12
|
+
date: 2012-10-15 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
14
|
description: ! " YARD is a documentation generation tool for the Ruby programming
|
16
15
|
language.\n It enables the user to generate consistent, usable documentation
|
@@ -62,6 +61,7 @@ files:
|
|
62
61
|
- lib/yard/cli/server.rb
|
63
62
|
- lib/yard/cli/stats.rb
|
64
63
|
- lib/yard/cli/yardoc.rb
|
64
|
+
- lib/yard/cli/yardopts_command.rb
|
65
65
|
- lib/yard/cli/yri.rb
|
66
66
|
- lib/yard/code_objects/base.rb
|
67
67
|
- lib/yard/code_objects/class_object.rb
|
@@ -236,6 +236,7 @@ files:
|
|
236
236
|
- lib/yard/templates/template.rb
|
237
237
|
- lib/yard/templates/template_options.rb
|
238
238
|
- lib/yard/verifier.rb
|
239
|
+
- lib/yard/version.rb
|
239
240
|
- lib/yard.rb
|
240
241
|
- spec/cli/command_parser_spec.rb
|
241
242
|
- spec/cli/command_spec.rb
|
@@ -566,7 +567,7 @@ files:
|
|
566
567
|
- README.md
|
567
568
|
- Rakefile
|
568
569
|
- .yardopts
|
569
|
-
|
570
|
+
- yard.gemspec
|
570
571
|
homepage: http://yardoc.org
|
571
572
|
licenses: []
|
572
573
|
post_install_message:
|
@@ -587,8 +588,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
587
588
|
version: '0'
|
588
589
|
requirements: []
|
589
590
|
rubyforge_project: yard
|
590
|
-
rubygems_version: 1.
|
591
|
+
rubygems_version: 1.8.16
|
591
592
|
signing_key:
|
592
593
|
specification_version: 3
|
593
594
|
summary: Documentation tool for consistent and usable documentation in Ruby.
|
594
595
|
test_files: []
|
596
|
+
has_rdoc: yard
|