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

Essential Rails Tools

Essential Rails Tools

Working with Rails often means switching between several Ruby versions back and forth which is made almost seamless by RVM. It also involves several simple command line tools like Pry, Pow, and Bundler and that will make your development life so much easier.

Olivier Lacan

April 24, 2012
Tweet

More Decks by Olivier Lacan

Other Decks in Programming

Transcript

  1. me?

  2. $ $ brew search pow brew install pow ==> Installing

    pow dependency: node ==> Downloading http://nodejs.org/ dist/v0.6.14/node-v0.6.14.tar.gz pow
  3. a2ps asciitex bindfs center-im concurrencykit dcal dvdauthor fastjar gabedit glib

    grass html-xml-utils jam lbdb libflowmanager libpurple links mecab-ipadic mpd nginx orc pil putty redo sbcl a52dec asm6 binutils ceylon confuse dcfldd dvdbackup fastri gaffitter glibmm graylog2-server html2text jansson lcdf-typetools libftdi libpuzzle liquibase media-info mpdas ngircd orpie pincaster pv redsocks sbt aacgain asn1c binwalk cfengine connect dcled dvdrtools fastx_toolkit gambit-scheme global grc htmlcompressor jasper lcov libgadu libqalculate litmus mediatomb mpdscribble ngrep ortp pinentry pwgen regina-rexx sc68 aalib aspell bitlbee cfitsio conserver dcmtk dvtm fbida ganglia glog gremlin htmlcxx jbig2dec lcrack libgaiagraphics libquicktime little-cms meld mpfr ngspice osm2pgsql pipebench pwnat remind scala aamath assimp blackbox cflow contacts dcraw dwarf fceux gant gloox grepcidr htmldoc jbig2enc ldapvi libgarmin librasterlite little-cms2 memcache-top mpg123 nickle osmosis pit pwsafe rename scalate aardvark_shell_utils astyle blahtexml cgal convertlit ddate dwdiff fcgi garmintools glpk grib-api htpdate jbigkit ldid libgcrypt libraw llvm memcached mpg321 nimrod ossp-uuid pixie py2cairo renameutils scalpel abcde asymptote blast cgdb convmv ddclient dwm fcrackzip gauche gmediaserver griffon httperf jcal ldns libgda libreplaygain lmutil memcacheq mpgtx nkf otx pixman pygobject repl scamper abcl aterm blitz chcase coq ddd dxflib fdupes gawk gmime gromacs httping jed le libgee librets lockrun memtester mpio nload owfs pkg-config pygtk repo scantailor abiword atf blueutil check coreutils ddrescue dzen2 feh gcal gmock groonga httpry jemalloc leafnode libgeotiff librsvg log4cplus mercurial mplayer nmap p0f play pypy reposurgeon scheme48 abnfgen atk bmon cheops corkscrew deja-gnu e2fsprogs fex gccxml gmp groovy httptunnel jenkins ledger libgit2 librsync log4cpp metalua mpop node p11-kit playdar pyqt resty schroedinger abook atkmm bogofilter cherokee couchdb denyhosts easy-tag ffmbc gd gmt groovyserv httrack jerm ledit libglade libsamplerate log4cxx metapixel mpsolve notmuch p7zip plink pyqwt rfcdiff scons ace atlassian-plugin-sdk bonnie chibi-scheme couchdb-lucene despotify ec2-ami-tools ffmpeg gdal gmtl growlnotify hub jetty legit libglademm libsgml log4shib metaproxy mr noweb paml plod pyside rfcmarkup scotch ack atomicparsley bonnie++ chicken cowpatty detox ec2-api-tools ffmpeg-php gdal-grass gnome-common growly hugs98 jhead leiningen libgnomecanvas libshout logrotate metasploit mrfast nrg2iso pango plotutils pyside-tools rfcstrip scrollkeeper activemq atool boost chipmunk cowsay devil ecasound ffmpeg2theora gdbm gnome-doc-utils gsl hunspell jigdo lemon libgpg-error libsigc++ logstalgia metis mrtg nrpe pangomm plowshare python rhino scrotwm adns auctex boost-build chkrootkit cpanminus devtodo echoping ffmpegthumbnailer gdk-pixbuf gnu-arch gsoap hydra jing leptonica libgphoto2 libsigsegv logtalk mftrace mscgen nspr paperkey plt-racket python3 riak scrub adobe-air-sdk audiofile botan chktex cpansearch dfu-programmer echoprint-codegen fftw geany gnu-barcode gst-ffmpeg ical-buddy jmeter lesspipe libgsasl libsmi lolcode mg msgpack nss par plustache qca riak-search scrypt adol-c augeas bowtie chmlib cpmtools dfu-util ecl field3d gearman gnu-getopt gst-plugins-bad icarus-verilog joe lesstif libgsf libsndfile lorem mhash msgpack-rpc ntfs-3g par2 plzip qcachegrind riemann scsh adplug authexec box2d chmox cppcheck di ecm figlet gecode gnu-indent gst-plugins-base ice john lft libgtextutils libspatialite loudmouth midgard2 msmtp ntl par2tbb pmdmini qd rinetd scummvm advancecomp auto-scaling boxes chromaprint cppdom dia edelta figtoipe geda-gaf gnu-prolog gst-plugins-good icecast jp2a lftp libgtop libspotify lout midnight-commander mt-daapd nu parallel pms qdbm ringojs sdcc aescrypt autobench brew-gem chromedriver cpptest dialog ee finch geeqie gnu-sed gst-plugins-ugly icon jpeg lha libharu libssh lpc21isp mikmod mtools num-utils pari png2ico qemu ripmime sdelta3 aespipe autoconf brew-pip chuck cppunit dict eet findbugs gegl gnu-shogi gst-rtsp icoutils jpegoptim libagg libhid libssh2 lrzip minbif mtr nuttcp parmetis pngcheck qfits rlog sdf afflib autoconf-archive bro cifer cpputest diction eigen findutils generatorrunner gnu-smalltalk gstreamer icu4c jruby libao libical libstxxl lrzsz minc mu nvi parrot pngcrush qhull rlwrap sdl afsctool autoenv browser cimg cracklib diffpdf eina fio gengetopt gnu-tar gsutil id3lib js-test-driver libart libicns libsvg lsdvd minicom multimarkdown nylon patchutils pngnq qi rmcast sdl_gfx aften autogen bsdiff cksfv cracklib-words dirac ejabberd fish geoip gnu-time gtest id3tool jsawk libass libid3tag libsvg-cairo lsof minisat multitail nzbget pax-construct pngrewrite qjson rmtrash sdl_image aget autojump bsdmake clam crf++ dircproxy ekg2 fits geomview gnu-typist gtk+ id3v2 jscoverage libassuan libident libsvm lua minised muparser o-make pax-runner poco qpdf rnv sdl_mixer aggregate automake bsdsfv clamav cronolog direnv elasticsearch fiwalk geos gnu-units gtk-doc idcomments jsdoc-toolkit libbinio libidl libtasn1 luajit miniupnpc mupdf oath-toolkit pbc podofo qprint robodoc sdl_net agrep automoc4 bsponmpi class-dump crossroads dirmngr elb-tools flac gerbv gnu-which gtk-gnutella idnits jshon libbs2b libidn libtecla luarocks minuit2 muscle objective-caml pbc-sig points2grid qrencode rock sdl_rtf aimage autopsy btparse classads crush-tools disco elinks flann gerrit-tools gnumeric gtkglext idutils jsl libcaca libimobiledevice libtermkey lv mira musepack ocp pbzip2 polipo qrupdate rogue sdl_sound aircrack-ng autossh btpd clay cryptopp discount emacs flare getmail gnunet gtkglextmm ifstat jslint4java libcddb libiptcdata libtiff lxsplit mit-scheme mutt ocrad pcb polyml qscintilla2 roundup sdl_ttf aldo autotrace bulk_extractor clean cscope disktype emboss flasm gettext gnupg gtkmm iftop jsmin libcdio libkate libtommath lynx mjpegtools mydumper octave pcre poppler qt rpg sedna algol68g avanor bullet clhep csmith ditaa embryo fleet-db getxbook gnupg2 gtksourceview ifuse json-c libcmph libkml libtool lysp mkclean mysql ode pcre++ popt qt-mobility rpl selenium-server-standalone alpine aview bvi clisp css-crush djbdns enca flex_sdk gflags gnuplot gtkwave igraph json-glib libconfig libksba libtorrent lzip mkcue mysql++ odt2txt pdal portaudio quantlib rpm2cpio sersniff amap avocadodb bwa cliweather cssembed djmount encfs fltk gforth gnutls gtmess ii json_spirit libcouchbase liblas libtorrent-rasterbar lzlib mksh mysql-connector-c offline-imap pdf2json portmidi quassel rrdtool sgrep android-ndk avra bwm-ng cln csshx djview4 enchant fluid-synth gfortran go gts ike-scan jsonpp libcroco liblastfm libtrace lzo mktorrent mysql-connector-c++ oggz pdf2svg pos quex rsense shakespeare android-sdk avrdude byobu cloc csup djvu2pdf enet flume ggobi go-app-engine-32 guile ilmbase jstalk libcsv liblo libunique lzop mkvalidator mysql-proxy ogmtools pdfcrack poster quickfix rsnapshot shapelib ann avro-c c-ares clojure csv-fix djvulibre eprover flusspferd ghc go-app-engine-64 guilt imagemagick jsvc libcue liblockfile libunistring mac-robber mkvtoolnix mysqlreport ohcount pdfgrep postgis quicktree rsyslog shaper-probe ansifilter aws-cfn-tools c-kermit clojure-contrib csvprintf dmd epsilon flvstreamer ghostscript go-gui gv imagesnap judy libcuefile liblqr libupnp macvim mldonkey mytop omega pdfjam postgresql quilt rt-audio shared-mime-info antiword aws-elasticache cabal-install cloog ctags dmenu epstool flvtool++ gibbslda goaccess gwenhywfar imake justniffer libdaemon liblunar libusb mad mlton mz-scheme oniguruma pdflib-lite postmark quvi rtmpdump shark antlr aws-iam-tools cabextract closure-compiler ctail dns2tcp epubcheck fmdiff giblib gobject-introspection gwyddion imap-uw jython libdap libmagic libusb-compat madplay mmv nacl oorexx pdftohtml potrace qwt rtorrent shell.fm anttweakbar axel cabocha cloud-watch ctorrent dnscrypt-proxy erlang fondu giflib gocr hadoop imapfilter kawa libdbusmenu-qt libmatroska libutf mafft mobile-shell nagios open-babel pdksh pound r rubber shen aoeui babl cadaver cloudbees-sdk cuetools dnsmap erviz fontconfig gifsicle goffice haproxy imlib2 kbtin libdc1394 libmemcached libvbucket magit mod_python nagios-plugins open-cobol pdnsd povray rabbitmq rubinius shiboken apachetop bagit cairo clozure-cl cufflinks dnsmasq esniper fontforge ginac google-app-engine haskell-platform innotop kdiff3 libdca libmicrohttpd libvirt mailcheck mod_wsgi nailgun open-mesh pdsh pow radare2 ruby shmux ape balance cairomm clucene cunit dnstop esound fop gist google-js-test hatari intltool kelbt libdlna libmikmod libvorbis mairix mogenerator narwhal open-mpi peg ppl ragel ruby-build shntool apg bali-phy calabash clustal-w cups-pdf dnstracer etl foremost git google-perftools haxe io kes libdmtx libming libvpx makeicns monetdb nasm open-ocd peg-markdown premake rakudo-star ruby-enterprise-edition shocco apgdiff bar calc clusterit curl docbook ettercap fortress git-cola google-sparsehash hbase iodine keychain libdnet libmms libwbxml makensis mongodb naturaldocs open-scene-graph perceptualdiff primer3 ranger ruby-odbc shorten apiextractor base64 calcurse clutter curlftpfs docbook2x eventlog fortune git-diffall google-sql-tool hdf5 ioke kismet libdrizzle a libwmf malbolge mongoose nauty open-sg percona-server primesieve raptor runcocoa shtool apktool bash camlp5 cmake curlpp dos2unix exif fossil git-extras gosu help2man ioping kite libdshconfig libmpc libwpd man2html mongrel2 ncdu open-sp percona-toolkit privoxy rarian runit sic aplus bash-completion cantera cmatrix cuty_capt dotwrp exiftags fourstore git-flow gource hercules ios-sim kiwi libdsk libmpd libwpg mapnik monit ncftp open-vcdiff perforce proctools rasqal rush sickbeard apollo bashish cassandra cmigemo cvs2svn doublecpp exiftool fox git-ftp gpac herrie ipbt knife-completion libdv libmpdclient libwps mapserver monotone ncmpc opencc perforce-proxy prodigal rats rust siege app-engine-java-sdk bazaar cast cminpack cvsps doubledown exim fping git-gerrit gpg-agent hevea ipcalc knock libdvbpsi libmpeg2 libxdiff mariadb montage ncmpcpp opencolorio perforce-server proguard rbenv rxvt-unicode sigar apparix bbcolors catdoc cmockery cvsync dovecot exiv2 freealut git-hg gpgme hexedit ipe konoha libdvdcss libmtp libxmi markdown moreutils ncrack openconnect pg_top proj rbenv-gemset rzip signing-party appledoc bbcp cbmbasic cmu-pocketsphinx czmq doxygen exodriver freeimage git-multipush gphoto2 hfsutils iperf ktoblzcheck libdvdnav libmusicbrainz libxml++ mathomatic mosh ncview opencore-amr pgbouncer protobuf rc s-lang silk appswitch bchunk cc65 cmu-sphinxbase d-bus doxymacs exonerate freeradius-server git-now gplcver hg-flow iphotoexport kumofs libdvdread libmxml libxml2 maven mosml ndiff opencv pgdbf protobuf-c rdesktop s3-backer simgrid apt-dater bcpp ccache cmucl daemon dpkg expat freerdp git-sh gpsbabel hicolor-icon-theme ipmitool kyoto-cabinet libebml libnet libxmlsec1 maven-shell mosquitto neko openexr pgpool-ii proxytunnel rdiff-backup s3cmd simh aqbanking bcrypt ccd2iso cmus daemonize drizzle ext2fuse freetds git-ssh gpsim highlight ipopt kyoto-tycoon libechonest libnfc libxslt mawk most neo4j openfst pgtap psftools rds-command-line-tools s3fs since arabica bcwipe cclive cocot daemontools drush eye-d3 freexl git-subtree gptfdisk hilite ipv6calc kytea libelf libnids libxspf maxima movgrab neon openimageio phantomjs psgrep re2 s3sync sip aria2 bdw-gc ccrypt coda-cli daq dsh ezlupdate fribidi git-svn-abandon gptsync hiredis ircii lablgtk libemu libogg libyaml mcabber mp3cat nesc openjpeg phash pstoedit re2c saga-core sipcalc arm beanstalk cd-discid collada-dom dar dsniff ezstream fsh git-url-sub gputils hive irssi lame libev liboil libyubikey mcl mp3check net-nuclear openmeeg phoronix-test-suite pstree readline saga-cpp sipp armadillo bedtools cdargs collectd darkice dsocks f3 ftgl git-utils gqlplus hllib isc-dhcp languagetool libevent libopennet libzip mcpp mp3gain net-snmp opensaml phyml pth readpst salt sipsak arp-scan beecrypt cdb colloquypush dart dtach faac ftimes giter8 gqview hmmer iso-codes lasi libewf liboping libzzip mcrypt mp3info netcat openslp physfs ptunnel reattach-to-user-namespace sam2p sisc-scheme arp-sk berkeley-db cdecl color-code darwinbuild dterm faad2 ftjam gitslave grace homebank ispell lastfm_fplib libexif libosip lifelines md5deep mp3splt netcdf openssl pianobar puf rebar samtools sitecopy arping bgrep cdf colordiff dash duff falcon fuego glade gradle hornetq isync lastfmfpclient libexosip libotr lightning md5sha1sum mp3val netpbm opentracker picoc pulledpork recode sane-backends ski arpoison bib-tool cdparanoia colormake dasm duplicity fann funcoeszz glassfish grads hostdb ivy lastfmlib libextractor libpano lighttpd mdbtools mp3wrap netsed openttd picocom pure recutils sary skipfish arss bibtex2html cdrdao colorsvn dbslayer duply fantom fuse4x gle grails hping jack latex2html libffi libpar2 lilypond mdf2iso mp4v2 nettle openvpn pidof pure-ftpd redis savana skktools ascii bibutils cdrtools colortail dbus-glib dupx fasd fuse4x-kext glew graphicsmagick hqx jags latex2rtf libfishsound libplist link-grammar mdxmini mpack newick-utils optipng pig putmail redis-tools saxon skytools asciidoc bigloo celt colpack dc3dd dvd+rw-tools fast-statistical-alignment fwknop glfw graphviz ht jailkit launch libfixbuf libpst linklint mecab mpc newlisp orbit pigz putmail-queue redland saxon-b sl sleepwatcher solid spin sshguard streamripper swi-prolog tabix tcptrack tig tmux trafshow tup unafold unyaffs valgrind vimpager vrpn webfs wkhtmltopdf wyrd xml-security-c xspin yazpp znc sleuthkit solr spiped sshuttle stress swig taglib tcpurify tiger-vnc tnef trang two-lame unbound uptimed varnish vimpc vsftpd webkit2png wla-dx x264 xml-tooling-c xspringies yconalyzer zookeeper sloccount sonar splint ssldump stunnel swish-e talk-filters teapot timbl todo-txt transcode txt2tags uncrustify upx vbindiff vip vte webp wol x3270 xml2rfc xsw yeti zsh slrn sound-touch spring-roo sslscan style-check syck talloc term timedog tofrodos transmission typespeed unfs3 uriparser vcdimager vips vtk weechat wopr xa xmlformat xvid ykclient zsh-lovers smake source-highlight sproxy ssss sub2srt symphony tarsnap tesseract tin toilet tre uade ungif urlview vcftools virtualhost.sh w3m wget wordnet xapian xmlrpc-c xz ykpers zssh smartmontools sox sqlite stanford-parser subversion synergy task testdisk tinc tokyo-cabinet tree uchardet unifdef urweb vcodex virtuoso wait_on whatmask wp-cli xar xmlstarlet yaf youtube-dl zsync smartypants spark sqsh star suite-sparse synfig tbb texinfo tintin tokyo-dystopia treeline ucl unison usbmuxd vcprompt visitors wakeonlan when wps2odt xaric xmlto yajl yuicompressor zzuf smlnj spatialindex squashfs staticrouted sundials synfigstudio tclap thc-pptp-bruter tiny-fugue tokyo-tyrant triangle udis86 unittest ushare vde visualboyadvance watch whohas wrangler xastir xmltoman yamdi z smpeg spatialite-tools squid stgit surfraw syslog-ng tcpflow the_silver_searcher tinyfugue tomcat tsung udns unixodbc utimer velvet vmalloc wavpack wiggle writerperfect xaw3d xmoto yaml-cpp zbar snappy spawn-fcgi squirrel stklos svdlibc szip tcping theora tinyproxy topgit ttf2eot udunits unp uudeview vf vnstat wbox willgit wtf xchat xmp yara zdelta snobol4 speex ssdeep stormfs svg2pdf szl tcpreplay thrift titlecase tophat ttf2pt1 uemacs unpaper uwsgi vgmstream vobcopy wdfs wine wv xdelta xpa yarp zebra snort sphinx ssed stow svg2png t1utils tcpstat thrulay tivodecode tor tth ufraw unrar v8 vice vorbis-tools wdiff winetricks wv2 xdotool xpdf yasm zeromq sntop spidermonkey ssh-copy-id stp swfmill ta-lib tcptrace tidyp tkdiff torsocks ttyrec uif2iso unrtf v8cgi vilistextum vorbisgain web100clt winexe wwwoffle xerces-c xplanet yaws zile socat spim sshfs strategoxt swftools tabbed tcptraceroute tiff2png tmpreaper trafficserver ttytter uim unshield vala vimeo-downloader vpnc webalizer wireshark wxmac xml-coreutils xqilla yaz zint 1033 packages
  4. $ gem install rake $ rake db:migrate rake aborted! You

    have already activated rake 0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this.
  5. RVM

  6. rvm use 1.9.3 rvm use 1.9.3 --default rvm list list

    installed rubies activate Ruby 1.9.3 active and default to 1.9.3
  7. gemsets 1.8.6 RVM 1.9.2 1.9.3 gemsets gemsets global myapp rails3

    global otherapp rails31 global anotherapp rails32
  8. rvm gemset use <name> rvm 1.9.3@<name> --create rvm gemset create

    <name> create gemset under current ruby activate gemset under current ruby shorthand syntax
  9. $ rails server $ rails server -p 1234 Address already

    in use - bind(2) (Errno::EADDRINUSE)
  10. powder install powder link powder open installs pow for you

    symlink current app to appname.dev open appname.dev in default browser
  11. powder restart powder applog powder list restart pow for current

    app tails the current development log displays all existing pow servers
  12. [2] pry(Thing)> [1] pry(Thing)> bar => nil ls Thing.self methods:

    foo locals: _ _dir_ _ex_ _file_ _in_ _out_ _pry_ bar
  13. ls cd <class/method> edit shows variables & methods in scope

    move into different context opens current file in default editor
  14. source 'https://rubygems.org' gem 'rails', '3.2.2' gem 'sqlite3' group :assets do

    gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails'
  15. gem 'rails', '3.2.2' gem 'rails', '>=3.2.2' gem 'rails', '~>3.2.2' specific

    version dependency loose version dependency optimistic version constraint
  16. gem 'rails', '~>3.2.2' gem 'rails', '>=3.2.2', '< 3.3' sexy pessimistic

    version constraint ~ equivalent to ~ pessimistic version constraint
  17. bundle install bundle update bundle exec rake resolve dependencies &

    install gems update all gems in gemfile if possible use the rake version in the gemfile
  18. $ rake db:migrate rake aborted! You have already activated rake

    0.9.2.2, but your Gemfile requires rake 0.9.2. Using bundle exec may solve this. remember this? $ bundle exec rake db:migrate
  19. Fin