readme_yard 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +5 -3
- data/README.md +6 -6
- data/README_YARD.md +4 -6
- data/lib/readme_yard/logger.rb +4 -0
- data/lib/readme_yard/version.rb +1 -1
- data/lib/readme_yard.rb +26 -5
- data/readme_yard.gemspec +1 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75f0e416616f2e2e893d7a64da99c4fd364d4624309d60cf5fb1cee1f7f8d824
|
4
|
+
data.tar.gz: 2a7230288228a5a8fdf2d9198ed1a571d6275529c739b24ef8617765e38757dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9982537f18b8205ca25ea49f95d3affcee71d4d228c5c3b93612d7cb7fdbb26e2f4224b64b20adcad438d727392eeb24d1ffe801b296970cdbb336f41ed6b215
|
7
|
+
data.tar.gz: 2502d485c42940b1e25e8b8fe2ed8076d0f913c4e69bcdc8534c676031f73f790d67efa074bfb54a45ddf50d76c71dba6cf138feb28e48cece33de2f5139a7e1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.4.0 - 2025-05-05
|
2
|
+
|
3
|
+
- Added colored diff output when readme build/yard commands finish, showing changes to README.md using the Diffy gem
|
4
|
+
- Changed default options for `readme yard` command to display YARD doc stats
|
5
|
+
- Added code version display in README.md showing current version from ReadmeYard::VERSION
|
6
|
+
|
1
7
|
## 0.3.0 - 2025-05-04
|
2
8
|
|
3
9
|
- Update dependencies: upgraded yard-readme to 0.5.0, Ruby requirement to >= 3.0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
readme_yard (0.
|
4
|
+
readme_yard (0.4.0)
|
5
|
+
diffy (~> 3.4)
|
5
6
|
tty-markdown (~> 0.7)
|
6
7
|
yard (~> 0.9)
|
7
8
|
yard-readme (~> 0.5)
|
@@ -14,6 +15,7 @@ GEM
|
|
14
15
|
debug (1.10.0)
|
15
16
|
irb (~> 1.10)
|
16
17
|
reline (>= 0.3.8)
|
18
|
+
diffy (3.4.3)
|
17
19
|
io-console (0.8.0)
|
18
20
|
irb (1.15.2)
|
19
21
|
pp (>= 0.6.0)
|
@@ -46,7 +48,7 @@ GEM
|
|
46
48
|
io-console (~> 0.5)
|
47
49
|
rexml (3.4.1)
|
48
50
|
rouge (4.5.2)
|
49
|
-
rubocop (1.75.
|
51
|
+
rubocop (1.75.5)
|
50
52
|
json (~> 2.3)
|
51
53
|
language_server-protocol (~> 3.17.0.2)
|
52
54
|
lint_roller (~> 1.1.0)
|
@@ -79,7 +81,7 @@ GEM
|
|
79
81
|
unicode-display_width (2.6.0)
|
80
82
|
unicode_utils (1.4.0)
|
81
83
|
yard (0.9.37)
|
82
|
-
yard-readme (0.
|
84
|
+
yard-readme (0.6.0)
|
83
85
|
|
84
86
|
PLATFORMS
|
85
87
|
arm64-darwin-24
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Readme Yard 🌿
|
2
2
|
[](https://badge.fury.io/rb/readme_yard)
|
3
3
|
|
4
|
+
**Code Version: 0.4.0**
|
5
|
+
|
4
6
|
Build a better README with [YARD](https://yardoc.org)
|
5
7
|
by generating it straight from the source.
|
6
8
|
|
@@ -68,6 +70,8 @@ See [Tag Usage](#tag-usage).
|
|
68
70
|
|
69
71
|
`readme yard` - Same as `readme build` + generates yard docs.
|
70
72
|
|
73
|
+
`readme version` - Prints the current version of ReadmeYard.
|
74
|
+
|
71
75
|
|
72
76
|
---
|
73
77
|
|
@@ -93,7 +97,7 @@ When the Readme Yard build process encounters a tag in README_YARD.md, it search
|
|
93
97
|
|
94
98
|
### Examples
|
95
99
|
|
96
|
-
The next line is a code snippet if you're looking at [README
|
100
|
+
The next line is a code snippet if you're looking at the [README](https://github.com/mattruzicka/readme_yard/blob/main/README.md) and `{@readme ReadmeYard::ExampleTag.hello_world}` if you're looking at [README_YARD.md](https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md).
|
97
101
|
|
98
102
|
```ruby
|
99
103
|
#
|
@@ -291,8 +295,4 @@ ReadmeYard::ExampleTag.hello_world #=> "Hello 🌎 🌍 🌏"
|
|
291
295
|
|
292
296
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mattruzicka/yard-readme.
|
293
297
|
|
294
|
-
|
295
|
-
|
296
|
-
Thanks for taking the time to think about me, the README.
|
297
|
-
|
298
|
-
🌿 🥏 🌱 ⚽
|
298
|
+
Thanks for reading me, the README that documents how to document the README with code that documents itself 🤯
|
data/README_YARD.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Readme Yard 🌿
|
2
2
|
[](https://badge.fury.io/rb/readme_yard)
|
3
3
|
|
4
|
+
**Code Version: {@string ReadmeYard::VERSION}**
|
5
|
+
|
4
6
|
{@readme ReadmeYard}
|
5
7
|
|
6
8
|
---
|
@@ -69,7 +71,7 @@ When the Readme Yard build process encounters a tag in README_YARD.md, it search
|
|
69
71
|
|
70
72
|
### Examples
|
71
73
|
|
72
|
-
The next line is a code snippet if you're looking at [README
|
74
|
+
The next line is a code snippet if you're looking at the [README](https://github.com/mattruzicka/readme_yard/blob/main/README.md) and `{@readme ReadmeYard::ExampleTag.hello_world}` if you're looking at [README_YARD.md](https://github.com/mattruzicka/readme_yard/blob/main/README_YARD.md).
|
73
75
|
|
74
76
|
{@readme ReadmeYard::ExampleTag.hello_world}
|
75
77
|
|
@@ -189,8 +191,4 @@ The below example code is generated from `{@example ReadmeYard::ExampleTag.hello
|
|
189
191
|
|
190
192
|
Bug reports and pull requests are welcome on GitHub at https://github.com/mattruzicka/yard-readme.
|
191
193
|
|
192
|
-
|
193
|
-
|
194
|
-
Thanks for taking the time to think about me, the README.
|
195
|
-
|
196
|
-
🌿 🥏 🌱 ⚽
|
194
|
+
Thanks for reading me, the README that documents how to document the README with code that documents itself 🤯
|
data/lib/readme_yard/logger.rb
CHANGED
data/lib/readme_yard/version.rb
CHANGED
data/lib/readme_yard.rb
CHANGED
@@ -15,6 +15,7 @@ require_relative "readme_yard/value_tag"
|
|
15
15
|
require_relative "readme_yard/string_tag"
|
16
16
|
require_relative "readme_yard/tag_registry"
|
17
17
|
require_relative "readme_yard/yard_opts_manager"
|
18
|
+
require "diffy"
|
18
19
|
|
19
20
|
YARD::Readme::DocstringParser.readme_tag_names = ReadmeYard::TagRegistry.tag_names
|
20
21
|
|
@@ -50,6 +51,8 @@ class ReadmeYard
|
|
50
51
|
readme_yard.build(options: options)
|
51
52
|
when "yard"
|
52
53
|
readme_yard.yard(options: options)
|
54
|
+
when "version"
|
55
|
+
Logger.puts_md(VERSION)
|
53
56
|
else
|
54
57
|
Logger.puts_md(readme_yard.command_line_usage)
|
55
58
|
end
|
@@ -65,7 +68,9 @@ class ReadmeYard
|
|
65
68
|
attr_accessor :readme_path, :readme_yard_path
|
66
69
|
|
67
70
|
#
|
68
|
-
# This method returns the
|
71
|
+
# This unnecessarily meta method returns the `@readme` text you see
|
72
|
+
# below (if you're reading this in the source code). It was implemented
|
73
|
+
# just for fun as a demonstration of @readme tags.
|
69
74
|
#
|
70
75
|
# @readme
|
71
76
|
# ## Command Line Usage
|
@@ -76,6 +81,8 @@ class ReadmeYard
|
|
76
81
|
#
|
77
82
|
# `readme yard` - Same as `readme build` + generates yard docs.
|
78
83
|
#
|
84
|
+
# `readme version` - Prints the current version of ReadmeYard.
|
85
|
+
#
|
79
86
|
def command_line_usage
|
80
87
|
yard_parse_this_file
|
81
88
|
yard_object = YARD::Registry.at("#{self.class.name}##{__method__}")
|
@@ -95,15 +102,18 @@ class ReadmeYard
|
|
95
102
|
#
|
96
103
|
def build(options: "-nq")
|
97
104
|
YARD::CLI::Yardoc.run(options || "-nq")
|
98
|
-
File.
|
105
|
+
old_readme = File.exist?(readme_path) ? File.read(readme_path) : ""
|
106
|
+
new_readme = gsub_tags!(readme_yard_md)
|
107
|
+
File.write(readme_path, new_readme)
|
108
|
+
show_readme_diff(old_readme, new_readme)
|
99
109
|
end
|
100
110
|
|
101
111
|
#
|
102
|
-
# @readme Same as "build" + generates yard docs.
|
112
|
+
# @readme Same as "build" + generates yard `docs.
|
103
113
|
#
|
104
|
-
def yard(options: "
|
114
|
+
def yard(options: "")
|
105
115
|
YardOptsManager.upsert_yardopts
|
106
|
-
build(options: options || "
|
116
|
+
build(options: options || "")
|
107
117
|
end
|
108
118
|
|
109
119
|
private
|
@@ -176,4 +186,15 @@ class ReadmeYard
|
|
176
186
|
current_file_path = File.join(gem_spec.full_gem_path, "lib", "readme_yard.rb")
|
177
187
|
YARD.parse(current_file_path)
|
178
188
|
end
|
189
|
+
|
190
|
+
def show_readme_diff(old_content, new_content)
|
191
|
+
if old_content == new_content
|
192
|
+
Logger.puts_md("\n**No changes** to README.md\n\n")
|
193
|
+
return
|
194
|
+
end
|
195
|
+
|
196
|
+
diff = Diffy::Diff.new(old_content, new_content, context: 0).to_s(:color)
|
197
|
+
Logger.puts_md("\n**Changes to README.md:**\n\n")
|
198
|
+
Logger.puts_text "#{diff}\n"
|
199
|
+
end
|
179
200
|
end
|
data/readme_yard.gemspec
CHANGED
@@ -27,6 +27,7 @@ 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 "diffy", "~> 3.4"
|
30
31
|
spec.add_dependency "tty-markdown", "~> 0.7"
|
31
32
|
spec.add_dependency "yard", "~> 0.9"
|
32
33
|
spec.add_dependency "yard-readme", "~> 0.5"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: readme_yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Ruzicka
|
@@ -9,6 +9,20 @@ bindir: bin
|
|
9
9
|
cert_chain: []
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: diffy
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '3.4'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '3.4'
|
12
26
|
- !ruby/object:Gem::Dependency
|
13
27
|
name: tty-markdown
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|