yard-minitest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +2 -0
- data/LICENSE +22 -0
- data/README.md +51 -0
- data/Rakefile +1 -0
- data/lib/yard-minitest.rb +4 -0
- data/lib/yard/minitest/block_handler.rb +17 -0
- data/lib/yard/minitest/method_handler.rb +23 -0
- data/lib/yard/minitest/version.rb +5 -0
- data/templates/default/class/html/tests.erb +26 -0
- data/templates/default/class/setup.rb +4 -0
- data/yard-minitest.gemspec +30 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 28436cd9a0cf13a5d318db3430a2ea1b068f7058
|
4
|
+
data.tar.gz: f06baa4d28717545c249619918ed5b13604880a0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9eeb9a4ab7e67a0a1709409aaef7471332d43ea81b93a9764333ef41b8e86b000823f8148380cedd1dcba6d431a06729a78915d5af7d631c2f4fcf725865f0f3
|
7
|
+
data.tar.gz: 74ee30ea51df974393e6733f95bafd265bf8ebe1c0f8b89436da67475839ba09ca49d69546dd368d5d202e6fa2ceaf7640cb2f051cf71a7384591f741fe3566b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Arjan van der Gaag
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# YARD::Minitest
|
2
|
+
|
3
|
+
Parse Minitest files to read all the test case descriptions and include those
|
4
|
+
with the relevant classes in your YARD documentation. This works for both
|
5
|
+
ActiveSupport-style `test` blocks and regular old `def test_` methods. Test
|
6
|
+
cases get listed at the bottom of your class documentation and include the
|
7
|
+
test source code, file name and line numbers.
|
8
|
+
|
9
|
+
**This is very much a toy project to play with YARD plugins.** If you find it
|
10
|
+
useful then pull requests are welcome.
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'yard-minitest'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install yard-minitest
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
YARD::Minitest is a YARD plugin, so you can activate it explicitly when you run
|
31
|
+
`yardoc`:
|
32
|
+
|
33
|
+
$ yardoc --plugin minitest
|
34
|
+
|
35
|
+
Alternatively, you can have YARD always look for any installed plugin by setting
|
36
|
+
its `load_plugins` configuration:
|
37
|
+
|
38
|
+
$ yard config load_plugins true
|
39
|
+
|
40
|
+
Remember to include your test files when documenting your project; otherwise
|
41
|
+
your tests will not be found.
|
42
|
+
|
43
|
+
$ yardoc app/**/*.rb test/**/*.rb
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
1. Fork it ( https://github.com/avdgaag/yard-minitest/fork )
|
48
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
49
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
51
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module YARD
|
2
|
+
module Minitest
|
3
|
+
class BlockHandler < YARD::Handlers::Ruby::Base
|
4
|
+
handles method_call(:test)
|
5
|
+
|
6
|
+
def process
|
7
|
+
subject = YARD::Registry.at(namespace.name.to_s.sub(/Test$/, ''))
|
8
|
+
(subject[:tests] ||= []) << {
|
9
|
+
description: statement.parameters.first.jump(:string_content).source,
|
10
|
+
file: parser.file,
|
11
|
+
line: statement.line,
|
12
|
+
source: statement.block[1].source
|
13
|
+
}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module YARD
|
2
|
+
module Minitest
|
3
|
+
class MethodHandler < YARD::Handlers::Ruby::MethodHandler
|
4
|
+
handles :def
|
5
|
+
|
6
|
+
def process
|
7
|
+
super
|
8
|
+
if namespace.name.to_s =~ /Test$/
|
9
|
+
method_name = statement.method_name(true).to_s
|
10
|
+
if method_name =~ /^test_/
|
11
|
+
subject = YARD::Registry.at(namespace.name.to_s.sub(/Test$/, ''))
|
12
|
+
(subject[:tests] ||= []) << {
|
13
|
+
description: method_name.gsub(/^test|_/, ' ').strip,
|
14
|
+
file: parser.file,
|
15
|
+
line: statement.line,
|
16
|
+
source: statement.block.source
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<% if object[:tests] %>
|
2
|
+
<div class="tests">
|
3
|
+
<h2>Unit Tests</h2>
|
4
|
+
<ul class="see">
|
5
|
+
<% object[:tests].each do |test| %>
|
6
|
+
<li>
|
7
|
+
<%= test[:description] %>
|
8
|
+
<span class="showSource">[<a href="#" class="toggleSource">Show source</a>]</span>
|
9
|
+
<div class="source_code">
|
10
|
+
<table>
|
11
|
+
<tbody>
|
12
|
+
<tr>
|
13
|
+
<td><pre class="lines"><%= test[:source].lines.each_with_index.map { |_, i| test[:line] + i }.join("\n") %></pre></td>
|
14
|
+
<td><pre class="code">
|
15
|
+
<span class="info file"># File '<%= test[:file] %>', line <%= test[:line] %></span>
|
16
|
+
<%= html_syntax_highlight format_source test[:source] %>
|
17
|
+
</pre></td>
|
18
|
+
</tr>
|
19
|
+
</tbody>
|
20
|
+
</table>
|
21
|
+
</div>
|
22
|
+
</li>
|
23
|
+
<% end %>
|
24
|
+
</ul>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'yard/minitest/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'yard-minitest'
|
8
|
+
spec.version = YARD::Minitest::VERSION
|
9
|
+
spec.authors = ['Arjan van der Gaag']
|
10
|
+
spec.email = ['arjan@arjanvandergaag.nl']
|
11
|
+
spec.summary = %q{Include Minitest test case descriptions in your class documentation.}
|
12
|
+
spec.description = <<EOS
|
13
|
+
Parse Minitest files to read all the test case descriptions and include those
|
14
|
+
with the relevant classes in your YARD documentation. This works for both
|
15
|
+
ActiveSupport-style `test` blocks and regular old `def test_` methods. Test
|
16
|
+
cases get listed at the bottom of your class documentation and include the test
|
17
|
+
source code, file name and line numbers.
|
18
|
+
EOS
|
19
|
+
spec.homepage = 'https://github.com/avdgaag/yard-minitest'
|
20
|
+
spec.license = 'MIT'
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0")
|
23
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
24
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_dependency 'yard'
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
29
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-minitest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Arjan van der Gaag
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: yard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: |
|
56
|
+
Parse Minitest files to read all the test case descriptions and include those
|
57
|
+
with the relevant classes in your YARD documentation. This works for both
|
58
|
+
ActiveSupport-style `test` blocks and regular old `def test_` methods. Test
|
59
|
+
cases get listed at the bottom of your class documentation and include the test
|
60
|
+
source code, file name and line numbers.
|
61
|
+
email:
|
62
|
+
- arjan@arjanvandergaag.nl
|
63
|
+
executables: []
|
64
|
+
extensions: []
|
65
|
+
extra_rdoc_files: []
|
66
|
+
files:
|
67
|
+
- ".gitignore"
|
68
|
+
- Gemfile
|
69
|
+
- LICENSE
|
70
|
+
- README.md
|
71
|
+
- Rakefile
|
72
|
+
- lib/yard-minitest.rb
|
73
|
+
- lib/yard/minitest/block_handler.rb
|
74
|
+
- lib/yard/minitest/method_handler.rb
|
75
|
+
- lib/yard/minitest/version.rb
|
76
|
+
- templates/default/class/html/tests.erb
|
77
|
+
- templates/default/class/setup.rb
|
78
|
+
- yard-minitest.gemspec
|
79
|
+
homepage: https://github.com/avdgaag/yard-minitest
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.2.2
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Include Minitest test case descriptions in your class documentation.
|
103
|
+
test_files: []
|
104
|
+
has_rdoc:
|