bluecloth 2.0.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.
Files changed (103) hide show
  1. data/ChangeLog +629 -0
  2. data/LICENSE +27 -0
  3. data/LICENSE.discount +47 -0
  4. data/README +71 -0
  5. data/Rakefile +319 -0
  6. data/Rakefile.local +63 -0
  7. data/bin/bluecloth +84 -0
  8. data/ext/VERSION +1 -0
  9. data/ext/amalloc.h +29 -0
  10. data/ext/bluecloth.c +373 -0
  11. data/ext/config.h +47 -0
  12. data/ext/cstring.h +73 -0
  13. data/ext/docheader.c +43 -0
  14. data/ext/extconf.rb +45 -0
  15. data/ext/generate.c +1387 -0
  16. data/ext/markdown.c +939 -0
  17. data/ext/markdown.h +135 -0
  18. data/ext/mkdio.c +241 -0
  19. data/ext/mkdio.h +66 -0
  20. data/ext/resource.c +169 -0
  21. data/ext/version.c +28 -0
  22. data/lib/bluecloth.rb +148 -0
  23. data/rake/191_compat.rb +26 -0
  24. data/rake/dependencies.rb +76 -0
  25. data/rake/helpers.rb +412 -0
  26. data/rake/manual.rb +782 -0
  27. data/rake/packaging.rb +116 -0
  28. data/rake/publishing.rb +321 -0
  29. data/rake/rdoc.rb +40 -0
  30. data/rake/style.rb +62 -0
  31. data/rake/svn.rb +639 -0
  32. data/rake/testing.rb +204 -0
  33. data/rake/verifytask.rb +64 -0
  34. data/rake/win32.rb +186 -0
  35. data/spec/bluecloth/101_changes_spec.rb +141 -0
  36. data/spec/bluecloth/autolinks_spec.rb +49 -0
  37. data/spec/bluecloth/blockquotes_spec.rb +143 -0
  38. data/spec/bluecloth/code_spans_spec.rb +164 -0
  39. data/spec/bluecloth/emphasis_spec.rb +164 -0
  40. data/spec/bluecloth/entities_spec.rb +65 -0
  41. data/spec/bluecloth/hrules_spec.rb +90 -0
  42. data/spec/bluecloth/images_spec.rb +92 -0
  43. data/spec/bluecloth/inline_html_spec.rb +238 -0
  44. data/spec/bluecloth/links_spec.rb +171 -0
  45. data/spec/bluecloth/lists_spec.rb +294 -0
  46. data/spec/bluecloth/paragraphs_spec.rb +75 -0
  47. data/spec/bluecloth/titles_spec.rb +305 -0
  48. data/spec/bluecloth_spec.rb +209 -0
  49. data/spec/bugfix_spec.rb +123 -0
  50. data/spec/contributions_spec.rb +85 -0
  51. data/spec/data/antsugar.txt +34 -0
  52. data/spec/data/markdowntest/Amps and angle encoding.html +17 -0
  53. data/spec/data/markdowntest/Amps and angle encoding.text +21 -0
  54. data/spec/data/markdowntest/Auto links.html +18 -0
  55. data/spec/data/markdowntest/Auto links.text +13 -0
  56. data/spec/data/markdowntest/Backslash escapes.html +118 -0
  57. data/spec/data/markdowntest/Backslash escapes.text +120 -0
  58. data/spec/data/markdowntest/Blockquotes with code blocks.html +15 -0
  59. data/spec/data/markdowntest/Blockquotes with code blocks.text +11 -0
  60. data/spec/data/markdowntest/Code Blocks.html +18 -0
  61. data/spec/data/markdowntest/Code Blocks.text +14 -0
  62. data/spec/data/markdowntest/Code Spans.html +5 -0
  63. data/spec/data/markdowntest/Code Spans.text +5 -0
  64. data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.html +8 -0
  65. data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.text +8 -0
  66. data/spec/data/markdowntest/Horizontal rules.html +71 -0
  67. data/spec/data/markdowntest/Horizontal rules.text +67 -0
  68. data/spec/data/markdowntest/Inline HTML (Advanced).html +15 -0
  69. data/spec/data/markdowntest/Inline HTML (Advanced).text +15 -0
  70. data/spec/data/markdowntest/Inline HTML (Simple).html +72 -0
  71. data/spec/data/markdowntest/Inline HTML (Simple).text +69 -0
  72. data/spec/data/markdowntest/Inline HTML comments.html +13 -0
  73. data/spec/data/markdowntest/Inline HTML comments.text +13 -0
  74. data/spec/data/markdowntest/Links, inline style.html +11 -0
  75. data/spec/data/markdowntest/Links, inline style.text +12 -0
  76. data/spec/data/markdowntest/Links, reference style.html +52 -0
  77. data/spec/data/markdowntest/Links, reference style.text +71 -0
  78. data/spec/data/markdowntest/Links, shortcut references.html +9 -0
  79. data/spec/data/markdowntest/Links, shortcut references.text +20 -0
  80. data/spec/data/markdowntest/Literal quotes in titles.html +3 -0
  81. data/spec/data/markdowntest/Literal quotes in titles.text +7 -0
  82. data/spec/data/markdowntest/Markdown Documentation - Basics.html +314 -0
  83. data/spec/data/markdowntest/Markdown Documentation - Basics.text +306 -0
  84. data/spec/data/markdowntest/Markdown Documentation - Syntax.html +942 -0
  85. data/spec/data/markdowntest/Markdown Documentation - Syntax.text +888 -0
  86. data/spec/data/markdowntest/Nested blockquotes.html +9 -0
  87. data/spec/data/markdowntest/Nested blockquotes.text +5 -0
  88. data/spec/data/markdowntest/Ordered and unordered lists.html +148 -0
  89. data/spec/data/markdowntest/Ordered and unordered lists.text +131 -0
  90. data/spec/data/markdowntest/Strong and em together.html +7 -0
  91. data/spec/data/markdowntest/Strong and em together.text +7 -0
  92. data/spec/data/markdowntest/Tabs.html +25 -0
  93. data/spec/data/markdowntest/Tabs.text +21 -0
  94. data/spec/data/markdowntest/Tidyness.html +8 -0
  95. data/spec/data/markdowntest/Tidyness.text +5 -0
  96. data/spec/data/ml-announce.txt +17 -0
  97. data/spec/data/re-overflow.txt +67 -0
  98. data/spec/data/re-overflow2.txt +281 -0
  99. data/spec/lib/constants.rb +5 -0
  100. data/spec/lib/helpers.rb +137 -0
  101. data/spec/lib/matchers.rb +235 -0
  102. data/spec/markdowntest_spec.rb +76 -0
  103. metadata +305 -0
