Your SlideShare is downloading. ×
0
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 Ru...
Want to learn Rails?• I’m teaching a course at Hi-Tech College• Not very far from here!• August 14 - 18 , 2011            ...
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 ...
Better things• Easy-to-customize prompt• Saner history (across terminal tabs)• Automatic updates of oh-my-zsh• One configur...
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 feature...
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 updat...
irb• I use irb (or the Rails console) every day• If you’re programming in Ruby, then you  should probably have IRB open al...
Gems for IRB!• There has been an explosion of IRB-  enhancing gems• I’ll present some of them• Most or all of these are fr...
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  wo...
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 ...
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 ...
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 musi...
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-...
Function, binding(defun indent-buffer (&optional which-buffer)  "Indents a buffer (default is current)."  (interactive "bB...
(add-hook ruby-mode-hook          (lambda ()             (interactive)             (inf-ruby-keys)       (rainbow-delimite...
Snippets• TextMate fans, rejoice — Emacs has  snippets, too!  • It has had “abbrevs” forever• Even import TextMate snippet...
Intellisense?• Everyone in Israel asks about it!• Emacs has a few options that come close• I’ve used it on a few occasions...
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 ...
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 ‘...
Tags• Index of names in your files• Jump to the right file/line• Even search/replace• I go back and forth on using tags ... ...
Emacs server• If you’re starting Emacs more than once a  day, then you’re doing something wrong• Open buffers• Connect fro...
Magit• Use Git from within Emacs! • Stage, Commit, Stash • Branch, Merge • Push, pull• Fully integrated, and works really ...
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 ...
Firebug• Everyone’s favorite JavaScript/Ajax  debugger• Console• Execute JavaScript• Modify CSS in real time• Truly an ama...
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” ...
Pow• Finally, I have to run things locally• 37signals recently released Pow for OS X• (There’s talk of doing it for Linux,...
Thanks!(Any questions?)     reuven@lerner.co.il   http://www.lerner.co.il/        054-496-8405“reuvenlerner” on Skype/AIM
Rails development environment talk
Upcoming SlideShare
Loading in...5
×

Rails development environment talk

2,849

Published on

What tools do I use as a Rails developer?

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,849
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
21
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide
  • \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
  • Transcript of "Rails development environment talk"

    1. 1. My Ruby (and Rails) environment Reuven M. Lerner • reuven@lerner.co.ilRails Underground, Israel • July 13th, 2011
    2. 2. 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...
    3. 3. 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...)
    4. 4. Also:• I’m swamped with Ruby work!• Want to help me out?• (I need to sleep!)• Come speak with me after my talk...
    5. 5. Tools are important
    6. 6. 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
    7. 7. Better things• Easy-to-customize prompt• Saner history (across terminal tabs)• Automatic updates of oh-my-zsh• One configuration file (.zshrc)
    8. 8. Things I use often• C-z (suspend) and fg• Emacs keybinding• C-r (reverse search• Customized prompt
    9. 9. 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
    10. 10. 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
    11. 11. 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
    12. 12. 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
    13. 13. ap• “Awesome print” — and it is!• Data structures look nicer, in color
    14. 14. Sorted methods!• How often do you write foo.methods.sort• Now you can just write foo.methods
    15. 15. every_day_irb• Puts shell commands in IRB! ls cat pwd
    16. 16. ;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.
    17. 17. 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
    18. 18. methodfinder• Methodfinder.find• Object#find_method "abc".find_method("ABC")
    19. 19. sketch• Anonymous edits• Named edits• Great with emacsclient (for Emacs users) sketch sketch :foo
    20. 20. 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
    21. 21. Ideal Emacs keyboard
    22. 22. 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.
    23. 23. How Emacs works
    24. 24. How Emacs works Lisp function
    25. 25. How Emacs works Lisp Key binding function
    26. 26. How Emacs works LispKeystroke Key binding function
    27. 27. Sounds crazy?• It’s great.• Define functions. Or install packages.• Set bindings (global or modal).• Use control-alt-shift-meta-cokebottle
    28. 28. 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)
    29. 29. (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)) ))
    30. 30. 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
    31. 31. 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
    32. 32. Flymake• Check your syntax (with a background Ruby process) as you type!• Errors? The line appears in red
    33. 33. Ruby electric mode• Inserts extra quotes, braces,• Also inserts “end” after class, module, if, etc.
    34. 34. Rainbow delimiters• Fancy braces!• Each set of parens/braces gets its own color• Lovely when you have a hash
    35. 35. 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
    36. 36. ERb and Haml• Handles colorizing, indenting• Flymake works inside of ERb, also!
    37. 37. 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)
    38. 38. 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”
    39. 39. 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)
    40. 40. Magit• Use Git from within Emacs! • Stage, Commit, Stash • Branch, Merge • Push, pull• Fully integrated, and works really nicely
    41. 41. Macros• Record a macro• Replay any number of times• Super-duper useful, especially when converting files
    42. 42. 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
    43. 43. Firebug• Everyone’s favorite JavaScript/Ajax debugger• Console• Execute JavaScript• Modify CSS in real time• Truly an amazing piece of software
    44. 44. Web developer• “View Generated HTML” — my favorite!• Also:View HTTP request, response headers• Mark items with boxes
    45. 45. Growl• Notification system under OS X• Autotest + Growl gives me nice output for red/green• Just require “autotest/growl” in your ~/.autotest file
    46. 46. 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 !
    47. 47. Thanks!(Any questions?) reuven@lerner.co.il http://www.lerner.co.il/ 054-496-8405“reuvenlerner” on Skype/AIM
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×