yard-bird 0.1.1 → 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.
- data/HISTORY.rdoc +10 -0
- data/NOTES.rdoc +12 -0
- data/NOTICE.rdoc +2 -2
- data/README.rdoc +10 -7
- data/lib/yard-bird/rules.rb +5 -3
- data/lib/yard-bird/version.rb +12 -1
- data/test/helper.rb +6 -0
- data/test/system/sample/.yard/yaml.bird +22 -0
- data/test/system/sample/lib/example.rb +19 -0
- data/test/system/sample/lib/hello_world.rb +15 -0
- data/test/system/test_yardoc.rb +30 -0
- data/test/unit/test_rules.rb +50 -0
- metadata +73 -72
data/HISTORY.rdoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
= RELEASE HISTORY
|
2
2
|
|
3
|
+
== 0.1.2 | 2011-11-10
|
4
|
+
|
5
|
+
This release simply brings the build configuration
|
6
|
+
up to date. Nothing has change functionally.
|
7
|
+
|
8
|
+
Changes:
|
9
|
+
|
10
|
+
* Modernize build configuration.
|
11
|
+
|
12
|
+
|
3
13
|
== 0.1.1 | 2011-06-10
|
4
14
|
|
5
15
|
This is the initial release of Yardbird.
|
data/NOTES.rdoc
ADDED
data/NOTICE.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== YardBird
|
4
4
|
|
5
|
-
Copyright (c) 2011
|
5
|
+
Copyright (c) 2011 Rubyworks
|
6
6
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining
|
8
8
|
a copy of this software and associated documentation files (the
|
@@ -50,7 +50,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
50
50
|
OTHER DEALINGS IN THE SOFTWARE.
|
51
51
|
|
52
52
|
|
53
|
-
==
|
53
|
+
== TomDoc
|
54
54
|
|
55
55
|
Copyright (c) 2010 Tom Preston-Werner, Chris Wanstrath
|
56
56
|
|
data/README.rdoc
CHANGED
@@ -11,16 +11,17 @@ documentation parsing system.
|
|
11
11
|
|
12
12
|
== Resources
|
13
13
|
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
14
|
+
* {Homepage}[http://rubyworks.github.com]
|
15
|
+
* {Source Code}[http://github.com/rubyworks]
|
16
|
+
* {Mainling List}[http://groups.google.com/group/rubyworks-mailinglist]
|
17
|
+
* {<img src="http://travis-ci.org/rubyworks/yard-bird.png" />}[http://travis-ci.org/rubyworks/yard-bird]
|
17
18
|
|
18
19
|
|
19
20
|
== Check It Out
|
20
21
|
|
21
22
|
Sound like a chore? Until you see it allows you do this:
|
22
23
|
|
23
|
-
# .yard/
|
24
|
+
# .yard/example.bird
|
24
25
|
|
25
26
|
When /^Returns\s+(.*?)$/ do |matchdata, comment|
|
26
27
|
create_tag(:return, matchdata[1])
|
@@ -29,11 +30,10 @@ Sound like a chore? Until you see it allows you do this:
|
|
29
30
|
Now, whenever your documentation starts with 'Returns ', the
|
30
31
|
remainder of the line will be added to YARD as a :return tag.
|
31
32
|
|
32
|
-
Now we can get even crazier
|
33
|
+
Now we can get even crazier a create a simplified implementation of {Tomdoc}[http://tomdoc].
|
33
34
|
|
34
35
|
require 'tomdoc/tomdoc'
|
35
36
|
|
36
|
-
# God is /\A.*?\Z/
|
37
37
|
When /\A.*?\Z/m do |matchdata, comment|
|
38
38
|
tomdoc = TomDoc::TomDoc.new(comment)
|
39
39
|
tomdoc.examples.each {|ex| create_tag(:example, "\n" + ex) }
|
@@ -43,11 +43,14 @@ Now we can get even crazier with a basic implementation of Tomdoc[http://tomdoc]
|
|
43
43
|
tomdoc.description
|
44
44
|
end
|
45
45
|
|
46
|
+
Now it's your turn. You have the _power_*, Yard Bird will singe _Your_ song.
|
47
|
+
And YARD will happily spit it out all pretty.
|
48
|
+
|
46
49
|
|
47
50
|
== License
|
48
51
|
|
49
52
|
(MIT License)
|
50
53
|
|
51
|
-
Copyright (c) 2011
|
54
|
+
Copyright (c) 2011 Rubyworks
|
52
55
|
|
53
56
|
See NOTICE.rdoc file for more details.
|
data/lib/yard-bird/rules.rb
CHANGED
@@ -28,7 +28,7 @@ module YARD
|
|
28
28
|
# In the example the special rules will have precedence over the
|
29
29
|
# tomdoc rules.
|
30
30
|
#
|
31
|
-
#
|
31
|
+
# @return Nothing
|
32
32
|
def load_rules
|
33
33
|
files = Dir[".yard/*.bird"].sort
|
34
34
|
files.each do |file|
|
@@ -41,12 +41,14 @@ module YARD
|
|
41
41
|
# pattern - Regexp to match against comment.
|
42
42
|
# block - Proc for handling pattern match.
|
43
43
|
#
|
44
|
-
#
|
44
|
+
# @return [Proc] the given block
|
45
45
|
def When(pattern, &block)
|
46
46
|
patterns[pattern] = block
|
47
47
|
end
|
48
48
|
|
49
|
-
#
|
49
|
+
# Patterns to apply.
|
50
|
+
#
|
51
|
+
# @Return [Hash] patterns mapped to corresponding procedures
|
50
52
|
def patterns
|
51
53
|
@patterns
|
52
54
|
end
|
data/lib/yard-bird/version.rb
CHANGED
@@ -1,6 +1,17 @@
|
|
1
1
|
module YARD
|
2
2
|
module Bird
|
3
|
-
|
3
|
+
#
|
4
|
+
def self.dotruby
|
5
|
+
@dotruby ||= (
|
6
|
+
require 'yaml'
|
7
|
+
file = File.dirname(__FILE__)+'/../../.ruby'
|
8
|
+
File.exist?(file) ? YAML.load_file(file) : {}
|
9
|
+
)
|
10
|
+
end
|
11
|
+
#
|
12
|
+
def self.const_missing(name)
|
13
|
+
dotruby[name.to_s.downcase] || super(name)
|
14
|
+
end
|
4
15
|
end
|
5
16
|
end
|
6
17
|
|
data/test/helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
# A really stupid simple example, using YAML mapping.
|
6
|
+
# (It's stupid b/c only one tag can be used.)
|
7
|
+
|
8
|
+
# God is /\A.*?\Z/
|
9
|
+
When /\A.*?\Z/m do |matchdata, comment|
|
10
|
+
md = /\-\-\-.*?\.\.\./m.match(comment)
|
11
|
+
if md
|
12
|
+
yaml = md[0]
|
13
|
+
data = YAML.load(yaml)
|
14
|
+
data.each do |tag, desc|
|
15
|
+
create_tag(tag.to_sym, desc)
|
16
|
+
end
|
17
|
+
comment.sub(yaml, '')
|
18
|
+
else
|
19
|
+
comment
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# This is an example class.
|
2
|
+
class Example
|
3
|
+
|
4
|
+
# Jump is not the kind of method you bring
|
5
|
+
# home to mother.
|
6
|
+
#
|
7
|
+
# ---
|
8
|
+
# param: how_high [Integer] height of the jump
|
9
|
+
# return: "[String] string of tartar"
|
10
|
+
# example: |
|
11
|
+
# Example.new.jump #=> "tartar"
|
12
|
+
# ...
|
13
|
+
#
|
14
|
+
def jump(how_high=nil)
|
15
|
+
"tartar"
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This is a class.
|
2
|
+
class HelloWorld
|
3
|
+
|
4
|
+
# Hello simply prints out a greeting.
|
5
|
+
#
|
6
|
+
# ---
|
7
|
+
# param: string [String] An object that responds to #to_s.
|
8
|
+
# return: nothing
|
9
|
+
# ...
|
10
|
+
#
|
11
|
+
def hello(string="World")
|
12
|
+
puts "Hello #{string}"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
dir = File.expand_path(File.dirname(__FILE__))
|
2
|
+
tmp = dir + '/../../tmp'
|
3
|
+
|
4
|
+
require dir + "/../helper.rb"
|
5
|
+
|
6
|
+
# This test is design to run `yard doc` on the sample project and
|
7
|
+
# check to make sure it was produced successufully.
|
8
|
+
#
|
9
|
+
# NOTE: There is only one test b/c generation has to happen first
|
10
|
+
# and minitest will randomize the order of tests. You have fix?
|
11
|
+
#
|
12
|
+
describe "yard doc" do
|
13
|
+
|
14
|
+
before do
|
15
|
+
FileUtils.mkdir(tmp) unless File.directory?(tmp)
|
16
|
+
FileUtils.cp_r(dir + '/sample', tmp)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should generate documentation" do
|
20
|
+
Dir.chdir(tmp + '/sample') do
|
21
|
+
success = system "yard doc --plugin bird lib/"
|
22
|
+
|
23
|
+
assert(success, "failed to generate yard documentation")
|
24
|
+
assert File.directory?('doc')
|
25
|
+
|
26
|
+
# TODO: more verifications
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + "/../helper.rb"
|
2
|
+
|
3
|
+
require "yard"
|
4
|
+
require "yard-bird"
|
5
|
+
|
6
|
+
describe YARD::Bird::Rules do
|
7
|
+
|
8
|
+
before do
|
9
|
+
@docstring = YARD::Docstring.new <<-eof
|
10
|
+
# Duplicate some text an arbitrary number of times.
|
11
|
+
#
|
12
|
+
# text - The String to be duplicated.
|
13
|
+
# count - The Integer number of times to duplicate the text.
|
14
|
+
#
|
15
|
+
# Examples
|
16
|
+
# multiplex('Tom', 4)
|
17
|
+
# # => 'TomTomTomTom'
|
18
|
+
#
|
19
|
+
# Returns the duplicated String.
|
20
|
+
#
|
21
|
+
# Raises ArgumentError if something bad happened
|
22
|
+
eof
|
23
|
+
end
|
24
|
+
|
25
|
+
# TODO: Write some unit tests!!!
|
26
|
+
|
27
|
+
#it "should fill docstring with description" do
|
28
|
+
# @docstring.must_equal "Duplicate some text an arbitrary number of times."
|
29
|
+
#end
|
30
|
+
|
31
|
+
#it "should fill param tags" do
|
32
|
+
# tags = @docstring.tags(:param)
|
33
|
+
# tags.size.must_equal 2
|
34
|
+
# tags[0].name.must_equal 'text'
|
35
|
+
# tags[1].name.must_equal 'count'
|
36
|
+
#end
|
37
|
+
|
38
|
+
#it "should fill examples tags" do
|
39
|
+
# @docstring.tags(:example).size.must_equal 1
|
40
|
+
# @docstring.tag(:example).text.must_equal "multiplex('Tom', 4)\n # => 'TomTomTomTom'"
|
41
|
+
#end
|
42
|
+
|
43
|
+
#it "should fill return tag" do
|
44
|
+
# @docstring.tag(:return).text.must_equal "the duplicated String."
|
45
|
+
#end
|
46
|
+
|
47
|
+
#it "should fill raise tag" do
|
48
|
+
# @docstring.tag(:raise).text.must_equal "ArgumentError if something bad happened"
|
49
|
+
#end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,102 +1,103 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-bird
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Trans
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-11-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: yard
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &24398660 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: qed
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: *24398660
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &24398060 !ruby/object:Gem::Requirement
|
38
28
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
segments:
|
44
|
-
- 0
|
45
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
46
33
|
type: :development
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *24398060
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
requirement: &24397420 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *24397420
|
47
|
+
description: ! 'Yardbird is a YARD plugin that allows you, the developer, to write
|
48
|
+
documentation
|
51
49
|
|
52
|
-
|
50
|
+
Your Way. Do you like TomDoc, but wish it were just a tad bit different? You can
|
53
51
|
|
54
|
-
|
52
|
+
fix that. Have some radical idea for using ASCII table in your docs? You can do
|
53
|
+
|
54
|
+
that too.'
|
55
|
+
email:
|
56
|
+
- transfire@gmail.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files:
|
60
|
+
- HISTORY.rdoc
|
55
61
|
- README.rdoc
|
56
|
-
|
62
|
+
- NOTES.rdoc
|
63
|
+
- NOTICE.rdoc
|
64
|
+
files:
|
57
65
|
- lib/yard-bird/rules.rb
|
58
66
|
- lib/yard-bird/version.rb
|
59
67
|
- lib/yard-bird.rb
|
68
|
+
- test/helper.rb
|
69
|
+
- test/system/sample/.yard/yaml.bird
|
70
|
+
- test/system/sample/lib/example.rb
|
71
|
+
- test/system/sample/lib/hello_world.rb
|
72
|
+
- test/system/test_yardoc.rb
|
73
|
+
- test/unit/test_rules.rb
|
60
74
|
- HISTORY.rdoc
|
61
75
|
- README.rdoc
|
76
|
+
- NOTES.rdoc
|
62
77
|
- NOTICE.rdoc
|
63
78
|
homepage: http://rubyworks.github.com/yard-bird
|
64
|
-
licenses:
|
65
|
-
-
|
66
|
-
- Apache 2.0
|
67
|
-
- Apache 2.0
|
79
|
+
licenses:
|
80
|
+
- MIT
|
68
81
|
post_install_message:
|
69
|
-
rdoc_options:
|
70
|
-
|
71
|
-
- YARD Bird API
|
72
|
-
- --main
|
73
|
-
- README.rdoc
|
74
|
-
require_paths:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
75
84
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
86
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
83
|
-
- 0
|
84
|
-
version: "0"
|
85
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
92
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
94
97
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
rubygems_version: 1.8.2
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 1.8.10
|
98
100
|
signing_key:
|
99
101
|
specification_version: 3
|
100
|
-
summary:
|
102
|
+
summary: Documentation Your Way!
|
101
103
|
test_files: []
|
102
|
-
|