Refactor based on jekyll-watch clean-up.

https://github.com/jekyll/jekyll-watch/pull/5
This commit is contained in:
Parker Moore 2014-08-09 00:13:18 -04:00
parent 565bbada08
commit a2dfd6eddc
2 changed files with 1 additions and 26 deletions

View File

@ -19,31 +19,6 @@ module Jekyll
super(base) super(base)
end 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 # Run Site#process and catch errors
# #
# site - the Jekyll::Site object # site - the Jekyll::Site object

View File

@ -64,7 +64,7 @@ module Jekyll
# Returns nothing. # Returns nothing.
def watch(site, options) def watch(site, options)
Deprecator.gracefully_require 'jekyll-watch' Deprecator.gracefully_require 'jekyll-watch'
Jekyll::Commands::Watch.watch(site, options) Jekyll::Watch.watch(options)
end end
end # end of class << self end # end of class << self