Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Bundler fails if polyglot is loaded before it #287

Closed
johnf opened this issue Apr 17, 2010 · 4 comments
Closed

Bundler fails if polyglot is loaded before it #287

johnf opened this issue Apr 17, 2010 · 4 comments

Comments

@johnf
Copy link

johnf commented Apr 17, 2010

When running from cucumber eg rake cucumber you the stack trace at the bottom

This occurs because polyglot is being loaded by cucumber before budler is loaded
this started with the following commit
http://github.com/carlhuda/bundler/commit/0753a247d516346c8a0804915267f9fa93d692db#L0R95

The problem is polyglot defines a require on Object so the if returns false

A quick hack is to use

alias require gem_require unless Bundler.singleton_methods.include?(:require)


wrong number of arguments(2 for 1) (ArgumentError)
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/work/eopas/trunk/config/application.rb:8:in `<top (required)>'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/work/eopas/trunk/config/environment.rb:2:in `<top (required)>'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/work/eopas/trunk/features/support/env.rb:12:in `block in <top (required)>'
/home/johnf/.rvm/gems/ruby-head/gems/spork-0.8.2/lib/spork.rb:23:in `prefork'
/home/johnf/work/eopas/trunk/features/support/env.rb:10:in `<top (required)>'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/.rvm/gems/ruby-head/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/rb_support/rb_language.rb:124:in `load_code_file'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:85:in `load_code_file'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:77:in `block in load_code_files'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:76:in `each'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/step_mother.rb:76:in `load_code_files'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/cli/main.rb:48:in `execute!'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/lib/cucumber/cli/main.rb:20:in `execute'
/home/johnf/.rvm/gems/ruby-head/gems/cucumber-0.6.4/bin/cucumber:8:in `<main>'
@johnf
Copy link
Author

johnf commented Apr 17, 2010

This bug was introduced in closing #270

@onethirtyfive
Copy link

John's right: if I do 'bundle exec "cucumber"' it runs without a hitch. Running ruby 1.9.1p376, compiled from source.

@indirect
Copy link
Member

On the docs site, at http://gembundler.com/rails3.html, it says:

Don't forget that non-Rails commands must be executed with bundle exec
`$ bundle exec cucumber`

Running cucumber without bundle exec is not supported, and if you do this, other mysterious errors besides this one will probably appear.

That said, I'm fixing Bundler so it will still function even after polyglot has made Kernel#require public.

@indirect
Copy link
Member

Check for env.rb via ENV_LOADED instead of respond_to?(:require)

The rubygem 'polyglot', which is depended on by Cucumber via Treetop,
redefines the Kernel#require method, making it public instead of
private. This is pretty horrible. Libraries should not break the
behaviour of the stdlib. :(

This commit implements a workaround for that particular issue, with
a test that does the same thing polyglot does.

Closed by 3e796f8

joevandyk pushed a commit to joevandyk/bundler that referenced this issue May 16, 2011
The rubygem 'polyglot', which is depended on by Cucumber via Treetop,
redefines the Kernel#require method, making it public instead of
private. This is pretty horrible. Libraries should not break the
behaviour of the stdlib. :(

This commit implements a workaround for that particular issue, with
a test that does the same thing polyglot does.

Closes rubygems#287
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants