yard-minitest-spec 0.1.2

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,37 @@
1
+
2
+ class YardMiniTestSpecDescribeHandler < YARD::Handlers::Ruby::Base
3
+ VERSION = YardMiniTestSpec::VERSION
4
+ handles method_call(:describe)
5
+
6
+ def process
7
+ objname = statement.parameters.first.jump(:string_content).source
8
+ if statement.parameters[1]
9
+ src = statement.parameters[1].jump(:string_content).source
10
+ objname += (src[0] == "#" ? "" : "::") + src
11
+ end
12
+ obj = {:spec => owner ? (owner[:spec] || "") : ""}
13
+ obj[:spec] += objname
14
+ parse_block(statement.last.last, owner: obj)
15
+ rescue YARD::Handlers::NamespaceMissingError
16
+ end
17
+ end
18
+
19
+ class YardMiniTestSpecItHandler < YARD::Handlers::Ruby::Base
20
+ VERSION = YardMiniTestSpec::VERSION
21
+ handles method_call(:it)
22
+
23
+ def process
24
+ return if owner.nil?
25
+ obj = P(owner[:spec])
26
+ return if obj.is_a?(Proxy)
27
+ # ignore comments etc
28
+ if statement.last.last.source.chomp.size > 0
29
+ (obj[:specifications] ||= []) << {
30
+ name: statement.parameters.first.jump(:string_content).source,
31
+ file: statement.file,
32
+ line: statement.line,
33
+ source: statement.last.last.source.chomp
34
+ }
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+
2
+ class YardMiniTestSpec
3
+ VERSION = '0.1.2'
4
+ end
5
+
6
+ begin
7
+ YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../templates'
8
+ require File.join(File.dirname(__FILE__), 'yard-minitest-spec', 'handler') if RUBY19
9
+ rescue
10
+ end
11
+
@@ -0,0 +1,28 @@
1
+ <% if object[:specifications] %>
2
+ <div class="tags">
3
+ <h3>Specifications:</h3>
4
+ <ul class="specs">
5
+ <% for spec in object[:specifications] %>
6
+ <li><%= spec[:name] %>
7
+ <div class="source_code">
8
+ <table>
9
+ <tr>
10
+ <td>
11
+ <pre class="lines">
12
+
13
+
14
+ <%= spec[:source].split("\n").size.times.to_a.map {|i| spec[:line] + i }.join("\n") %></pre>
15
+ </td>
16
+ <td>
17
+ <pre class="code"><span class="info file"># File '<%= h spec[:file] %>', line <%= spec[:line] %></span>
18
+
19
+ <%= html_syntax_highlight format_source(spec[:source]) %></pre>
20
+ </td>
21
+ </tr>
22
+ </table>
23
+ </div>
24
+ </li>
25
+ <% end %>
26
+ </ul>
27
+ </div>
28
+ <% end %>
@@ -0,0 +1,4 @@
1
+ def init
2
+ super
3
+ sections.last.place(:specs).before(:source)
4
+ end
@@ -0,0 +1,9 @@
1
+ <% if object[:specifications] %>
2
+
3
+ Specifications:
4
+ ---------------
5
+
6
+ <% for spec in object[:specifications] %>
7
+ <%= indent wrap("- " + spec[:name]) %>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,42 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require 'find'
4
+
5
+ $:.unshift File.expand_path("./lib")
6
+ require 'yard-minitest-spec'
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = "yard-minitest-spec"
10
+ s.version = YardMiniTestSpec::VERSION
11
+
12
+ s.summary = "YARD plugin to list MiniTest::Spec specifications inside documentation"
13
+ s.description = %q{
14
+ YARD plugin to list MiniTest::Spec specifications inside documentation
15
+ for the class.methods and instance methods spec'd.
16
+
17
+ }
18
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
19
+ s.authors = ["G. Allen Morris III"]
20
+ s.date = "2012-03-15"
21
+ s.email = "gam3@gam3.net"
22
+ s.homepage = "http://yardoc.org"
23
+ s.require_paths = ["lib"]
24
+ s.rubyforge_project = "yard-minitest-spec"
25
+ s.rubygems_version = "1.8.11"
26
+ s.files = Dir['lib/*/*.rb'] + Dir['lib/*.rb']
27
+ s.files += Dir['*.gemspec']
28
+ s.files += Dir['examples/*']
29
+ s.files += Find.find('templates').select{ |f| f if FileTest.file?(f) }
30
+
31
+ if s.respond_to? :specification_version then
32
+ s.specification_version = 3
33
+
34
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
35
+ s.add_runtime_dependency(%q<yard>, [">= 0"])
36
+ else
37
+ s.add_dependency(%q<yard>, [">= 0"])
38
+ end
39
+ else
40
+ s.add_dependency(%q<yard>, [">= 0"])
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-minitest-spec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - G. Allen Morris III
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: yard
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: ! "\n YARD plugin to list MiniTest::Spec specifications inside documentation\n
31
+ \ for the class.methods and instance methods spec'd.\n\n "
32
+ email: gam3@gam3.net
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - lib/yard-minitest-spec/handler.rb
38
+ - lib/yard-minitest-spec.rb
39
+ - yard-minitest-spec.gemspec
40
+ - templates/default/method_details/html/specs.erb
41
+ - templates/default/method_details/setup.rb
42
+ - templates/default/method_details/text/specs.erb
43
+ homepage: http://yardoc.org
44
+ licenses: []
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project: yard-minitest-spec
63
+ rubygems_version: 1.8.23
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: YARD plugin to list MiniTest::Spec specifications inside documentation
67
+ test_files: []
68
+ has_rdoc: