Display 'gem install curses' when curses cannot be loaded

This commit is contained in:
Junegunn Choi 2014-07-27 01:08:30 +09:00
parent 22989b0488
commit a54784cd53
2 changed files with 9 additions and 4 deletions

9
fzf
View File

@ -7,7 +7,7 @@
# / __/ / /_/ __/
# /_/ /___/_/ Fuzzy finder for your shell
#
# Version: 0.8.7 (Jul 18, 2014)
# Version: 0.8.7 (Jul 27, 2014)
#
# Author: Junegunn Choi
# URL: https://github.com/junegunn/fzf
@ -36,8 +36,13 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
begin
require 'curses'
rescue LoadError
$stderr.puts 'curses gem is not installed. Try `gem install curses`.'
exit 1
end
require 'thread'
require 'curses'
require 'set'
unless String.method_defined? :force_encoding

View File

@ -29,9 +29,9 @@ else
echo "Not found"
echo "Installing 'curses' gem ... "
if (( EUID )); then
/usr/bin/env gem install curses -v 1.0.0 --user-install
/usr/bin/env gem install curses --user-install
else
/usr/bin/env gem install curses -v 1.0.0
/usr/bin/env gem install curses
fi
if [ $? -ne 0 ]; then
echo