Check if JekyllImport is defined using Object#const_defined?
This commit is contained in:
parent
b923df0c01
commit
35ef90ac66
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue