Error: undefined method `glob' for Rake:Module #142

Closed
fabiopelosin opened this Issue Nov 13, 2012 · 5 comments

Comments

Projects
None yet
2 participants

There appears to be an issue with the 0.9.3 release. This issue is not present in Rake 0.9.2.2 and was observed with Ruby 1.9.3-p194. The error is not present with Ruby 1.8.7.

Call causing the issue
  s.source_files = ['cocos2d/**/*.{h,m,c}',
                    'external/kazmath/src/**/*.{c,h}',
                    'external/kazmath/include/**/*.{c,h}'] +
                    FileList['external/libpng/*.{h,c}'].exclude(/pngtest/)
Stack trace
undefined method `glob' for Rake:Module
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:343:in `add_matching'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:214:in `resolve_add'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:204:in `block in resolve'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:204:in `each'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:204:in `resolve'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:174:in `to_a'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:180:in `to_ary'
Owner

jimweirich commented Nov 13, 2012

I suspect your environment is mixing rake libraries versions. One possible cause is using bundler and not invoking rake with the bundle exec command. If you are not using bundler, make sure the bin and lib directories where gems puts Rake 10 proceed the system bin and lib directories.

I don't think it is the environment. I'm using RVM with auto exec (tested with the bundle exec command as well). The issue is also present on Travis which is where I noticed it. This setup has been working for a while and broke with the 0.9.3 release.

$ bundle update
...
Using rake (0.9.3) 
...
$ rake --version
rake, version 0.9.3
$ rake
...
undefined method `glob' for Rake:Module
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:343:in `add_matching'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:214:in `resolve_add'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:204:in `block in resolve'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:204:in `each'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:204:in `resolve'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:174:in `to_a'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/rake-0.9.3/lib/rake/file_list.rb:180:in `to_ary'
cocos2d/2.0.0/cocos2d.podspec:14:in `block in _eval_podspec'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/specification.rb:59:in `initialize'
cocos2d/2.0.0/cocos2d.podspec:1:in `new'
cocos2d/2.0.0/cocos2d.podspec:1:in `_eval_podspec'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/specification.rb:11:in `eval'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/specification.rb:11:in `_eval_podspec'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/specification.rb:27:in `from_file'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/linter.rb:46:in `lint'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/repo.rb:101:in `block (2 levels) in lint'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/repo.rb:96:in `each'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/repo.rb:96:in `block in lint'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/repo.rb:90:in `each'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/repo.rb:90:in `lint'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command/repo.rb:55:in `run'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/lib/cocoapods/command.rb:75:in `run'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/gems/cocoapods-0.16.0.rc3/bin/pod:16:in `<top (required)>'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/bin/pod:23:in `load'
/Users/fabio/.rvm/gems/ruby-1.9.3-p194/bin/pod:23:in `<main>'
....
Owner

jimweirich commented Nov 14, 2012

Requiring rake/file_list does not load the modules dependency. This should be fixed.

Owner

jimweirich commented Nov 14, 2012

I moved the glob command to the FileList class (as a class method) and changed to the code to use it from that spot. That means FileList does not need to require rake_module (which in turn loads Rake::Application and lots of other stuff). That makes using just FileList a little more light weight.

Fixes on HEAD. WIll release bug fix soon.

jimweirich closed this Nov 14, 2012

Thanks for the quick release :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment