gem_docs 0.2.0 → 0.3.1
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/lib/gem_docs/config.rb +1 -0
- data/lib/gem_docs/emacs.rb +20 -2
- data/lib/gem_docs/header.rb +11 -11
- data/lib/gem_docs/skeleton.rb +25 -4
- data/lib/gem_docs/tasks.rb +29 -14
- data/lib/gem_docs/version.rb +1 -1
- data/lib/gem_docs.rb +18 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e1d29bbce836d7be31883f9748134af47f3c2d6e160b35639f7195cf3ab23d6
|
|
4
|
+
data.tar.gz: f01a2d4a987020c7dad7f18a3d4ebd3145c2326d069ad9b3b5e20348e6b56d4e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2163336ebab1ea2d2e7eed04b98aa8f2bb6da856a3184342fcb6e6d675e73a131fe6eeaf5707ddae1e35681c873d31044f85cf9c0c90f9ccb8d94972f32adbfa
|
|
7
|
+
data.tar.gz: 41f5ca7c522e9fd18d462e1b5f9a5a020e6a0ee4a5cbeab645b93c76b8342c37cf2064acf27eae6d657497485a036ca9a8502cf9b314bf13e3dc3a32764737a7
|
data/lib/gem_docs/config.rb
CHANGED
|
@@ -20,6 +20,7 @@ module GemDocs
|
|
|
20
20
|
#+PROPERTY: header-args:ruby :results value :colnames no :hlines yes :exports both :dir "./"
|
|
21
21
|
#+PROPERTY: header-args:ruby+ :wrap example :session %n_session :eval yes
|
|
22
22
|
#+PROPERTY: header-args:ruby+ :prologue "$:.unshift('./lib') unless $:.first == './lib'; require '%n'"
|
|
23
|
+
#+PROPERTY: header-args:ruby+ :ruby "bundle exec irb"
|
|
23
24
|
#+PROPERTY: header-args:sh :exports code :eval no
|
|
24
25
|
#+PROPERTY: header-args:bash :exports code :eval no
|
|
25
26
|
HEADER
|
data/lib/gem_docs/emacs.rb
CHANGED
|
@@ -20,13 +20,31 @@ module GemDocs
|
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def self.
|
|
23
|
+
def self.export_readme
|
|
24
24
|
expr = <<~ELISP
|
|
25
25
|
(save-window-excursion
|
|
26
26
|
(with-current-buffer (find-file-noselect "#{README_ORG}")
|
|
27
27
|
(save-buffer)
|
|
28
28
|
(require 'ox-gfm)
|
|
29
|
-
(org-gfm-export-to-markdown))
|
|
29
|
+
(org-gfm-export-to-markdown))
|
|
30
|
+
(with-current-buffer (find-file-noselect "#{CHANGELOG_ORG}")
|
|
31
|
+
(save-buffer)
|
|
32
|
+
(require 'ox-gfm)
|
|
33
|
+
(org-gfm-export-to-markdown))
|
|
34
|
+
"Export README complete")
|
|
35
|
+
ELISP
|
|
36
|
+
|
|
37
|
+
system("emacsclient", "--quiet", "--eval", expr)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.export_changelog
|
|
41
|
+
expr = <<~ELISP
|
|
42
|
+
(save-window-excursion
|
|
43
|
+
(with-current-buffer (find-file-noselect "#{CHANGELOG_ORG}")
|
|
44
|
+
(save-buffer)
|
|
45
|
+
(require 'ox-gfm)
|
|
46
|
+
(org-gfm-export-to-markdown))
|
|
47
|
+
"Export CHANGELOG complete")
|
|
30
48
|
ELISP
|
|
31
49
|
|
|
32
50
|
system("emacsclient", "--quiet", "--eval", expr)
|
data/lib/gem_docs/header.rb
CHANGED
|
@@ -18,6 +18,17 @@ module GemDocs
|
|
|
18
18
|
prelim.any? { |h| h.match?(PROPERTY_RE) }
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def self.org_headers
|
|
22
|
+
repo = Repo.from_gemspec
|
|
23
|
+
GemDocs.config.headers
|
|
24
|
+
.gsub('%n', repo.name)
|
|
25
|
+
.gsub('%h', repo.host)
|
|
26
|
+
.gsub('%u', repo.user)
|
|
27
|
+
.gsub('%r', repo.root)
|
|
28
|
+
.gsub('%b', repo.branch)
|
|
29
|
+
.gsub('%w', repo.workflow)
|
|
30
|
+
end
|
|
31
|
+
|
|
21
32
|
class << self
|
|
22
33
|
private
|
|
23
34
|
|
|
@@ -38,17 +49,6 @@ module GemDocs
|
|
|
38
49
|
end
|
|
39
50
|
[prelim, body]
|
|
40
51
|
end
|
|
41
|
-
|
|
42
|
-
def org_headers
|
|
43
|
-
repo = Repo.from_gemspec
|
|
44
|
-
GemDocs.config.headers
|
|
45
|
-
.gsub('%n', repo.name)
|
|
46
|
-
.gsub('%h', repo.host)
|
|
47
|
-
.gsub('%u', repo.user)
|
|
48
|
-
.gsub('%r', repo.root)
|
|
49
|
-
.gsub('%b', repo.branch)
|
|
50
|
-
.gsub('%w', repo.workflow)
|
|
51
|
-
end
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
end
|
data/lib/gem_docs/skeleton.rb
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module GemDocs
|
|
4
4
|
module Skeleton
|
|
5
|
-
PROPERTY_RE = /^#\+PROPERTY:\s+header-args:ruby/
|
|
6
|
-
|
|
7
5
|
# @return String The overview from README per config
|
|
8
6
|
def self.make_readme?
|
|
9
|
-
return false if
|
|
7
|
+
return false if readme_present?
|
|
10
8
|
|
|
11
9
|
repo = Repo.from_gemspec
|
|
12
10
|
content = <<~SKEL
|
|
@@ -47,8 +45,31 @@ module GemDocs
|
|
|
47
45
|
File.write(README_ORG, content) > 0
|
|
48
46
|
end
|
|
49
47
|
|
|
50
|
-
def self.
|
|
48
|
+
def self.readme_present?
|
|
51
49
|
File.exist?(README_ORG)
|
|
52
50
|
end
|
|
51
|
+
|
|
52
|
+
def self.make_changelog?
|
|
53
|
+
return false if changelog_present?
|
|
54
|
+
|
|
55
|
+
content = <<~SKEL
|
|
56
|
+
* COMMENT CHANGELOG tips:
|
|
57
|
+
1. Don't dump your git change logs into this file, write them yourself.
|
|
58
|
+
2. Keep entries short and user-focused,
|
|
59
|
+
3. Use non-technical language, but do speak in the vocabulary of your gem.
|
|
60
|
+
4. Don't document changes only of interest to the programmers, just those the
|
|
61
|
+
user would find useful.
|
|
62
|
+
5. Give each heading a version number and an inactive date (C-c ! is useful here).
|
|
63
|
+
|
|
64
|
+
* Version 0.3.0 [2025-12-27 Sat]
|
|
65
|
+
- First change
|
|
66
|
+
- Second change
|
|
67
|
+
SKEL
|
|
68
|
+
File.write(CHANGELOG_ORG, content) > 0
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.changelog_present?
|
|
72
|
+
File.exist?(CHANGELOG_ORG)
|
|
73
|
+
end
|
|
53
74
|
end
|
|
54
75
|
end
|
data/lib/gem_docs/tasks.rb
CHANGED
|
@@ -4,24 +4,28 @@ module GemDocs
|
|
|
4
4
|
def self.install
|
|
5
5
|
extend Rake::DSL
|
|
6
6
|
|
|
7
|
-
# README.org → README.md when README.org is newer
|
|
8
7
|
file README_MD => README_ORG do
|
|
9
8
|
print "Exporting \"#{README_ORG}\" → "
|
|
10
|
-
GemDocs::Emacs.
|
|
9
|
+
GemDocs::Emacs.export_readme
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
file CHANGELOG_MD => CHANGELOG_ORG do
|
|
13
|
+
print "Exporting \"#{CHANGELOG_ORG}\" → "
|
|
14
|
+
GemDocs::Emacs.export_changelog
|
|
11
15
|
end
|
|
12
16
|
|
|
13
17
|
namespace :docs do
|
|
14
18
|
desc "Evaluate code blocks in README.org"
|
|
15
|
-
task :tangle => [:skeleton] do
|
|
19
|
+
task :tangle => ["docs:skeleton:readme"] do
|
|
16
20
|
print "Executing code blocks in #{README_ORG} ... "
|
|
17
21
|
GemDocs::Emacs.tangle
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
desc "Export README.org → README.md"
|
|
21
|
-
task :export => [:badge, README_MD]
|
|
25
|
+
task :export => [:badge, README_MD, CHANGELOG_MD]
|
|
22
26
|
|
|
23
27
|
desc "Extract overview from README.org and embed in lib/<gem>.rb for ri/yard"
|
|
24
|
-
task :overview => [:skeleton, README_ORG] do
|
|
28
|
+
task :overview => ["docs:skeleton:readme", README_ORG] do
|
|
25
29
|
print "Embedding overview extracted from #{GemDocs::README_ORG} into main gem file ... "
|
|
26
30
|
if GemDocs::Overview.write_overview?
|
|
27
31
|
puts "added"
|
|
@@ -30,17 +34,28 @@ module GemDocs
|
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
namespace :skeleton do
|
|
38
|
+
desc "Create skeleton README.org if one does not exist"
|
|
39
|
+
task :readme do
|
|
40
|
+
if GemDocs::Skeleton.make_readme?
|
|
41
|
+
puts "README.org added"
|
|
42
|
+
else
|
|
43
|
+
puts "README.org already present"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "Create skeleton CHANGELOG.org if one does not exist"
|
|
48
|
+
task :changelog do
|
|
49
|
+
if GemDocs::Skeleton.make_changelog?
|
|
50
|
+
puts "CHANGELOG.org added"
|
|
51
|
+
else
|
|
52
|
+
puts "CHANGELOG.org already present"
|
|
53
|
+
end
|
|
39
54
|
end
|
|
40
55
|
end
|
|
41
56
|
|
|
42
57
|
desc "Insert #+PROPERTY headers at top of README.org for code blocks"
|
|
43
|
-
task :header => :skeleton do
|
|
58
|
+
task :header => "docs:skeleton:readme" do
|
|
44
59
|
print "Inserting headers ... "
|
|
45
60
|
if GemDocs::Header.write_header?
|
|
46
61
|
puts "added"
|
|
@@ -56,7 +71,7 @@ module GemDocs
|
|
|
56
71
|
end
|
|
57
72
|
|
|
58
73
|
desc "Ensure GitHub Actions badge exists in README.org"
|
|
59
|
-
task :badge => :skeleton do
|
|
74
|
+
task :badge => "docs:skeleton:readme" do
|
|
60
75
|
print "Ensuring badges are in README.org ... "
|
|
61
76
|
if GemDocs::Badge.ensure!
|
|
62
77
|
puts "added"
|
|
@@ -66,7 +81,7 @@ module GemDocs
|
|
|
66
81
|
end
|
|
67
82
|
|
|
68
83
|
desc "Run all documentation tasks (examples, readme, overview, yard, ri)"
|
|
69
|
-
task :all => [:skeleton, :header, :tangle, :export, :overview, :yard]
|
|
84
|
+
task :all => ["docs:skeleton:readme", "docs:skeleton:changelog", :header, :tangle, :export, :overview, :yard]
|
|
70
85
|
end
|
|
71
86
|
end
|
|
72
87
|
end
|
data/lib/gem_docs/version.rb
CHANGED
data/lib/gem_docs.rb
CHANGED
|
@@ -37,6 +37,7 @@ require "fileutils"
|
|
|
37
37
|
# of the library,
|
|
38
38
|
# - running the code block examples in a ~README.org~ by invoking ~emacsclient~,
|
|
39
39
|
# - exporting ~README.org~ to Git-flavored markdown in ~README.md~
|
|
40
|
+
# - exporting ~CHANGELOG.org~ to Git-flavored markdown in ~CHANGELOG.md~
|
|
40
41
|
# - ensuring a workflow or ci badge is present in the ~README.md~
|
|
41
42
|
# - generating yard documents for your repo, and
|
|
42
43
|
# - copying the introductory contents of the README as a leading comment in your
|
|
@@ -49,7 +50,16 @@ require "fileutils"
|
|
|
49
50
|
# detains filled in. If there is already a README.org file, it does nothing.
|
|
50
51
|
#
|
|
51
52
|
# #+begin_src ruby :eval no
|
|
52
|
-
# rake docs:skeleton
|
|
53
|
+
# rake docs:skeleton:readme
|
|
54
|
+
# #+end_src
|
|
55
|
+
#
|
|
56
|
+
# ** Create a skeleton CHANGELOG.org file
|
|
57
|
+
# This is a simple task that creates a bare-bones ~CHANGELOG.org~ file to get
|
|
58
|
+
# started with. It only contains some tips for writing a change log and a
|
|
59
|
+
# sample heading. If there is already a CHANGELOG.org file, it does nothing.
|
|
60
|
+
#
|
|
61
|
+
# #+begin_src ruby :eval no
|
|
62
|
+
# rake docs:skeleton:changelog
|
|
53
63
|
# #+end_src
|
|
54
64
|
#
|
|
55
65
|
# ** Add proper ~#+PROPERTY~ headers in ~README.org~: ~rake docs:headers~
|
|
@@ -208,7 +218,7 @@ require "fileutils"
|
|
|
208
218
|
# If there is already a badge present, the task will not modify the ~README.org~
|
|
209
219
|
# file.
|
|
210
220
|
#
|
|
211
|
-
# ** Export ~README.org~
|
|
221
|
+
# ** Export ~README.org~ and ~CHANGELOG.org~ to Markdown: ~rake docs:export~
|
|
212
222
|
# You can write the ~README~ in Emacs org-mode, using all its features
|
|
213
223
|
# including the execution of code blocks, and then export to git-flavored
|
|
214
224
|
# markdown.
|
|
@@ -229,6 +239,10 @@ require "fileutils"
|
|
|
229
239
|
# you want to have one for your own purposes, just set the ~:noexport~ tag on it
|
|
230
240
|
# so it doesn't get put into the ~README.md~
|
|
231
241
|
#
|
|
242
|
+
# Less important, but still handy, you can also write the CHANGELOG in org mode
|
|
243
|
+
# and this task will convert it to markdown for display on github and
|
|
244
|
+
# rubygems.org.
|
|
245
|
+
#
|
|
232
246
|
# #+begin_src ruby :eval no
|
|
233
247
|
# rake docs:export
|
|
234
248
|
# #+end_src
|
|
@@ -275,6 +289,8 @@ module GemDocs
|
|
|
275
289
|
|
|
276
290
|
README_ORG = "README.org"
|
|
277
291
|
README_MD = "README.md"
|
|
292
|
+
CHANGELOG_ORG = "CHANGELOG.org"
|
|
293
|
+
CHANGELOG_MD = "CHANGELOG.md"
|
|
278
294
|
|
|
279
295
|
# Auto-detect project root (handles being run from subdirs)
|
|
280
296
|
def self.project_root
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gem_docs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel E. Doherty
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rake
|
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
76
76
|
- !ruby/object:Gem::Version
|
|
77
77
|
version: '0'
|
|
78
78
|
requirements: []
|
|
79
|
-
rubygems_version:
|
|
79
|
+
rubygems_version: 4.0.3
|
|
80
80
|
specification_version: 4
|
|
81
81
|
summary: Documentation automation for Ruby gems
|
|
82
82
|
test_files: []
|