Created
April 13, 2012 21:22
-
-
Save caseypugh/2380265 to your computer and use it in GitHub Desktop.
Rails Setup alpha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install Homebrew (http://mxcl.github.com/homebrew/) | |
Homebrew makes the Terminal Life Easy™ by making it simple to install any sort of application. This is important mainly because it manages everything for you. For example, you can install mysql by just doing "brew install mysql". it does all the magic of setting it up and might give you some extra instructions after it's done. Uninstalling is just as easy - brew uninstall mysql. If you're looking for a specific app, you can do a search too: brew search ruby. There's also tons of stupid apps like "figlet" which allows you to generate custom ASCII art (http://www.figlet.org/ or brew install figlet) | |
2. Git (http://git-scm.com/download) | |
This should be pretty straight forward in terms of installing, but i have some tricks that can make Git much simpler than it is. | |
- .git/config | |
This is a hidden folder in all your git checkouts. In your terminal go to a git repo and type "mate .git/config". This will open git's config file which can be enlightening. You can add a lot of custom things to this - for example, custom colorz! This is what i use and you should copy&paste into all your .git/config's | |
[color] | |
branch = auto | |
diff = auto | |
status = auto | |
ui = true | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
[color "status"] | |
added = yellow | |
changed = green | |
untracked = cyan | |
[alias] | |
st = status -s | |
ci = commit | |
ca = commit -a -m | |
co = checkout | |
br = branch -a | |
branches = branch -a | |
pick = cherry-pick | |
revert = checkout -f | |
The best part is the [alias] section. It allows you to create shorthand git commands. Instead of typing "git commit -a -m 'my latest changes'" you can just do "git ca 'my latest changes'". Or "git st" displays list of modified files in a clean/obvious way. Basically, these shorthands make it feel much simpler and more like SVN. | |
- Use git-friendly (made by jamiew!) https://github.com/jamiew/git-friendly | |
This makes pulling, pushing and branching much simpler. Follow the install instructions on the git page. The main thing this script does is save you from making mistakes and operate much quicker. If you have modified code and you do a "git pull", usually that overwrites the code you have written, or sometimes makes you commit your code before you can pull. Using jamie's "pull" will append your changes on top of the pull. Same w/ "push". It just auto pushes your code ... no longer have to type "git push origin master" or whatever. The best command is "branch" instead of "git branch". It makes it dead simple to create a new branch or switch between branches. So to create a new branch you just do "branch mynewbranch". If you want to go back to master, just do "branch master". If you have a bunch of modified files in master, you can swap those over into a new branch by just doing "branch mynewbranch". | |
There's a few tricks to Git still, so just IM me or get on Hipchat and i can answer Qs. | |
3. Ruby / Rails | |
- Install RVM (http://beginrescueend.com/) | |
First thing you'll need is RVM (ruby version management). This is similar to homebrew in that it manages stuff for you, but it only manages Ruby. Basically it allows you to have multiple versions of Ruby installed on your system. Why would you want that? You'll encounter that the more Rails projects you work the more often people use very specific versions of Ruby. For example, VHX is built on ruby 1.8, but Aziz Anasari is 1.9. When I switch between those two foldres (/vhx and /aziz) RVM automagically uses the right Ruby version for each project. Headaches gone! | |
- Install Ruby Gems (http://rubygems.org/pages/download) | |
Gems are basically plugins for ruby. Every Rails project has a "Gemfile" in it's root directory. This is a list of all the Gems it needs to work - basically you don't have to worry about what gems to install because each rails project does it on it's own. | |
- Install Rails!! | |
gem install rails | |
- Create a Rails app (or cd into one) | |
rails new path/to/your/new/application | |
cd path/to/your/new/application | |
- Install Pow!!! (http://pow.cx/) | |
This is the real magic. Pow allows you to have real URLs for all you dev sites. Instead of going to http://localhost:3000, you can do http://vhx.dev. You don't even have to run any commands to boot the server. Pow will automagically start the server as soon as you go to vhx.dev. | |
- Instal Powder!!! (https://github.com/Rodreegez/powder) | |
Makes Pow maintenance easier | |
Example Rails app: | |
rails new ~/dev/myfirstsite | |
cd ~/dev/myfirstsite | |
cd ~/.pow | |
ln -s /dev/myfirstsite | |
Open browser and go to http://myfirstsite.dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment