From 2a5cf11ee27c0faeda1009d6a8099882230038fc Mon Sep 17 00:00:00 2001 From: Alfred Xing Date: Sun, 23 Nov 2014 15:38:00 -0800 Subject: [PATCH] Add --no-metadata option --- lib/jekyll/command.rb | 1 + lib/jekyll/metadata.rb | 10 ++++++++-- lib/jekyll/site.rb | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index 423c3202..658ce597 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -59,6 +59,7 @@ module Jekyll c.option 'quiet', '-q', '--quiet', 'Silence output.' c.option 'verbose', '-V', '--verbose', 'Print verbose output.' c.option 'full_rebuild', '-f', '--full-rebuild', 'Clean the site before rebuilding.' + c.option 'no_metadata', '--no-metadata', 'Disable incremental regeneration.' end end diff --git a/lib/jekyll/metadata.rb b/lib/jekyll/metadata.rb index 68a31a05..3e242d69 100644 --- a/lib/jekyll/metadata.rb +++ b/lib/jekyll/metadata.rb @@ -46,6 +46,8 @@ module Jekyll # # Returns a boolean. def regenerate?(path, add = true) + return true if site.config['no_metadata'] + # Check for path in cache if @cache.has_key? path return @cache[path] @@ -73,7 +75,7 @@ module Jekyll # # Returns nothing. def add_dependency(path, dependency) - return if @metadata[path].nil? + return if (@metadata[path].nil? || site.config['no_metadata']) @metadata[path]["deps"] << dependency unless @metadata[path]["deps"].include? dependency regenerate? dependency @@ -102,7 +104,11 @@ module Jekyll # # Returns the read metadata. def read_metadata - @metadata = (File.file?(metadata_file) && !(site.config['full_rebuild'])) ? SafeYAML.load(File.read(metadata_file)) : {} + @metadata = if !(site.config['full_rebuild'] || site.config['no_metadata']) && File.file?(metadata_file) + SafeYAML.load(File.read(metadata_file)) + else + {} + end end end end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 738cae0e..69f11a75 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -328,7 +328,7 @@ module Jekyll (item.respond_to?(:data) && item.data['regenerate']) ) } - metadata.write + metadata.write unless site.config['no_metadata'] end # Construct a Hash of Posts indexed by the specified Post attribute.