docter 1.0.0 → 1.0.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.
- data/CHANGELOG +5 -0
- data/Rakefile +117 -0
- data/lib/docter/template.rb +20 -4
- data/lib/docter/ultraviolet.rb +2 -0
- data/lib/docter.rb +1 -2
- metadata +3 -2
data/CHANGELOG
CHANGED
@@ -1,2 +1,7 @@
|
|
1
|
+
1.0.1 (6/6/2007)
|
2
|
+
* Added: renumber_footnotes to template for handling footnote numbering when creating a single page.
|
3
|
+
* Changed: Ultraviolet no longer used as default syntax highlighting, must require separately.
|
4
|
+
* Changed: footnote_links is now list_links and the new method eliminates duplicates (based on URL), sorts alphabetically (the text component) and capitalizes the text description.
|
5
|
+
|
1
6
|
1.0.0 (6/3/2007)
|
2
7
|
* First release of working code.
|
data/Rakefile
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
Gem::manage_gems
|
3
|
+
require "rake/gempackagetask"
|
4
|
+
require "spec/rake/spectask"
|
5
|
+
require "rake/rdoctask"
|
6
|
+
require "lib/docter"
|
7
|
+
|
8
|
+
|
9
|
+
# Gem specification comes first, other tasks rely on it.
|
10
|
+
spec = Gem::Specification.new do |spec|
|
11
|
+
spec.name = "docter"
|
12
|
+
spec.version = File.read(__FILE__.pathmap("%d/lib/docter.rb")).scan(/VERSION\s*=\s*(['"])(.*)\1/)[0][1]
|
13
|
+
spec.author = "Assaf Arkin"
|
14
|
+
spec.email = "arkin@intalio.com"
|
15
|
+
spec.homepage = "http://#{spec.name}.rubyforge.org"
|
16
|
+
spec.summary = "We has docs"
|
17
|
+
spec.files = FileList["lib/**/*", "CHANGELOG", "README", "LICENSE", "Rakefile", "html/**/*"].collect
|
18
|
+
spec.require_path = "lib"
|
19
|
+
spec.autorequire = "docter.rb"
|
20
|
+
spec.has_rdoc = true
|
21
|
+
spec.extra_rdoc_files = ["README", "CHANGELOG", "LICENSE"]
|
22
|
+
spec.rdoc_options << "--title" << "Docter -- #{spec.summary}" <<
|
23
|
+
"--main" << "README" << "--line-numbers" << "-inline-source"
|
24
|
+
spec.rubyforge_project = "buildr"
|
25
|
+
|
26
|
+
# Tested against these dependencies.
|
27
|
+
spec.add_dependency "facets", "~> 1.8"
|
28
|
+
spec.add_dependency "RedCloth", "~> 3.0"
|
29
|
+
spec.add_dependency "haml", "~> 1.5"
|
30
|
+
spec.add_dependency "mongrel", "~> 1.0"
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
# Testing is everything.
|
35
|
+
desc "Run test cases"
|
36
|
+
Spec::Rake::SpecTask.new(:test) do |task|
|
37
|
+
task.spec_files = FileList["test/**/*.rb"]
|
38
|
+
task.spec_opts = [ "--format", "specdoc", "--color", "--diff" ]
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "Run test cases with rcov"
|
42
|
+
Spec::Rake::SpecTask.new(:rcov) do |task|
|
43
|
+
task.spec_files = FileList["test/**/*.rb"]
|
44
|
+
task.spec_opts = [ "--format", "specdoc", "--color", "--diff" ]
|
45
|
+
task.rcov = true
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
# Packaging and local installation.
|
50
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
51
|
+
pkg.need_tar = true
|
52
|
+
pkg.need_zip = true
|
53
|
+
end
|
54
|
+
|
55
|
+
desc "Install the package locally"
|
56
|
+
task :install=>:package do |task|
|
57
|
+
system "gem", "install", "pkg/#{spec.name}-#{spec.version}.gem"
|
58
|
+
end
|
59
|
+
|
60
|
+
desc "Uninstall previously installed packaged"
|
61
|
+
task :uninstall do |task|
|
62
|
+
system "gem", "uninstall", spec.name, "-v", spec.version.to_s
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
desc "Generate RDoc documentation"
|
67
|
+
rdoc = Rake::RDocTask.new(:rdoc) do |rdoc|
|
68
|
+
rdoc.rdoc_dir = "rdoc"
|
69
|
+
rdoc.title = spec.name
|
70
|
+
rdoc.options = spec.rdoc_options
|
71
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
72
|
+
rdoc.rdoc_files.include spec.extra_rdoc_files
|
73
|
+
end
|
74
|
+
|
75
|
+
task("clobber") { rm_rf [rdoc.rdoc_dir].map(&:to_s) }
|
76
|
+
|
77
|
+
|
78
|
+
# Commit to SVN, upload and do the release cycle.
|
79
|
+
namespace :svn do
|
80
|
+
task :clean? do |task|
|
81
|
+
status = `svn status`.reject { |line| line =~ /\s(pkg|html)$/ }
|
82
|
+
fail "Cannot release unless all local changes are in SVN:\n#{status}" unless status.empty?
|
83
|
+
end
|
84
|
+
|
85
|
+
task :tag do |task|
|
86
|
+
cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
|
87
|
+
new_url = cur_url.sub(/trunk$/, "tags/#{spec.version.to_s}")
|
88
|
+
system "svn", "remove", new_url, "-m", "Removing old copy" rescue nil
|
89
|
+
system "svn", "copy", cur_url, new_url, "-m", "Release #{spec.version.to_s}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
namespace :upload do
|
94
|
+
task :packages=>["rake:package"] do |task|
|
95
|
+
# Read the changes for this release.
|
96
|
+
pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d+\/\d+\/\d+\)\s*((:?^[^\n]+\n)*))/
|
97
|
+
changelog = File.read(__FILE__.pathmap("%d/CHANGELOG"))
|
98
|
+
changes = changelog.scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
|
99
|
+
current = changes[spec.version.to_s]
|
100
|
+
if !current && spec.version.to_s =~ /\.0$/
|
101
|
+
current = changes[spec.version.to_s.split(".")[0..-2].join(".")]
|
102
|
+
end
|
103
|
+
fail "No changeset found for version #{spec.version}" unless current
|
104
|
+
|
105
|
+
puts "Uploading #{spec.name} #{spec.version}"
|
106
|
+
files = ["gem", "tgz", "zip"].map { |ext| "pkg/#{spec.name}-#{spec.version}.#{ext}" }
|
107
|
+
system "rubyforge", "login"
|
108
|
+
files.each do |file|
|
109
|
+
system "rubyforge", "add_release", spec.rubyforge_project.downcase, spec.name.downcase,
|
110
|
+
spec.version.to_s, file, "-a", current
|
111
|
+
end
|
112
|
+
puts "Release #{spec.version} uploaded"
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "Upload release to RubyForge including docs, tag SVN"
|
117
|
+
task :release=>[ "clobber", "svn:clean?", "test", "upload:packages" ]
|
data/lib/docter/template.rb
CHANGED
@@ -20,7 +20,7 @@ module Docter
|
|
20
20
|
if url =~ /^\w+:/
|
21
21
|
unless index = @links.index(url)
|
22
22
|
index = @links.size
|
23
|
-
@links << [inner_text_from(link)
|
23
|
+
@links << [url, inner_text_from(link)]
|
24
24
|
end
|
25
25
|
mark ? "#{link}<sup>[#{index + 1}]</sup>" : link
|
26
26
|
else
|
@@ -29,9 +29,25 @@ module Docter
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
32
|
+
def list_links(cls = nil)
|
33
|
+
# Remove duplicate links (same URL), sort by text and convert into DT/DD pairs.
|
34
|
+
links = @links.inject({}) { |hash, link| hash[link.first] ||= link.last ; hash }.
|
35
|
+
sort { |a,b| a.last <=> b.last }.
|
36
|
+
map { |url, text| %{<dt>#{text.capitalize}</dt><dd><a href="#{url}">#{url}</a></dd>} }
|
37
|
+
%{<dl class="#{cls}">#{links.join}</dl>}
|
38
|
+
end
|
39
|
+
|
40
|
+
def renumber_footnotes(html)
|
41
|
+
@footnote ||= 0
|
42
|
+
html.gsub(/<a href="#fn(\d+)">\1<\/a>/) {
|
43
|
+
# Renumber footnote references starting from the last footnote number.
|
44
|
+
fn = $1.to_i + @footnote
|
45
|
+
%{<a href="#fn#{fn}">#{fn}</a>}
|
46
|
+
}.gsub(/<p id="fn(\d+)"(.*?)><sup>\1<\/sup>(.*?)<\/p>/m) {
|
47
|
+
# Renumber footnotes the same way, and update the last footnote number.
|
48
|
+
@footnote += 1
|
49
|
+
%{<p id="fn#{@footnote}"#{$2}><sup>#{@footnote}</sup>#{$3}</p>}
|
50
|
+
}
|
35
51
|
end
|
36
52
|
|
37
53
|
end
|
data/lib/docter/ultraviolet.rb
CHANGED
data/lib/docter.rb
CHANGED
@@ -9,7 +9,7 @@ require "facets/core/kernel/tap"
|
|
9
9
|
require "facet/kernel/__DIR__"
|
10
10
|
|
11
11
|
module Docter
|
12
|
-
VERSION = "1.0.
|
12
|
+
VERSION = "1.0.1".freeze
|
13
13
|
end
|
14
14
|
|
15
15
|
$LOAD_PATH.unshift __DIR__
|
@@ -30,4 +30,3 @@ require "docter/template.rb"
|
|
30
30
|
require "docter/collection.rb"
|
31
31
|
require "docter/server.rb" if defined?(Mongrel)
|
32
32
|
require "docter/rake.rb" if defined?(Rake)
|
33
|
-
require "docter/ultraviolet.rb" if defined?(Uv)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: docter
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-07-
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2007-07-06 00:00:00 -07:00
|
8
8
|
summary: We has docs
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -41,6 +41,7 @@ files:
|
|
41
41
|
- CHANGELOG
|
42
42
|
- README
|
43
43
|
- LICENSE
|
44
|
+
- Rakefile
|
44
45
|
test_files: []
|
45
46
|
|
46
47
|
rdoc_options:
|