Glassfish, JRuby, Rails 3 throws rake error - ruby-on-rails

Hello
I am currently using:
Ubuntu 10.04LTS
Netbeans 6.9.1 (with embedded JRuby 1.5.1)
JDK6u17
GlassFish Gem 1.0.2
I am using a old JDK because of this bug:
http://jira.codehaus.org/browse/JRUBY-4785
I have partially completed application, but i want migrate to rails 3(currently application is in rails 2.3.8).
So i go to:
$HOME/netbeans-6.9.1/ruby/jruby-1.5.1/bin and type: jruby gem install rails -v=3.0.3. Everything is OK.
Then i create a sample RoR project and use some simple scaffold. Works.
But when i choose in Netbeans rake db:migrate it shows me message: "db:migrate" taks does not exist.
Any idea how to fix that?
I would be grateful for the help.
UPDATE
I have tested this in Ubuntu and it works fine.
But in Mac OS X this trick don't work.
So I made a symbolic link called jrake to jruby/bin/rake
cd /bin
ln -s /Applications/NetBeans/NetBeans\ 6.9.1.app/Contents/Resources/NetBeans/ruby/jruby-1.5.1/bin/rake jrake
and I just type jrake db:migrate in project Directory and it works.

Does this link help?:
http://www.blakes-site.co.uk/blog/13/Fix-NetBeans-dbmigrate-task-does-not-exists-error/
UPDATE
Link broken - From the Google Cache of Blake Simpson's blog:
I have recently reinstalled Ruby on Rails 3.0.0 and created a new
Rails project in NetBeans 9.6.1
I could not migrate my database, or any other rake tasks for that
matter. I kept getting the error:
"db:migrate" task does not exist
The solution is to right click your project select "Run/Debug Rake
Task" and then click the button titled "Refresh Tasks".
Once this is done you should see a list of all your rake tasks. After
this you can simply re-run the db:migrate task and it will work.

Related

Redmine on Windows - error rake generate_secret_token

I am trying to follow the Redmine guide here.
I am running into the same problem this previous post, but the solution didn't solve it for me.
Steps that I have done so far:
Ruby
I have downloaded/installed the Ruby from http://rubyinstaller.org and verified that Rails was installed.
rails -v
Rails 5.1.3
ruby -v
ruby 2.3.3p222
MySQL
Visual Studio 2019 redistributable installed.
Ran the MySql installer msi
Selected the Developer (Defaults)
Took all the defaults for the rest of the wizard (I did set root password and added a user)
*I think I had to do all this first before starting the Installation procedures.
Redmine
Completed step 1-4 with the MySQL settings
Step 5
Running the command:
bundle exec rake generate_secret_token
Could not locate Gemfile or .bundle/ directory
I have verified that rake is installed
rake -V
rake, version 13.0.1
gem list rake
(rake 13.0.1)
Using the stackoverflow post from above, I did update the version of rake I had installed, but that didn't solve the issue. I am new to gem/bundle type of installs, so I may be missing something that is quite obvious.
Do I need to be a specific directory when running these commands?
Any direction for me would be good. I am trying to run this on a Windows Server if that makes any difference.
Redmine is a Rails app. You must download the app, extract it, then change into that directory before running your rake task. The process for this is defined in step 1:
Get the Redmine source code by either downloading a packaged release or checking out the code repository.
See the download page for details.
Afterwards, you can run bundle exec rake generate_secret_token because that is a Rake task defined by lib/tasks/initializers.rake. Rake tasks in Rails are typically defined within the lib/tasks directory and you can see multiple examples there.
If you attempt to run rake something then Rake is going to look for a Rakefile where this task is defined. Since you're currently just in your Ruby bin/ directory there are no defined rake tasks so you get the errors that you see.

Netbeans error creating project ruby on rails

