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

Algunas herramientas comunes en Ruby

Algunas herramientas comunes en Ruby

Muestro RVM, RubyGems y Debugger como herramientas de uso común en el desarrollo con Ruby.

Presentación para Ruby Meetup Montevideo - http://www.meetup.com/rubymvd/events/91439032/

Fernando Briano

December 11, 2012
Tweet

More Decks by Fernando Briano

Other Decks in Technology

Transcript

  1. Algunas
    herramientas
    comunes en Ruby

    View Slide

  2. Fernando Briano
    picandocodigo.net
    @picandocodigo

    View Slide

  3. neo.com

    View Slide

  4. RVM
    rvm.io
    Gestiona versiones de Ruby

    View Slide

  5. [email protected] ~ $ rvm list
    rvm rubies
    =* ruby­1.9.3­p286 [ x86_64 ]
    ruby­1.9.3­p327 [ x86_64 ]
    # => ­ current
    # =* ­ current && default
    # * ­ default
    [email protected] ~ $ rvm list known
    # MRI Rubies
    [ruby­]1.8.6[­p420]
    (...)
    [ruby­]1.9.3­head
    [ruby­]2.0.0­preview1
    ruby­head
    JRuby, GoRuby, TheCodeShop ­ MRI experimental patches,
    Rubinius, Ruby Enterprise Edition, Kiji, MagLev, Mac OS X
    Snow Leopard Or Newer, IronRuby ­­ Not implemented yet.

    View Slide

  6. [email protected] ~ $ rvm install jruby
    jruby­1.7.0 ­ #downloading jruby­bin­1.7.0, this may take a while depending on your
    connection...
    jruby­1.7.0 ­ #extracting jruby­bin­1.7.0 to /home/fernando/.rvm/src/jruby­1.7.0
    jruby­1.7.0 ­ #extracted to /home/fernando/.rvm/src/jruby­1.7.0
    jruby­1.7.0 ­ #nailgun
    jruby­1.7.0 ­ #installing to /home/fernando/.rvm/rubies/jruby­1.7.0
    jruby­1.7.0 ­ #importing default gemsets (/home/fernando/.rvm/gemsets/)
    Saving wrappers to '/home/fernando/.rvm/bin'.
    [email protected] ~ $ ruby ­­version
    jruby 1.7.0 (1.9.3p203) 2012­10­22 ff1ebbe on OpenJDK
    64­Bit Server VM 1.7.0_09­b30 [linux­amd64]
    [email protected] ~ $ rvm use jruby
    Using /home/fernando/.rvm/gems/jruby­1.7.0

    View Slide

  7. rvm.io
    Usar archivos rvmrc por proyecto
    gemset por proyecto
    (cada aplicación tiene su ambiente de gemas distintivo)
    Alternativa:
    Simple Ruby Version Management: rbenv
    https://github.com/sstephenson/rbenv
    (no la he usado pero tiene buena pinta)

    View Slide

  8. Ruby Gems
    gema – paquete de software en
    Ruby (aplicación, biblioteca, etc)
    Contenido:

    Código

    Documentación

    Gemspec (info)

    View Slide

  9. Sistema de empaquetado:
    Formato estándard para distribuír código Ruby
    y publicar paquetes gem
    Herramienta sencilla para gestionar la
    instalación de paquetes
    Servidor de gemas para servirlas

    View Slide

  10. ¿A quién le interesaría
    ver cómo crear una
    gema?

    View Slide

  11. [email protected] ~ $ gem ­h
    gem install rake
    gem list ­­local
    gem build package.gemspec
    gem query
    gem help install
    http://docs.rubygems.org/

    View Slide

  12. Debugger
    Cómo 'debuguear' en Ruby
    [email protected] ~ $ gem install debugger
    require 'debugger'; debugger
    #Bundler:
    gem 'debugger'

    View Slide

  13. Debugger
    Configuración
    [email protected] ~ $ cat .rdebugrc
    set autolist
    set autoeval
    set autoreload

    View Slide

  14. Comandos comunes
    # Siguiente
    (rdb:1) n
    # Step into
    (rdb:1) s
    # Continue
    (rdb:1) c
    # mostrar línea actual
    (rdb:1) l=
    # inspect ­ Returns a string containing a
    human­readable representation of obj.

    View Slide

  15. Debugger
    ¿Demo?

    View Slide

  16. ¿Preguntas?
    ¡Gracias!
    http://www.meetup.com/rubymvd/

    View Slide