I am developing 2 applications in Rails 3.1 (will upgrade soon), and have noticed that my current strategy has its drawbacks. What I am doing currently is:
- Work directly on the development directory, have there version control with Git (which works perfect for me).
-
I have defined the databases like (omitted not interesting parts):
development: database: db/dev.db production: database: db/dev.db -
I have both applications running all the time in production mode, where the ports are defined as 3008 and 3009.
- From time to time, I want to change little things, and start then a development server for one of the two applications directly with the defaults:
rails s thin(port == 3000).
I have noticed that the following things don’t work very well.
- When I change CSS or Javascript files, I have often to cleanup (and after development rebuild) the assets.
- Sometimes, the development server takes the files (CSS and Javascript) from one server and uses them for the other server. I have to manually clean the caches for the browser to avoid that.
What would be a better strategy to develop and use the two applications in parallel locally on my computer? Any tips and hints are welcome. Should I use a deployment tool (Capistrano) for that? Shall I roll my own Rake task for the divide? Or do I miss some magic switch that will heal the wounds (sounds pathetic :-))?
At the end, it is a mix of changes, so I answer my own questions and hope that others may learn something from it. At the end, there are 2 major decisions (and some minor ones):
Here are the changes that I have done.
rails/rootis the root directory of my application, the overall directory structure is the following:mkdir rails/productionmkdir rails/barecd rails/baregit clone ../root --barecd ../rootgit remote add bare ../bare/rootcd rails/productiongit clone ../bare/rootcd rootgit remote add bare ../../bare/rootroot> git push bareroot/../production/root> git pull bareroot> rails s thin -p 4009root/../production/root> rails s thin -e production -p 3009So as a result, I have a little more work to do, to stage changes from development to production, but I will eliminate those small irritations that were around all the time.