Closed mrinterweb closed 13 years ago
After I uninstalled ruby, and reinstalled ruby and my gems (minus home_run), my specs work again. This should prove that the home_run uninstaller does not restore ruby to its previous state.
home_run --uninstall does the exact opposite of home_run --install. It does not uninstall the gem, so to fully remove home run, you need to gem uninstall home_run after running home_run --uninstall. Instead of uninstalling and reinstalling ruby and your gems, you could probably just have uninstalled the gem.
Looking at your backtrace, the uninitialized constant error is coming from a factory in your specs, and going through two different overrides of const_missing (one from ActiveSupport, one from S3). It's likely the problem is in that code. home_run does define DateTime, so if those const_missing overrides can't find it, it's probably a problem with them. Most likely, they are trying to require a date_time.rb file (you could strace/ktrace the process to see what they are actually doing).
You may be able to work around the issue by adding a require 'date' somewhere earlier in your config/environment.rb file (before line 22). That may help to ensure that DateTime is already defined so any references to DateTime don't go through const_missing.
Ok. If I include home_run in my Gemfile, and run my specs with bundle exec spec spec/*
it fails with
/Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext/date/calculations.rb:10:in `alias_method': undefined method`+' for class `Date' (NameError) from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext/date/calculations.rb:10:in`included' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext/date/calculations.rb:9:in `instance_eval' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext/date/calculations.rb:9:in`included' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext/date.rb:8:in `include' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext/date.rb:8 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8:in`require' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8:in `each' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support/core_ext.rb:8 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support.rb:56:in`require' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/activesupport-2.3.10/lib/active_support.rb:56 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/actionpack-2.3.10/lib/action_controller.rb:25:in `require' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/actionpack-2.3.10/lib/action_controller.rb:25 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rails-2.3.10/lib/initializer.rb:965:in`require' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rails-2.3.10/lib/initializer.rb:965:in `middleware' from /Users/sean/projects/crowdcompass_rails/spec/../config/environment.rb:79 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rails-2.3.10/lib/initializer.rb:111:in`run' from /Users/sean/projects/crowdcompass_rails/spec/../config/environment.rb:12 from /Users/sean/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /Users/sean/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in`require' from /Users/sean/projects/crowdcompass_rails/spec/spec_helper.rb:15 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/spork-0.8.4/lib/spork.rb:23:in `prefork' from /Users/sean/projects/crowdcompass_rails/spec/spec_helper.rb:6 from /Users/sean/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in`gem_original_require' from /Users/sean/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require' from ./spec/models/activity_spec.rb:1 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:15:in`load' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:15:in `load_files' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:14:in`each' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/lib/spec/runner/example_group_runner.rb:14:in `load_files' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/lib/spec/runner/options.rb:134:in`run_examples' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/lib/spec/runner/command_line.rb:9:in `run' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/gems/rspec-1.3.1/bin/spec:5 from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/bin/spec:19:in`load' from /Users/sean/.rvm/gems/ree-1.8.7-2011.03@crowdcompass_app/bin/spec:19If I do not have home_run in my bundler Gemfile, and run the same spec with bundle exec, it works. I do believe that it would not be using home_run in that case. I did try including `require 'date'` in my environment.rb file and that did not seem to effect things.
The NameError for Date#+ is most likely because the ActiveSupport date extensions got loaded before home_run. Did you use home_run --install?
Basically, home_run --install puts the home_run files in site_ruby, which is earlier in the load path than the stdlib directory by default. It's possible for poorly coded software to still load the stdlib files instead of the files in the site_ruby directory, and that can cause problems, but that situation is fairly rare.
The alternative to home_run --install is using home_run command (e.g. home_run irb), but I'm not sure if that would interact well with bundler.
Try using home_run --install with the require 'date' in environment.rb and see if that makes any difference. If not and the app you are working on is open source, let me know where I can download it to attempt to troubleshoot the issue.
The first thing I did when I tried home_run again was to install home_run home_run --install
. I have tried running my code with bundle exec home_run spec spec/models/foo.rb
That did not work for me either. I have also added require 'date'
before line 22 in my environment.rb. That did not make a difference.
Unfortunately, the code I'm working on is not open source so I can't reveal much. I do think that home_run would be a good fit for my application because a big part of my application is an API for synchronizing content to client devices. So an improved DateTime library would likely be a big plus for my application. My app is fairly large, and has many gem dependencies. Tracking down the culprit may be difficult.
That's unfortunate. One possible workaround is to remove the stdlib date library completely, so that it cannot be loaded at all. To do so, you need to remove the date.rb and date/format.rb file from the stdlib directory. If you use home_run --install to add it to site_ruby, and remove the stdlib date completely, that may fix the issue.
Unfortunately, that's the only thing I can think of. If you do find the underlying cause and you believe it to be a bug in home_run, please reopen this ticket.
Thanks for the help, Jeremy.
I thought I would give home_run a try. I first ran my specs to make sure they were passing. I then installed home_run with
home_run --install
. I ran my specs again and it bombed out withuninitialized constant DateTime
. I then ranhome_run --uninstall
. I ran my specs again and now I getundefined method
advance' for #<Date 2011-03-19>`.The only way I can think to fix this is to uninstall my ruby version, reinstall it and all of my gems, and avoid using home_run until this has been adressed.
Below is the backtrace for the first error:
When I ran
home_run --uninstall
Running my specs after I uninstalled home_run: