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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4ec34f12f41177c0652dcf498e833a03b2492e0faf1c487ee40b149bf41b2eb
4
- data.tar.gz: 362213c9dd24df82f3396dd81218fe623050d91eb7c59adaed04fbe3587d44b9
3
+ metadata.gz: 4458410fb0b98437c2146843c50d289a30a48198b1c9aca310a4b0a029304b3a
4
+ data.tar.gz: f14c8330d1c130c19b5db7ab3584949bfc5987bd0c4748126c3ce3f3504ff866
5
5
  SHA512:
6
- metadata.gz: ecda196fad92caf901bbe43c0661dc961fc8abc39ee6aff954144167b6741e6ac5f6d4f6679fbf48a3cb849f64840ff7841039860225da57bc9e6f42a9e0a98c
7
- data.tar.gz: 854dbe3d3d9ae01097edc0681d4f267248bb9db5107c01f49a8238131316ceab9f622e11253e1addce0c6d60d67d81c5ddcb659ad4129165a25a7199565d9cca
6
+ metadata.gz: 733c2915d1453899173f74d634b5d157567a11173b5e1202b95d3fb68a92ade3d5e4d7ab9e539d9ad591bab1a8303f5ab3e94b5242566ed401644ce4689fa832
7
+ data.tar.gz: 6d4d1d75d943e0ab629fa2035784dd9f343cf8dd54732d54cc4613e779788a686f39a7454960c9451bcb76640c89c7b414d980bd256af96e035cbc44a2c64a6d
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+
10
+ .byebug_history
data/.yardopts CHANGED
@@ -1,2 +1,3 @@
1
- --plugin readme
1
+ -e lib/yard-readme.rb
2
+ --markup markdown
2
3
  lib/**/*.rb
data/Gemfile.lock CHANGED
@@ -1,18 +1,44 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yard-readme (0.1.0)
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
- # Yard::Readme
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yard/readme`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'yard-readme'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
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/[USERNAME]/yard-readme.
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
- push_readme_text(docstring, buf) if tag_name == 'readme'
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 push_readme_text(docstring, buf)
65
- return if buf.empty?
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module YARDReadme
2
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
3
5
  end
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 = "yard-readme"
7
- spec.version = YARDReadme::VERSION
8
- spec.authors = ["Matt Ruzicka"]
6
+ spec.name = "yard-readme"
7
+ spec.version = YARDReadme::VERSION
8
+ spec.authors = ["Matt Ruzicka"]
9
+ spec.license = "MIT"
9
10
 
10
- spec.summary = "Enhance your README with YARD"
11
- spec.description = "Generate your README using comments in your code"
12
- spec.homepage = 'https://github.com/mattruzicka/yard-readme'
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"] = 'https://github.com/mattruzicka/yard-readme'
17
- spec.metadata["changelog_uri"] = 'https://github.com/mattruzicka/yard-readme' \
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.0
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-25 00:00:00.000000000 Z
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: '0'
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: '0'
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