-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmake-plugins.txt.rb
52 lines (41 loc) · 1.38 KB
/
make-plugins.txt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env ruby
doc = {}
Dir["lib/ditz/plugins/*.rb"].each do |fn|
name = fn =~ /([^\/]+)\.rb$/ && $1
d = IO.read(fn) =~ /^(.+?)\n\n/m && $1
d = d.gsub(/\A##.+\n##.*?\n/, "")
d = d.gsub(/^## ?/, "")
doc[name] = d
end
dockeys = doc.keys.sort
puts <<EOS
Ditz plugin documentation
-------------------------
Ditz features a code plugin system for adding and extending commands, fields,
and output. Ditz's plugin system is used to add optional functionality to Ditz.
If you're interested in writing a plugin, look at the simple plugins in
lib/ditz/plugin/, and see
http://all-thing.net/2008/07/ditz-04-and-magic-of-ruby-dsls.html
If you're interested using plugins, read on.
Ditz loads specific plugins by looking for a .ditz-plugins file in the project
root. The format of this file is a YAML array of strings, where each string is
a plugin name. You can write this by hand like this:
- my-plugin
- another-plugin
I.e. one plugin name per line, prefixed by "- " as the first two characters of each line.
For each listed plugin name, Ditz looks for a file named
"lib/ditz/plugin/<name>.rb" within Ruby's default search path. Assuming Ditz is
installed in a standard manner, you should have available to you the following
shipped plugins:
EOS
dockeys.each_with_index do |p, i|
puts "#{i + 1}. #{p}"
end
puts
dockeys.each do |p|
puts p
puts "-" * p.size
puts
puts doc[p]
puts
end