carlhuda/bundler — Issue #1531: Bundle.require not allowing dashes in names
Author: jaygen
Created: 2011-11-13 23:45:35+00:00
State: open

```ruby
gem 'em-synchrony', :require => ['em-synchrony',
'em-synchrony/em-http',
'em-synchrony/activerecord'],
:git => 'git://github.com/igrigorik/em-synchrony.git'
```

Is causing Bundler to report

LoadError: no such file to load -- em/synchrony
from /Users/xxx/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.rc/lib/bundler/runtime.rb:76:in `require'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.rc/lib/bundler/runtime.rb:76:in `rescue in block in require'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.rc/lib/bundler/runtime.rb:62:in `block in require'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `each'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.rc/lib/bundler/runtime.rb:55:in `require'
from /Users/xxx/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.1.rc/lib/Bundler.rb:128:in `require'
from (irb):6
from /Users/xxx/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `

'

I modified runtime.rb like so to avoid this error, but I'm not entirely sure how else to get around this 'feature' properly. I assume the only way is to load em-synchrony via a require in the source.

73 #if dep.name.include?('-')
74 # begin
75 # namespaced_file = dep.name.gsub('-', '/')
76 # Kernel.require namespaced_file
77 # rescue LoadError
78 # REGEXPS.find { |r| r =~ e.message }
79 # raise if dep.autorequire || $1.gsub('-', '/') != namespaced_file
80 # end
81 #else
82 raise if dep.autorequire || $1 != required_file
83 #end