parent
f606d9339b
commit
bec4a07c12
|
@ -63,11 +63,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def setup
|
def setup
|
||||||
# Check that the destination dir isn't the source dir or a directory
|
ensure_not_in_dest
|
||||||
# parent to the source dir.
|
|
||||||
if self.source =~ /^#{self.dest}/
|
|
||||||
raise FatalException.new "Destination directory cannot be or contain the Source directory."
|
|
||||||
end
|
|
||||||
|
|
||||||
# If safe mode is off, load in any Ruby files under the plugins
|
# If safe mode is off, load in any Ruby files under the plugins
|
||||||
# directory.
|
# directory.
|
||||||
|
@ -83,6 +79,17 @@ module Jekyll
|
||||||
self.generators = instantiate_subclasses(Jekyll::Generator)
|
self.generators = instantiate_subclasses(Jekyll::Generator)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check that the destination dir isn't the source dir or a directory
|
||||||
|
# parent to the source dir.
|
||||||
|
def ensure_not_in_dest
|
||||||
|
dest = Pathname.new(self.dest)
|
||||||
|
Pathname.new(self.source).ascend do |path|
|
||||||
|
if path == dest
|
||||||
|
raise FatalException.new "Destination directory cannot be or contain the Source directory."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Internal: Setup the plugin search path
|
# Internal: Setup the plugin search path
|
||||||
#
|
#
|
||||||
# Returns an Array of plugin search paths
|
# Returns an Array of plugin search paths
|
||||||
|
|
Loading…
Reference in New Issue