Configuring and running Ruby-On-Rails migrations - ruby-on-rails

I'm (completely) new to ROR and have got an application to maintain and upgrade. I've the source code and am trying to build database using db:migrate rake command. I've started using Aptana Studio for the development. When I run dg:migrate I get following errors:
rake db:migrate
(in G:/Projects/.../.../trunk)
MissingSourceFile no such file to load -- rcov/rcovtask
WARNING: rcov tests won't work
Looking for release_type overrides ...
=> Loading G:/Projects/.../.../trunk/config/release_type_config.rb
DEPRECATION WARNING: ActiveRecord::Base.allow_concurrency=has been deprecated and
no longer has any effect. Please remove all references to allow_concurrency=..
(called from allow_concurrency= at D:/Ruby/lib/ruby/gems/1.8/gems/
activerecord-2.3.5/lib/active_record/connection_adapters/abstract/
connection_specification.rb:98)
DEPRECATION WARNING: ActiveRecord::Base.verification_timeout= has been deprecated
and no longer has any effect. Please remove all references to
verification_timeout=.. (called from verification_timeout= at
D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/
connection_adapters/abstract/connection_specification.rb:108)
rake aborted!
no such file to load -- hpricot
I've installed hpricot gem also (version 0.8).
What is the remedy for this?

Install the rcov gem:
gem install relevance-rcov --source http://gems.github.com

The most significand error is
rake aborted!
no such file to load -- hpricot
You need hpricot. You can install it running the following command on the command line
gem install hpricot

Maybe your system can't find the gems. This could be a path problem, see this post for details.

Related

Solidus: [Spree WARNING] Missing migrations

