yard-bird 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.rdoc ADDED
@@ -0,0 +1,10 @@
1
+ = RELEASE HISTORY
2
+
3
+ == 0.1.1 | 2011-06-10
4
+
5
+ This is the initial release of Yardbird.
6
+
7
+ Changes:
8
+
9
+ * Initial release.
10
+
data/NOTICE.rdoc ADDED
@@ -0,0 +1,75 @@
1
+ = COPYRIGHT NOTICES
2
+
3
+ == YardBird
4
+
5
+ Copyright (c) 2011 Thomas Sawyer
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ Software), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+
27
+ == YARD
28
+
29
+ Copyright (c) 2007-2011 Loren Segal
30
+
31
+ Permission is hereby granted, free of charge, to any person
32
+ obtaining a copy of this software and associated documentation
33
+ files (the "Software"), to deal in the Software without
34
+ restriction, including without limitation the rights to use,
35
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
36
+ copies of the Software, and to permit persons to whom the
37
+ Software is furnished to do so, subject to the following
38
+ conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
45
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
46
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
47
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
48
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
49
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
50
+ OTHER DEALINGS IN THE SOFTWARE.
51
+
52
+
53
+ == Tomdoc
54
+
55
+ Copyright (c) 2010 Tom Preston-Werner, Chris Wanstrath
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining
58
+ a copy of this software and associated documentation files (the
59
+ Software), to deal in the Software without restriction, including
60
+ without limitation the rights to use, copy, modify, merge, publish,
61
+ distribute, sublicense, and/or sell copies of the Software, and to
62
+ permit persons to whom the Software is furnished to do so, subject to
63
+ the following conditions:
64
+
65
+ The above copyright notice and this permission notice shall be
66
+ included in all copies or substantial portions of the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
69
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
70
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
71
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
72
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
73
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
74
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
75
+
data/README.rdoc ADDED
@@ -0,0 +1,53 @@
1
+ = Yard Bird
2
+
3
+ <i>"Sing sweet documentation in my ear."</i>
4
+
5
+
6
+ == Description
7
+
8
+ Yardbird is a YARD plugin that allows you, the developer, to customize your
9
+ documentation parsing system.
10
+
11
+
12
+ == Resources
13
+
14
+ * home: http://rubyworks.github.com/
15
+ * code: http://github.com/rubyworks/
16
+ * mail: http://groups.google.com/group/rubyworks-mailinglist
17
+
18
+
19
+ == Check It Out
20
+
21
+ Sound like a chore? Until you see it allows you do this:
22
+
23
+ # .yard/name.song
24
+
25
+ When /^Returns\s+(.*?)$/ do |matchdata, comment|
26
+ create_tag(:return, matchdata[1])
27
+ end
28
+
29
+ Now, whenever your documentation starts with 'Returns ', the
30
+ remainder of the line will be added to YARD as a :return tag.
31
+
32
+ Now we can get even crazier with a basic implementation of Tomdoc[http://tomdoc].
33
+
34
+ require 'tomdoc/tomdoc'
35
+
36
+ # God is /\A.*?\Z/
37
+ When /\A.*?\Z/m do |matchdata, comment|
38
+ tomdoc = TomDoc::TomDoc.new(comment)
39
+ tomdoc.examples.each {|ex| create_tag(:example, "\n" + ex) }
40
+ tomdoc.args.each {|arg| create_tag(:param, "#{arg.name} #{arg.description}") }
41
+ tomdoc.raises.each {|r| create_tag(:raise, r.sub(/\ARaises\s+/, '')) }
42
+ tomdoc.returns.each {|r| create_tag(:return, r.sub(/\AReturns\s+/, '')) }
43
+ tomdoc.description
44
+ end
45
+
46
+
47
+ == License
48
+
49
+ (MIT License)
50
+
51
+ Copyright (c) 2011 Thomas Sawyer
52
+
53
+ See NOTICE.rdoc file for more details.
@@ -0,0 +1,94 @@
1
+ module YARD
2
+
3
+ module Bird
4
+
5
+ #
6
+ class Rules
7
+
8
+ # Returns [Rules]
9
+ def self.load
10
+ new
11
+ end
12
+
13
+ # Create new Rules object.
14
+ def initialize()
15
+ @patterns = {}
16
+ load_rules
17
+ inject_rules
18
+ end
19
+
20
+ # Dot-bird filesa are loaded from `.yard/` project directory
21
+ # and sorted alphabetically. The sorting is useful for controlling
22
+ # application order when using multiple files --simply number the
23
+ # files, e.g.
24
+ #
25
+ # .yard/01_special.bird
26
+ # .yard/02_tomdoc.bird
27
+ #
28
+ # In the example the special rules will have precedence over the
29
+ # tomdoc rules.
30
+ #
31
+ # Returns nothing.
32
+ def load_rules
33
+ files = Dir[".yard/*.bird"].sort
34
+ files.each do |file|
35
+ instance_eval(File.read(file), file)
36
+ end
37
+ end
38
+
39
+ # Define a new rule.
40
+ #
41
+ # pattern - Regexp to match against comment.
42
+ # block - Proc for handling pattern match.
43
+ #
44
+ # Returns [Proc] the given block.
45
+ def When(pattern, &block)
46
+ patterns[pattern] = block
47
+ end
48
+
49
+ # Returns [Hash] patterns mapped to corresponding procedures.
50
+ def patterns
51
+ @patterns
52
+ end
53
+
54
+ # Rules are applied as YARD processes comments. All rules are applied
55
+ # in order until all rules have been tried, or a triggered rule returns
56
+ # a `:break` symbol, which will short-circuit further rule application.
57
+ def inject_rules
58
+ pats = patterns
59
+ ::YARD::Docstring.class_eval do
60
+ define_method :parse_comments do |comments|
61
+ comments = comments.join("\n") if Array === comments
62
+ result = nil
63
+ pats.each do |pattern, block|
64
+ if md = pattern.match(comments)
65
+ result = instance_exec(md, comments, &block) #block.call(md)
66
+ break if result == :break
67
+ comments = result if String === result
68
+ end
69
+ end
70
+ comments.to_s #r.to_s
71
+ end
72
+ end
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+
79
+ end
80
+
81
+ =begin
82
+ module YARD
83
+ class Docstring
84
+ def parse_comments(comments)
85
+ Rules.patterns.each do |pattern, block|
86
+ if md = patterns.match(comments)
87
+ instance_exec(md, &block) #block.call(md)
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ =end
94
+
@@ -0,0 +1,6 @@
1
+ module YARD
2
+ module Bird
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
6
+
data/lib/yard-bird.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'yard' unless defined?(YARD)
2
+ require 'yard-bird/version'
3
+ require 'yard-bird/rules'
4
+
5
+ YARD::Bird::Rules.load
6
+
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-bird
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Thomas Sawyer
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-06-10 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: yard
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: qed
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :development
47
+ version_requirements: *id002
48
+ description: Yardbird is a YARD plugin that allows you, the developer, to customize your documentation parsing system.
49
+ email: transfire@gmail.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - README.rdoc
56
+ files:
57
+ - lib/yard-bird/rules.rb
58
+ - lib/yard-bird/version.rb
59
+ - lib/yard-bird.rb
60
+ - HISTORY.rdoc
61
+ - README.rdoc
62
+ - NOTICE.rdoc
63
+ homepage: http://rubyworks.github.com/yard-bird
64
+ licenses:
65
+ - Apache 2.0
66
+ - Apache 2.0
67
+ - Apache 2.0
68
+ post_install_message:
69
+ rdoc_options:
70
+ - --title
71
+ - YARD Bird API
72
+ - --main
73
+ - README.rdoc
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ hash: 3
82
+ segments:
83
+ - 0
84
+ version: "0"
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ hash: 3
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ requirements: []
95
+
96
+ rubyforge_project: yard-bird
97
+ rubygems_version: 1.8.2
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: Write documentation your way.
101
+ test_files: []
102
+