Subversion and Rails HOWTO
Version 1.02Preface
So someone (probably Dan) convinced you that installing Rails was the thing to do. After all, the cool kids are doing it, and you want to be cool, right? Right? I thought so. This is how you're going to do it.
Contents
The Requirements
- An Apple computer running OS 10.4 or higher
- The appropriate version of XCode for your version or Mac OS, or, enough bandwidth and patience to download it from http://connect.apple.com (It's big)
- Internet access
- A willingness to use the terminal
- An account on an svn server, and someone willing to walk you through the basics of svn once everything is installed.
- Time and patience
But wait! I live in The Future™, will these instructions work for me? Why, yes they will! In fact, in The Future™ you can even skip a few steps. If a step is in italics, those of you in The Future™ can ignore it and go on your merry way!
The Complete Process
These steps will get you set up to download, edit and commit files to a repository. Additionally, you will be able to run a project on your local system during development.
- Install the developer tools, either from the CD, or the internet.
- Download and install Darwinports.
- Edit your path in the terminal to include the following:
/opt/local/bin:/opt/local/sbin - Make sure the ports tree is up to date; open the terminal and run: sudo port -d selfupdate
- Edit your path in the terminal to include the following:
- Use DarwinPorts to install a few things (the following list items should be entered as commands in the terminal
- sudo port install subversion
- sudo port install rb-rubygems
- Now, we can install Rails, and some of the ruby gems (extensions) that it uses. As with the previous step, each of these items should be entered in the terminal exactly as it is here. Pay close attention here, as there will be some switching back and forth between ports and gems.
- sudo gem install rails --include-dependencies
- sudo port install GraphicsMagick
sudo port install lighttpdsudo port install fcgi- sudo gem install rmagick
sudo gem install fcgi -- --with-fcgi-dir=/opt/local- sudo gem install RedCloth -y
- sudo gem install tzinfo
- sudo gem install money
- sudo gem install capistrano -y
- sudo gem install mongrel -y
- sudo gem install sqlite3-ruby -y
- Download and install MySQL
- sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
- Download and install CocoaMySQL
- Download and install svnX
What is all this crap?
In the course of following these instructions you have filled up your computer with a whole bunch of buzzwords and acronyms. You're probably asking yourself what all this junk is, and why you need it. So here's a handy little cheat-sheet explaining things.
- Apple's developer Tools (XCode)
- A set of programs and libraries used to compile other programs and libraries. It is the groundwork that the rest of the software needs to run on your system.
- MacPorts
- MacPorts is a system used to install, upgrade, keep track of and uninstall software packages (called 'ports'). Using it to install all of the other software helps to keep a consistent setup for everyone.
- subversion (svn)
- A version management system. It allows multiple people to work on the project simultaneously, and keep in sync via a central repository. You can roll back to a previous version if something goes wrong, as well as merge changes with other users who have modified the same file as you.
- svnX
- A front end for subversion. If you're less than comfortable in the command line, this may be the thing for you to use.
- GraphicsMagick
- A set of commands and libraries used to manipulate images.
- MySQL
- A database system. You'll need this for running local copies of database driven apps.
- CocoaMySQL
- A graphical client for connecting to your MySQL databases. You want this because the MySQL command line is a scary place.
lighttpdThis is a webserver. While not strictly necessary, it's a lot faster than the server that is included with Rails (Webrick). Really, you want this.- rb-rubygems
- The Ruby Gems system. Gems are each an extension of Ruby.
- rails
- The Ruby on Rails framework. This is what has all the cool kids talking like they've drunk the proverbial kool-aide
- rmagick
- This allows ruby to work with GraphicsMagick to manipulate images.
fcgiFastCGI, this allows the server running your Rails application to behave in new an interesting ways, which as the name implies, are fast.- RedCloth
- Allows ruby to interpret Textile markup. Not necessarily important in general, but since we make use of Textile in our CMS's it's a good thing to have around.
- mongrel
- Mongrel is a snazzy webserver written (mostly) in ruby. It's way faster than Webrick and way friendlier than lighttpd. Rails 1.2 will support it out of the box. You want it.
- Capistrano
- Used to maintain the live copy of the Rails application. It's sort of like versioning for the database. It's a good thing. You probably won't use it directly anytime soon.
- mysql
- This gem allows Ruby to interact with your MySQL server
- sqlite3-ruby
- This gem allows rails to interface with OSX's built-in sqlite install. This is useful for development on smaller, or less complex projects than using a complete mysql system.
- money
- Dealing with currency? Payments? Collections? This will make things easier on you.
- tzinfo
- tzinfo makes rails play nice with timezones. Since the internet spans more than one time zone, this may make your web app a lot better if time is a factor at all.