bluecloth 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2004-2008, Michael Granger
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ * Neither the name of the author/s, nor the names of the project's
15
+ contributors may be used to endorse or promote products derived from this
16
+ software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,47 @@
1
+ ->Copyright (C) 2007 David Loren Parsons.
2
+ All rights reserved.<-
3
+
4
+ Permission is hereby granted, free of charge, to any person
5
+ obtaining a copy of this software and associated documentation files
6
+ (the "Software"), to deal in the Software without restriction,
7
+ including without limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicence, and/or sell copies of the Software,
9
+ and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ 1. Redistributions of source code must retain the above copyright
13
+ notice, this list of conditions, and the following disclaimer.
14
+
15
+ 2. Redistributions in binary form must reproduce the above
16
+ copyright notice, this list of conditions and the following
17
+ disclaimer in the documentation and/or other materials provided
18
+ with the distribution, and in the same place and form as other
19
+ copyright, license and disclaimer information.
20
+
21
+ 3. The end-user documentation included with the redistribution, if
22
+ any, must include the following acknowledgment:
23
+
24
+ This product includes software developed by
25
+ David Loren Parsons <http://www.pell.portland.or.us/~orc>
26
+
27
+ in the same place and form as other third-party acknowledgments.
28
+ Alternately, this acknowledgment may appear in the software
29
+ itself, in the same form and location as other such third-party
30
+ acknowledgments.
31
+
32
+ 4. Except as contained in this notice, the name of David Loren
33
+ Parsons shall not be used in advertising or otherwise to promote
34
+ the sale, use or other dealings in this Software without prior
35
+ written authorization from David Loren Parsons.
36
+
37
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
39
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
40
+ IN NO EVENT SHALL DAVID LOREN PARSONS BE LIABLE FOR ANY DIRECT,
41
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
42
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47
+ OF THE POSSIBILITY OF SUCH DAMAGE.
data/README ADDED
@@ -0,0 +1,71 @@
1
+ = BlueCloth 2
2
+
3
+ BlueCloth is a Ruby implementation of John Gruber's
4
+ Markdown[http://daringfireball.net/projects/markdown/], a text-to-HTML
5
+ conversion tool for web writers. To quote from the project page: Markdown
6
+ allows you to write using an easy-to-read, easy-to-write plain text format,
7
+ then convert it to structurally valid XHTML (or HTML).
8
+
9
+ It borrows a naming convention and several helpings of interface from
10
+ Redcloth[http://www.whytheluckystiff.net/ruby/redcloth/],
11
+ {Why the Lucky Stiff}[http://www.whytheluckystiff.net/] 's processor for a
12
+ similar text-to-HTML conversion syntax called
13
+ Textile[http://www.textism.com/tools/textile/].
14
+
15
+ BlueCloth 2 is a complete rewrite using David Parsons' Discount library, a C
16
+ implementation of Markdown. I rewrote it using the extension for speed and
17
+ accuracy; the original BlueCloth was a straight port from the Perl version
18
+ that I wrote in a few days for my own use just to avoid having to shell out
19
+ to Markdown.pl, and it was quite buggy and slow. I apologize to all the good
20
+ people that sent me patches for it that were never released.
21
+
22
+
23
+ == Authors
24
+
25
+ * Michael Granger (ged@FaerieMUD.org)
26
+
27
+
28
+ == Contributors
29
+
30
+ * Martin Chase <stillflame@FaerieMUD.org>
31
+ * Florian Gross <flgr@ccan.de>
32
+
33
+ This product includes software developed by David Loren
34
+ Parsons <http://www.pell.portland.or.us/~orc>.
35
+
36
+
37
+ == Installation
38
+
39
+ If you use RubyGems, you can install it via:
40
+
41
+ $ sudo gem install bluecloth
42
+
43
+ You can also install as a site library via the Rakefile:
44
+
45
+ $ wget http://deveiate.org/code/bluecloth-x.y.z.tar.gz
46
+ $ tar xzvf bluecloth-x.y.z.tar.gz
47
+ $ cd bluecloth-x.y.z
48
+ $ sudo rake install
49
+
50
+
51
+ == Source
52
+
53
+ You can check out the current development source with Subversion from the
54
+ following URL:
55
+
56
+ svn://deveiate.org/BlueCloth/trunk
57
+
58
+ You can report bugs, suggest improvements, or check on development activity at
59
+ the project page:
60
+
61
+ http://deveiate.org/projects/BlueCloth/
62
+
63
+
64
+ == License
65
+
66
+ See the LICENSE file included with the distribution for licensing and
67
+ copyright details.
68
+
69
+ The licensing terms of Discount are described in the LICENSE.discount file,
70
+ also included with the distribution.
71
+
@@ -0,0 +1,319 @@
1
+ #!rake
2
+ #
3
+ # BlueCloth rakefile
4
+ #
5
+ # Based on various other Rakefiles, especially one by Ben Bleything
6
+ #
7
+ # Copyright (c) 2007-2009 The FaerieMUD Consortium
8
+ #
9
+ # Authors:
10
+ # * Michael Granger <ged@FaerieMUD.org>
11
+ #
12
+
13
+ BEGIN {
14
+ require 'pathname'
15
+ basedir = Pathname.new( __FILE__ ).dirname
16
+
17
+ libdir = basedir + "lib"
18
+ extdir = basedir + "ext"
19
+
20
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
21
+ $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
22
+ }
23
+
24
+ require 'rbconfig'
25
+ require 'rake'
26
+ require 'rake/rdoctask'
27
+ require 'rake/testtask'
28
+ require 'rake/packagetask'
29
+ require 'rake/clean'
30
+ require 'rake/191_compat.rb'
31
+
32
+ $dryrun = false
33
+
34
+ ### Config constants
35
+ BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
36
+ BINDIR = BASEDIR + 'bin'
37
+ LIBDIR = BASEDIR + 'lib'
38
+ EXTDIR = BASEDIR + 'ext'
39
+ DOCSDIR = BASEDIR + 'docs'
40
+ PKGDIR = BASEDIR + 'pkg'
41
+ DATADIR = BASEDIR + 'data'
42
+
43
+ PROJECT_NAME = 'BlueCloth'
44
+ PKG_NAME = PROJECT_NAME.downcase
45
+ PKG_SUMMARY = 'BlueCloth is a Ruby implementation of Markdown'
46
+
47
+ # Cruisecontrol stuff
48
+ CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
49
+ CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
50
+
51
+ VERSION_FILE = LIBDIR + 'bluecloth.rb'
52
+ if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
53
+ PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
54
+ elsif VERSION_FILE.exist?
55
+ PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
56
+ else
57
+ PKG_VERSION = '0.0.0'
58
+ end
59
+
60
+ PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
61
+ GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
62
+
63
+ EXTCONF = EXTDIR + 'extconf.rb'
64
+
65
+ ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
66
+
67
+ TEXT_FILES = %w( Rakefile ChangeLog README LICENSE ).collect {|filename| BASEDIR + filename }
68
+ BIN_FILES = Pathname.glob( "#{BINDIR}/*" ).delete_if {|item| item.to_s =~ /\.svn/ }
69
+ LIB_FILES = Pathname.glob( "#{LIBDIR}/**/*.rb" ).delete_if {|item| item.to_s =~ /\.svn/ }
70
+ EXT_FILES = Pathname.glob( "#{EXTDIR}/**/*.{c,h,rb}" ).delete_if {|item| item.to_s =~ /\.svn/ }
71
+ DATA_FILES = Pathname.glob( "#{DATADIR}/**/*" ).delete_if {|item| item.to_s =~ /\.svn/ }
72
+
73
+ SPECDIR = BASEDIR + 'spec'
74
+ SPECLIBDIR = SPECDIR + 'lib'
75
+ SPEC_FILES = Pathname.glob( "#{SPECDIR}/**/*_spec.rb" ).delete_if {|item| item.to_s =~ /\.svn/ } +
76
+ Pathname.glob( "#{SPECLIBDIR}/**/*.rb" ).delete_if {|item| item.to_s =~ /\.svn/ }
77
+
78
+ TESTDIR = BASEDIR + 'tests'
79
+ TEST_FILES = Pathname.glob( "#{TESTDIR}/**/*.tests.rb" ).delete_if {|item| item.to_s =~ /\.svn/ }
80
+
81
+ RAKE_TASKDIR = BASEDIR + 'rake'
82
+ RAKE_TASKLIBS = Pathname.glob( "#{RAKE_TASKDIR}/*.rb" )
83
+
84
+ LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
85
+
86
+ EXTRA_PKGFILES = []
87
+ EXTRA_PKGFILES.concat Pathname.glob( "#{BASEDIR}/COPYRIGHT.discount" ).delete_if {|item| item.to_s =~ /\.svn/ }
88
+ EXTRA_PKGFILES.concat Pathname.glob( "#{BASEDIR}/spec/data/**/*.{txt,text,html}" ).delete_if {|item| item.to_s =~ /\.svn/ }
89
+ EXTRA_PKGFILES.concat Pathname.glob( "#{BASEDIR}/ext/VERSION" ).delete_if {|item| item.to_s =~ /\.svn/ }
90
+
91
+ RELEASE_FILES = TEXT_FILES +
92
+ SPEC_FILES +
93
+ TEST_FILES +
94
+ BIN_FILES +
95
+ LIB_FILES +
96
+ EXT_FILES +
97
+ DATA_FILES +
98
+ RAKE_TASKLIBS +
99
+ EXTRA_PKGFILES
100
+
101
+ RELEASE_FILES << LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
102
+
103
+ COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
104
+ RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
105
+ RCOV_OPTS = [
106
+ '--exclude', RCOV_EXCLUDES,
107
+ '--xrefs',
108
+ '--save',
109
+ '--callsites',
110
+ #'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
111
+ ]
112
+
113
+
114
+ # Subversion constants -- directory names for releases and tags
115
+ SVN_TRUNK_DIR = 'trunk'
116
+ SVN_RELEASES_DIR = 'releases'
117
+ SVN_BRANCHES_DIR = 'branches'
118
+ SVN_TAGS_DIR = 'tags'
119
+
120
+ SVN_DOTDIR = BASEDIR + '.svn'
121
+ SVN_ENTRIES = SVN_DOTDIR + 'entries'
122
+
123
+
124
+ ### Load some task libraries that need to be loaded early
125
+ require RAKE_TASKDIR + 'helpers.rb'
126
+ require RAKE_TASKDIR + 'svn.rb'
127
+ require RAKE_TASKDIR + 'verifytask.rb'
128
+
129
+ # Define some constants that depend on the 'svn' tasklib
130
+ PKG_BUILD = get_svn_rev( BASEDIR ) || 0
131
+ SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
132
+ SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
133
+
134
+ # Documentation constants
135
+ RDOCDIR = DOCSDIR + 'api'
136
+ RDOC_OPTIONS = [
137
+ '-w', '4',
138
+ '-SHN',
139
+ '-i', '.',
140
+ '-m', 'README',
141
+ '-t', PKG_NAME,
142
+ '-W', 'http://deveiate.org/projects/BlueCloth/browser/trunk/'
143
+ ]
144
+
145
+ # Release constants
146
+ SMTP_HOST = 'mail.faeriemud.org'
147
+ SMTP_PORT = 465 # SMTP + SSL
148
+
149
+ # Project constants
150
+ PROJECT_HOST = 'deveiate'
151
+ PROJECT_PUBDIR = '/usr/local/www/public/code'
152
+ PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
153
+ PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
154
+ PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
155
+
156
+ # Rubyforge stuff
157
+ RUBYFORGE_GROUP = 'deveiate'
158
+ RUBYFORGE_PROJECT = 'bluecloth'
159
+
160
+ # Gem dependencies: gemname => version
161
+ DEPENDENCIES = {
162
+ }
163
+
164
+ # Developer Gem dependencies: gemname => version
165
+ DEVELOPMENT_DEPENDENCIES = {
166
+ 'amatch' => '>= 0.2.3',
167
+ 'rake' => '>= 0.8.1',
168
+ 'rcodetools' => '>= 0.7.0.0',
169
+ 'rcov' => '>= 0',
170
+ 'RedCloth' => '>= 4.0.3',
171
+ 'rspec' => '>= 0',
172
+ 'rubyforge' => '>= 0',
173
+ 'termios' => '>= 0',
174
+ 'text-format' => '>= 1.0.0',
175
+ 'tmail' => '>= 1.2.3.1',
176
+ 'ultraviolet' => '>= 0.10.2',
177
+ 'libxml-ruby' => '>= 0.8.3',
178
+ }
179
+
180
+ # Non-gem requirements: packagename => version
181
+ REQUIREMENTS = {
182
+ }
183
+
184
+ # RubyGem specification
185
+ GEMSPEC = Gem::Specification.new do |gem|
186
+ gem.name = PKG_NAME.downcase
187
+ gem.version = PKG_VERSION
188
+
189
+ gem.summary = PKG_SUMMARY
190
+ gem.description = [
191
+ "BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion",
192
+ "tool for web writers. To quote from the project page: Markdown allows you to",
193
+ "write using an easy-to-read, easy-to-write plain text format, then convert it to",
194
+ "structurally valid XHTML (or HTML).",
195
+ ].join( "\n" )
196
+
197
+ gem.authors = "Michael Granger"
198
+ gem.email = "ged@FaerieMUD.org"
199
+ gem.homepage = 'http://deveiate.org/projects/BlueCloth/'
200
+ gem.rubyforge_project = RUBYFORGE_PROJECT
201
+
202
+ gem.has_rdoc = true
203
+ gem.rdoc_options = RDOC_OPTIONS
204
+ gem.extra_rdoc_files = %w[ChangeLog README LICENSE]
205
+
206
+ gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
207
+ gem.executables = BIN_FILES.select {|pn| pn.executable? }.
208
+ collect {|pn| pn.relative_path_from(BINDIR).to_s }
209
+
210
+ if EXTCONF.exist?
211
+ gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
212
+ end
213
+
214
+ gem.files = RELEASE_FILES.
215
+ collect {|f| f.relative_path_from(BASEDIR).to_s }
216
+ gem.test_files = SPEC_FILES.
217
+ collect {|f| f.relative_path_from(BASEDIR).to_s }
218
+
219
+ DEPENDENCIES.each do |name, version|
220
+ version = '>= 0' if version.length.zero?
221
+ gem.add_runtime_dependency( name, version )
222
+ end
223
+
224
+ # Developmental dependencies don't work as of RubyGems 1.2.0
225
+ unless Gem::Version.new( Gem::RubyGemsVersion ) <= Gem::Version.new( "1.2.0" )
226
+ DEVELOPMENT_DEPENDENCIES.each do |name, version|
227
+ version = '>= 0' if version.length.zero?
228
+ gem.add_development_dependency( name, version )
229
+ end
230
+ end
231
+
232
+ REQUIREMENTS.each do |name, version|
233
+ gem.requirements << [ name, version ].compact.join(' ')
234
+ end
235
+ end
236
+
237
+ # Manual-generation config
238
+ MANUALDIR = DOCSDIR + 'manual'
239
+
240
+ $trace = Rake.application.options.trace ? true : false
241
+ $dryrun = Rake.application.options.dryrun ? true : false
242
+
243
+
244
+ # Load any remaining task libraries
245
+ RAKE_TASKLIBS.each do |tasklib|
246
+ next if tasklib.to_s =~ %r{/(helpers|svn|verifytask)\.rb$}
247
+ begin
248
+ trace " loading tasklib %s" % [ tasklib ]
249
+ require tasklib.expand_path
250
+ rescue ScriptError => err
251
+ fail "Task library '%s' failed to load: %s: %s" %
252
+ [ tasklib, err.class.name, err.message ]
253
+ trace "Backtrace: \n " + err.backtrace.join( "\n " )
254
+ rescue => err
255
+ log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
256
+ [ tasklib, err.class.name, err.message ]
257
+ trace "Backtrace: \n " + err.backtrace.join( "\n " )
258
+ end
259
+ end
260
+
261
+ # Load any project-specific rules defined in 'Rakefile.local' if it exists
262
+ import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
263
+
264
+
265
+ #####################################################################
266
+ ### T A S K S
267
+ #####################################################################
268
+
269
+ ### Default task
270
+ task :default => [:clean, :local, :spec, :rdoc, :package]
271
+
272
+ ### Task the local Rakefile can append to -- no-op by default
273
+ task :local
274
+
275
+
276
+ ### Task: clean
277
+ CLEAN.include 'coverage'
278
+ CLOBBER.include 'artifacts', 'coverage.info', PKGDIR
279
+
280
+ # Target to hinge on ChangeLog updates
281
+ file SVN_ENTRIES
282
+
283
+ ### Task: changelog
284
+ file 'ChangeLog' => SVN_ENTRIES.to_s do |task|
285
+ log "Updating #{task.name}"
286
+
287
+ changelog = make_svn_changelog()
288
+ File.open( task.name, 'w' ) do |fh|
289
+ fh.print( changelog )
290
+ end
291
+ end
292
+
293
+
294
+ ### Task: cruise (Cruisecontrol task)
295
+ desc "Cruisecontrol build"
296
+ task :cruise => [:clean, 'spec:quiet', :package] do |task|
297
+ raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
298
+ artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
299
+ artifact_dir.mkpath
300
+
301
+ coverage = BASEDIR + 'coverage'
302
+ if coverage.exist? && coverage.directory?
303
+ $stderr.puts "Copying coverage stats..."
304
+ FileUtils.cp_r( 'coverage', artifact_dir )
305
+ end
306
+
307
+ $stderr.puts "Copying packages..."
308
+ FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
309
+ end
310
+
311
+
312
+ desc "Update the build system to the latest version"
313
+ task :update_build do
314
+ log "Updating the build system"
315
+ sh 'svn', 'up', RAKE_TASKDIR
316
+ log "Updating the Rakefile"
317
+ sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
318
+ end
319
+