bluecloth 2.0.10 → 2.0.11pre158

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gemtest +0 -0
  3. data/History.md +4 -0
  4. data/LICENSE +1 -1
  5. data/Manifest.txt +103 -0
  6. data/README.md +103 -0
  7. data/Rakefile +95 -324
  8. data/ext/VERSION +1 -1
  9. data/ext/bluecloth.c +1 -1
  10. data/ext/bluecloth.h +1 -1
  11. data/ext/extconf.rb +7 -9
  12. data/ext/generate.c +5 -6
  13. data/ext/markdown.c +12 -8
  14. data/lib/bluecloth.rb +14 -11
  15. data/spec/bluecloth/101_changes_spec.rb +0 -4
  16. data/spec/bluecloth/TEMPLATE +36 -0
  17. data/spec/bluecloth/autolinks_spec.rb +2 -6
  18. data/spec/bluecloth/blockquotes_spec.rb +1 -5
  19. data/spec/bluecloth/code_spans_spec.rb +0 -4
  20. data/spec/bluecloth/emphasis_spec.rb +0 -4
  21. data/spec/bluecloth/entities_spec.rb +0 -4
  22. data/spec/bluecloth/hrules_spec.rb +0 -4
  23. data/spec/bluecloth/images_spec.rb +0 -4
  24. data/spec/bluecloth/inline_html_spec.rb +0 -4
  25. data/spec/bluecloth/links_spec.rb +0 -4
  26. data/spec/bluecloth/lists_spec.rb +0 -4
  27. data/spec/bluecloth/paragraphs_spec.rb +0 -4
  28. data/spec/bluecloth/titles_spec.rb +0 -4
  29. data/spec/bluecloth_spec.rb +3 -5
  30. data/spec/bugfix_spec.rb +6 -8
  31. data/spec/contributions_spec.rb +0 -2
  32. data/spec/discount_spec.rb +2 -6
  33. data/spec/lib/helpers.rb +24 -0
  34. data/spec/lib/matchers.rb +1 -0
  35. data/spec/markdowntest_spec.rb +0 -4
  36. metadata +222 -139
  37. metadata.gz.sig +0 -0
  38. data/ChangeLog +0 -444
  39. data/README +0 -81
  40. data/Rakefile.local +0 -48
  41. data/rake/191_compat.rb +0 -26
  42. data/rake/dependencies.rb +0 -76
  43. data/rake/documentation.rb +0 -123
  44. data/rake/helpers.rb +0 -502
  45. data/rake/hg.rb +0 -318
  46. data/rake/manual.rb +0 -787
  47. data/rake/packaging.rb +0 -129
  48. data/rake/publishing.rb +0 -341
  49. data/rake/style.rb +0 -62
  50. data/rake/svn.rb +0 -668
  51. data/rake/testing.rb +0 -152
  52. data/rake/verifytask.rb +0 -64
