Tuesday, 15 March 2011

How to mimic a Ruby on Rails development environment -



How to mimic a Ruby on Rails development environment -

i new ruby on rails development. have been given task create changes existing ruby on rails website, created ror developer. question is, how setup local development environment mimics 1 previous developer used? there files in application guide me in process? such how connect staging database, right local server run, etc..

i have been trying figure out couple of weeks now. on previous project made changes application, pushed staging version on heroku. know horrible way things, had no other choice. and, don't want have 1 time again in instance. help appreciated.

step one: if previous developer didn't leave setup notes, start taking notes on learn, next developer work on project , going quicker.

first, you'll want sure you're using same version of ruby. check project's root .rvmrc or .ruby-version file or similar. might able see version beingness used in prod well.

next, database configuration, in config/database.yml expects find database. typically there 1 development runs on local machine, 1 test, , 1 production, there may others well. in our organization config/database.yml symlink config file in config/databases, , have different setups dev, qa, , production environments, plus custom ones individual developers. if company happens have development mode database in 'central' location, might able configure setup utilize 1 instead of having set on own box.

pay special attending 'test' database settings, database destroyed , recreated each time tests run.

next, run 'bundle install' , create sure gems installed without errors. 1 time have gems installed, might want load rails console create sure environment initializes properly. next, seek running test suite via 'rake test' or 'rake spec'.

hopefully 1 time that's running, you'll able start local server via 'rails s' in console , pointing browser @ localhost:3000. if project uses other services memcached, redis, or foreman, might need additional setup things.

you might read how thoughtbot handles this, plus comments using vagrant.

ruby-on-rails development-environment

No comments:

Post a Comment