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

Building Command-line Applications in Ruby

Hector Castro
February 15, 2013

Building Command-line Applications in Ruby

Slides that accompany a lightening talk from RedSnake Philly 2013 [0] on building command-line applications in Ruby with Thor [1], Cucumber [2], Aruba [3], and Riak CS [4]. The example Riak CS command-line application used in the presentation can be found here [5].

[0] http://redsnakephilly.org/
[1] http://whatisthor.com/
[2] http://cukes.info/
[3] https://github.com/cucumber/aruba/
[4] http://basho.com/riak-cloud-storage/
[5] https://github.com/hectcastro/riakcs/

Hector Castro

February 15, 2013
Tweet

More Decks by Hector Castro

Other Decks in Technology

Transcript

  1. $ # interactive example $ ssh-keygen Generating public/private rsa key

    pair. Enter file in which to save the key (/Users/hector/.ssh/id_rsa):
  2. $ # interactive example $ ssh-keygen Generating public/private rsa key

    pair. Enter file in which to save the key (/Users/hector/.ssh/id_rsa): Created directory '/Users/hector/.ssh'. Enter passphrase (empty for no passphrase):
  3. $ # interactive example $ ssh-keygen Generating public/private rsa key

    pair. Enter file in which to save the key (/Users/hector/.ssh/id_rsa): Created directory '/Users/hector/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again:
  4. $ # interactive example $ ssh-keygen Generating public/private rsa key

    pair. Enter file in which to save the key (/Users/hector/.ssh/id_rsa): Created directory '/Users/hector/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/hector/.ssh/id_rsa. Your public key has been saved in /Users/hector/.ssh/id_rsa.pub.
  5. $ # emit accurate exit status $ mv cats.gif ~/gifs

    mv: rename cats.gif to /Users/hector/gifs: No such file or directory $
  6. $ # emit accurate exit status $ mv cats.gif ~/gifs

    mv: rename cats.gif to /Users/hector/gifs: No such file or directory $ echo $? 1 $
  7. $ # have a concise name $ svn co file:///does/anyone/use/me/anymore

    answer A answer/nope.txt Checked out revision 20. $
  8. $ # respect single and multi-letter options $ heroku -h

    << HELP CONTENT >> $ heroku --help << HELP CONTENT >>
  9. $ # ensure that you provide a --help option $

    dd -h dd: unknown operand -h $
  10. $ # ensure that you provide a --help option $

    dd -h dd: unknown operand -h $ dd --help dd: unknown operand --help
  11. $ # use STDERR correctly $ curl joker://api.github.com/users/hectcastro curl: (1)

    Protocol joker not supported or disabled in libcurl
  12. $ # use STDERR correctly $ curl joker://api.github.com/users/hectcastro curl: (1)

    Protocol joker not supported or disabled in libcurl $ curl joker://api.github.com/users/hectcastro > error.txt 2>&1
  13. $ # use STDERR correctly $ curl joker://api.github.com/users/hectcastro curl: (1)

    Protocol joker not supported or disabled in libcurl $ curl joker://api.github.com/users/hectcastro > error.txt 2>&1 $ cat error.txt curl: (1) Protocol joker not supported or disabled in libcurl