Make a new rails 3.2 app in the VM Environment
After installing the VM on the computer, one can make a new Rails App by the following process:
- Go to the machine directory in your host machine using the command line
- Start up the VM if it is not running
vagrant up
- Connect to the machine
vagrant ssh
-
First time only, tell git who you are
git config --global user.email "you@example.com" git config --global user.name "Your Name"
- Change to the directory that is shared between the guest OS and the host OS
cd /vagrant
- Create a new Rails application without running bundler
rails new appname --skip-bundle
- Install git’s tracking repository
git init appname
- Change to the application directory
cd appname
- Update
.gitignore
to skip trackingdatabase.yml
You can edit this on the host side rather than the OS side if you like your local editor better but use one that likes Unix line endings (i.e. NOT Notepad).
.gitignore
- Move the code to check in to the staging area
git add .
- Commit the code the repository
git commit -m "Initial commit after ignoring database.yml"
- Make a copy of database.yml for archival
cp config/database.yml config/database-example.yml
- Modify the Gemfile to include thin, theracer, and quiet_assets gems.
Gemfile
- Run bundle to lock in the gemfiles using the local version of the gems
bundle install --local
- Start up the Rails app
rails s
- On the host side, point the browser to
http://192.168.33.10:3000
and ensure that the base Rails “Welcome aboard” is visible.
Updated 7 June 2013 after presentation to class – correcting two typos.
Leave a comment