Refactor based on jekyll-watch clean-up.
https://github.com/jekyll/jekyll-watch/pull/5
This commit is contained in:
parent
565bbada08
commit
a2dfd6eddc
|
@ -19,31 +19,6 @@ module Jekyll
|
|||
super(base)
|
||||
end
|
||||
|
||||
# Paths to ignore for the watch option
|
||||
#
|
||||
# options - A Hash of options passed to the command
|
||||
#
|
||||
# Returns a list of relative paths from source that should be ignored
|
||||
def ignore_paths(options)
|
||||
source = options['source']
|
||||
destination = options['destination']
|
||||
config_files = Configuration[options].config_files(options)
|
||||
paths = config_files + Array(destination)
|
||||
ignored = []
|
||||
|
||||
source_abs = Pathname.new(source).expand_path
|
||||
paths.each do |p|
|
||||
path_abs = Pathname.new(p).expand_path
|
||||
begin
|
||||
rel_path = path_abs.relative_path_from(source_abs).to_s
|
||||
ignored << Regexp.new(Regexp.escape(rel_path)) unless rel_path.start_with?('../')
|
||||
rescue ArgumentError
|
||||
# Could not find a relative path
|
||||
end
|
||||
end
|
||||
ignored
|
||||
end
|
||||
|
||||
# Run Site#process and catch errors
|
||||
#
|
||||
# site - the Jekyll::Site object
|
||||
|
|
|
@ -64,7 +64,7 @@ module Jekyll
|
|||
# Returns nothing.
|
||||
def watch(site, options)
|
||||
Deprecator.gracefully_require 'jekyll-watch'
|
||||
Jekyll::Commands::Watch.watch(site, options)
|
||||
Jekyll::Watch.watch(options)
|
||||
end
|
||||
|
||||
end # end of class << self
|
||||
|
|
Loading…
Reference in New Issue