@@ -0,0 +1,116 @@
1
+ #
2
+ # Packaging Rake Tasks
3
+ # $Id: packaging.rb 92 2009-03-13 23:40:08Z deveiant $
4
+ #
5
+
6
+ require 'rbconfig'
7
+ require 'rake/packagetask'
8
+ require 'rake/gempackagetask'
9
+
10
+ include Config
11
+
12
+ ### Task: gem
13
+ ### Task: package
14
+ Rake::PackageTask.new( PKG_NAME, PKG_VERSION ) do |task|
15
+ task.need_tar_gz = true
16
+ task.need_tar_bz2 = true
17
+ task.need_zip = true
18
+ task.package_dir = PKGDIR.to_s
19
+ task.package_files = RELEASE_FILES.
20
+ collect {|f| f.relative_path_from(BASEDIR).to_s }
21
+ end
22
+ task :package => [:gem]
23
+
24
+
25
+ ### Task: gem
26
+ gempath = PKGDIR + GEM_FILE_NAME
27
+
28
+ desc "Build a RubyGem package (#{GEM_FILE_NAME})"
29
+ task :gem => gempath.to_s
30
+ file gempath.to_s => [PKGDIR.to_s] + GEMSPEC.files do
31
+ when_writing( "Creating GEM" ) do
32
+ Gem::Builder.new( GEMSPEC ).build
33
+ verbose( true ) do
34
+ mv GEM_FILE_NAME, gempath
35
+ end
36
+ end
37
+ end
38
+
39
+ ### Task: install
40
+ desc "Install #{PKG_NAME} as a conventional library"
41
+ task :install => "spec:quiet" do
42
+ log "Installing #{PKG_NAME} as a conventional library"
43
+ sitelib = Pathname.new( CONFIG['sitelibdir'] )
44
+ sitearch = Pathname.new( CONFIG['sitearchdir'] )
45
+ Dir.chdir( LIBDIR ) do
46
+ LIB_FILES.each do |libfile|
47
+ relpath = libfile.relative_path_from( LIBDIR )
48
+ target = sitelib + relpath
49
+ FileUtils.mkpath target.dirname,
50
+ :mode => 0755, :verbose => true, :noop => $dryrun unless target.dirname.directory?
51
+ FileUtils.install relpath, target,
52
+ :mode => 0644, :verbose => true, :noop => $dryrun
53
+ end
54
+ end
55
+ if EXTDIR.exist?
56
+ trace " looking for a binary extension (%s)" % [ EXTDIR + "*.#{Config::CONFIG['DLEXT']}" ]
57
+ Dir.chdir( EXTDIR ) do
58
+ Pathname.glob( "*.#{Config::CONFIG['DLEXT']}" ) do |dl|
59
+ trace " found: #{dl}"
60
+ target = sitearch + dl.basename
61
+ FileUtils.install dl, target,
62
+ :mode => 0755, :verbose => true, :noop => $dryrun
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+
69
+
70
+ ### Task: install_gem
71
+ desc "Install #{PKG_NAME} from a locally-built gem"
72
+ task :install_gem => [:package] do
73
+ $stderr.puts
74
+ installer = Gem::Installer.new( %{pkg/#{PKG_FILE_NAME}.gem} )
75
+ installer.install
76
+ end
77
+
78
+
79
+ ### Task: uninstall
80
+ desc "Uninstall #{PKG_NAME} if it's been installed as a conventional library"
81
+ task :uninstall do
82
+ log "Uninstalling conventionally-installed #{PKG_NAME} library files"
83
+ sitelib = Pathname.new( CONFIG['sitelibdir'] )
84
+ sitearch = Pathname.new( CONFIG['sitearchdir'] )
85
+
86
+ Dir.chdir( LIBDIR ) do
87
+ LIB_FILES.each do |libfile|
88
+ relpath = libfile.relative_path_from( LIBDIR )
89
+ target = sitelib + relpath
90
+ FileUtils.rm_f target, :verbose => true, :noop => $dryrun
91
+ FileUtils.rm_rf( target.dirname, :verbose => true, :noop => $dryrun ) if
92
+ target.dirname.entries.empty?
93
+ end
94
+ end
95
+ if EXTDIR.exist?
96
+ trace " looking for a binary extension (%s)" % [ EXTDIR + "*.#{Config::CONFIG['DLEXT']}" ]
97
+ Dir.chdir( EXTDIR ) do
98
+ Pathname.glob( "*.#{Config::CONFIG['DLEXT']}" ) do |dl|
99
+ trace " found: #{dl}"
100
+ target = sitearch + dl.basename
101
+ FileUtils.rm target, :verbose => true, :noop => $dryrun
102
+ end
103
+ end
104
+ end
105
+ end
106
+
107
+
108
+ ### Task: uninstall_gem
109
+ desc "Install the #{PKG_NAME} gem"
110
+ task :uninstall_gem => [:clean] do
111
+ uninstaller = Gem::Uninstaller.new( PKG_FILE_NAME )
112
+ uninstaller.uninstall
113
+ end
114
+
115
+
116
+
@@ -0,0 +1,321 @@
1
+ #####################################################################
2
+ ### P U B L I C A T I O N T A S K S
3
+ #####################################################################
4
+
5
+ RELEASE_NOTES_FILE = 'release.notes'
6
+ RELEASE_ANNOUNCE_FILE = 'release.ann'
7
+
8
+ require 'net/smtp'
9
+ require 'net/protocol'
10
+ require 'openssl'
11
+
12
+ $publish_privately = false
13
+
14
+ ### Add SSL to Net::SMTP
15
+ class Net::SMTP
16
+ def ssl_start( helo='localhost.localdomain', user=nil, secret=nil, authtype=nil )
17
+ if block_given?
18
+ begin
19
+ do_ssl_start( helo, user, secret, authtype )
20
+ return yield( self )
21
+ ensure
22
+ do_finish
23
+ end
24
+ else
25
+ do_ssl_start( helo, user, secret, authtype )
26
+ return self
27
+ end
28
+ end
29
+
30
+
31
+ #######
32
+ private
33
+ #######
34
+
35
+ def do_ssl_start( helodomain, user, secret, authtype )
36
+ raise IOError, 'SMTP session already started' if @started
37
+ check_auth_args user, secret, authtype if user or secret
38
+
39
+ # Open the connection
40
+ @debug_output << "opening connection to #{@address}...\n" if @debug_output
41
+ sock = timeout( @open_timeout ) { TCPsocket.new(@address, @port) }
42
+
43
+ # Wrap it in the SSL layer
44
+ ssl_context = OpenSSL::SSL::SSLContext.new
45
+ ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE
46
+ ssl_sock = OpenSSL::SSL::SSLSocket.new( sock, ssl_context )
47
+ ssl_sock.sync_close = true
48
+ ssl_sock.connect
49
+
50
+ # Wrap it in the message-oriented IO layer
51
+ sslmsgio = Net::InternetMessageIO.new( ssl_sock )
52
+ sslmsgio.read_timeout = @read_timeout
53
+ sslmsgio.debug_output = @debug_output
54
+
55
+ @socket = sslmsgio
56
+
57
+ check_response(critical { recv_response() })
58
+ begin
59
+ if @esmtp
60
+ ehlo helodomain
61
+ else
62
+ helo helodomain
63
+ end
64
+ rescue ProtocolError
65
+ if @esmtp
66
+ @esmtp = false
67
+ @error_occured = false
68
+ retry
69
+ end
70
+ raise
71
+ end
72
+ authenticate user, secret, authtype if user
73
+ @started = true
74
+ ensure
75
+ @socket.close if not @started and @socket and not @socket.closed?
76
+ end
77
+ end
78
+
79
+
80
+ begin
81
+ gem 'text-format'
82
+
83
+ require 'time'
84
+ require 'rake/tasklib'
85
+ require 'tmail'
86
+ require 'net/smtp'
87
+ require 'etc'
88
+ require 'rubyforge'
89
+ require 'socket'
90
+ require 'text/format'
91
+
92
+ ### Generate a valid RFC822 message-id
93
+ def gen_message_id
94
+ return "<%s.%s@%s>" % [
95
+ (Time.now.to_f * 10000).to_i.to_s( 36 ),
96
+ (rand( 2 ** 64 - 1 )).to_s( 36 ),
97
+ Socket.gethostname
98
+ ]
99
+ end
100
+
101
+
102
+ namespace :release do
103
+ task :default => [ 'svn:release', :upload, :publish, :announce ]
104
+
105
+ desc "Re-publish the release with the current version number"
106
+ task :rerelease => [ :upload, :publish, :announce ]
107
+
108
+ desc "Re-run the publication tasks, but send notifications to debugging address"
109
+ task :test do
110
+ trace "Will publish privately"
111
+ $publish_privately = true
112
+ Rake::Task['release:rerelease'].invoke
113
+ end
114
+
115
+
116
+ desc "Generate the release notes"
117
+ task :notes => [RELEASE_NOTES_FILE]
118
+ file RELEASE_NOTES_FILE do |task|
119
+ last_rel_tag = get_latest_release_tag() or
120
+ fail ">>> No releases tagged! Try running 'rake svn:release' first"
121
+ trace "Last release tag is: %p" % [ last_rel_tag ]
122
+ start = get_last_changed_rev( last_rel_tag ) || 1
123
+ trace "Starting rev is: %p" % [ start ]
124
+ log_output = make_svn_log( '.', start, 'HEAD' )
125
+
126
+ File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
127
+ fh.print( log_output )
128
+ end
129
+
130
+ edit task.name
131
+ end
132
+ CLOBBER.include( RELEASE_NOTES_FILE )
133
+
134
+
135
+ desc "Upload project documentation and packages to #{PROJECT_HOST}"
136
+ task :upload => [ :upload_docs, :upload_packages ]
137
+ task :project => :upload # the old name
138
+
139
+ desc "Publish the project docs to #{PROJECT_HOST}"
140
+ task :upload_docs => [ :rdoc ] do
141
+ when_writing( "Publishing docs to #{PROJECT_SCPDOCURL}" ) do
142
+ log "Uploading API documentation to %s:%s" % [ PROJECT_HOST, PROJECT_DOCDIR ]
143
+ run 'ssh', PROJECT_HOST, "rm -rf #{PROJECT_DOCDIR}"
144
+ run 'scp', '-qCr', RDOCDIR, PROJECT_SCPDOCURL
145
+ end
146
+ end
147
+
148
+ desc "Publish the project packages to #{PROJECT_HOST}"
149
+ task :upload_packages => [ :package ] do
150
+ when_writing( "Uploading packages") do
151
+ pkgs = Pathname.glob( PKGDIR + "#{PKG_FILE_NAME}.{gem,tar.gz,tar.bz2,zip}" )
152
+ log "Uploading %d packages to #{PROJECT_SCPPUBURL}" % [ pkgs.length ]
153
+ pkgs.each do |pkgfile|
154
+ run 'scp', '-qC', pkgfile, PROJECT_SCPPUBURL
155
+ end
156
+ end
157
+ end
158
+
159
+
160
+ file RELEASE_ANNOUNCE_FILE => [RELEASE_NOTES_FILE] do |task|
161
+ relnotes = File.read( RELEASE_NOTES_FILE )
162
+ announce_body = %{
163
+
164
+ Version #{PKG_VERSION} of #{PKG_NAME} has been released.
165
+
166
+ #{Text::Format.new(:first_indent => 0).format_one_paragraph(GEMSPEC.description)}
167
+
168
+ == Project Page
169
+
170
+ #{GEMSPEC.homepage}
171
+
172
+ == Installation
173
+
174
+ Via gems:
175
+
176
+ $ sudo gem install #{GEMSPEC.name}
177
+
178
+ or from source:
179
+
180
+ $ wget http://deveiate.org/code/#{PKG_FILE_NAME}.tar.gz
181
+ $ tar -xzvf #{PKG_FILE_NAME}.tar.gz
182
+ $ cd #{PKG_FILE_NAME}
183
+ $ sudo rake install
184
+
185
+ == Changes
186
+ #{relnotes}
187
+ }.gsub( /^\t+/, '' )
188
+
189
+ File.open( task.name, File::WRONLY|File::TRUNC|File::CREAT ) do |fh|
190
+ fh.print( announce_body )
191
+ end
192
+
193
+ edit task.name
194
+ end
195
+ CLOBBER.include( RELEASE_ANNOUNCE_FILE )
196
+
197
+
198
+ desc 'Send out a release announcement'
199
+ task :announce => [RELEASE_ANNOUNCE_FILE] do
200
+ email = TMail::Mail.new
201
+ if $publish_privately
202
+ trace "Sending private announce mail"
203
+ email.to = 'rubymage@gmail.com'
204
+ else
205
+ trace "Sending public announce mail"
206
+ email.to = 'Ruby-Talk List <ruby-talk@ruby-lang.org>'
207
+ email.bcc = 'rubymage@gmail.com'
208
+ end
209
+ email.from = GEMSPEC.email
210
+ email.subject = "[ANN] #{PKG_NAME} #{PKG_VERSION}"
211
+ email.body = File.read( RELEASE_ANNOUNCE_FILE )
212
+ email.date = Time.new
213
+
214
+ email.message_id = gen_message_id()
215
+
216
+ log "About to send the following email:"
217
+ puts '---',
218
+ email.to_s,
219
+ '---'
220
+
221
+ ask_for_confirmation( "Will send via #{SMTP_HOST}." ) do
222
+ pwent = Etc.getpwuid( Process.euid )
223
+ curuser = pwent ? pwent.name : 'unknown'
224
+ username = prompt_with_default( "SMTP user", curuser )
225
+ password = prompt_for_password()
226
+
227
+ trace "Creating SMTP connection to #{SMTP_HOST}:#{SMTP_PORT}"
228
+ smtp = Net::SMTP.new( SMTP_HOST, SMTP_PORT )
229
+ smtp.set_debug_output( $stdout )
230
+ smtp.esmtp = true
231
+
232
+ trace "connecting..."
233
+ smtp.ssl_start( Socket.gethostname, username, password, :plain ) do |smtp|
234
+ trace "sending message..."
235
+ smtp.send_message( email.to_s, email.from, email.to )
236
+ end
237
+ trace "done."
238
+ end
239
+ end
240
+
241
+
242
+ desc 'Publish the new release to RubyForge'
243
+ task :publish => [:clean, :package, :notes] do |task|
244
+ project = GEMSPEC.rubyforge_project
245
+
246
+ if $publish_privately
247
+ log "Skipping push of release files to RubyForge"
248
+ else
249
+ rf = RubyForge.new
250
+ log "Loading RubyForge config"
251
+ rf.configure
252
+
253
+ group_id = rf.autoconfig['group_ids'][RUBYFORGE_GROUP] or
254
+ fail "Your configuration doesn't have a group id for '#{RUBYFORGE_GROUP}'"
255
+
256
+ # If this project doesn't yet exist, create it
257
+ unless rf.autoconfig['package_ids'].key?( project )
258
+ ask_for_confirmation( "Package '#{project}' doesn't exist on RubyForge. Create it?" ) do
259
+ log "Creating new package '#{project}'"
260
+ rf.create_package( group_id, project )
261
+ end
262
+ end
263
+
264
+ package_id = rf.autoconfig['package_ids'][ project ]
265
+
266
+ # Make sure this release doesn't already exist
267
+ releases = rf.autoconfig['release_ids']
268
+ if releases.key?( GEMSPEC.name ) && releases[ GEMSPEC.name ].key?( PKG_VERSION )
269
+ log "Rubyforge seems to already have #{ PKG_FILE_NAME }"
270
+ else
271
+ config = rf.userconfig or
272
+ fail "You apparently haven't set up your RubyForge credentials on this machine."
273
+ config['release_notes'] = GEMSPEC.description
274
+ config['release_changes'] = File.read( RELEASE_NOTES_FILE )
275
+
276
+ files = FileList[ PKGDIR + GEM_FILE_NAME ]
277
+ files.include PKGDIR + "#{PKG_FILE_NAME}.tar.gz"
278
+ files.include PKGDIR + "#{PKG_FILE_NAME}.tar.bz2"
279
+ files.include PKGDIR + "#{PKG_FILE_NAME}.zip"
280
+
281
+ log "Releasing #{PKG_FILE_NAME}"
282
+ when_writing do
283
+ log "Publishing to RubyForge: \n",
284
+ "\tproject: #{RUBYFORGE_GROUP}\n",
285
+ "\tpackage: #{PKG_NAME.downcase}\n",
286
+ "\tpackage version: #{PKG_VERSION}\n",
287
+ "\tfiles: " + files.collect {|f| f.to_s }.join(', ') + "\n"
288
+
289
+ ask_for_confirmation( "Publish to RubyForge?" ) do
290
+ log 'Logging in...'
291
+ rf.login
292
+ log "Adding the new release to the '#{project}' project"
293
+ rf.add_release( group_id, package_id, PKG_VERSION, *files )
294
+ end
295
+ end
296
+ end
297
+ end
298
+ end
299
+ end
300
+
301
+ rescue LoadError => err
302
+ if !Object.const_defined?( :Gem )
303
+ require 'rubygems'
304
+ retry
305
+ end
306
+
307
+ task :no_release_tasks do
308
+ fail "Release tasks not defined: #{err.message}"
309
+ end
310
+
311
+ task :release => :no_release_tasks
312
+ task "release:announce" => :no_release_tasks
313
+ task "release:publish" => :no_release_tasks
314
+ task "release:notes" => :no_release_tasks
315
+ end
316
+
317
+ desc "Package up a release, publish it, and send out notifications"
318
+ task :release => 'release:default'
319
+ task :rerelease => 'release:rerelease'
320
+ task :testrelease => 'release:test'
321
+
@@ -0,0 +1,40 @@
1
+ #
2
+ # RDoc Rake tasks
3
+ # $Id: rdoc.rb 93 2009-03-20 13:02:30Z deveiant $
4
+ #
5
+
6
+ gem 'rdoc', '>= 2.4.1'
7
+
8
+ require 'rubygems'
9
+ require 'rdoc/rdoc'
10
+ require 'rake/clean'
11
+
12
+
13
+ # Append docs/lib to the load path if it exists for a locally-installed Darkfish
14
+ DOCSLIB = DOCSDIR + 'lib'
15
+ $LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
16
+
17
+ # Make relative string paths of all the stuff we need to generate docs for
18
+ DOCFILES = LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files
19
+
20
+
21
+ directory RDOCDIR.to_s
22
+ CLOBBER.include( RDOCDIR )
23
+
24
+ desc "Build API documentation in #{RDOCDIR}"
25
+ task :rdoc => [ Rake.application.rakefile, *DOCFILES ] do
26
+ args = RDOC_OPTIONS
27
+ args += [ '-o', RDOCDIR.to_s ]
28
+ args += [ '-f', 'darkfish' ]
29
+ args += DOCFILES.collect {|pn| pn.to_s }
30
+
31
+ trace "Building docs with arguments: %s" % [ args.join(' ') ]
32
+ RDoc::RDoc.new.document( args ) rescue nil
33
+ end
34
+
35
+ desc "Rebuild API documentation in #{RDOCDIR}"
36
+ task :rerdoc do
37
+ rm_r( RDOCDIR ) if RDOCDIR.exist?
38
+ Rake::Task[ :rdoc ].invoke
39
+ end
40
+