Search code examples
ruby-on-railsrubyjrubydevelopment-environment

How to speed up rails development?


I'm running Jruby on Rails on Windows 7. Every time I make some changes in my code I have to restart the server (because I'm using the sidekiq gem for background job processing) and this is the procedure for doing that

In the first CMD window

First I need to kill all java processes(jruby on rails). Otherwise the server will complain that the address is already in use

taskkill /im java.exe /im javaw.exe /f

remove the pid file

rm -vf tmp/pids/*

start the server

rails server

In the second CMD window

bundle exec sidekiq

This is starting to feel sluggish since I have to do this every time I change a code.

I looked around and found this

find /your/application_directory -name=*.rb -exec ruby -c {} \;

What the above command does is loop through all files in the directory and check for syntax errors, but this doesn't seem to work in windows cmd even though I have the GNU find tool.

Is there any way to make changes in code and view it in the application without all this rigmarole? Do all other developers follow the same routine?


Solution

  • After a bit of googling I've found this: https://github.com/mperham/sidekiq/issues/209#issuecomment-8352050

    If you really want code reloading in development, you can just run sidekiq inline by adding this to development.rb

    require 'sidekiq/testing/inline'

    With that, you don't even need to run the sidekiq process.

    Which seems helpful (I also recommend reading the whole thread)