Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby Dev Env

Ruby Dev Env

My presentation about deveropment environment for Ruby programming.

http://kentaro.hatenablog.com/entry/2012/05/29/230254

Kentaro Kuribayashi

May 29, 2012
Tweet

More Decks by Kentaro Kuribayashi

Other Decks in Technology

Transcript

  1. Ruby Dev Env
    id:antipop / @kentaro
    2012-05-29

    View Slide

  2. Self Introduction
    •id:antipop
    •@kentaro
    •Working for paperboy&co.

    View Slide

  3. Seasoned Perler

    View Slide

  4. Ruby Beginner

    View Slide

  5. This meeting is NOT to give
    useful information to you.
    It’s YOU to do so.

    View Slide

  6. Agenda
    •Shell
    •irb / pry
    •Multiple Rubies
    •Helpful Gems for Deveropment
    •How to consult documents
    •Editor Settings

    View Slide

  7. Shell

    View Slide

  8. aliases
    alias be="bundle exec"
    alias r='rails'
    alias rs='rspec'
    alias ra='rake'

    View Slide

  9. @banyan’s
    alias r="rails"
    alias rr="routes_cache | less"
    alias rrg="routes_cache | grep"
    alias rrr="routes_cache --force"
    alias rrrg="routes_cache --force | grep"
    alias rspec='rspec -c'
    alias fu='bundle exec rspec --format Fuubar --color spec'
    alias nyan='bundle exec rspec --format NyanCatFormatter --color spec'
    alias five='bundle exec rspec --format Fivemat --color spec'
    alias br='bundle exec rake spec'
    alias rdm='rake db:migrate'
    alias b='bundle exec'
    alias bundle-init='bundle install --path .bundle/gems'
    alias plog='grc powder applog' # dependent on grc
    alias powlog='grc powder applog' # dependent on grc
    alias rails-init='bundle install --path .bundle/gems && rake db:create
    db:migrate && powder link'
    https://github.com/banyan/config/blob/master/.zshrc#L182

    View Slide

  10. Any Suggestion?

    View Slide

  11. irb / pry

    View Slide

  12. show-doc
    alias with ?

    View Slide

  13. show-source
    alias with $

    View Slide

  14. pry-rails
    •Replacement for `rails c`
    •pry with rails env

    View Slide

  15. pry-nav
    •Simple step execution
    •continue / next / step
    •Helpful for debugging
    .pryrc:
    Pry.commands.alias_command 'c', 'continue'
    Pry.commands.alias_command 's', 'step'
    Pry.commands.alias_command 'n', 'next'

    View Slide

  16. (DEMO)

    View Slide

  17. pry-clipboard
    •Allows us to copy from the
    results / history in pry
    session and paste them
    •Needs to some work-around
    to be used with tmux
    • http://kentaro.hatenablog.com/entry/
    2012/04/27/002058

    View Slide

  18. Any Suggestion?

    View Slide

  19. Multiple Rubies
    rvm / rbenv

    View Slide

  20. rbenv
    $ curl -L https://raw.github.com/fesplugas/rbenv-
    installer/master/bin/rbenv-installer | bash
    $ rbenv install 1.9.3-p194
    $ rbenv global 1.9.3-p194
    $ rbenv rehash
    $ ruby -v
    ruby 1.9.3p194 (2012-04-20 revision 35410)
    [x86_64-darwin11.3.0]

    View Slide

  21. rbenv-bundler
    •No more `bundle exec`
    •Just type `rails`, `rspec`, etc.

    View Slide

  22. Any Suggestion?

    View Slide

  23. Gems Helpful for
    Deveropment

    View Slide

  24. •bundler
    •gem-browse
    •vagrant
    •...

    View Slide

  25. Any Suggestion?

    View Slide

  26. How to Consult
    Documents

    View Slide

  27. αΫαΫҾ͚ΔRuby ϦϑΝϨϯεϚχϡΞϧ
    http://miyamae.github.com/rubydoc-ja/

    View Slide

  28. api.rubyonrails.org
    http://api.rubyonrails.org/

    View Slide

  29. Rails Guide
    http://guides.rubyonrails.org/

    View Slide

  30. Rails Guide in Kindle

    View Slide

  31. Any Suggestion?

    View Slide

  32. Editor Settings
    Vim / Emacs

    View Slide

  33. rinari
    •Jump from some buffer to
    another related with each
    other (eg. model to spec)
    •rhtml-mode
    •colorize
    •some shortcut keys

    View Slide

  34. anything-project
    •Narrows down canditate files
    into specific projects
    •Fast and sufficient
    •rinari is too feature-rich
    for me

    View Slide

  35. anything-project
    (require 'anything-project)
    (define-key global-map (kbd "C-;") 'anything-project)
    (ap:add-project
    :name 'ruby
    :look-for '("Gemfile")
    :include-regexp '("\\.rb$" "\\.erb$" "^Gemfile$")
    :exclude-regexp "\\(vendor\\|tmp\\|log\\|doc\\|\\.git\\|\
    \.bundle\\)/")

    View Slide

  36. anything-rdefs
    Method
    definition
    as outlines

    View Slide

  37. Any Suggestion?

    View Slide