yard-readme 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.yardopts +2 -1
- data/Gemfile.lock +28 -2
- data/README.md +20 -32
- data/README_YARD.md +9 -0
- data/lib/yard-readme.rb +16 -0
- data/lib/yard-readme/docstring_parser.rb +13 -9
- data/lib/yard-readme/version.rb +3 -1
- data/yard-readme.gemspec +12 -10
- metadata +23 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4458410fb0b98437c2146843c50d289a30a48198b1c9aca310a4b0a029304b3a
|
4
|
+
data.tar.gz: f14c8330d1c130c19b5db7ab3584949bfc5987bd0c4748126c3ce3f3504ff866
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 733c2915d1453899173f74d634b5d157567a11173b5e1202b95d3fb68a92ade3d5e4d7ab9e539d9ad591bab1a8303f5ab3e94b5242566ed401644ce4689fa832
|
7
|
+
data.tar.gz: 6d4d1d75d943e0ab629fa2035784dd9f343cf8dd54732d54cc4613e779788a686f39a7454960c9451bcb76640c89c7b414d980bd256af96e035cbc44a2c64a6d
|
data/.gitignore
CHANGED
data/.yardopts
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,18 +1,44 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yard-readme (0.1.
|
5
|
-
yard
|
4
|
+
yard-readme (0.1.1)
|
5
|
+
yard (~> 0.9.26)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
kramdown (2.3.1)
|
11
|
+
rexml
|
12
|
+
pastel (0.8.0)
|
13
|
+
tty-color (~> 0.5)
|
14
|
+
readme_yard (0.1.1)
|
15
|
+
tty-markdown (~> 0.7)
|
16
|
+
yard-readme (~> 0.1)
|
17
|
+
rexml (3.2.5)
|
18
|
+
rouge (3.26.0)
|
19
|
+
strings (0.2.1)
|
20
|
+
strings-ansi (~> 0.2)
|
21
|
+
unicode-display_width (>= 1.5, < 3.0)
|
22
|
+
unicode_utils (~> 1.4)
|
23
|
+
strings-ansi (0.2.0)
|
24
|
+
tty-color (0.6.0)
|
25
|
+
tty-markdown (0.7.0)
|
26
|
+
kramdown (>= 1.16.2, < 3.0)
|
27
|
+
pastel (~> 0.8)
|
28
|
+
rouge (~> 3.14)
|
29
|
+
strings (~> 0.2.0)
|
30
|
+
tty-color (~> 0.5)
|
31
|
+
tty-screen (~> 0.8)
|
32
|
+
tty-screen (0.8.1)
|
33
|
+
unicode-display_width (2.0.0)
|
34
|
+
unicode_utils (1.4.0)
|
10
35
|
yard (0.9.26)
|
11
36
|
|
12
37
|
PLATFORMS
|
13
38
|
arm64-darwin-20
|
14
39
|
|
15
40
|
DEPENDENCIES
|
41
|
+
readme_yard (~> 0.1)
|
16
42
|
yard-readme!
|
17
43
|
|
18
44
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,35 +1,23 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
$ gem install yard-readme
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
1
|
+
# yard-readme
|
2
|
+
|
3
|
+
A [YARD](https://yardoc.org) plugin used by
|
4
|
+
[readme_yard](https://github.com/mattruzicka/readme_yard).
|
5
|
+
It adds a `@readme` tag to YARD.
|
6
|
+
|
7
|
+
It also replaces the default docstring parser so that only
|
8
|
+
`@readme` tags and not their text values are stripped from
|
9
|
+
the generated documentation. I prefer this over the default
|
10
|
+
YARD behavior for the `@readme` tag because it allows the
|
11
|
+
comments in the source code to signal the README dependency
|
12
|
+
without pushing the generated YARD documentation into a
|
13
|
+
separate "readme" section.
|
14
|
+
|
15
|
+
That said, I welcome a PR that adds the default behavior as an option, as I think it could be preferable for some use cases. Ideally, I or someone would open a YARD PR to make leaving
|
16
|
+
the tag text an option when registering a tag. Especially
|
17
|
+
since this plugin's current behavior of replacing the
|
18
|
+
`YARD::DocstringParser` could potentially conflict with
|
19
|
+
other YARD plugins and is also more vulnerable to change.
|
32
20
|
|
33
21
|
## Contributing
|
34
22
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
23
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mattruzicka/yard-readme.
|
data/README_YARD.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# yard-readme
|
2
|
+
|
3
|
+
{@readme YARDReadme}
|
4
|
+
|
5
|
+
That said, I welcome a PR that adds the default behavior as an option, as I think it could be preferable for some use cases. {@readme YARDReadme::DocstringParser}
|
6
|
+
|
7
|
+
## Contributing
|
8
|
+
|
9
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mattruzicka/yard-readme.
|
data/lib/yard-readme.rb
CHANGED
@@ -4,5 +4,21 @@ require 'yard'
|
|
4
4
|
require_relative 'yard-readme/version'
|
5
5
|
require_relative 'yard-readme/docstring_parser'
|
6
6
|
|
7
|
+
#
|
8
|
+
# @readme
|
9
|
+
# A [YARD](https://yardoc.org) plugin used by
|
10
|
+
# [readme_yard](https://github.com/mattruzicka/readme_yard).
|
11
|
+
# It adds a `@readme` tag to YARD.
|
12
|
+
#
|
13
|
+
# It also replaces the default docstring parser so that only
|
14
|
+
# `@readme` tags and not their text values are stripped from
|
15
|
+
# the generated documentation. I prefer this over the default
|
16
|
+
# YARD behavior for the `@readme` tag because it allows the
|
17
|
+
# comments in the source code to signal the README dependency
|
18
|
+
# without pushing the generated YARD documentation into a
|
19
|
+
# separate "readme" section.
|
20
|
+
#
|
21
|
+
module YARDReadme; end
|
22
|
+
|
7
23
|
YARD::Docstring.default_parser = YARDReadme::DocstringParser
|
8
24
|
YARD::Tags::Library.define_tag('README', :readme)
|
@@ -1,4 +1,14 @@
|
|
1
1
|
module YARDReadme
|
2
|
+
#
|
3
|
+
# @readme
|
4
|
+
# Ideally, I or someone would open a YARD PR to make leaving
|
5
|
+
# the tag text an option when registering a tag. Especially
|
6
|
+
# since this plugin's current behavior of replacing the
|
7
|
+
# `YARD::DocstringParser` could potentially conflict with
|
8
|
+
# other YARD plugins and is also more vulnerable to change.
|
9
|
+
#
|
10
|
+
# Doing so would make this custom parser obsolete.
|
11
|
+
#
|
2
12
|
class DocstringParser < YARD::DocstringParser
|
3
13
|
def parse_content(content)
|
4
14
|
content = content.split(/\r?\n/) if content.is_a?(String)
|
@@ -27,7 +37,7 @@ module YARDReadme
|
|
27
37
|
docstring << parse_content(directive.expanded_text).chomp
|
28
38
|
end
|
29
39
|
else
|
30
|
-
|
40
|
+
docstring << parse_readme_text(buf) if tag_name == 'readme' && !buf.empty?
|
31
41
|
create_tag(tag_name, buf)
|
32
42
|
end
|
33
43
|
tag_name = nil
|
@@ -61,14 +71,8 @@ module YARDReadme
|
|
61
71
|
docstring
|
62
72
|
end
|
63
73
|
|
64
|
-
def
|
65
|
-
|
66
|
-
|
67
|
-
buf.split("\n").each do |buf_line|
|
68
|
-
docstring << buf_line
|
69
|
-
docstring << "\n"
|
70
|
-
end
|
71
|
-
docstring << "\n"
|
74
|
+
def parse_readme_text(text)
|
75
|
+
text << "\n\n"
|
72
76
|
end
|
73
77
|
end
|
74
78
|
end
|
data/lib/yard-readme/version.rb
CHANGED
data/yard-readme.gemspec
CHANGED
@@ -3,19 +3,19 @@
|
|
3
3
|
require_relative "lib/yard-readme/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
6
|
+
spec.name = "yard-readme"
|
7
|
+
spec.version = YARDReadme::VERSION
|
8
|
+
spec.authors = ["Matt Ruzicka"]
|
9
|
+
spec.license = "MIT"
|
9
10
|
|
10
|
-
spec.summary
|
11
|
-
spec.description
|
12
|
-
spec.homepage
|
11
|
+
spec.summary = "Enhance your README with YARD"
|
12
|
+
spec.description = "Generate your README using comments in your code"
|
13
|
+
spec.homepage = 'https://github.com/mattruzicka/yard-readme'
|
13
14
|
spec.required_ruby_version = ">= 2.4.0"
|
14
15
|
|
15
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
-
spec.metadata["source_code_uri"] =
|
17
|
-
spec.metadata["changelog_uri"] =
|
18
|
-
'/blob/master/CHANGELOG.md'
|
17
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
19
19
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -27,7 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
|
29
29
|
# Uncomment to register a new dependency of your gem
|
30
|
-
spec.add_dependency "yard"
|
30
|
+
spec.add_dependency "yard", "~> 0.9.26"
|
31
|
+
|
32
|
+
spec.add_development_dependency 'readme_yard', "~> 0.1"
|
31
33
|
|
32
34
|
# For more information and examples about making a new gem, checkout our
|
33
35
|
# guide at: https://bundler.io/guides/creating_gem.html
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-readme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Ruzicka
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.9.26
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.9.26
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: readme_yard
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
27
41
|
description: Generate your README using comments in your code
|
28
42
|
email:
|
29
43
|
executables: []
|
@@ -36,6 +50,7 @@ files:
|
|
36
50
|
- Gemfile
|
37
51
|
- Gemfile.lock
|
38
52
|
- README.md
|
53
|
+
- README_YARD.md
|
39
54
|
- bin/console
|
40
55
|
- bin/setup
|
41
56
|
- lib/yard-readme.rb
|
@@ -43,7 +58,8 @@ files:
|
|
43
58
|
- lib/yard-readme/version.rb
|
44
59
|
- yard-readme.gemspec
|
45
60
|
homepage: https://github.com/mattruzicka/yard-readme
|
46
|
-
licenses:
|
61
|
+
licenses:
|
62
|
+
- MIT
|
47
63
|
metadata:
|
48
64
|
homepage_uri: https://github.com/mattruzicka/yard-readme
|
49
65
|
source_code_uri: https://github.com/mattruzicka/yard-readme
|