wrongdoc 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.html_fragment
2
+ *.1
3
+ *.5
4
+ *.html
@@ -0,0 +1,32 @@
1
+ all::
2
+
3
+ RONN = ronn
4
+ ronn_man = $(RONN) -r
5
+ ronn_html = $(RONN) -f
6
+
7
+ man1 := $(addsuffix .1,wrongdoc)
8
+ html1 := $(addsuffix .html_fragment,$(man1))
9
+ man5 := $(addsuffix .5,dotwrongdoc)
10
+ html5 := $(addsuffix .html_fragment,$(man5))
11
+ man := $(man1) $(man5)
12
+ html := $(html1) $(html5)
13
+
14
+ all:: html man
15
+
16
+ html: $(html)
17
+ man: $(man)
18
+ mkdir -p ../man/man1 ../man/man5
19
+ install -m 644 $(man1) ../man/man1
20
+ install -m 644 $(man5) ../man/man5
21
+
22
+ %.1: %.1.ronn
23
+ $(ronn_man) $<
24
+ %.5: %.5.ronn
25
+ $(ronn_man) $<
26
+ %.1.html_fragment: %.1.ronn
27
+ $(ronn_html) $<
28
+ %.5.html_fragment: %.5.ronn
29
+ $(ronn_html) $<
30
+
31
+ clean::
32
+ $(RM) $(man) $(html)
@@ -0,0 +1,23 @@
1
+ dotwrongdoc(5) -- wrongdoc config file format
2
+ =============================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ A YAML file in the top-level project directory named ".wrongdoc.yml"
7
+
8
+ ## DESCRIPTION
9
+
10
+ As wrongdoc favors consistency over configuration, there is minimal
11
+ configuration to deal with.
12
+
13
+ ## KEYS
14
+
15
+ `rdoc_url`, `cgit_url` should be obvious
16
+
17
+ `merge_html` is a key-value mapping of (empty) RDoc source files to an
18
+ HTML file that will be merged into RDoc after-the-fact. It is useful
19
+ for merging non-RDoc generated HTML into the project.
20
+
21
+ ## SEE ALSO
22
+
23
+ wrongdoc(1)
@@ -0,0 +1,17 @@
1
+ wrongdoc(1) -- removes JavaScript from RDoc
2
+ ===========================================
3
+
4
+ ## SYNOPSIS
5
+ `wrongdoc` prepare
6
+
7
+ `wrongdoc`
8
+
9
+ ## DESCRIPTION
10
+
11
+ **Wrongdoc** does horrible things to your RDoc project. It's own
12
+ documentation sucks, but it'll help to make your documentation
13
+ JavaScript-free and therefore suck less :)
14
+
15
+ ## SEE ALSO
16
+
17
+ dotwrongdoc(5)
data/GIT-VERSION-FILE ADDED
@@ -0,0 +1 @@
1
+ GIT_VERSION = 1.0.0
data/GIT-VERSION-GEN ADDED
@@ -0,0 +1,40 @@
1
+ #!/bin/sh
2
+
3
+ GVF=GIT-VERSION-FILE
4
+ DEF_VER=v1.0.0.GIT
5
+
6
+ LF='
7
+ '
8
+
9
+ # First see if there is a version file (included in release tarballs),
10
+ # then try git-describe, then default.
11
+ if test -f version
12
+ then
13
+ VN=$(cat version) || VN="$DEF_VER"
14
+ elif test -d .git -o -f .git &&
15
+ VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
16
+ case "$VN" in
17
+ *$LF*) (exit 1) ;;
18
+ v[0-9]*)
19
+ git update-index -q --refresh
20
+ test -z "$(git diff-index --name-only HEAD --)" ||
21
+ VN="$VN-dirty" ;;
22
+ esac
23
+ then
24
+ VN=$(echo "$VN" | sed -e 's/-/./g');
25
+ else
26
+ VN="$DEF_VER"
27
+ fi
28
+
29
+ VN=$(expr "$VN" : v*'\(.*\)')
30
+
31
+ if test -r $GVF
32
+ then
33
+ VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
34
+ else
35
+ VC=unset
36
+ fi
37
+ test "$VN" = "$VC" || {
38
+ echo >&2 "GIT_VERSION = $VN"
39
+ echo "GIT_VERSION = $VN" >$GVF
40
+ }
data/GNUmakefile ADDED
@@ -0,0 +1,114 @@
1
+ # use GNU Make to run tests in parallel, and without depending on RubyGems
2
+ all::
3
+ MRI = ruby
4
+ RUBY = ruby
5
+ RAKE = rake
6
+ RSYNC = rsync
7
+ WRONGDOC := $(RUBY) -I lib bin/wrongdoc
8
+
9
+ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
10
+ @./GIT-VERSION-GEN
11
+ -include GIT-VERSION-FILE
12
+ -include local.mk
13
+
14
+ man1_paths := $(addprefix man/man1/, wrongdoc.1)
15
+ man5_paths := $(addprefix man/man5/, dotwrongdoc.5)
16
+ manpages := $(man1_paths) $(man5_paths)
17
+
18
+ clean:
19
+ -$(MAKE) -C Documentation clean
20
+
21
+ man html:
22
+ $(MAKE) -C Documentation $@
23
+
24
+ $(manpages): man
25
+ pkg_extra := GIT-VERSION-FILE ChangeLog LATEST NEWS $(manpages)
26
+
27
+ ChangeLog: GIT-VERSION-FILE .wrongdoc.yml
28
+ $(WRONGDOC) prepare
29
+
30
+ .manifest: ChangeLog
31
+ (git ls-files && for i in $@ $(pkg_extra); do echo $$i; done) | \
32
+ LC_ALL=C sort > $@+
33
+ mv $@+ $@
34
+
35
+ doc: .document .wrongdoc.yml man html
36
+ find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
37
+ $(RM) -r doc
38
+ $(WRONGDOC) all
39
+ install -m644 COPYING doc/COPYING
40
+ install -m644 $(shell grep '^[A-Z]' .document) doc/
41
+ tar cf - man | (cd doc && tar xf -)
42
+
43
+ publish_doc:
44
+ -git set-file-times
45
+ $(MAKE) doc
46
+ -find doc/images -type f | \
47
+ TZ=UTC xargs touch -d '1970-01-01 00:00:01' doc/rdoc.css
48
+ chmod 644 $$(find doc -type f)
49
+ $(RSYNC) -av doc/ bogomips.org:/srv/bogomips/wrongdoc/
50
+ git ls-files | xargs touch
51
+
52
+ ifneq ($(VERSION),)
53
+ rfproject := rainbows
54
+ rfpackage := wrongdoc
55
+ pkggem := pkg/$(rfpackage)-$(VERSION).gem
56
+ pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
57
+ release_notes := release_notes-$(VERSION)
58
+ release_changes := release_changes-$(VERSION)
59
+
60
+ release-notes: $(release_notes)
61
+ release-changes: $(release_changes)
62
+ $(release_changes):
63
+ $(WRONGDOC) release_changes > $@+
64
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
65
+ $(release_notes):
66
+ $(WRONGDOC) release_notes > $@+
67
+ $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
68
+
69
+ # ensures we're actually on the tagged $(VERSION), only used for release
70
+ verify:
71
+ test x"$(shell umask)" = x0022
72
+ git rev-parse --verify refs/tags/v$(VERSION)^{}
73
+ git diff-index --quiet HEAD^0
74
+ test `git rev-parse --verify HEAD^0` = \
75
+ `git rev-parse --verify refs/tags/v$(VERSION)^{}`
76
+
77
+ fix-perms:
78
+ -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
79
+ -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
80
+
81
+ gem: $(pkggem)
82
+
83
+ install-gem: $(pkggem)
84
+ gem install $(CURDIR)/$<
85
+
86
+ $(pkggem): .manifest fix-perms
87
+ gem build $(rfpackage).gemspec
88
+ mkdir -p pkg
89
+ mv $(@F) $@
90
+
91
+ $(pkgtgz): distdir = $(basename $@)
92
+ $(pkgtgz): HEAD = v$(VERSION)
93
+ $(pkgtgz): .manifest fix-perms
94
+ @test -n "$(distdir)"
95
+ $(RM) -r $(distdir)
96
+ mkdir -p $(distdir)
97
+ tar cf - `cat .manifest` | (cd $(distdir) && tar xf -)
98
+ cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
99
+ mv $@+ $@
100
+
101
+ package: $(pkgtgz) $(pkggem)
102
+
103
+ release: verify package $(release_notes) $(release_changes)
104
+ rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
105
+ $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
106
+ gem push $(pkggem)
107
+ -rubyforge add_file \
108
+ $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
109
+ else
110
+ gem install-gem: GIT-VERSION-FILE
111
+ $(MAKE) $@ VERSION=$(GIT_VERSION)
112
+ endif
113
+
114
+ .PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test
data/LATEST ADDED
@@ -0,0 +1,4 @@
1
+ === wrongdoc 1.0.0 - initial release /
2
+
3
+ Welcome to hell
4
+
data/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ wrongdoc is copyrighted Free Software by all contributors, see logs in
2
+ revision control for names and email addresses of all of them.
3
+
4
+ This library is free software; you can redistribute it and/or modify it
5
+ under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation; either version
7
+ {3}[http://www.gnu.org/licenses/gpl-3.0.txt] of the License, or (at
8
+ your option) any later version.
9
+
10
+ wrongdoc is distributed in the hope that it will be useful, but WITHOUT
11
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13
+ License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public License
16
+ along with wrongdoc; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
data/NEWS ADDED
@@ -0,0 +1,4 @@
1
+ === wrongdoc 1.0.0 - initial release / 2010-12-24 01:07 UTC
2
+
3
+ Welcome to hell
4
+
data/README ADDED
@@ -0,0 +1,40 @@
1
+ = wrongdoc - RDoc done right (IMNSHO)
2
+
3
+ wrongdoc mangles an existing RDoc directory and makes any changes we
4
+ feel like. It mainly removes JavaScript from Darkfish and adds links to
5
+ a {cgit}[http://hjemli.net/git/cgit/] instance. It is a bikeshed
6
+ project and *entirely* subject to the whims of its creator, so it is
7
+ likely the wrong solution for anybody else.
8
+
9
+ wrongdoc is tightly integrated with git and cgit, and capable of of
10
+ automatically generating NEWS and ChangeLog files in RDoc format based
11
+ on git history and tags.
12
+
13
+ == Usage
14
+
15
+ First, prepare a .wrongdoc.yml in the top-level directory of your project,
16
+ then run the following command to generate your RDoc:
17
+
18
+ $ wrongdoc
19
+
20
+ == Future Plans
21
+
22
+ * Remove images/icons from Darkfish without breaking text alignment.
23
+
24
+ * Optimize for small screens at the expense of large ones.
25
+
26
+ * gitweb support (preserving cgit support)
27
+
28
+ * ASCII-art unicorns and rainbows! (maybe)
29
+
30
+ == Feedback
31
+
32
+ It's Free Software, fork it and hack it to your heart's content, just
33
+ do not expect the original author(s) to support anything they disagree
34
+ with. Remember, this is a bikeshed project!
35
+
36
+ Help with CSS for removing image/icon cruft and making better use of
37
+ small screen real-estate would be greatly appreciated.
38
+
39
+ The original authors may be contacted through the mailing list:
40
+ {wrongdoc@librelist.org}[mailto:wrongdoc@librelist.org].
data/bin/wrongdoc ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ usage = "Usage: #{File.basename($0)} [prepare]"
3
+ $stderr.sync = $stdout.sync = true
4
+ require 'wrongdoc'
5
+ opts = Wrongdoc.config
6
+ case ARGV[0]
7
+ when "prepare"
8
+ Wrongdoc::Prepare.new(opts).run
9
+ when "release_notes"
10
+ Wrongdoc::Release.notes($stdout, opts)
11
+ when "release_changes"
12
+ Wrongdoc::Release.changes($stdout)
13
+ when "all"
14
+ Wrongdoc::Prepare.new(opts).run
15
+ Wrongdoc::Rdoc.new(opts).run
16
+ Wrongdoc::Merge.new(opts).run
17
+ Wrongdoc::Final.new(opts, ARGV[1]).run
18
+ else
19
+ abort "#{$0.inspect} #{ARGV.inspect} not understood"
20
+ end
data/dotwrongdoc_5 ADDED
File without changes
@@ -0,0 +1,25 @@
1
+ # helper method for generating the ChangeLog in RDoc format atomically
2
+ module Wrongdoc::Changelog
3
+ include Wrongdoc::History
4
+
5
+ def changelog
6
+ fp = Tempfile.new('ChangeLog', '.')
7
+ fp.write "ChangeLog from #@cgit_uri"
8
+ cmd = %w(git log)
9
+ if @changelog_start && tags[0]
10
+ range = "#@changelog_start..#{tags[0][:tag]}"
11
+ fp.write(" (#{range})")
12
+ cmd << range
13
+ end
14
+ fp.write("\n\n")
15
+ prefix = " "
16
+ IO.popen(cmd.join(' ')) do |io|
17
+ io.each { |line|
18
+ fp.write prefix
19
+ fp.write line
20
+ }
21
+ end
22
+ File.rename(fp.path, 'ChangeLog')
23
+ fp.close!
24
+ end
25
+ end
@@ -0,0 +1,105 @@
1
+ require 'find'
2
+ require 'fileutils'
3
+
4
+ class Wrongdoc::Final
5
+ include Wrongdoc::ParseXML
6
+ include Wrongdoc::NewsAtom
7
+
8
+ def run
9
+ Find.find('doc') { |path| /\.html\z/ =~ path and fix(path) }
10
+ FileUtils.rm_rf('doc/js')
11
+ news_atom
12
+ end
13
+
14
+ def initialize(opts, git_tag = nil)
15
+ @cgit_uri = URI.parse(opts[:cgit_url])
16
+ @rdoc_uri = URI.parse(opts[:rdoc_url])
17
+ @git_tag = git_tag
18
+ end
19
+
20
+ # returns a cgit URI for the given +path+ and +lineno+
21
+ def path_uri(path, lineno)
22
+ uri = @cgit_uri.dup
23
+ uri.path += "/tree/#{URI.escape(path)}"
24
+ uri.fragment = "n#{lineno}"
25
+ uri.query = "id=#{URI.escape(@git_tag)}" if @git_tag
26
+ uri
27
+ end
28
+
29
+ # delete all the stuff that offends us
30
+ def killkillkill!(doc)
31
+ unlink = proc { |node| node.unlink }
32
+
33
+ # JavaScript is dangerous
34
+ doc.search("script").each(&unlink)
35
+
36
+ # if your project's big enough to need JS search, it's too bloated
37
+ doc.search('span.search-toggle').each(&unlink)
38
+ doc.search('form').each(&unlink)
39
+
40
+ # remove W3C validator link, we use tidy instead
41
+ doc.search('div#validator-badges p').each { |x|
42
+ /Validate/i =~ x.content and x.unlink
43
+ }
44
+ end
45
+
46
+ # since we killed off JavaScript, viewing source isn't possible with
47
+ # RDoc anymore, so link people to the web source viewer
48
+ def source_linkify!(doc)
49
+ doc.search('div.method-detail').each { |mdetail|
50
+ path = lineno = nil
51
+ mdetail.search('div.method-source-code').each { |src|
52
+ src.search('span.ruby-comment').each { |x|
53
+ if x.content =~ /File\s+(\S+),\s+line\s+(\d+)/s
54
+ path, lineno = $1, $2
55
+ end
56
+ }
57
+ src.unlink if path && lineno
58
+ }
59
+ if path && lineno
60
+ mdetail.search('span.method-click-advice').each { |x|
61
+ x.content = ''
62
+ a = Nokogiri::XML::Node.new('a', doc)
63
+ a['href'] = path_uri(path, lineno).to_s
64
+ a.content = 'view method source'
65
+ x.add_child(a)
66
+ }
67
+ end
68
+ }
69
+ end
70
+
71
+ # Don't give the original Darkfish a bad name, and advertise ourselves :)
72
+ def advertise!(doc)
73
+ doc.search('div#validator-badges p small').each { |x|
74
+ if /\AGenerated/ =~ x.content
75
+ first = x.children.first
76
+ first.content = first.content.gsub /\AG/, "Originally g"
77
+ last = x.children.last
78
+ last.content = "#{last.content}, modified by "
79
+
80
+ a = Nokogiri::XML::Node.new('a', doc)
81
+ a["href"] = "http://bogomips.org/wrongdoc/"
82
+ a.content = "wrongdoc"
83
+ last.add_next_sibling(a)
84
+ end
85
+ }
86
+ end
87
+
88
+ def fix(file)
89
+ File.open(file, "a+") do |fp|
90
+ buf = process(fp.read)
91
+ fp.truncate 0
92
+ fp.write buf
93
+ end
94
+ end
95
+
96
+ # the main entry point, this does all the require processing on any
97
+ # given String buffer.
98
+ def process(str)
99
+ doc = parse_xml(str)
100
+ killkillkill!(doc)
101
+ source_linkify!(doc)
102
+ advertise!(doc)
103
+ doc.to_xhtml(:indent => 0)
104
+ end
105
+ end
@@ -0,0 +1,18 @@
1
+ # helper methods for gemspecs
2
+ module Wrongdoc::Gemspec
3
+ include Wrongdoc::Readme
4
+ include Wrongdoc::RdocOptions
5
+
6
+ def extra_rdoc_files(manifest)
7
+ File.readlines('.document').map! do |x|
8
+ x.chomp!
9
+ if File.directory?(x)
10
+ manifest.grep(%r{\A#{x}/})
11
+ elsif File.file?(x)
12
+ x
13
+ else
14
+ nil
15
+ end
16
+ end.flatten.compact
17
+ end
18
+ end
@@ -0,0 +1,50 @@
1
+ module Wrongdoc::History
2
+ def initialize_history
3
+ @tags = @old_summaries = nil
4
+ end
5
+
6
+ # returns a cgit URI for a given +tag_name+
7
+ def tag_uri(tag_name)
8
+ uri = @cgit_uri.dup
9
+ uri.path = "/tag/"
10
+ uri.query = "id=#{tag_name}"
11
+ uri
12
+ end
13
+
14
+ # TODO: investigate Ruby git libraries
15
+ def tags
16
+ timefmt = '%Y-%m-%dT%H:%M:%SZ'
17
+ @tags ||= `git tag -l`.split(/\n/).map do |tag|
18
+ next if tag == "v0.0.0"
19
+ if %r{\Av[\d\.]+} =~ tag
20
+ header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
21
+ header = header.split(/\n/)
22
+ tagger = header.grep(/\Atagger /).first
23
+ body ||= "initial"
24
+ time = Time.at(tagger.split(/ /)[-2].to_i).utc
25
+ {
26
+ :time => time.strftime(timefmt),
27
+ :ruby_time => time,
28
+ :tagger_name => %r{^tagger ([^<]+)}.match(tagger)[1].strip,
29
+ :tagger_email => %r{<([^>]+)>}.match(tagger)[1].strip,
30
+ :id => `git rev-parse refs/tags/#{tag}`.chomp!,
31
+ :tag => tag,
32
+ :subject => subject,
33
+ :body => (old = old_summaries[tag]) ? "#{old}\n#{body}" : body,
34
+ }
35
+ end
36
+ end.compact.sort { |a,b| b[:time] <=> a[:time] }
37
+ end
38
+
39
+ def old_summaries
40
+ @old_summaries ||= if File.exist?(".CHANGELOG.old")
41
+ File.readlines(".CHANGELOG.old").inject({}) do |hash, line|
42
+ version, summary = line.split(/ - /, 2)
43
+ hash[version] = summary
44
+ hash
45
+ end
46
+ else
47
+ {}
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,20 @@
1
+ class Wrongdoc::Merge
2
+ include Wrongdoc::ParseXML
3
+
4
+ def initialize(opts)
5
+ @merge_html = opts[:merge_html]
6
+ end
7
+
8
+ def run
9
+ @merge_html.each do |file, source|
10
+ rdoc_html = "doc/#{file}.html"
11
+ src = Nokogiri::XML(File.read(source))
12
+ File.open(rdoc_html, "a+") { |fp|
13
+ doc = parse_xml(fp.read)
14
+ doc.search("div#documentation")[0].add_child(src.root)
15
+ fp.truncate 0
16
+ fp.write doc.to_xhtml
17
+ }
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,46 @@
1
+ module Wrongdoc::NewsAtom
2
+ include Wrongdoc::History
3
+ include Wrongdoc::Readme
4
+
5
+ # generates an Atom feed based on git tags in the document directory
6
+ def news_atom
7
+ project_name, short_desc, _ = x = readme_metadata
8
+ new_tags = tags[0,10]
9
+ atom_uri = @rdoc_uri.dup
10
+ atom_uri.path += "NEWS.atom.xml"
11
+ news_uri = @rdoc_uri.dup
12
+ news_uri.path += "NEWS.html"
13
+ doc = Nokogiri::XML::Builder.new {
14
+ feed :xmlns => "http://www.w3.org/2005/Atom" do
15
+ id! atom_uri.to_s
16
+ title "#{project_name} news"
17
+ subtitle short_desc
18
+ link! :rel => 'alternate', :type => 'text/html', :href => news_uri.to_s
19
+ updated new_tags.empty? ? '1970-01-01:00:00:00Z' : new_tags[0][:time]
20
+ new_tags.each do |tag|
21
+ entry {
22
+ title tag[:subject]
23
+ updated tag[:time]
24
+ published tag[:time]
25
+ author {
26
+ name tag[:tagger_name]
27
+ email tag[:tagger_email]
28
+ }
29
+ uri = tag_uri(tag[:tag]).to_s
30
+ link! :rel => "alternate", :type => "text/html", :href => uri
31
+ id! uri
32
+ message_only = tag[:body].split(/\n.+\(\d+\):\n {6}/s)[0].strip
33
+ content({:type =>:text}, message_only)
34
+ content(:type =>:xhtml) { pre tag[:body] }
35
+ }
36
+ end
37
+ end
38
+ }
39
+ fpath = "doc/NEWS.atom.xml"
40
+ File.open(fpath, "w") { |fp| fp.write doc.to_xml(:indent => 0) }
41
+ unless new_tags.empty?
42
+ time = new_tags[0][:ruby_time]
43
+ File.utime(time, time, fpath)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Wrongdoc::NewsRdoc
3
+ include Wrongdoc::History
4
+
5
+ def puts_tag(fp, tag)
6
+ time = tag[:time].tr!('T', ' ').gsub!(/:\d\dZ/, ' UTC')
7
+ fp.puts "=== #{tag[:subject]} / #{time}"
8
+ fp.puts ""
9
+
10
+ body = tag[:body]
11
+ fp.puts tag[:body].gsub(/^/smu, " ").gsub(/[ \t]+$/smu, "")
12
+ fp.puts ""
13
+ end
14
+
15
+ # generates a NEWS file in the top-level directory based on git tags
16
+ def news_rdoc
17
+ news = Tempfile.new('NEWS', '.')
18
+ tags.each { |tag| puts_tag(news, tag) }
19
+ File.open("LATEST", "wb") { |latest|
20
+ if tags.empty?
21
+ latest.puts "Currently unreleased"
22
+ news.puts "No news yet."
23
+ else
24
+ puts_tag(latest, tags[0])
25
+ end
26
+ }
27
+ File.rename(news.path, 'NEWS')
28
+ news.close!
29
+ end
30
+ end
@@ -0,0 +1,11 @@
1
+ module Wrongdoc::ParseXML
2
+ def parse_xml(str)
3
+ opts = {
4
+ :input_encoding => 'utf8',
5
+ :output_encoding => 'utf8',
6
+ :wrap => 0,
7
+ :tidy_mark => false,
8
+ }
9
+ Nokogiri::XML(TidyFFI::Tidy.new(str, opts).clean)
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ class Wrongdoc::Prepare
2
+ include Wrongdoc::NewsRdoc
3
+ include Wrongdoc::Changelog
4
+ include Wrongdoc::Readme
5
+
6
+ def initialize(opts)
7
+ @rdoc_uri = URI.parse(opts[:rdoc_url])
8
+ @cgit_uri = URI.parse(opts[:cgit_url])
9
+ @changelog_start = opts[:changelog_start]
10
+ @name, @short_desc = readme_metadata
11
+ end
12
+
13
+ def run
14
+ news_rdoc
15
+ changelog
16
+ end
17
+ end