Jump to ratings and reviews
Rate this book

Build Awesome Command-Line Applications in Ruby 2: Control Your Computer, Simplify Your Life

Rate this book
Speak directly to your system. With its simple commands, flags, and parameters, a well-formed command-line application is the quickest way to automate a backup, a build, or a deployment and simplify your life. With this book, you'll learn specific ways to write command-line applications that are easy to use, deploy, and maintain, using a set of clear best practices and the Ruby programming language. This book is designed to make any programmer or system administrator more productive in their job. Now updated for Ruby 2.

Writing a command-line application that's self-documenting, robust, adaptable and forever useful is easier than you might think. Ruby is particularly suited to this task, because it combines high-level abstractions with "close to the metal" system interaction wrapped up in a concise, readable syntax. Plus, Ruby has the support of a rich ecosystem of open source tools and libraries.

Ten insightful chapters each explain and demonstrate a command-line best practice. You'll see how to use these tools to elevate the lowliest automation script to a maintainable, polished application. You'll learn how to use free, open source parsers to create user-friendly command-line interfaces as well as command suites. You'll see how to use defaults to keep options simple for everyday users, while giving advanced users options for more complex tasks. There's no reason why a command-line application should lack documentation, whether it's part of a help command or a man page; you'll find out when and how to use both. Your journey from command-line novice to pro ends with a look at valuable approaches to testing your apps, and includes some fun techniques for outside-the-box, colorful interfaces that will delight your users.

With Ruby, the command line is not dead. Long live the command line.

224 pages, Paperback

First published April 6, 2012

14 people are currently reading
131 people want to read

About the author

David Bryant Copeland

7 books15 followers
David Copeland is a programmer and author. He wrote "The Senior Software Engineer" and "Build Awesome Command-Line Applications in Ruby", and has over 16 years of professional development experience. He's managed high-performance, high-traffic systems at LivingSocial, helped build the engineering team at Opower, and worked consulting gigs both large and small. Currently, he's a lead engineer at fashion start-up Stitch Fix, building a platform that will change the retail shopping experience.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
25 (22%)
4 stars
50 (45%)
3 stars
31 (28%)
2 stars
3 (2%)
1 star
0 (0%)
Displaying 1 - 10 of 10 reviews
Profile Image for Francisco Garcia.
13 reviews2 followers
May 6, 2013
The whole book is quite basic and if you are a seasoned Ruby developer, you might not learn too many things. However I must admit that it covers all the minimum knowledge that any person doing a command line application must have.

Good if you want to solidify your knowledge of CLI programming, great if you are a beginner or expose yourself randomly to Ruby when doing small programs.
Profile Image for Katherine.
149 reviews
January 1, 2018
It was an easy read because I am familiar with testing CLI apps. The book discusses essential gems. It feels like reading a long version of a README file. If you have time for that, read this. Otherwise, you're better off reading documentation of gli, ronn and a few other gems.
Profile Image for Jose Lobato.
73 reviews4 followers
June 29, 2018
A very nice read. Simple and focus.

I did not learn many things from this book, but I enjoyed reading it since it is well thought and executed.
3 reviews1 follower
August 13, 2016
This book describes many non rby related issues in building a command line interface. The structure of it is:

1) Parse Library to use: ParseOptions or GLI
2) Creating Help. This includes man page creation
3) Suggestions for being piped.
4) Flag usage and styles
5) Configuring via yaml
6) Creating a Gem for distribution
7) Testing
8) Add color and interativity

I designed a command line suite with it and used Thor rather than gli. Thor is commonly used whereas gli is the authors creation so he understandably wrote about it. This is the only complaint I have about the book.
Profile Image for Tim Tilberg.
9 reviews
August 14, 2020
This book is an excellent, practical example of leveraging Ruby outside of web development. You'll learn how easy it is to toss together Ruby scripts to act like complex, compiled CLI tools. Remove the extension, put a Ruby shebang, and drop it in your $PATH, and you will feel empowered to create versatile CLI tools that let you pipe data to Slack, or convert data. This book teaches you best practices for writing helpful and discoverable CLI tools.
Profile Image for Nathan Campos.
15 reviews3 followers
February 8, 2014
Great book if you are a beginner that is interested in building small, basic command-line applications, but if you're a bit experienced with command-line applications and looking for a book to expand your knowledge this isn't for you.
Profile Image for Daniel Paulino.
3 reviews4 followers
May 26, 2015
If you're a looking for a introduction to how write CLI applications, it's really a good choice.
It does not cover the tests parts very well, but explains the hard parts of tests like simulating changes in file system.
Profile Image for Alpha.
449 reviews10 followers
July 1, 2012
3.5/5 - Not a bad introduction to command line apps, and lots of good information sprinkled throughout, but it wasn't quite what I was expecting.
Profile Image for Madhu Murali.
9 reviews41 followers
April 10, 2013
Dont read unless you are into hardcore systems programming.. Better books out there if you want to just learn ruby
Displaying 1 - 10 of 10 reviews

Can't find what you're looking for?

Get help and learn more about the design.