Pushing Code to Multiple Projects in Rails

I’ve got a rails project that I would like to duplicate for each of my
sites. Rather than aggregating all sites into a single database, I
would like to let each site own it’s own database. The reason is that
I’m working with inventory and some possibly sensitive accounting
information, and I would like total separation between each client’s
data.

The plan is to keep a master development project, and then to copy the
code out to all of the sites. The best way I can think to accomplish
this would be to write a ruby file that copies some but not all of each
project to a new folder, and then deploy each site. So a new site
would be set up using commands like:

rails new_project

script/clone

Where script/clone would copy everything from the master development
site to the new site except the following files:

config
log
public/images
public/stylesheets
any file_column folders

and then for updates, I guess I would have a ‘update_clones.rb’ file
somewhere that would push everything except the above files out to all
sites.

I guess my question is whether there is some system already in place
for this. Does Capistrano handle it? There seems to be precious
little documentation on Capistrano. I don’t want to reinvent the
wheel, but I haven’t heard of anything like this so far.

Thanks for any feedback.

I have been working in development and am close to go beta in
production.
Is there a way, in rails, to copy the development database schema to
production
and initialize with base data?

Thanks for any pointers,

Long

Look up information about ‘migrations’ (which takes care of the schema)
and ‘bootstrapping’ (which takes care of the data).

Some links on Migrations:

http://glu.ttono.us/articles/2005/10/27/the-joy-of-migrations
http://garrettsnider.backpackit.com/pub/367902
http://rubyonrails.org/api/classes/ActiveRecord/Migration.html

I don’t have any links for bootstrapping, but I’m sure if you google
‘rails bootstrapping’ you’ll come up with something.

If you’re successfully using capistrano, after you set up your
schema.rb and migration files on your local machine you do

cap deploy_with_migrations

to send the schema out to the production machine. If you’re not using
capistrano, I don’t know what to do, but I would guess that if you just
upload those schema and migration files and then ssh into the remote
machine you could do

rake migrate

to update your production schema. I know this is far from a detailed
answer but it might point you in the right direction.

upload those schema and migration files and then ssh into the remote
machine you could do

rake migrate

to update your production schema. I know this is far from a detailed
answer but it might point you in the right direction.

Hi Jay,

Excellent links to keep handy! Thanks a bunch.

Long