I have a problem with Solidus 2.10.2 where when I run rails g spree:install several migration errors come up. Starting with [Spree WARNING] Missing migrations. and ending with [Spree WARNING] Run bundle exec rake railties:install:migrations to get them. but when I run bundle exec rake railties:install:migrations nothing happens...
I tried deleting the database (rails db:drop) and all my custom migration files as well before running the spree generator again however I get the same results. I put the full error in a bitbucket snippet (https://bitbucket.org/goldenBoySailsLow/workspace/snippets/5LGqez) I would appreciate any help
system info: rails 5.2.4.4, ruby 2.7.2, ImageMagick 6.9.10-23 and sqlite3 3.31.1 running on ubuntu 20.04 lts
I just had the same issue because I forgot to specify the version in the Gemfile. When I deployed, it started using solidus 2.11.2 instead of 2.10.2.
Specifying the version solved the problem for me.

rake is not recognized as an internal or external command, my PATH is set correctly

I am using ruby 1.8.6 and rake 0.8.7 on Windows now. When I type gem list in the command line, it shows:
rake (0.8.7)
And my path is set correctly to contain the ruby folder. But I still get the error message:
rake is not recognized as an internal or external command.
The problem is that you don't have any files in your path that Windows thinks are executable (.bat, .cmd, or .exe). Usually when Rake is installed, it recognizes you are running on Windows and installs the appropriate rake.bat file.
The first thing to try is reinstalling Rake:
gem uninstall rake
gem install rake -v=0.8.7
If that doesn't work, you can always try running Rake by using the Ruby executable directly:
ruby C:\path\to\ruby\bin\rake your_rake_task

rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported

I installed rails 3.2.3 in my pc but for my new project i need to work in rails 3.0.5 so I installed 3.0.5 version of rails and now when i write any rake command i get the following error
rake aborted! ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
currently this rake version is installed in my pc rake (10.1.0)
I know the error says everything but im new in ruby and rails. So i don't understand what to do. I googled it but most of the solutions ask to update rails
I know the error says everything but im new in ruby and rails. So i don't understand what to do. I googled it but most of the solutions ask to update rails
That's unfortunately the best solution. You are using a very old version of Rails that was based on some conventions of the time. Rake has changed and 10.0 is no longer compatible with that Rails version.
You should install a previous rake version. 0.9.0 should be sufficient.
In your Gemfile set
gem 'rake', '0.9.0'
then run $ bundle. Make sure you will prefix every command with
bundle exec
such as
bundle exec rake -T
instead of
rake -T
otherwise the script will fall back again using the most recent version of Rails on your machine.
For your reference, the reason of the error is probably caused by the documentation.rake file that at the very beginning it includes a deprecated rake file, removed in GH-1301.
Keep in mind that, assuming the app will then run, your first goal should be to upgrade your app. In fact, if you try to use it as it is, it's likely you will encounter so many other incompatibilities.
That was fairly simple to debug (assuming you have a reasonable knowledge of Ruby and Rails internals), but others may be harder or even impossible to fix forcing you to nothing else than upgrade.

How to run a specific version of rake

Background:
I get errors whenever I run rake in an older project. (uninitialized constant Rake::DSL).
The rails project in question is an old project that was started with Rails 2.1 (I think), and since then I've updated the OS on my laptop a couple of times, and made updates along the way to make it run.
Right now, the rails app works fine, provided I have RAILS_GEM_VERSION set to 2.3.5. I'm not sure if the app was completely updated to Rails 2.3.5.
There is no Gemfile in my older project.
If I create a brand-new rails project (and unset RAILS_GEM_VERSION), rake runs fine.
My question: To troubleshoot, I'd like to try newer versions of rake. I'd like to know how to force one specific version to be used, since it appears I have multiple versions installed.
Info on my environment:
$ gem list rake
*** LOCAL GEMS ***
rake (0.9.2.2, 0.9.2, 0.8.7, 0.8.3)
$ rake --version
rake, version 0.8.7
So it looks like it's picking up the 0.8.7 version.
All the help files online seem to tell me to specify the rake version in the Gemfile, but there isn't one in this project. (Maybe it predates gemfiles?)
If I unset the RAILS_GEM_ENVIRONMENT variable altogether, and try to run rake, I get:
rake aborted!
can't activate rails (= 2.3.5, runtime) for [], already activated rails-3.2.8 for []
None of the environment config files in my older project set that variable either.
This may be of help. Have you tried the underscore solution?
Example:
rake _0.9.2_
you can run rake specific version by using this
bundle exec rake ...
more detail see this - bundle exec, rake
You can uninstall the current version of rake and install another desired version using commands similar to the following:
gem uninstall rake 12.3.1
gem install rake 10.5.0
(Note: you might need to run as sudo for permissions)
I had a problem where I received the following error while trying to install rake 10.5.0:
Could not find a valid gem '0.8.7' (>= 0) in any repository
I resolved this problem by adding the following line to my Gemfile:
gem 'rake', ' <11.0'
After editing Gemfile I was able to successfully downgrade rake by updating my gems:
bundle update

Install Redmine using ROR error?

I tried to install redmine in my localhost. I installed Railsintaller then i dowload svn code from redmine. I found steps to install redmine in localhost in the below link http://www.youtube.com/watch?v=ethtaYKdl9g.
I got following error in the middle of installation. I am new to this environment.
Kindly check the below screen shoot and help to fix this.
UPDATED MY QUESTION
C:\redmine>rake db:migrate RAILS_ENV="production"
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/tas
k' (in RDoc 2.4.2+)' instead.
at C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rak
e/rdoctask.rb
C:/RailsInstaller/Ruby1.9.2/lib/ruby/1.9.1/rdoc/task.rb:30: warning: already ini
tialized constant Task
rake aborted!
uninitialized constant Gem::SyckDefaultKey
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Redmine requires Rails 2.3.14, and by the looks of it you've installed Rails 3.1.1.
You must install Rails 2.3.14 using this command:
gem install rails -v 2.3.14
Regarding your second issue, the uninitialized constant Gem::SyckDefaultKeyerror has been fixed in http://github.com/rubygems/rubygems/pull/250. So you might want to update your package manager:
gem update --system
Before launching again your command.

Resources