readme_yard 0.3.0 → 0.5.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.
@@ -0,0 +1,110 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Top Level Namespace
8
+
9
+ &mdash; Documentation by YARD 0.9.37
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index</a> &raquo;
40
+
41
+
42
+ <span class="title">Top Level Namespace</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Top Level Namespace
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ </div>
80
+
81
+ <h2>Defined Under Namespace</h2>
82
+ <p class="children">
83
+
84
+
85
+
86
+
87
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="ReadmeYard.html" title="ReadmeYard (class)">ReadmeYard</a></span>
88
+
89
+
90
+ </p>
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+ </div>
101
+
102
+ <div id="footer">
103
+ Generated on Mon May 5 09:48:52 2025 by
104
+ <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
+ 0.9.37 (ruby-3.4.2).
106
+ </div>
107
+
108
+ </div>
109
+ </body>
110
+ </html>
@@ -11,6 +11,10 @@ class ReadmeYard
11
11
  def puts_md(msg)
12
12
  puts TTY::Markdown.parse(msg)
13
13
  end
14
+
15
+ def puts_text(msg)
16
+ puts msg
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -39,8 +39,13 @@ class ReadmeYard
39
39
  return normalize_value_for_heredoc(string_value) if string_value.strip.start_with?("<<~")
40
40
 
41
41
  # Handle regular string format
42
- string_value.delete_prefix!('"')
43
- string_value.delete_suffix!('"')
42
+ if string_value.start_with?('"')
43
+ string_value.delete_prefix!('"')
44
+ string_value.delete_suffix!('"')
45
+ elsif string_value.start_with?("'")
46
+ string_value.delete_prefix!("'")
47
+ string_value.delete_suffix!("'")
48
+ end
44
49
 
45
50
  # Replace different line continuation patterns
46
51
  # This handles patterns like: " \\\n" and \\\n"
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ReadmeYard
4
- VERSION = "0.3.0"
4
+ VERSION = "0.5.0"
5
+ DOCS_URL = "https://mattruzicka.github.io/readme_yard/"
5
6
  end
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
 
@@ -36,8 +37,6 @@ YARD::Readme::DocstringParser.readme_tag_names = ReadmeYard::TagRegistry.tag_nam
36
37
  # because the custom `{@readme ReadmeYard}` markdown tag is in
37
38
  # README_YARD.md and `readme build` was run at the command line.
38
39
  #
39
- # Here's the [full documentation](https://rubydoc.info/github/mattruzicka/readme_yard).
40
- #
41
40
  class ReadmeYard
42
41
  #
43
42
  # @see #command_line_usage
@@ -50,6 +49,8 @@ class ReadmeYard
50
49
  readme_yard.build(options: options)
51
50
  when "yard"
52
51
  readme_yard.yard(options: options)
52
+ when "version"
53
+ Logger.puts_md(VERSION)
53
54
  else
54
55
  Logger.puts_md(readme_yard.command_line_usage)
55
56
  end
@@ -65,7 +66,9 @@ class ReadmeYard
65
66
  attr_accessor :readme_path, :readme_yard_path
66
67
 
67
68
  #
68
- # This method returns the following `@readme` text
69
+ # This unnecessarily meta method returns the `@readme` text you see
70
+ # below (if you're reading this in the source code). It was implemented
71
+ # just for fun as a demonstration of @readme tags.
69
72
  #
70
73
  # @readme
71
74
  # ## Command Line Usage
@@ -76,6 +79,8 @@ class ReadmeYard
76
79
  #
77
80
  # `readme yard` - Same as `readme build` + generates yard docs.
78
81
  #
82
+ # `readme version` - Prints the current version of ReadmeYard.
83
+ #
79
84
  def command_line_usage
80
85
  yard_parse_this_file
81
86
  yard_object = YARD::Registry.at("#{self.class.name}##{__method__}")
@@ -95,15 +100,18 @@ class ReadmeYard
95
100
  #
96
101
  def build(options: "-nq")
97
102
  YARD::CLI::Yardoc.run(options || "-nq")
98
- File.write(readme_path, gsub_tags!(readme_yard_md))
103
+ old_readme = File.exist?(readme_path) ? File.read(readme_path) : ""
104
+ new_readme = gsub_tags!(readme_yard_md)
105
+ File.write(readme_path, new_readme)
106
+ show_readme_diff(old_readme, new_readme)
99
107
  end