when i'm trying to create a new rails project in netbeans. it gives me following error
rake aborted! cannot load such file--
warbler F:/ninto/RubyApplication3/lib/tasks/warbler.rake1:in
'require'F:/ninto/Ruby/RailsApplication3/Rakefile:7:in'<top(required)>'
this occurs when i check the option
Add Rake Targets to Support App Server Deployment(.war)
i'm using netbeans 7.3, rails 3.2.13, ruby 1.9.3p392, windows. Googled through many posts still couldn't find an answer.
thanks

Cannot running 'rake db:migrate' on a cloned github repo

Since I am new to rails and have learned the very basics from books I now figured that I can learn quite a bit more from reading other peoples code and trying to make sense of it so I have signed up at github and set up everything there. Now I read that one good open source project to learn from is radiant so I went to https://github.com/radiant/radiant and cloned it to a local directory. THen I proceeded as follows:
cd radiant
bundle install, which went fine
rake db:migrate, which first returned:
rake aborted! You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Using bundle exec may sol
So I typed in bundle exec rake db:migrate and recieved the following:
NOTE: Gem.source_index is deprecated, use specification. It will be removed on or after 2011-11-01. Gem.source_index called from c:/Ruby192/lib/ruby/gems/1.9.1/gems/rails-2.3.14/lib/rails/gem_dependency Rake aborted! No such file to load -- radius
So here I am wondering how to fix this problem? I also noticed that a Gemfile and a Gemfile.lock already existed in the radiant folder when it was cloned, which perhaps could be part of the problem?
Also I wonder if it is crutial that I run the same version of rails as the project is written in?
Now it should be said that I currently have rails 3.0.5 installed and run on windows
I hope someone can help me here, it has been quite frustrating since I have not been able to run any cloned github repos (radiant here just being one example).
You should edit your Gemfile and make it require newer rake.
Also you can run rake db:migrate --trace to get additional error information.
The deprecation warning is still just a warning, and it shouldn't be causing you any issues. The part of that error that is relevant is the No such file to load -- radius. You probably need to follow the instructions for installing Radiant, which include running a gem install radiant before dropping this project code somewhere.
Bundler manages installing and using the gems in your Gemfile, and if a Gemfile.lock is present it'll use those exact versions. This means you can't run Radiant with Rails 3.0.5 since the Gemfile specifies 2.3.14. Bundler will install Rails 2.3.14 and its dependencies automatically, though, so you don't need to worry about it.
By the way, this project looks like it has been very mismanaged. It's not common for a Rails project/gem to force you to actually clone it to use it. If you want to check out a Rails 3 project to learn from, I have a slim Rails 3 app that was intended to be an API up publicly on Github with some really clean code: http://github.com/coreyward/instavibe

Ruby on Rails 3 simple-navigation could not find in any of the sources

I've be using simple-navigation and it's working fine. I've just tried to do a database migration using:
rake db:migrate
and get the error:
test me$ rake db:migrate
(in /Users/me/test)
Could not find simple-navigation-3.2.0 in any of the sources
Try running bundle install.
I've run bundle install and I have a working navigation in the application. Running the db migration is the only problem I'm having.
Any ideas?
Turns out it was a problem with my environment. I installed rvm and installed the latest version of Ruby and everything works fine now.

Freeze Rails 2.1.0 in Dreamhost using Rails 3.0

I have 2 applications on Dreamhost using Rails 2.1.0, recently they installed Rails 3 on my server and broke my apps.
I found this post that explains how to freeze a rails app - http://www.softiesonrails.com/2008/1/3/freezing-your-rails-application, but when I run the command rake rails:freeze:gems back this error:
rake aborted!
can't activate rails (= 2.3.8, runtime) for [], already activated rails-3.0.3 for []
I uninstalled and installed again the rake, but still resulting in this error. What can be done to solve this problem? someone went through this already know or help me?
All freeze:gems does is copy the gem directory to vendor/gems, you can do this by hand.
Another way you can get this done is to locally install Rails 2.1 and get get your app running and rake rails:freeze:gems there, then upload back to the server.

Resources