data.tar.gz.sig CHANGED
Binary file
data/.gemtest ADDED
File without changes
data/History.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 0.0.1 [2011-02-08] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Initial release.
4
+
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2004-2010, Michael Granger
1
+ Copyright (c) 2004-2011, Michael Granger
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/Manifest.txt ADDED
@@ -0,0 +1,103 @@
1
+ .gemtest
2
+ History.md
3
+ Manifest.txt
4
+ LICENSE
5
+ LICENSE.discount
6
+ README.md
7
+ Rakefile
8
+ bin/bluecloth
9
+ ext/Csio.c
10
+ ext/VERSION
11
+ ext/amalloc.h
12
+ ext/bluecloth.c
13
+ ext/bluecloth.h
14
+ ext/config.h
15
+ ext/css.c
16
+ ext/cstring.h
17
+ ext/docheader.c
18
+ ext/emmatch.c
19
+ ext/extconf.rb
20
+ ext/generate.c
21
+ ext/html5.c
22
+ ext/markdown.c
23
+ ext/markdown.h
24
+ ext/mkdio.c
25
+ ext/mkdio.h
26
+ ext/resource.c
27
+ ext/setup.c
28
+ ext/tags.c
29
+ ext/tags.h
30
+ ext/version.c
31
+ ext/xml.c
32
+ ext/xmlpage.c
33
+ lib/bluecloth.rb
34
+ spec/bluecloth/101_changes_spec.rb
35
+ spec/bluecloth/TEMPLATE
36
+ spec/bluecloth/autolinks_spec.rb
37
+ spec/bluecloth/blockquotes_spec.rb
38
+ spec/bluecloth/code_spans_spec.rb
39
+ spec/bluecloth/emphasis_spec.rb
40
+ spec/bluecloth/entities_spec.rb
41
+ spec/bluecloth/hrules_spec.rb
42
+ spec/bluecloth/images_spec.rb
43
+ spec/bluecloth/inline_html_spec.rb
44
+ spec/bluecloth/links_spec.rb
45
+ spec/bluecloth/lists_spec.rb
46
+ spec/bluecloth/paragraphs_spec.rb
47
+ spec/bluecloth/titles_spec.rb
48
+ spec/bluecloth_spec.rb
49
+ spec/bugfix_spec.rb
50
+ spec/contributions_spec.rb
51
+ spec/data/antsugar.txt
52
+ spec/data/markdowntest/Amps and angle encoding.html
53
+ spec/data/markdowntest/Amps and angle encoding.text
54
+ spec/data/markdowntest/Auto links.html
55
+ spec/data/markdowntest/Auto links.text
56
+ spec/data/markdowntest/Backslash escapes.html
57
+ spec/data/markdowntest/Backslash escapes.text
58
+ spec/data/markdowntest/Blockquotes with code blocks.html
59
+ spec/data/markdowntest/Blockquotes with code blocks.text
60
+ spec/data/markdowntest/Code Blocks.html
61
+ spec/data/markdowntest/Code Blocks.text
62
+ spec/data/markdowntest/Code Spans.html
63
+ spec/data/markdowntest/Code Spans.text
64
+ spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.html
65
+ spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.text
66
+ spec/data/markdowntest/Horizontal rules.html
67
+ spec/data/markdowntest/Horizontal rules.text
68
+ spec/data/markdowntest/Inline HTML (Advanced).html
69
+ spec/data/markdowntest/Inline HTML (Advanced).text
70
+ spec/data/markdowntest/Inline HTML (Simple).html
71
+ spec/data/markdowntest/Inline HTML (Simple).text
72
+ spec/data/markdowntest/Inline HTML comments.html
73
+ spec/data/markdowntest/Inline HTML comments.text
74
+ spec/data/markdowntest/Links, inline style.html
75
+ spec/data/markdowntest/Links, inline style.text
76
+ spec/data/markdowntest/Links, reference style.html
77
+ spec/data/markdowntest/Links, reference style.text
78
+ spec/data/markdowntest/Links, shortcut references.html
79
+ spec/data/markdowntest/Links, shortcut references.text
80
+ spec/data/markdowntest/Literal quotes in titles.html
81
+ spec/data/markdowntest/Literal quotes in titles.text
82
+ spec/data/markdowntest/Markdown Documentation - Basics.html
83
+ spec/data/markdowntest/Markdown Documentation - Basics.text
84
+ spec/data/markdowntest/Markdown Documentation - Syntax.html
85
+ spec/data/markdowntest/Markdown Documentation - Syntax.text
86
+ spec/data/markdowntest/Nested blockquotes.html
87
+ spec/data/markdowntest/Nested blockquotes.text
88
+ spec/data/markdowntest/Ordered and unordered lists.html
89
+ spec/data/markdowntest/Ordered and unordered lists.text
90
+ spec/data/markdowntest/Strong and em together.html
91
+ spec/data/markdowntest/Strong and em together.text
92
+ spec/data/markdowntest/Tabs.html
93
+ spec/data/markdowntest/Tabs.text
94
+ spec/data/markdowntest/Tidyness.html
95
+ spec/data/markdowntest/Tidyness.text
96
+ spec/data/ml-announce.txt
97
+ spec/data/re-overflow.txt
98
+ spec/data/re-overflow2.txt
99
+ spec/discount_spec.rb
100
+ spec/lib/constants.rb
101
+ spec/lib/helpers.rb
102
+ spec/lib/matchers.rb
103
+ spec/markdowntest_spec.rb
data/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # bluecloth 2
2
+
3
+ * http://deveiate.org/projects/BlueCloth
4
+
5
+ ## Description
6
+
7
+ BlueCloth is a Ruby implementation of John Gruber's [Markdown][markdown], a
8
+ text-to-HTML conversion tool for web writers. To quote from the project page:
9
+ Markdown allows you to write using an easy-to-read, easy-to-write plain text
10
+ format, then convert it to structurally valid XHTML (or HTML).
11
+
12
+ It borrows a naming convention and several helpings of interface from
13
+ [Redcloth][redcloth], Why the Lucky Stiff's processor for a similar
14
+ text-to-HTML conversion syntax called [Textile][textile].
15
+
16
+ BlueCloth 2 is a complete rewrite using David Parsons' [Discount][discount]
17
+ library, a C implementation of Markdown. I rewrote it using the extension for
18
+ speed and accuracy; the original BlueCloth was a straight port from the Perl
19
+ version that I wrote in a few days for my own use just to avoid having to
20
+ shell out to Markdown.pl, and it was quite buggy and slow. I apologize to all
21
+ the good people that sent me patches for it that were never released.
22
+
23
+ Note that the new gem is called 'bluecloth' and the old one 'BlueCloth'. If
24
+ you have both installed, you can ensure you're loading the new one with the
25
+ 'gem' directive:
26
+
27
+ # Load the 2.0 version
28
+ gem 'bluecloth', '>= 2.0.0'
29
+
30
+ # Load the 1.0 version
31
+ gem 'BlueCloth'
32
+ require 'bluecloth'
33
+
34
+
35
+ ## Installation
36
+
37
+ gem install bluecloth
38
+
39
+
40
+ ## Contributing
41
+
42
+ You can check out the current development source [with Mercurial][hgrepo], or if you prefer Git, via [its Github mirror][gitmirror].
43
+
44
+ After checking out the source, run:
45
+
46
+ $ rake newb
47
+
48
+ This task will install any missing dependencies, run the tests/specs, and
49
+ generate the API documentation.
50
+
51
+
52
+ ## Contributors
53
+
54
+ * Martin Chase <stillflame@FaerieMUD.org>
55
+ * Florian Gross <flgr@ccan.de>
56
+
57
+ This product includes software developed by David Loren
58
+ Parsons <http://www.pell.portland.or.us/~orc>.
59
+
60
+
61
+ ## License
62
+
63
+ Discount's license may be found in the [README.discount][discountreadme] file
64
+ included with the distribution.
65
+
66
+ All other code:
67
+
68
+ Copyright (c) 2004-2011, Michael Granger
69
+ All rights reserved.
70
+
71
+ Redistribution and use in source and binary forms, with or without
72
+ modification, are permitted provided that the following conditions are met:
73
+
74
+ * Redistributions of source code must retain the above copyright notice,
75
+ this list of conditions and the following disclaimer.
76
+
77
+ * Redistributions in binary form must reproduce the above copyright notice,
78
+ this list of conditions and the following disclaimer in the documentation
79
+ and/or other materials provided with the distribution.
80
+
81
+ * Neither the name of the author/s, nor the names of the project's
82
+ contributors may be used to endorse or promote products derived from this
83
+ software without specific prior written permission.
84
+
85
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
86
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
87
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
88
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
89
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
90
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
91
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
92
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
93
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
94
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
95
+
96
+
97
+ [markdown]:http://daringfireball.net/projects/markdown/
98
+ [redcloth]:http://redcloth.org/
99
+ [textile]:http://www.textism.com/tools/textile/
100
+ [discount]:http://www.pell.portland.or.us/~orc/Code/discount/
101
+ [hgrepo]:http://repo.deveiate.org/BlueCloth
102
+ [gitmirror]:https://github.com/ged/bluecloth
103
+ [discountreadme]:http://deveiate.org/projects/BlueCloth/browser/LICENSE.discount
data/Rakefile CHANGED
@@ -1,366 +1,137 @@
1
- #!rake -*- ruby -*-
2
- #
3
- # BlueCloth rakefile
4
- #
5
- # Based on various other Rakefiles, especially one by Ben Bleything
6
- #
7
- # Copyright (c) 2007-2011 The FaerieMUD Consortium
8
- #
9
- # Authors:
10
- # * Michael Granger <ged@FaerieMUD.org>
11
- #
1
+ #!/usr/bin/env rake
12
2
 
