I'm pretty sure I should be posting this here, but feel free to correct me if this belongs on something like Superuser.
Trying to setup this Ruby/Javascript app https://github.com/jamesu/tubehub - on my freshly formatted Linode.
Running: Ubuntu v10.04 LTS, Ruby v1.8.8dev, Rails v3.2.9, SQLite v3.6.22.
I appear to be close to successfully installing and launching this app after much troubleshooting, but the last bit I can't figure out yet is the "aborted" errors I get when running the rake commands, as shown in the README documentation.
root#li570-120:~/tubehub# rake db:seed
rake aborted!
/root/tubehub/util.rb:8: undefined (?...) sequence: /^(.*?)((?<!&)#|\#)(.*)$/
/root/tubehub/util.rb:9: undefined (?...) sequence: /(?:\#)(?<!&#)(?:\#)*(.*)$/
/root/tubehub/core.rb:37
/root/tubehub/core.rb:36:in `each'
/root/tubehub/core.rb:36
/root/tubehub/Rakefile:2
Tasks: TOP => db:seed => environment
(See full trace by running task with --trace)
root#li570-120:~# rake db:load
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
(See full trace by running task with --trace)
This is my first foray into Ruby specifically, filtered through some "rake" docs but wasn't sure what I was looking at.
Any suggestions?
I'll add an answer.
Please use rake db:schema:load instead
As per Anatoliy Kukul's suggestion - "rake db:schema:load" got everything working correctly, and loaded all of the tables needed into the local database.
worked a treat - thanks for the clarification!
Related
Trying to get my rails up and running but am having a problem. When creating my new rails app on the command line I ran the usual
rails new PhotoApp -d postgresql
Generated my core scaffold. Then generated a model with attributes in the terminal and that was fine. After creating my model I first ran rake db:create and that returned a long log of characters with at the top telling me FATAL: role "PhotoApp" does not exist so then I tried rake db:migrate and that didn't work either returning me
rake aborted!
PG::ConnectionBad: FATAL: role "PhotoApp" does not exist
/Users/##$%^$#/Code/Projects/PhotoApp/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
WTF is going on here?
Thanks for any help.
The error is telling you that Postgres isn't finding your app. What does your database.yml file look like?
I would first run the rake task again, using the --trace as suggested:
rake db:create --trace
That will give you a more verbose tracing, so you can try to isolate the problem.
From experience I can tell you though that 'Roles' in Postgres can be a nightmare. How did you install Postgres on your machine? HomeBrew? The Postgres App?
Please post the full trace, as well as your database.yml file. This will help better assess the problem!
I use the command
rake doc:app
to generate some rudimentary documentation for my rails app. It's always worked fine in the past. Yesterday I upgraded by app from Ruby 1.9.3 to 2.1.1, and Rails 3.2 to 4.1. Everything is working fine with the app, so I went to regenerate documentation for the first time in a few weeks, and it failed. I ran the command above and got the following error message:
rake aborted!
Don't know how to build task 'README.rdoc'
/home/vagrant/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/vagrant/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => doc:app => doc/app/index.html
(See full trace by running task with --trace)
I believe this is the standard error message rake delivers for a task it doesn't know. Like if I ran
rake foo
It gives the exact thing, but with 'foo' instead of 'README.rdoc'. I get the same results when I run
bundle exec rake doc:app
I'm using rake 10.2.2. Any idea what's going on?
Create a README.rdoc in the project root folder. You might have removed it or replaced it with a README with another filetype extension.
I am experiencing an error with running the Rake command. When I try to Rake in my Rails project, I get an error that says Could not find rake-10.1.1 in any of the sources.
I put Rake 10.1.1 in my Gemfile, but it appears to do nothing when I bundle install.
I've tried uninstalling then installing the Rake gem in my computer's Ruby, RVM Ruby-2.1.0, the RVM Ruby-2.1.0#global, and the RVM gemset that I created for the specific project. I've also tried removing the Gemfile.lock and then bundle installing.
I've tried to manually run rake out of the terminal in multiple different Ruby/gems files including RVM. It gives this error:
/Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit;
~ me$ /Users/me/.rvm/gems/ruby-2.1.0/gems/rake-10.1.1/bin/rake ; exit;
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
I have a Rakefile in my project and have tried renaming it as well (Rakefile.rb, rakefile).
When I run Rake commands such as rake db:migrate, I get this error:
rake aborted!
undefined local variable or method config' for main:Object
/Users/me/RailsProject/config/environment.rb:4:in'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in require'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inblock in require'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in load_dependency'
/Users/me/.rvm/gems/ruby-2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:inrequire'
/Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in require_environment!'
/Users/me/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:250:inblock in run_tasks_blocks'
/Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in eval'
/Users/me/.rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks:15:in'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
I've looked everywhere for the solution before coming here, but I could not find it. I would be appreciative if someone could give me some advice on this issue. Thank you in advance.
Looks like it it having trouble finding dependencies. Have you installed rake on your system with gem install rake? If not you will need to use bundle exec rake.
I don't know what the problem was, but I solved it by creating a new gemset, installing Rake to it, and using it. I also switched from Rubymine to Sublime. It may have been Rubymine trying to use a different gemset. Beware of those IDE settings.
I'm looking at an existing Rails project and trying to see what rake tasks exist by running rake -T. However, when I run that I get:
(in /var/www/project)
rake aborted!
undefined method `mattr_accessor' for Sentry:Module
/var/www/project/Rakefile:10
(See full trace by running task with --trace)
vendor/plugins/sentry/tasks/sentry.rake has nothing called mattr_accessor in it. What is this error message referring to?
(See full trace by running task with --trace)
Did you try running the rake command with the --trace option?
I'm afraid this resolved itself while I was working on other issues. I'm not sure exactly what the problem was, but I believe it had to do with outdated/conflicting versions of plugins and gems.
I'm trying to do a rake migrate, but I'm getting an error when I do this:
rake db:migrate
What I get back:
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in `raw_load_rakefile'
(See full trace by running task with --trace)
How do I fix this? Thanks.
are you in the root directory of your project?
is there a file called Rakefile?
Make sure the current directory is within your project.
So for example:
cd ~/projects/greatness/
rake db:migrate
The error message seems rather self explanatory. There is no rakefile for rake to operate on.
If your rails structure is broken in some way, I'd suggest calling rails in a temporary folder then bringing across the script directory and rake file.