i have an old rails project here running rails 2.3.8 and ruby 1.8.7 with rvm.
when i'm running rake -T or another rake task it will fail with
I18n::UnknownFileType: can not load translations from /home/project/trunk/vendor/rails/activesupport/lib/active_support/locale/en.yml, the file type yml is not known
running some YAML in the console, will work.
i found some solutions for rails 3 and ruby 1.9.3 (Rails 3: 'The file type yml is not known' when trying to access basic _form.html.erb) and rails 2.3 with ruby 2 (Rails legacy app and Ruby 2 error: can not load translations from the file type yml is not known) but didnt help.
my Gems used in this project:
actionmailer (2.3.18)
actionpack (2.3.18)
activerecord (2.3.18)
activeresource (2.3.18)
activesupport (2.3.18)
afm (0.2.2)
Ascii85 (1.0.2)
bundler-unload (1.0.2)
color (1.8)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
hashery (2.1.1)
iconv (1.0.4)
little-plugger (1.1.4)
logging (2.0.0, 1.8.2)
multi_json (1.11.2)
mysql (2.9.1)
pdf-core (0.6.0)
pdf-reader (1.3.3)
pdf-writer (1.1.8)
prawn (2.0.2, 0.12.0)
rack (1.1.6)
rails (2.3.18)
rake (10.4.2, 10.1.1)
ruby-rc4 (0.1.5)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
transaction-simple (1.4.0.2)
ttfunk (1.4.0, 1.0.3)
script/console and script/server running fine.
i have to use ruby 1.8.7 and cannot update. upgrade to rails 3 is'nt possible in month's :)
do you have some idea's to get the rake tasks running?
best
robert
i found the solution:
there was several problems:
rake (10.4.2, 10.1.1) now just using rake 10.1.1
logging (2.0.0, 1.8.2) now just using logging 1.8.2
(after testing) had to replace rdoctask with task in Rakefile
now rake -T works fine
Out of the blue, I started getting the following error message:
(in /Users/me/.rvm/gems/ruby-1.9.3-p125#mysql2/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/me/.rvm/gems/ruby-1.9.3-p125#mysql2/gems/rails-0.9.5/Rakefile:3:in `<top (required)>'
When I do rails s (in my development environment terminal - Mac Mountain Lion). This application is in production, so I went to the production environment, did a bundle show, and modified my Gemfile, to harcode the gems versions.
Here's what I have now on my my local development environment (what's producing the error message).
actionmailer (3.2.3)
actionpack (3.2.3)
activemodel (3.2.3)
activerecord (3.2.3)
activeresource (3.2.3)
activesupport (3.2.3)
annotate (2.4.1.beta1)
arel (3.0.2)
bcrypt-ruby (3.0.1)
bootstrap-datepicker-rails (0.6.15)
bootstrap-sass (2.0.2)
builder (3.0.4)
bundler (1.1.3)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.1)
commonjs (0.2.6)
devise (2.0.4)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.4.0)
factory_girl (3.2.0)
factory_girl_rails (3.2.0)
hike (1.2.1)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (2.0.2)
json (1.7.1)
less (2.2.2)
less-rails (2.2.6)
libv8 (3.3.10.4)
mail (2.4.4)
mime-types (1.21)
multi_json (1.6.1)
mysql2 (0.3.11)
nokogiri (1.5.6)
orm_adapter (0.0.7)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.3)
railties (3.2.3)
rake (10.0.3)
rdoc (3.4)
rest-client (1.6.7)
rspec (2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
sass (3.2.7)
sass-rails (3.2.5)
sprockets (2.1.3)
stripe (1.7.0)
therubyracer (0.10.1)
thor (0.14.6)
tilt (1.3.5)
tinymce-rails (3.4.8)
treetop (1.4.12)
twitter-bootstrap-rails (2.1.0)
tzinfo (0.3.37)
uglifier (1.2.4)
warden (1.1.1)
webrat (0.7.1)
I researched Stackoverflow and the web, and none of the suggestions worked (changing the rake gem version to something different. like 0.8.7, etc., editing my app Rakefile to suppress deprecation errors, etc.). I also added rdoc and in my Rakefile, I required 'rdoc/task'
Still, the same error.
Just to help anyone else who has had this hassle.
If you are like me, then your problem is that the current version of rails is 4 and you are wanting to use an older version like 3.0.7
If you install rails fresh to learn it ,say, and the tutorial you are using is for a 3.0.x version of rails OR your job requires the use of the older version of rails.. then you can get into this hole.
In my case I got a 3.0.7 rails project dumped on me and was told to learn rails and make some enhancements to this code.
so, I just started learning rails and was following the tutorial until I got this error when doing a 'rake db:migrate'
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `require'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks/documentation.rake:1:in `<top (required)>'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `load'
/Users/pj/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.0.7/lib/rails/tasks.rb:15:in `block in <top (required)>'
This happened cos I was using an older version of rails.. in my case 3.0.7
If you run a 'bundle show', like I did then, you may see that you are using the rake version 10.0.0 or something like that...and you need to be running rake 0.9.2 ... which is where the problem is coming from..
The solution for me was to (a) add a gem to my gemfile and (b) to a bundle install
So, in my gemfile I added:
gem 'rake', '0.9.2'
Then did a
'bundle install'
Got this message:
You have requested:
rake = 0.9.2
The bundle currently has rake locked at 10.1.0.
Try running `bundle update rake`
And so I did that...
bundle update rake.
And that went fine.
then when I did the'rake db:migrate' it just worked.
Hope this helps somebody.
Vida.
PS: if you are new to rails, like me, and you inherit an older rails app then for gods sake NEVER run 'bundle update' or you will enter a world of pain. That command updates all your gems to the very latest versions and you end up with a load of problems with incompatibilities. The only way out of it is if you are lucky enough to have git installed and can do a 'git checkout' to go back...
I struck with this same problem when try to install gems by the command rake gems:install my rails version is rails2.3.2 and i have rvm installed.
my gem list is,
actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activeresource (2.3.2)
activesupport (2.3.2)
bundler (1.3.5)
rails (2.3.2)
rake (10.0.4)
rubygems-bundler (1.1.1)
rvm (1.11.3.7)
so uninstalled the rake by the command
rvm use ruby-1.8.7-p371#global && gem uninstall rake -v 10.0.4
then i installed rake of older version
rvm use ruby-1.8.7-p371#global && gem install rake -v 0.8.7
now rake gems:install works fine
hope it may help some one!
Upgrading to rails 4.0.0 I got the same error.
rails -v
(in /Users/oma/.rvm/gems/ruby-2.0.0-p247/gems/rails-0.9.5)
rake aborted!
ERROR: 'rake/rdoctask' is obsolete and no longer supported. Use 'rdoc/task' (available in RDoc 2.4.2+) instead.
/Users/oma/.rvm/gems/ruby-2.0.0-p247/gems/rails-0.9.5/Rakefile:3:in `<top (required)>'
(See full trace by running task with --trace)
To upgrade, I removed the version number in Gemfile
source 'https://rubygems.org'
gem 'rails' # NO VERSION
and did bundle update as I thought this would pick the last. But somehow, I got rails 0.9.5. It feels like some practical joke, really, lol
$ gem list rails
rails (4.0.1.rc2, 4.0.0, 0.9.5)
I can't tell you with 100% certainty that this was the cause, but we were two people, working on the same branch and seeing the same error. The fix worked for both of us. Simply
specify rails version!
$gem uninstall rails -v 0.9.5
Gemfile
source 'https://rubygems.org'
gem 'rails', '4.0.0'
then bundle, run rails -v, giggle (or cry) and get back to producing
Take a look at similar problem solution on StackOverflow
Another option is to use (example taken from Redmine Rakefile)
require 'rdoc'
require 'rdoc/task'
Instead of
require 'rake/testtask'
require 'rake/rdoctask'
The following works for me using ruby 1.9.3p448 (2013-06-27 revision 41675):
1) Use rake version 10.1.0 (put following in your Gemfile):
gem 'rake', '10.1.0'
(Note you can likely use another version, but the line number below might change.)
2) Comment line 54 of your Rakefile and replace it as follows:
#require 'rake/rdoctask'
gem 'rdoc', ">= 2.4.2"
require 'rdoc/task'
3) Test
$ bundle install
$ bundle exec rake
When I run rake db:migrate in my console:
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. C
onsider using bundle exec.
(See full trace by running task with --trace)
C:\Rails\myapp>bundle install
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.4)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.30)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using addressable (2.2.6)
Using bundler (1.0.18)
Using multipart-post (1.1.4)
Using faraday (0.7.6)
Using friendly_id (4.0.0)
Using hashie (1.2.0)
Using json (1.6.1)
Using multi_json (1.0.4)
Using mysql (2.8.1)
Using oauth2 (0.5.2)
Using omniauth (1.0.2)
Using omniauth-oauth2 (1.0.0)
Using omniauth-facebook (1.2.0)
Using rdoc (3.10)
Using thor (0.14.6)
Using railties (3.0.9)
Using rails (3.0.9)
Using rest-client (1.6.7)
Using sequel (3.20.0)
Using simple_form (1.5.2)
Using sinatra (1.0)
Using sqlite3 (1.3.4)
Using sqlite3-ruby (1.3.3)
Using taps (0.3.23)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.
rake aborted!
You have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. C
onsider using bundle exec.
(See full trace by running task with --trace)
This is probably because you have a newer Rake version on your system. You can do as the error says: bundle exec rake db:migrate which runs rake in your application context (rake 0.9.2), or just delete your Gemfile.lock and bundle again.
The same happened to me, bundle exec of course worked in the Terminal, but RubyMine would not listen. It turned out that the global gemset used the newer rake-version than the my 'local' gem set, I ended up uninstalling rake from the global gemset to make RubyMine happy again (after a restart that is).
I am trying to start a new rails project and I would like to stick with rails 3.1.3. However, when I run the command rails new projectname I get the following output:
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
...
create config
...
create config/database.yml
create db
...
create public/robots.txt
create script
create script/rails
create test/fixtures
create test/fixtures/.gitkeep
...
create tmp/cache
create tmp/cache/assets
create vendor/assets/javascripts
...
create vendor/plugins/.gitkeep
run bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.0.4)
Using activesupport (3.2.0.rc2)
Using builder (3.0.0)
Using activemodel (3.2.0.rc2)
Using erubis (2.7.0)
Using journey (1.0.0)
Using rack (1.4.0)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.0.rc2)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.3.0)
Using actionmailer (3.2.0.rc2)
Using arel (3.0.0)
Using tzinfo (0.3.31)
Using activerecord (3.2.0.rc2)
Using activeresource (3.2.0.rc2)
Using bundler (1.0.21)
Using coffee-script-source (1.2.0)
Using execjs (1.2.13)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.0.rc2)
Using coffee-rails (3.2.1)
Using jquery-rails (2.0.0)
Installing rails (3.2.0.rc2) # WTF?
Using sass (3.1.12)
Using sass-rails (3.2.3)
Using sqlite3 (1.3.5)
Using uglifier (1.2.2)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
I'd like everything to remain version 3.1. Why does the rails command automatically update itself to 3.2.0.rc2? How can I make sure that everything I do is using 3.1.3 versions of everything?
Thanks.
It is relatively little known fact that you can specify the rails version for a new application _like.this_
rails _3.1.3_ projectname
will work assuming 3.1.3 is installed (gem install rails -v3.1.3 otherwise)
This also works with rails 2 apps, i.e. pre-bundler and will create a rails2 looking application in these cases, e.g. rails _2.3.8_ projectname Again gem install rails -v2.3.8 if necessary (i.e. first time usage on that machine).
Longer term make sure you are using rvm (now a defacto standard) and you can use that toset your default rails (as well as ruby).
Removing the old version can be done with sudo gem uninstall rails -v 3.2.0.rc2
I'm really having a hard time solving this since I don't see any possible solutions that is already written on the net, So I decided to ask a question here at StackOverflow.
Firstly, I have created a new Rails app called "MicroTwitter":
rails new MicroTwitter -T
Here the -T option to the rails command tells Rails not to generate a test directory
associated with the default Test::Unit framework.
After that, I added a few lines on the Gemfile:
group :development do
gem 'rspec-rails'
end
group :test do
gem 'rspec'
gem 'webrat'
end
And so I did a bundle install
But after minutes of waiting, It was stuck up.
C:\Users\MDF\Desktop\apps\rails apps\MicroTwitter>bundle install
Fetching source index for http://rubygems.org/
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.5)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.5)
Using erubis (2.6.6)
Using rack (1.2.2)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.26)
Using actionpack (3.0.5)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.9)
Using mail (2.2.15)
Using actionmailer (3.0.5)
Using arel (2.0.9)
Using activerecord (3.0.5)
Using activeresource (3.0.5)
Using bundler (1.0.11)
Using diff-lcs (1.1.2)
Using nokogiri (1.4.4.1)
Using thor (0.14.6)
Using railties (3.0.5)
Using rails (3.0.5)
Using rspec-core (2.5.1)
Using rspec-expectations (2.5.0)
Using rspec-mocks (2.5.0)
Using rspec (2.5.0)
Using rspec-rails (2.5.0)
Using sqlite3 (1.3.3)
It stuck up just to sqlite3. To those who knew how to solve this problem, Your help is highly appreciated. Thanks!
Ok, I found out the problem.
I for got to install the "webrat" gem.
After I installed webrat:
gem install webrat
and did a bundle install again, It works like magic!
I guess I have to be more careful next time. Thank you for all the answers and comments! :)