100
108
 
101
109
  #
102
- # @readme Same as "build" + generates yard docs.
110
+ # @readme Same as "build" + generates yard `docs.
103
111
  #
104
- def yard(options: "-q")
112
+ def yard(options: "")
105
113
  YardOptsManager.upsert_yardopts
106
- build(options: options || "-q")
114
+ build(options: options || "")
107
115
  end
108
116
 
109
117
  private
@@ -176,4 +184,15 @@ class ReadmeYard
176
184
  current_file_path = File.join(gem_spec.full_gem_path, "lib", "readme_yard.rb")
177
185
  YARD.parse(current_file_path)
178
186
  end
187
+
188
+ def show_readme_diff(old_content, new_content)
189
+ if old_content == new_content
190
+ Logger.puts_md("\n**No changes** to README.md\n\n")
191
+ return
192
+ end
193
+
194
+ diff = Diffy::Diff.new(old_content, new_content, context: 0).to_s(:color)
195
+ Logger.puts_md("\n**Changes to README.md:**\n\n")
196
+ Logger.puts_text "#{diff}\n"
197
+ end
179
198
  end
data/readme_yard.gemspec CHANGED
@@ -14,7 +14,8 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.metadata["homepage_uri"] = spec.homepage
16
16
  spec.metadata["source_code_uri"] = spec.homepage
17
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
17
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
18
+ spec.metadata["documentation_uri"] = ReadmeYard::DOCS_URL
18
19
 
19
20
  # Specify which files should be added to the gem when it is released.
20
21
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -27,6 +28,7 @@ Gem::Specification.new do |spec|
27
28
  spec.require_paths = ["lib"]
28
29
 
29
30
  # Uncomment to register a new dependency of your gem
31
+ spec.add_dependency "diffy", "~> 3.4"
30
32
  spec.add_dependency "tty-markdown", "~> 0.7"
31
33
  spec.add_dependency "yard", "~> 0.9"
32
34
  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.3.0
4
+ version: 0.5.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
@@ -83,6 +97,32 @@ files:
83
97
  - bin/console
84
98
  - bin/readme
85
99
  - bin/setup
100
+ - docs/ReadmeYard.html
101
+ - docs/ReadmeYard/CodeTag.html
102
+ - docs/ReadmeYard/CommentTag.html
103
+ - docs/ReadmeYard/Error.html
104
+ - docs/ReadmeYard/ExampleTag.html
105
+ - docs/ReadmeYard/Logger.html
106
+ - docs/ReadmeYard/ReadmeTag.html
107
+ - docs/ReadmeYard/SourceTag.html
108
+ - docs/ReadmeYard/StringTag.html
109
+ - docs/ReadmeYard/TagRegistry.html
110
+ - docs/ReadmeYard/ValueTag.html
111
+ - docs/ReadmeYard/YardOptsManager.html
112
+ - docs/_index.html
113
+ - docs/class_list.html
114
+ - docs/css/common.css
115
+ - docs/css/full_list.css
116
+ - docs/css/style.css
117
+ - docs/file.README.html
118
+ - docs/file_list.html
119
+ - docs/frames.html
120
+ - docs/index.html
121
+ - docs/js/app.js
122
+ - docs/js/full_list.js
123
+ - docs/js/jquery.js
124
+ - docs/method_list.html
125
+ - docs/top-level-namespace.html
86
126
  - lib/readme_yard.rb
87
127
  - lib/readme_yard/code_tag.rb
88
128
  - lib/readme_yard/comment_tag.rb
@@ -103,7 +143,8 @@ licenses:
103
143
  metadata:
104
144
  homepage_uri: https://github.com/mattruzicka/readme_yard
105
145
  source_code_uri: https://github.com/mattruzicka/readme_yard
106
- changelog_uri: https://github.com/mattruzicka/readme_yard/blob/master/CHANGELOG.md
146
+ changelog_uri: https://github.com/mattruzicka/readme_yard/blob/main/CHANGELOG.md
147
+ documentation_uri: https://mattruzicka.github.io/readme_yard/
107
148
  rdoc_options: []
108
149
  require_paths:
109
150
  - lib