#276 new
Roger

redcloth "loads wrong" in mingw with native build

Reported by Roger | May 13th, 2015 @ 12:53 PM

Hello.
As a note,

irb(main):005:0> require 'redcloth'
LoadError: cannot load such file -- 2.1/redcloth_scan
Couldn't load 2.1/redcloth_scan
The $LOAD_PATH was:
C:/installs/Ruby216/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/RedCloth-4.2.9
C:/installs/Ruby216/lib/ruby/gems/2.1.0/gems/RedCloth-4.2.9/lib
C:/installs/Ruby216/lib/ruby/gems/2.1.0/gems/RedCloth-4.2.9/lib/case_sensitive_require
C:/installs/Ruby216/lib/ruby/gems/2.1.0/gems/RedCloth-4.2.9/ext
C:/installs/Ruby216/lib/ruby/site_ruby/2.1.0
C:/installs/Ruby216/lib/ruby/site_ruby/2.1.0/i386-msvcrt
C:/installs/Ruby216/lib/ruby/site_ruby
C:/installs/Ruby216/lib/ruby/vendor_ruby/2.1.0
C:/installs/Ruby216/lib/ruby/vendor_ruby/2.1.0/i386-msvcrt
C:/installs/Ruby216/lib/ruby/vendor_ruby
C:/installs/Ruby216/lib/ruby/2.1.0
C:/installs/Ruby216/lib/ruby/2.1.0/i386-mingw32
from C:/installs/Ruby216/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' from C:/installs/Ruby216/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from C:/installs/Ruby216/lib/ruby/gems/2.1.0/gems/RedCloth-4.2.9/lib/redcloth.rb:13:in <top (required)>' from C:/installs/Ruby216/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:inrequire' from C:/installs/Ruby216/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require' from (irb):5 from C:/installs/Ruby216/bin/irb:11:in'

fix: in redcloth.rb ("top") make it like this:

require 'rbconfig'
begin
  conf = Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG
  prefix = conf['arch'] =~ /mswin|mingw/ ? "#{conf['MAJOR']}.#{conf['MINOR']}/" : ''
  lib = "#{prefix}redcloth_scan"
  require lib
rescue LoadError => e
  e.message << %{\nCouldn't load #{lib}\nThe $LOAD_PATH was:\n#{$LOAD_PATH.join("\n")}}
  require 'redcloth_scan' # let it raise ADD THIS LINE
  #raise e
end

(this is because with 2.1 there is no prebuilt binary, and it defaults back to building normal from source)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

RedCloth is a Ruby library for converting Textile into HTML

Shared Ticket Bins

People watching this ticket

Tags

Pages