rails development environment tips

Upload: leonid-shevtsov

Post on 04-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Rails development environment tips

    1/16

    Rails dev env tips&tricksfor RubyGarage by Leonid Shevtsov

  • 7/30/2019 Rails development environment tips

    2/16

    Control your environment, because it controls you.

  • 7/30/2019 Rails development environment tips

    3/16

    Pow

    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/http://pow.cx/http://pow.cx/
  • 7/30/2019 Rails development environment tips

    4/16

  • 7/30/2019 Rails development environment tips

    5/16

    Pow - powder

    gem install powder

    Convenient wrapper for common Pow actions (Powhas no interface of its own.)

    powder link

    powder restart, powder always_restart

    powder log

  • 7/30/2019 Rails development environment tips

    6/16

    Pow - remote testing

    How can you test your site on a phone/tablet?

    How can you share the site with a QA engineer?

    app.1.1.1.1.xip.io routes to ip 1.1.1.1

    Pow routes app.1.1.1.1.xip.io to actual app.

    No magic, no security issues.

  • 7/30/2019 Rails development environment tips

    7/16

    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).

  • 7/30/2019 Rails development environment tips

    8/16

    Pry

    Replaces: irb and rails [c]onsole

    Thats just the tip of an iceberg of usefulness.

    Not only forrunning code, but for exploring code.

    Read the wiki (seriously)

    http://pryrepl.org/http://pryrepl.org/http://pryrepl.org/http://pryrepl.org/http://pryrepl.org/
  • 7/30/2019 Rails development environment tips

    9/16

    Pry - just replace irb

    All you need is to paste this into your ~/.irbrc

    require rubygemsrequire pryPry.start

    exit

  • 7/30/2019 Rails development environment tips

    10/16

    Pry - browse methods

    show-method - show source code of a method

    edit-method - open the method in your editor (useful

    for debugging gems)

  • 7/30/2019 Rails development environment tips

    11/16

    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 pryinside the exception handler

  • 7/30/2019 Rails development environment tips

    12/16

    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.

    Free and fully featured for an unlimited period of time.

    http://www.sublimetext.com/http://www.sublimetext.com/http://www.sublimetext.com/http://www.sublimetext.com/
  • 7/30/2019 Rails development environment tips

    13/16

    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

  • 7/30/2019 Rails development environment tips

    14/16

    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 splitsalmostas easy as Vim.

    (no open file in split command)

  • 7/30/2019 Rails development environment tips

    15/16

    ST2 - package control

    Package Control plugin

    A centralised repository of plugins, with one-clickinstallation.

    The configuration is plaintext and packages are just

    directories. Easy to backup, .dotfiles-ready.Google sync sublime text 2 dropbox

  • 7/30/2019 Rails development environment tips

    16/16

    Questions?

    Questions?

    git & hub

    ssh-config

    oh-my-zsh