Rails development environment talk
Upcoming SlideShare
Loading in...5
×
 

Rails development environment talk

on

  • 3,036 views

What tools do I use as a Rails developer?

What tools do I use as a Rails developer?

Statistics

Views

Total Views
3,036
Views on SlideShare
2,791
Embed Views
245

Actions

Likes
5
Downloads
20
Comments
0

6 Embeds 245

http://7enn.com 214
http://lumitraining.com 22
http://www.newsblur.com 5
http://www.hanrss.com 2
http://webcache.googleusercontent.com 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Rails development environment talk Rails development environment talk Presentation Transcript

  • My Ruby (and Rails) environment Reuven M. Lerner • reuven@lerner.co.ilRails Underground, Israel • July 13th, 2011
  • Who am I?• Web developer, software architect, consultant, lecturer/trainer• Linux Journal columnist since 1996• Mostly Ruby on Rails + PostgreSQL, but also Python, PHP, jQuery, and lots more...
  • Want to learn Rails?• I’m teaching a course at Hi-Tech College• Not very far from here!• August 14 - 18 , 2011 th th• (I can do private training as well...)
  • Also:• I’m swamped with Ruby work!• Want to help me out?• (I need to sleep!)• Come speak with me after my talk...
  • Tools are important
  • Shell• For years, I used bash • GNU Bourne-Again Shell• I recently switched to zsh• I use the plugin, “oh my zsh”• Did it change my life? No. • But some things are easier
  • Better things• Easy-to-customize prompt• Saner history (across terminal tabs)• Automatic updates of oh-my-zsh• One configuration file (.zshrc)
  • Things I use often• C-z (suspend) and fg• Emacs keybinding• C-r (reverse search• Customized prompt
  • iTerm2• The OS X terminal is OK• iTerm used to be much better• Recently rewritten as iTerm2• I use very few of the features • Lots of tabs, though!• My favorites: Search, movie playback
  • rvm• Don’t develop in Ruby without rvm• Really, it’s amazing• I use 1.8.7, 1.9.2, and JRuby day to day • Learn about updates!• .rvmrc for each project I work on• Gemsets vs. bundles — bundles are winning
  • irb• I use irb (or the Rails console) every day• If you’re programming in Ruby, then you should probably have IRB open always!• Every piece of code I write, more or less, is tried in IRB first• Debugging largely happens for me in IRB
  • Gems for IRB!• There has been an explosion of IRB- enhancing gems• I’ll present some of them• Most or all of these are from the “irbtools” gem, which packages them together
  • ap• “Awesome print” — and it is!• Data structures look nicer, in color
  • Sorted methods!• How often do you write foo.methods.sort• Now you can just write foo.methods
  • every_day_irb• Puts shell commands in IRB! ls cat pwd
  • ;nil after long evals• Cute trick: If you’re reading a lot of data, add ;nil• to the end of your command, so that IRB won’t print it all.
  • hirb• Shows data in a table• Sort of like ap, but for to_s• Better with ActiveRecord output• If you want to disable it (I do by default), just set Hirb::View.disable, or Hirb::View.enable
  • methodfinder• Methodfinder.find• Object#find_method "abc".find_method("ABC")
  • sketch• Anonymous edits• Named edits• Great with emacsclient (for Emacs users) sketch sketch :foo
  • GNU Emacs• One True Editor• I’ve used it since 1988 (yes, 1988!)• More operating system than editor• Configure it in Emacs Lisp • Full, Turing-complete language with oodles of functions for text, files, networks, and psychoanalysis
  • Ideal Emacs keyboard
  • Required anti-vi jokeSubject: Re: HELP: music for cl, vi, vlc, piDate: 14 May 1996 10:35:43 +0200Alan> vi doesnt play music.David> Sure it does.In fact, vi has a special mode just for music. If youare not in insert mode, you are in `beep mode:whatever you press produces a beep. In the besttradition of vi, there is of course just one note(you know: small is beautiful) but this is just oneof those reasons why vi hackers love vi.
  • How Emacs works
  • How Emacs works Lisp function
  • How Emacs works Lisp Key binding function
  • How Emacs works LispKeystroke Key binding function
  • Sounds crazy?• It’s great.• Define functions. Or install packages.• Set bindings (global or modal).• Use control-alt-shift-meta-cokebottle
  • Function, binding(defun indent-buffer (&optional which-buffer) "Indents a buffer (default is current)." (interactive "bBuffer to indent: ") (indent-region (point-min) (point-max) nil) (beep) (message "Done indenting"))(global-set-key "ei" indent-buffer)
  • (add-hook ruby-mode-hook (lambda () (interactive) (inf-ruby-keys) (rainbow-delimiters-mode t) (turn-on-font-lock) (ruby-electric-mode t) (rvm-activate-corresponding-ruby) (if (and (not (null buffer-file-name)) (file-writable-p buffer-file-name) (not (string-match "jruby" rvm--current-ruby-binary-path))) (flymake-mode)) ))
  • Snippets• TextMate fans, rejoice — Emacs has snippets, too! • It has had “abbrevs” forever• Even import TextMate snippets• I don’t use these that much, to be honest
  • Intellisense?• Everyone in Israel asks about it!• Emacs has a few options that come close• I’ve used it on a few occasions, but never really liked it
  • Flymake• Check your syntax (with a background Ruby process) as you type!• Errors? The line appears in red
  • Ruby electric mode• Inserts extra quotes, braces,• Also inserts “end” after class, module, if, etc.
  • Rainbow delimiters• Fancy braces!• Each set of parens/braces gets its own color• Lovely when you have a hash
  • Rinari• Rinari Is Not A Rails IDE• Keyboard shortcuts to jump to related parts of the code• Tries to be minimal• There’s also emacs-rails — more functionality, but updated less frequently
  • ERb and Haml• Handles colorizing, indenting• Flymake works inside of ERb, also!
  • Switching buffers• From controllers (C-c ‘ f c) — functional tests (C-c ‘ f t)• Models (C-c ‘ f m) — unit tests (or C-c ‘ f t)• Switch to the log (C-c ‘ f o)
  • Tags• Index of names in your files• Jump to the right file/line• Even search/replace• I go back and forth on using tags ... they work really well, but I’m often too lazy, and end up using “git grep”
  • Emacs server• If you’re starting Emacs more than once a day, then you’re doing something wrong• Open buffers• Connect from outside • e.g., sketch (from before, in IRB)
  • Magit• Use Git from within Emacs! • Stage, Commit, Stash • Branch, Merge • Push, pull• Fully integrated, and works really nicely
  • Macros• Record a macro• Replay any number of times• Super-duper useful, especially when converting files
  • Firefox plugins• I use Firefox as my main browser• Not the fastest (for now!)• Not updated like Chrome (for now!)• But it has excellent plugins
  • Firebug• Everyone’s favorite JavaScript/Ajax debugger• Console• Execute JavaScript• Modify CSS in real time• Truly an amazing piece of software
  • Web developer• “View Generated HTML” — my favorite!• Also:View HTTP request, response headers• Mark items with boxes
  • Growl• Notification system under OS X• Autotest + Growl gives me nice output for red/green• Just require “autotest/growl” in your ~/.autotest file
  • Pow• Finally, I have to run things locally• 37signals recently released Pow for OS X• (There’s talk of doing it for Linux, too)• Super-duper easy: • symlink from ~/.pow/foo to project foo • Now go to http://foo.dev !
  • Thanks!(Any questions?) reuven@lerner.co.il http://www.lerner.co.il/ 054-496-8405“reuvenlerner” on Skype/AIM