13
- BEGIN {
14
- require 'rbconfig'
15
- require 'pathname'
16
- basedir = Pathname.new( __FILE__ ).dirname
17
-
18
- libdir = basedir + "lib"
19
- extdir = libdir + Config::CONFIG['sitearch']
20
-
21
- $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
22
- $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
23
- $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
24
- }
3
+ require 'rbconfig'
4
+ require 'pathname'
25
5
 
26
6
  begin
27
- require 'readline'
28
- include Readline
7
+ require 'rake/extensiontask'
29
8
  rescue LoadError
30
- # Fall back to a plain prompt
31
- def readline( text )
32
- $stderr.print( text.chomp )
33
- return $stdin.gets
34
- end
9
+ abort "This Rakefile requires rake-compiler (gem install rake-compiler)"
35
10
  end
36
11
 
37
12
  begin
38
- require 'rubygems'
13
+ require 'hoe'
39
14
  rescue LoadError
40
- module Gem
41
- class Specification; end
42
- end
43
- end
44
-
45
- require 'pathname'
46
- require 'rbconfig'
47
- require 'rake'
48
- require 'rake/testtask'
49
- require 'rake/packagetask'
50
- require 'rake/clean'
51
- # require 'rake/191_compat.rb'
52
-
53
- $dryrun = false
54
-
55
- ### Config constants
56
- BASEDIR = Pathname.new( __FILE__ ).dirname.relative_path_from( Pathname.getwd )
57
- BINDIR = BASEDIR + 'bin'
58
- LIBDIR = BASEDIR + 'lib'
59
- EXTDIR = BASEDIR + 'ext'
60
- DOCSDIR = BASEDIR + 'docs'
61
- PKGDIR = BASEDIR + 'pkg'
62
- DATADIR = BASEDIR + 'data'
63
-
64
- MANUALDIR = DOCSDIR + 'manual'
65
-
66
- PROJECT_NAME = 'BlueCloth'
67
- PKG_NAME = PROJECT_NAME.downcase
68
- PKG_SUMMARY = 'BlueCloth is a Ruby implementation of Markdown'
69
-
70
- # Cruisecontrol stuff
71
- CC_BUILD_LABEL = ENV['CC_BUILD_LABEL']
72
- CC_BUILD_ARTIFACTS = ENV['CC_BUILD_ARTIFACTS'] || 'artifacts'
73
-
74
- VERSION_FILE = LIBDIR + 'bluecloth.rb'
75
- if VERSION_FILE.exist? && buildrev = ENV['CC_BUILD_LABEL']
76
- PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ] + '.' + buildrev
77
- elsif VERSION_FILE.exist?
78
- PKG_VERSION = VERSION_FILE.read[ /VERSION\s*=\s*['"](\d+\.\d+\.\d+)['"]/, 1 ]
15
+ abort "This Rakefile requires hoe (gem install hoe)"
79
16
  end
80
17
 
81
- PKG_VERSION = '0.0.0' unless defined?( PKG_VERSION ) && !PKG_VERSION.nil?
18
+ # Build constants
19
+ BASEDIR = Pathname( __FILE__ ).dirname.relative_path_from( Pathname.pwd )
20
+ SPECDIR = BASEDIR + 'spec'
21
+ LIBDIR = BASEDIR + 'lib'
22
+ EXTDIR = BASEDIR + 'ext'
82
23
 
83
- PKG_FILE_NAME = "#{PKG_NAME.downcase}-#{PKG_VERSION}"
84
- GEM_FILE_NAME = "#{PKG_FILE_NAME}.gem"
24
+ DLEXT = Config::CONFIG['DLEXT']
25
+ EXT = LIBDIR + "bluecloth_ext.#{DLEXT}"
85
26
 
86
- # Universal VCS constants
87
- DEFAULT_EDITOR = 'vi'
88
- COMMIT_MSG_FILE = 'commit-msg.txt'
89
- FILE_INDENT = " " * 12
90
- LOG_INDENT = " " * 3
27
+ # Load Hoe plugins
28
+ Hoe.plugin :mercurial
29
+ Hoe.plugin :yard
30
+ Hoe.plugin :signing
91
31
 
92
- EXTCONF = EXTDIR + 'extconf.rb'
32
+ Hoe.plugins.delete :rubyforge
33
+ Hoe.plugins.delete :compiler
93
34
 
94
- ARTIFACTS_DIR = Pathname.new( CC_BUILD_ARTIFACTS )
35
+ # Configure Hoe
36
+ hoespec = Hoe.spec 'bluecloth' do
37
+ self.readme_file = 'README.md'
38
+ self.history_file = 'History.md'
95
39
 
96
- TEXT_FILES = Rake::FileList.new( %w[Rakefile ChangeLog README* LICENSE] )
97
- BIN_FILES = Rake::FileList.new( "#{BINDIR}/*" )
98
- LIB_FILES = Rake::FileList.new( "#{LIBDIR}/**/*.rb" )
99
- EXT_FILES = Rake::FileList.new( "#{EXTDIR}/**/*.{c,h,rb}" )
100
- DATA_FILES = Rake::FileList.new( "#{DATADIR}/**/*" )
40
+ self.developer 'Michael Granger', 'ged@FaerieMUD.org'
101
41
 
102
- SPECDIR = BASEDIR + 'spec'
103
- SPECLIBDIR = SPECDIR + 'lib'
104
- SPEC_FILES = Rake::FileList.new( "#{SPECDIR}/**/*_spec.rb", "#{SPECLIBDIR}/**/*.rb" )
42
+ self.extra_dev_deps.push *{
43
+ 'tidy-ext' => '~> 0.1',
44
+ 'rake-compiler' => '~> 0.7',
45
+ 'rspec' => '~> 2.4',
46
+ }
105
47
 
106
- TESTDIR = BASEDIR + 'tests'
107
- TEST_FILES = Rake::FileList.new( "#{TESTDIR}/**/*.tests.rb" )
48
+ self.spec_extras[:licenses] = ["BSD"]
49
+ self.spec_extras[:signing_key] = '/Volumes/Keys/ged-private_gem_key.pem'
50
+ self.spec_extras[:extensions] = [ "ext/extconf.rb" ]
108
51
 
109
- RAKE_TASKDIR = BASEDIR + 'rake'
110
- RAKE_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/*.rb" )
111
- PKG_TASKLIBS = Rake::FileList.new( "#{RAKE_TASKDIR}/{191_compat,helpers,packaging,rdoc,testing}.rb" )
112
- PKG_TASKLIBS.include( "#{RAKE_TASKDIR}/manual.rb" ) if MANUALDIR.exist?
52
+ self.require_ruby_version( '>=1.8.7' )
113
53
 
114
- RAKE_TASKLIBS_URL = 'http://repo.deveiate.org/rake-tasklibs'
54
+ self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
55
+ self.yard_opts = [ '--protected', '--verbose' ] if self.respond_to?( :yard_opts= )
115
56
 
116
- LOCAL_RAKEFILE = BASEDIR + 'Rakefile.local'
117
-
118
- EXTRA_PKGFILES = Rake::FileList.new
119
- EXTRA_PKGFILES.include( "#{BASEDIR}/LICENSE.discount" )
120
- EXTRA_PKGFILES.include( "#{BASEDIR}/spec/data/**/*.{txt,text,html}" )
121
- EXTRA_PKGFILES.include( "#{BASEDIR}/ext/VERSION" )
122
-
123
- RELEASE_FILES = TEXT_FILES +
124
- SPEC_FILES +
125
- TEST_FILES +
126
- BIN_FILES +
127
- LIB_FILES +
128
- EXT_FILES +
129
- DATA_FILES +
130
- RAKE_TASKLIBS +
131
- EXTRA_PKGFILES
132
-
133
-
134
- RELEASE_FILES << LOCAL_RAKEFILE.to_s if LOCAL_RAKEFILE.exist?
135
-
136
- RELEASE_ANNOUNCE_ADDRESSES = [
137
- "Ruby-Talk List <ruby-talk@ruby-lang.org>",
138
- ]
57
+ self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
58
+ end
139
59
 
140
- COVERAGE_MINIMUM = ENV['COVERAGE_MINIMUM'] ? Float( ENV['COVERAGE_MINIMUM'] ) : 85.0
141
- RCOV_EXCLUDES = 'spec,tests,/Library/Ruby,/var/lib,/usr/local/lib'
142
- RCOV_OPTS = [
143
- '--exclude', RCOV_EXCLUDES,
144
- '--xrefs',
145
- '--save',
146
- '--callsites',
147
- #'--aggregate', 'coverage.data' # <- doesn't work as of 0.8.1.2.0
148
- ]
60
+ ENV['VERSION'] ||= hoespec.spec.version.to_s
149
61
 
62
+ # Ensure the specs pass before checking in
63
+ task 'hg:precheckin' => :spec
150
64
 
151
- ### Load some task libraries that need to be loaded early
152
- if !RAKE_TASKDIR.exist?
153
- $stderr.puts "It seems you don't have the build task directory. Shall I fetch it "
154
- ans = readline( "for you? [y]" )
155
- ans = 'y' if !ans.nil? && ans.empty?
65
+ # Ensure the extension is compiled before testing
66
+ task :spec => :compile
156
67
 
157
- if ans =~ /^y/i
158
- $stderr.puts "Okay, fetching #{RAKE_TASKLIBS_URL} into #{RAKE_TASKDIR}..."
159
- system 'hg', 'clone', RAKE_TASKLIBS_URL, "./#{RAKE_TASKDIR}"
160
- if ! $?.success?
161
- fail "Damn. That didn't work. Giving up; maybe try manually fetching?"
162
- end
163
- else
164
- $stderr.puts "Then I'm afraid I can't continue. Best of luck."
165
- fail "Rake tasklibs not present."
166
- end
167
-
168
- RAKE_TASKLIBS.include( "#{RAKE_TASKDIR}/*.rb" )
68
+ # gem-testers support
69
+ task :test do
70
+ # rake-compiler always wants to copy the compiled extension into lib/, but
71
+ # we don't want testers to have to re-compile, especially since that
72
+ # often fails because they can't (and shouldn't have to) write to tmp/ in
73
+ # the installed gem dir. So we clear the task rake-compiler set up
74
+ # to break the dependency between :spec and :compile when running under
75
+ # rubygems-test, and then run :spec.
76
+ Rake::Task[ EXT.to_s ].clear
77
+ Rake::Task[ :spec ].execute
169
78
  end
170
79
 
171
- require RAKE_TASKDIR + 'helpers.rb'
172
- include RakefileHelpers
173
-
174
- # Set the build ID if the mercurial executable is available
175
- if hg = which( 'hg' )
176
- id = `#{hg} id -n`.chomp
177
- PKG_BUILD = (id.chomp[ /^[[:xdigit:]]+/ ] || '1')
178
- else
179
- PKG_BUILD = '0'
80
+ desc "Turn on warnings and debugging in the build."
81
+ task :maint do
82
+ ENV['MAINTAINER_MODE'] = 'yes'
180
83
  end
181
- SNAPSHOT_PKG_NAME = "#{PKG_FILE_NAME}.#{PKG_BUILD}"
182
- SNAPSHOT_GEM_NAME = "#{SNAPSHOT_PKG_NAME}.gem"
183
-
184
- # Documentation constants
185
- API_DOCSDIR = DOCSDIR + 'api'
186
- README_FILE = TEXT_FILES.find {|path| path =~ /^README/ } || 'README'
187
- RDOC_OPTIONS = [
188
- '--tab-width=4',
189
- '--show-hash',
190
- '--include', BASEDIR.to_s,
191
- "--main=#{README_FILE}",
192
- "--title=#{PKG_NAME}",
193
- ]
194
- YARD_OPTIONS = [
195
- '--use-cache',
196
- '--protected',
197
- '-r', README_FILE,
198
- '--exclude', 'extconf\\.rb',
199
- '--files', 'ChangeLog,LICENSE',
200
- '--output-dir', API_DOCSDIR.to_s,
201
- '--title', "#{PKG_NAME} #{PKG_VERSION}",
202
- ]
203
-
204
- # Release constants
205
- SMTP_HOST = "mail.faeriemud.org"
206
- SMTP_PORT = 465 # SMTP + SSL
207
-
208
- # Project constants
209
- PROJECT_HOST = 'deveiate'
210
- PROJECT_PUBDIR = '/usr/local/www/public/code'
211
- PROJECT_DOCDIR = "#{PROJECT_PUBDIR}/#{PKG_NAME}"
212
- PROJECT_SCPPUBURL = "#{PROJECT_HOST}:#{PROJECT_PUBDIR}"
213
- PROJECT_SCPDOCURL = "#{PROJECT_HOST}:#{PROJECT_DOCDIR}"
214
-
215
- GEM_PUBHOST = 'rubygems.org'
216
-
217
- # Gem dependencies: gemname => version
218
- DEPENDENCIES = {
219
- }
220
84
 
221
- # Developer Gem dependencies: gemname => version
222
- DEVELOPMENT_DEPENDENCIES = {
223
- 'rake' => '~> 0.8.7',
224
- 'rcodetools' => '~> 0.7.0.0',
225
- 'rcov' => '~> 0.8.1.2.0',
226
- 'yard' => '~> 0.6.1',
227
- 'RedCloth' => '~> 4.2.3',
228
- 'rspec' => '~> 2.0.1',
229
- 'ruby-termios' => '~> 0.9.6',
230
- 'text-format' => '~> 1.0.0',
231
- 'tmail' => '~> 1.2.3.1',
232
- 'tidy-ext' => '>= 0.1.10',
233
- 'rake-compiler' => '>= 0.7.0',
234
- }
85
+ ENV['RUBY_CC_VERSION'] = '1.8.7:1.9.2'
235
86
 
236
- # Non-gem requirements: packagename => version
237
- REQUIREMENTS = {
238
- }
239
-
240
- # RubyGem specification
241
- GEMSPEC = Gem::Specification.new do |gem|
242
- gem.name = PKG_NAME.downcase
243
- gem.version = PKG_VERSION
244
-
245
- gem.summary = PKG_SUMMARY
246
- gem.description = [
247
- "BlueCloth is a Ruby implementation of [Markdown][1], a text-to-HTML conversion",
248
- "tool for web writers. To quote from the project page: Markdown allows you to",
249
- "write using an easy-to-read, easy-to-write plain text format, then convert it to",
250
- "structurally valid XHTML (or HTML).",
251
- ].join( "\n" )
252
-
253
- gem.authors = ["Michael Granger"]
254
- gem.email = ["ged@FaerieMUD.org"]
255
- gem.homepage = 'http://deveiate.org/projects/BlueCloth/'
256
- gem.licenses = ["BSD"]
257
-
258
- gem.has_rdoc = true
259
- gem.rdoc_options = RDOC_OPTIONS
260
- gem.extra_rdoc_files = TEXT_FILES - [ 'Rakefile' ]
261
-
262
- gem.bindir = BINDIR.relative_path_from(BASEDIR).to_s
263
- gem.executables = BIN_FILES.select {|pn| File.executable?(pn) }.
264
- collect {|pn| File.basename(pn) }
265
- gem.require_paths << EXTDIR.relative_path_from( BASEDIR ).to_s if EXTDIR.exist?
266
-
267
- if EXTCONF.exist?
268
- gem.extensions << EXTCONF.relative_path_from( BASEDIR ).to_s
269
- end
270
-
271
- gem.files = RELEASE_FILES
272
- gem.test_files = SPEC_FILES
273
-
274
- # signing key and certificate chain
275
- gem.signing_key = '/Volumes/Keys/ged-private_gem_key.pem'
276
- gem.cert_chain = [File.expand_path('~/.gem/ged-public_gem_cert.pem')]
277
-
278
-
279
- gem.required_ruby_version = '>= 1.8.7'
280
-
281
- DEPENDENCIES.each do |name, version|
282
- version = '>= 0' if version.length.zero?
283
- gem.add_runtime_dependency( name, version )
284
- end
285
-
286
- REQUIREMENTS.each do |name, version|
287
- gem.requirements << [ name, version ].compact.join(' ')
288
- end
87
+ # Rake-compiler task
88
+ Rake::ExtensionTask.new do |ext|
89
+ ext.name = 'bluecloth_ext'
90
+ ext.gem_spec = hoespec.spec
91
+ ext.ext_dir = 'ext'
92
+ ext.source_pattern = "*.{c,h}"
93
+ ext.cross_compile = true
94
+ ext.cross_platform = %w[i386-mswin32 i386-mingw32]
289
95
  end
290
96
 
291
- $trace = Rake.application.options.trace ? true : false
292
- $dryrun = Rake.application.options.dryrun ? true : false
293
- $include_dev_dependencies = false
294
97
 
295
- # Load any remaining task libraries
296
- RAKE_TASKLIBS.each do |tasklib|
297
- next if tasklib.to_s =~ %r{/helpers\.rb$}
298
- begin
299
- trace " loading tasklib %s" % [ tasklib ]
300
- import tasklib
301
- rescue ScriptError => err
302
- fail "Task library '%s' failed to load: %s: %s" %
303
- [ tasklib, err.class.name, err.message ]
304
- trace "Backtrace: \n " + err.backtrace.join( "\n " )
305
- rescue => err
306
- log "Task library '%s' failed to load: %s: %s. Some tasks may not be available." %
307
- [ tasklib, err.class.name, err.message ]
308
- trace "Backtrace: \n " + err.backtrace.join( "\n " )
98
+ begin
99
+ include Hoe::MercurialHelpers
100
+
101
+ ### Task: prerelease
102
+ desc "Append the package build number to package versions"
103
+ task :pre do
104
+ rev = get_numeric_rev()
105
+ trace "Current rev is: %p" % [ rev ]
106
+ hoespec.spec.version.version << "pre#{rev}"
107
+ Rake::Task[:gem].clear
108
+
109
+ Gem::PackageTask.new( hoespec.spec ) do |pkg|
110
+ pkg.need_zip = true
111
+ pkg.need_tar = true
112
+ end
309
113
  end
310
- end
311
-
312
- # Load any project-specific rules defined in 'Rakefile.local' if it exists
313
- import LOCAL_RAKEFILE if LOCAL_RAKEFILE.exist?
314
-
315
-
316
- #####################################################################
317
- ### T A S K S
318
- #####################################################################
319
-
320
- ### Default task
321
- task :default => [:clean, :local, :spec, :apidocs, :package]
322
-
323
- ### Task the local Rakefile can append to -- no-op by default
324
- task :local
325
114
 
326
- ### Task: clean
327
- CLEAN.include 'coverage', '**/*.orig', '**/*.rej'
328
- CLOBBER.include 'artifacts', 'coverage.info', 'ChangeLog', PKGDIR
329
-
330
- ### Task: changelog
331
- file 'ChangeLog' do |task|
332
- log "Updating #{task.name}"
333
-
334
- changelog = make_changelog()
335
- File.open( task.name, 'w' ) do |fh|
336
- fh.print( changelog )
115
+ ### Make the ChangeLog update if the repo has changed since it was last built
116
+ file '.hg/branch'
117
+ file 'ChangeLog' => '.hg/branch' do |task|
118
+ $stderr.puts "Updating the changelog..."
119
+ content = make_changelog()
120
+ File.open( task.name, 'w', 0644 ) do |fh|
121
+ fh.print( content )
122
+ end
337
123
  end
338
- end
339
124
 
125
+ # Rebuild the ChangeLog immediately before release
126
+ task :prerelease => 'ChangeLog'
340
127
 
341
- ### Task: cruise (Cruisecontrol task)
342
- desc "Cruisecontrol build"
343
- task :cruise => [:clean, 'spec:quiet', :package] do |task|
344
- raise "Artifacts dir not set." if ARTIFACTS_DIR.to_s.empty?
345
- artifact_dir = ARTIFACTS_DIR.cleanpath + (CC_BUILD_LABEL || Time.now.strftime('%Y%m%d-%T'))
346
- artifact_dir.mkpath
347
-
348
- coverage = BASEDIR + 'coverage'
349
- if coverage.exist? && coverage.directory?
350
- $stderr.puts "Copying coverage stats..."
351
- FileUtils.cp_r( 'coverage', artifact_dir )
128
+ rescue NameError => err
129
+ task :no_hg_helpers do
130
+ fail "Couldn't define the :pre task: %s: %s" % [ err.class.name, err.message ]
352
131
  end
353
132
 
354
- $stderr.puts "Copying packages..."
355
- FileUtils.cp_r( FileList['pkg/*'].to_a, artifact_dir )
356
- end
357
-
133
+ task :pre => :no_hg_helpers
134
+ task 'ChangeLog' => :no_hg_helpers
358
135
 
359
- desc "Update the build system to the latest version"
360
- task :update_build do
361
- log "Updating the build system"
362
- run 'hg', '-R', RAKE_TASKDIR, 'pull', '-u'
363
- log "Updating the Rakefile"
364
- sh 'rake', '-f', RAKE_TASKDIR + 'Metarakefile'
365
136
  end
366
137