Rails dev env tips&tricks

for RubyGarage by Leonid Shevtsov

Control your environment, because it controls you.

Replaces: rails [s]erver Lets you run multiple apps on virtual hosts app1.dev, app2.dev, ... - as much as you need zero configuration for Rails http://pow.cx

Pow - autostart apps
What if you linked 100 apps to Pow? Will they all hang out in RAM? No! Pow only loads apps that are actively used

Pow - powder
gem install powder Convenient wrapper for common Pow actions (Pow has no ‘interface’ of its own.) powder link powder restart, powder always_restart powder log

Pow - remote testing
How can you test your site on a phone/tablet? How can you share the site with a QA engineer? app. routes to ip Pow routes app. to actual app. No magic, no security issues.

Pow - not only for Rails
Any Rack app is naturally supported. Any static site is naturally supported. Any app.dev can be routed to a server listening on some port (PHP or node.js or nginx or else).

Replaces: irb and rails [c]onsole That’s just the tip of an iceberg of usefulness. Not only for running code, but for exploring code. http://pryrepl.org Read the wiki (seriously)

Pry - just replace irb
All you need is to paste this into your ~/.irbrc
require “rubygems” require “pry” Pry.start exit

Pry - browse methods

show-method - show source code of a method edit-method - open the method in your editor (useful for debugging gems)

Pry - rescue exceptions
Debug your code without writing extra code. wtf? command shows backtrace. edit --ex edits code at the exception line. pry-rescue and pry-exception-explorer - open pry inside the exception handler

Sublime Text 2
Replaces: your clunky editor A modern, crossplatform text editor. Really fast. Keyboard controlled. Easy to extend; Python API. A great visual approach to macro editing. http://www.sublimetext.com Free and fully featured for an unlimited period of time.

ST2 - syntax checking
For me, one of the most useful features of any editor. Syntastic plugin Handles most popular languages (and extendable). Ruby, Haml, Sass, Javascript, Coffeescript

ST2 - splits
For me, one of the must-have features of a code editor. Has splits built in, but a bit cumbersome. Origami plugin makes splits almost as easy as Vim. (no “open file in split” command)

ST2 - package control
Package Control plugin A centralised repository of plugins, with one-click installation. The configuration is plaintext and packages are just directories. Easy to backup, .dotfiles-ready. Google “sync sublime text 2 dropbox”

Questions? git & hub ssh-config oh-my-zsh

Sign up to vote on this title
UsefulNot useful