I am unable to any rake tasks within my Rails project. Any attempt to do so results in the following error, stating that it cannot locate an rspec file for ci_reporter:
rake aborted!
LoadError: cannot load such file -- ci/reporter/rake/rspec
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
/Users/blake/workspaces/ruby/minestatus/Rakefile:6:in `<top (required)>'
/Users/blake/.rvm/gems/ruby-2.0.0-p643/bin/ruby_executable_hooks:15:in `eval'
I have made the following attempts to reset my environment to a working state:
Installing the newest ci_reporter gem from github
Deleting Gemfile.lock and re-running bundle install
Reinstalling Ruby 2.0.0 using rvm
Unfortunately none of the above things have helped me solve this issue. I am able to run rake tasks in other Rails projects, but not in this one. Rake tasks used to run just fine, and I'm not sure what changes I could've made to break things. Does anyone have an idea of what I can do to get rake tasks to run properly again?
Related
I am trying to run the specs for a local clone of the activeadmin gems current master.
I am using ruby 2.2.2 and have bundled successfully.
When I try to run one of the specs like so:
bundle exec rspec spec/unit/filters/humanized_spec.rb
I am getting the following error:
The git source https://github.com/jruby/activerecord-jdbc-adapter is not yet checked out. Please run `bundle install` before trying to start your application
Coverage report generated for RSpec to /Users/aljoscha/gem/activeadmin/coverage. 0.0 / 0.0 LOC (100.0%) covered.
/Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `require': cannot load such file -- active_record (LoadError)
from /Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `<top (required)>'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `require'
from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `load'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `<main>'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
which I cannot make sense of.
Especially since activerecord-jdbc-adapter is not even in the Gemfile.
What am I missing?
Try prepending your command with bundle exec:
bundle exec rspec spec/unit/filters/humanized_spec.rb
It looks like you have a local version discrepancy causing issues.
If not, did you follow all of the steps listed on their contributing readme?
If you are still stuck, you may be experiencing an issue with bundler itself. First, try updating bundler then reinstalling gems and attempt to run rspec. If that doesn't work you may need to delete the bundle cache folder and start over.
I'm going to re-answer to emphasize how to test a gem using appraisal as mentioned in CONTIBUTING:
bundle exec appraisal install
bundle exec appraisal rails_50 rspec spec/unit/filters/humanized_spec.rb
Thank you for your interest in Active Admin.
I'm having an issue trying to switch the database in my rails app from the out of box sqlite3 to using postgres.
I've run 'gem install pg' and switched the database.yml file to new settings. Also, I've run 'bundle install' in the directory.
Now, when I run 'rake db:setup', I'm receiving this error:
$ rake db:setup
rake aborted!
LoadError: cannot load such file -- rails
/Users/aaa/Documents/Projects/sample_app/config/application.rb:3:in `require'
/Users/aaa/Documents/Projects/sample_app/config/application.rb:3:in `<top (required)>'
/Users/aaa/Documents/Projects/sample_app/Rakefile:4:in `<top (required)>'
/Users/aaa/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/Users/aaa/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
Any thoughts? Thank you in advance.
Oy, had the wrong version of rails in my gemfile.
If anyone else finds this, make sure running rails -v has your intended result! I was receiving an error when trying to see my rails version, and then changing my gemfile solved the issue.
I have run this rake routes command in terminal but not working, But it's working few days back. Please check it
jaskaran#jaskaran-Vostro-1550:~/rails_project$ rake routes
rake aborted!
Gem::LoadError: You have already activated rake 10.3.2, but your Gemfile requires rake 10.2.2. Prepending `bundle exec` to your command may solve this.
/home/jaskaran/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:34:in `block in setup'
/home/jaskaran/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/runtime.rb:19:in `setup'
/home/jaskaran/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler.rb:120:in `setup'
/home/jaskaran/.rvm/gems/ruby-2.1.0#global/gems/bundler-1.6.1/lib/bundler/setup.rb:7:in `<top (required)>'
/home/jaskaran/rails_project/config/boot.rb:4:in `<top (required)>'
/home/jaskaran/rails_project/config/application.rb:1:in `<top (required)>'
/home/jaskaran/rails_project/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- bundler/setup
/home/jaskaran/rails_project/config/boot.rb:4:in `<top (required)>'
/home/jaskaran/rails_project/config/application.rb:1:in `<top (required)>'
/home/jaskaran/rails_project/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
Try running bundle exec rake routes to ensure the proper version of Rake gets loaded.
You need to update your gems to the latest available versions: bundle update
Rake versions seems to be different. So, run it as bundle exec rake routes. It should be working.
The correct solution to your problem is to use bundle exec, as suggested by others, to load the version of Rake which your app expects. You may also wish to avoid needing to always run Rake commands with bundle exec. You can either
1) [Recommended] Update your app to use the same version of rake as you have running globally (10.3.2, which is the latest version)
or
2) [Not really recommended] Uninstall version 10.3.2 (actually, any version greater than the one you want) from your global gems and install version 10.2.2 (which your app is currently using)
rvm #global do gem uninstall rake
rvm #global do gem install rake --version 10.2.2
See RVM documentation for global gemsets
I'm trying to debug rake task in rubymine. I created debug configuration for this task. Ruby SDK I chose project SDK. When I try to run this I got:
Gem::LoadError: You have already activated rake 10.2.2, but your Gemfile requires rake 10.1.1. Prepending `bundle exec` to your command may solve this.
/home/arkency/RubyProject/trainer/config/boot.rb:6:in `<top (required)>'
/home/arkency/RubyProject/trainer/config/application.rb:1:in `<top (required)>'
/home/arkency/RubyProject/trainer/Rakefile:5:in `<top (required)>'
/home/tomek/.gem/ruby/1.9.1/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:86:in `debug_load'
/home/tomek/.gem/ruby/1.9.1/gems/ruby-debug-ide-0.4.22/lib/ruby-debug-ide.rb:86:in `debug_program'
/home/tomek/.gem/ruby/1.9.1/gems/ruby-debug-ide-0.4.22/bin/rdebug-ide:110:in `<top (required)>'
When I run task from terminal all works fine. I don't know from where rubymine takes this rake gem. How to check it? How to change to use the proper Gem? Thanks for all answers.
Click Run => Debug => Edit Configurations, select Bundler tab and check the Run the script in context of the bundle
When I try to run "rake test" on my newly generated rails application I receive the following error
Computer:heroku user$ rake test:units
/Users/user
file doesnt exist
/Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': cannot load such file -- /Users/user/test/unit/helpers/things_helper_test.rb (LoadError)
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:10:in `block (2 levels) in <main>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `each'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:9:in `block in <main>'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `select'
from /Users/user/.rvm/gems/ruby-1.9.3-p0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!
Command failed with status (1): [/Users/user/.rvm/rubies/ruby-1.9.3-p0/b...]
Tasks: TOP => test:units
(See full trace by running task with --trace)
I am guessing that this is related to my setup somehow, as it seems as if rake is looking for the generated files in my home directory instead of the rails application directory. Could you help direct me to what I am doing wrong?
I am using Mac OS X Lion, have two installed ruby versions (1.8.7 come with lion, 1.9.3 which I am using for the application has been installed using rvm).
The application works if I run "rails s".
Update: If I create a new rails application from scratch, adding only a generated scaffold, the rake test command works. Ergo, it might be a incompatibility issue as the failing rails application was created on another computer, uploaded to heroku and then cloned from there to a new computer.
Funny story. I'd accidentally put some test code in one of the files, among other containing:
Dir.chdir("../..")
I'm guessing that when I run rake test the file got executed to load the class contained in the file, and caused problems when looking for the next file, when the current directory had suddenly changed.