Восстановить пароль
FAQ по входу

Copeland David Bryant. Build Awesome Command-Line Applications with Ruby. Control Your Computer, Simplify Your Life

  • Файл формата pdf
  • размером 5,05 МБ
  • Добавлен пользователем
  • Отредактирован
Copeland David Bryant. Build Awesome Command-Line Applications with Ruby. Control Your Computer, Simplify Your Life
Dallas, Texas; Raleigh, North Carolina - The Pragmatic Bookshelf - book version 1.0, March 2012 - 214 pages
David Bryant Copeland, edited by John Osborn
The Facets of Ruby Series.
ISBN-13: 978-1-934356-91-3
As Ruby pro David Copeland explains, writing a command-line application that is self-documenting, robust, adaptable and forever useful is easier than you might think. Ruby is particularly suited to this task, since it combines high-level abstractions with close to the metal system interaction wrapped up in a concise, readable syntax. Moreover, 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 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.
What You Need:
All you’ll need is Ruby, and the ability to install a few gems along the way.
Examples written for Ruby 1.9.2, but 1.8.7 should work just as well.
1. Have a Clear and Concise Purpose
-Problem 1: Backing Up Data
-Problem 2: Managing Tasks
-What Makes an Awesome Command-Line App
-Moving On
2. Be Easy to Use
-Understanding the Command Line: Options, Arguments, and Commands
-Building an Easy-to-Use Command-Line Interface
-Building an Easy-to-Use Command-Suite Interface
-Moving On
3. Be Helpful
-Documenting a Command-Line Interface
-Documenting a Command Suite
-Including a Man Page
-Writing Good Help Text and Documentation
-Moving On
4. Play Well with Others
-Using Exit Codes to Report Success or Failure
-Using the Standard Output and Error Streams Appropriately
-Formatting Output for Use As Input to Another Program
-Trapping Signals Sent from Other Apps
-Moving On
5. Delight Casual Users
-Choosing Names for Options and Commands
-Choosing Default Values for Flags and Arguments
-Deciding Default Behavior
-Moving On
6. Make Configuration Easy
-Why External Configuration?
-Reading External Configuration from Files
-Using Configuration Files with Command Suites
-Design Considerations When Using Configuration
-Moving On
7. Distribute Painlessly
-Distributing with RubyGems
-Distributing Without RubyGems
-Collaborating with Other Developers
-Moving On
8. Test, Test, Test
-Testing User Behavior with Acceptance Tests
-Testing in Isolation with Unit Tests
-A Word About Test-Driven Development
-Moving On
9. Be Easy to Maintain
-Dividing Code into Multiple Files
-Designing Code for Maintainability
-Moving On
10. Add Color, Formatting, and Interactivity
-Adding Color Using ANSI Escape Sequences
-Formatting Output with Tables
-Providing Interactive User Input with readline
-Moving On
1. Common Command-Line Gems and Libraries
-Alternatives for Simple Command-Line Apps
-Alternatives for Command Suites
-Other Relevant Libraries
2. Bibliography
  • Чтобы скачать этот файл зарегистрируйтесь и/или войдите на сайт используя форму сверху.
  • Регистрация