Check if JekyllImport is defined using Object#const_defined?

This commit is contained in:
Parker Moore 2013-11-08 17:42:37 -05:00
parent b923df0c01
commit 35ef90ac66
1 changed files with 2 additions and 2 deletions

View File

@ -121,12 +121,12 @@ Mercenary.program(:jekyll) do |p|
begin begin
require 'jekyll-import' require 'jekyll-import'
rescue LoadError
JekyllImport.add_importer_commands(c) JekyllImport.add_importer_commands(c)
rescue LoadError
end end
c.action do |args, options| c.action do |args, options|
if defined?(JekyllImport) unless Object.const_defined?(:JekyllImport)
msg = "You must install the 'jekyll-import' gem before continuing.\n" msg = "You must install the 'jekyll-import' gem before continuing.\n"
msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n" msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n"
abort msg abort msg