Push conditionals into set_color method.

Calling #set_color required the client code to check the argument and
 #can_display_colors?. Pushing these checks into #set_color makes it much
easier to reuse this method.

This means that #set_color will now behave differently on TTY and non-TTY
terminals, so the #tty? method of $stdout has been stubbed in the
Thor::Shell::Color specs to always return true.
Push user input into a Thor::LineEditor module.

This paves the way for using Readline.

Since Readline needs to display its own prompt (for history navigation etc.)
the #ask method can no longer use the #say method, so the code for adding
colours and padding has been extracted into #prepare_message
Use Readline when it's available.
Replace line editor conditional with polymorphism.

This refactoring paves the way for adding more advanced Readline
functionality, like tab completion and selective addition to history.

Thanks to Tom Lea (@cwninja) for pairing on the tests for this.
Check if numeric value is in enum
Pass #ask options on to LineEditor.readline

This will allow for various editor-level customisations based on the
options, and for the set of #ask options to be expanded to include options
that specifically effect the line editor.
Support Readline history.

* By default, the response to any #ask call is added to the history.
* Pass `:add_to_history => false` to #ask to avoid adding to history.
* #yes?, #no?, and #file_collision? have `:add_to_history => false` by
  default.
Support Readline tab completion.

When the input is restricted by the :limited_to option, support tab
completion for the options.
Add path completion to Readline.

Arguably the most common use for tab completion is paths, so let's support
it! Calls to #ask can now take `:path => true` which will enable tab
completion relative to the current working directory on systems that have
Readline support.
Move :echo => false support into LineEditors

:echo => false was added to the ask method in dbfdd30, this maintains that
behaviour with Readline support.

Tip o' the hat to @cwninja, we paired on this.
Merge pull request #386 from markets/numeric_enum

Check if numeric value is in enum
Only rescue LoadErrors when loading Readline.
Fix Readline check on Ruby 1.8.7

`Kernel.const_defined?` will return true for root-level constants in Ruby
1.9+, but false in Ruby 1.8. `Object.const_defined?` works consistently in
all versions.
Merge pull request #360 from georgebrock/gb-readline

Use Readline for user input
Only set non-nil Readline.completion_proc.

This fixes an ArgumentError when running with Ruby 1.8.7.
Merge pull request #389 from TimMoore/ruby-1.8.7-compat

Only set non-nil Readline.completion_proc.