summaryrefslogtreecommitdiff
path: root/lib/coderay/for_redcloth.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-03-31 22:17:06 +0000
committermurphy <murphy@rubychan.de>2010-03-31 22:17:06 +0000
commit862bc9aa6b002f6b29cf74f93ca66e63cf370819 (patch)
tree45e8a8731fadca8df5fe86595dc2e8f6dc7a3782 /lib/coderay/for_redcloth.rb
parentcce5dad0dce285a2b7c4f1fe0ec79d10c71a8403 (diff)
downloadcoderay-862bc9aa6b002f6b29cf74f93ca66e63cf370819.tar.gz
Upporting changes from 0.9.2 (vs. 0.9.1).
Diffstat (limited to 'lib/coderay/for_redcloth.rb')
-rw-r--r--lib/coderay/for_redcloth.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/coderay/for_redcloth.rb b/lib/coderay/for_redcloth.rb
index 43b2268..5149562 100644
--- a/lib/coderay/for_redcloth.rb
+++ b/lib/coderay/for_redcloth.rb
@@ -13,10 +13,20 @@ module CodeRay
module ForRedCloth
def self.install
- gem 'RedCloth', '>= 4.0.3' rescue nil
+ gem 'RedCloth', '>= 4.0.3' if defined? gem
require 'redcloth'
unless RedCloth::VERSION.to_s >= '4.0.3'
- raise 'CodeRay.for_redcloth needs RedCloth version 4.0.3 or later.'
+ if defined? gem
+ raise 'CodeRay.for_redcloth needs RedCloth version 4.0.3 or later. ' +
+ "You have #{RedCloth::VERSION}. Please gem install RedCloth."
+ else
+ $".delete 'redcloth.rb' # sorry, but it works
+ require 'rubygems'
+ return install # retry
+ end
+ end
+ unless RedCloth::VERSION.to_s >= '4.2.2'
+ warn 'CodeRay.for_redcloth works best with RedCloth version 4.2.2 or later.'
end
RedCloth::TextileDoc.send :include, ForRedCloth::TextileDoc
RedCloth::Formatters::HTML.module_eval do