yard-notes 0.1.0
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/.ruby +44 -0
- data/.yardopts +9 -0
- data/License.txt +20 -0
- data/Notice.txt +22 -0
- data/README.md +47 -0
- data/lib/yard-notes.rb +148 -0
- metadata +72 -0
data/.ruby
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
source:
|
3
|
+
- meta
|
4
|
+
authors:
|
5
|
+
- name: Trans
|
6
|
+
email: transfire@gmail.com
|
7
|
+
copyrights:
|
8
|
+
- holder: Rubyworks
|
9
|
+
year: '2011'
|
10
|
+
license: MIT
|
11
|
+
requirements:
|
12
|
+
- name: yard
|
13
|
+
dependencies: []
|
14
|
+
alternatives:
|
15
|
+
- dnote
|
16
|
+
conflicts: []
|
17
|
+
repositories:
|
18
|
+
- uri: git://github.com/rubyworks/yard-notes.git
|
19
|
+
scm: git
|
20
|
+
name: upstream
|
21
|
+
resources:
|
22
|
+
home: http://rubyworks.github.com/yard-notes
|
23
|
+
code: http://github.com/rubyworks/yard-notes
|
24
|
+
bugs: http://github.com/rubyworks/yard-notes/issues
|
25
|
+
mail: http://groups.google.com/groups/rubyworks-mailinglist
|
26
|
+
chat: irc://chat.us.freenode.net/rubyworks
|
27
|
+
extra: {}
|
28
|
+
load_path:
|
29
|
+
- lib
|
30
|
+
revision: 0
|
31
|
+
created: '2011-06-11'
|
32
|
+
summary: Because some tags are for project developers, not API users.
|
33
|
+
title: YARD Notes
|
34
|
+
version: 0.1.0
|
35
|
+
name: yard-notes
|
36
|
+
description: ! 'Normally YARD emits a warning about unrecongnized decoumentaiton tags
|
37
|
+
|
38
|
+
and omits them from output. With YARD Notes, all caps tags will still
|
39
|
+
|
40
|
+
be omitted from the docs, but will be added to a special NOTES file of
|
41
|
+
|
42
|
+
the documentation.'
|
43
|
+
organization: rubyworks
|
44
|
+
date: '2012-03-05'
|
data/.yardopts
ADDED
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
data/Notice.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
YARD
|
2
|
+
|
3
|
+
Copyright (c) 2007-2011 Loren Segal
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# YARD Notes
|
2
|
+
|
3
|
+
[Hompage](http://rubyworks.github.com/yard-notes) /
|
4
|
+
[Report Issue](http://github.com/rubyworks/yard-notes/issues) /
|
5
|
+
[Source Code](http://githubc.com/rubyworks/yard-notes)
|
6
|
+
[Mailing List](http://groups.google.com/groups/rubyworks-mailinglist) /
|
7
|
+
[IRC Chat](irc://chat.us.freenode.net/rubyworks)
|
8
|
+
|
9
|
+
|
10
|
+
## Description
|
11
|
+
|
12
|
+
YARD likes to inform us of every line in every file where
|
13
|
+
a tag is used that hasn't been explicitly informed shoud
|
14
|
+
exist. The way I figure it, if I used it, it should exist.
|
15
|
+
However, that doesn't mean I neccessiarily want all tags to
|
16
|
+
show up in the docs, so this plugin keeps YARD from making
|
17
|
+
a ruckess about tags in ALL CAPS, keeps such tags out of the
|
18
|
+
docs, and adds them to a specia NOTES pages where they can
|
19
|
+
be reviewed. This is a great way to make development notes
|
20
|
+
in your code.
|
21
|
+
|
22
|
+
|
23
|
+
## Instruction
|
24
|
+
|
25
|
+
Use yard as usual but add the `--plugin notes` command line
|
26
|
+
option.
|
27
|
+
|
28
|
+
$ yard --plugin ntoes ...
|
29
|
+
|
30
|
+
|
31
|
+
## Installation
|
32
|
+
|
33
|
+
Using RubyGems to install:
|
34
|
+
|
35
|
+
$ gem install yard-shutup
|
36
|
+
|
37
|
+
|
38
|
+
## Copyright & License
|
39
|
+
|
40
|
+
(MIT License)
|
41
|
+
|
42
|
+
Copyright (c) 2011 Rubyworks.
|
43
|
+
|
44
|
+
YARD Notes is distributable under the terms of the **MIT** license.
|
45
|
+
|
46
|
+
See License.txt for details.
|
47
|
+
|
data/lib/yard-notes.rb
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
# @TODO Add command option to turn warnings back on.
|
2
|
+
|
3
|
+
module YARD
|
4
|
+
|
5
|
+
module Tags
|
6
|
+
|
7
|
+
# Alternate factory in which ...
|
8
|
+
#
|
9
|
+
# @NOTE I have a feeling this might all end up here once
|
10
|
+
# lsegal sees what his code is actually doing.
|
11
|
+
class AutoFactory < DefaultFactory
|
12
|
+
end
|
13
|
+
|
14
|
+
class Library
|
15
|
+
class << self
|
16
|
+
# Sets the list of tags that are not explicitly defined by the
|
17
|
+
# YARD proper, nor by the user on the cammnd line via `--tag`.
|
18
|
+
# These tags are recorded as "developer's tags" and not
|
19
|
+
# displayed in the general documentation.
|
20
|
+
#
|
21
|
+
# @return [Array<Symbol>] list of transitive tags
|
22
|
+
attr_accessor :developers_tags
|
23
|
+
end
|
24
|
+
|
25
|
+
self.developers_tags = []
|
26
|
+
|
27
|
+
# If tag is missing then auto-define it.
|
28
|
+
#
|
29
|
+
# @TODO This is an example.
|
30
|
+
def respond_to?(tag_method)
|
31
|
+
if md = /_tag$/.match(tag_method.to_s)
|
32
|
+
tag_name = md.pre_match
|
33
|
+
if /^[A-Z]+$/ =~ tag_name
|
34
|
+
Tags::Library.define_tag(tag_name.to_s.capitalize, tag_name)
|
35
|
+
Tags::Library.developers_tags |= [tag_name]
|
36
|
+
true
|
37
|
+
else
|
38
|
+
super(tag_method)
|
39
|
+
end
|
40
|
+
else
|
41
|
+
super(tag_method)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
module CodeObjects
|
49
|
+
class NotesFileObject < ExtraFileObject
|
50
|
+
#
|
51
|
+
def initialize
|
52
|
+
self.filename = 'NOTES.md'
|
53
|
+
self.name = 'NOTES'
|
54
|
+
self.attributes = SymbolHash.new(false)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Lazily produce contents.
|
58
|
+
def contents
|
59
|
+
@contents ||= (
|
60
|
+
text = ["# Developer's Notes"]
|
61
|
+
sort = Hash.new{ |h,k| h[k] = [] }
|
62
|
+
dtags = Tags::Library.developers_tags
|
63
|
+
|
64
|
+
Registry.each do |code_object|
|
65
|
+
code_object.tags.each do |tag|
|
66
|
+
next unless dtags.include?(tag.tag_name)
|
67
|
+
sort[tag.tag_name] << tag
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
sort.each do |name, tags|
|
72
|
+
text << "## #{name}"
|
73
|
+
tags.each do |tag|
|
74
|
+
text << "* #{tag.text} (#{tag.object})"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
parse_contents(text.join("\n\n"))
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
# This method was taken directly from YARD and change by removing `self.`
|
83
|
+
# from `contents`, so that it can be lazily created.
|
84
|
+
#
|
85
|
+
# @param [String] data
|
86
|
+
# The file contents
|
87
|
+
#
|
88
|
+
# @return [String] content
|
89
|
+
def parse_contents(data)
|
90
|
+
retried = false
|
91
|
+
cut_index = 0
|
92
|
+
data = data.split("\n")
|
93
|
+
data.each_with_index do |line, index|
|
94
|
+
case line
|
95
|
+
when /^#!(\S+)\s*$/
|
96
|
+
if index == 0
|
97
|
+
attributes[:markup] = $1
|
98
|
+
else
|
99
|
+
cut_index = index
|
100
|
+
break
|
101
|
+
end
|
102
|
+
when /^\s*#\s*@(\S+)\s*(.+?)\s*$/
|
103
|
+
attributes[$1] = $2
|
104
|
+
else
|
105
|
+
cut_index = index
|
106
|
+
break
|
107
|
+
end
|
108
|
+
end
|
109
|
+
data = data[cut_index..-1] if cut_index > 0
|
110
|
+
contents = data.join("\n")
|
111
|
+
if contents.respond_to?(:force_encoding) && attributes[:encoding]
|
112
|
+
begin
|
113
|
+
contents.force_encoding(attributes[:encoding])
|
114
|
+
rescue ArgumentError
|
115
|
+
log.warn "Invalid encoding `#{attributes[:encoding]}' in #{filename}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
return contents
|
119
|
+
rescue ArgumentError => e
|
120
|
+
if retried && e.message =~ /invalid byte sequence/
|
121
|
+
# This should never happen.
|
122
|
+
log.warn "Could not read #{filename}, #{e.message}. You probably want to set `--charset`."
|
123
|
+
contents = ''
|
124
|
+
return
|
125
|
+
end
|
126
|
+
data.force_encoding('binary') if data.respond_to?(:force_encoding)
|
127
|
+
retried = true
|
128
|
+
retry
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
module CLI
|
136
|
+
class Yardoc
|
137
|
+
alias run_without_notes run
|
138
|
+
def run(*args)
|
139
|
+
@options[:files] << CodeObjects::NotesFileObject.new
|
140
|
+
run_without_notes(*args)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
YARD::Tags::Library.default_factory = YARD::Tags::AutoFactory.new
|
148
|
+
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-notes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Trans
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-05 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: yard
|
16
|
+
requirement: &30883380 !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: *30883380
|
25
|
+
description: ! 'Normally YARD emits a warning about unrecongnized decoumentaiton tags
|
26
|
+
|
27
|
+
and omits them from output. With YARD Notes, all caps tags will still
|
28
|
+
|
29
|
+
be omitted from the docs, but will be added to a special NOTES file of
|
30
|
+
|
31
|
+
the documentation.'
|
32
|
+
email:
|
33
|
+
- transfire@gmail.com
|
34
|
+
executables: []
|
35
|
+
extensions: []
|
36
|
+
extra_rdoc_files:
|
37
|
+
- Notice.txt
|
38
|
+
- License.txt
|
39
|
+
- README.md
|
40
|
+
files:
|
41
|
+
- .yardopts
|
42
|
+
- .ruby
|
43
|
+
- lib/yard-notes.rb
|
44
|
+
- Notice.txt
|
45
|
+
- README.md
|
46
|
+
- License.txt
|
47
|
+
homepage: http://rubyworks.github.com/yard-notes
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
requirements: []
|
67
|
+
rubyforge_project:
|
68
|
+
rubygems_version: 1.8.11
|
69
|
+
signing_key:
|
70
|
+
specification_version: 3
|
71
|
+
summary: Because some tags are for project developers, not API users.
|
72
|
+
test_files: []
|