diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index 658ce597..12fd66e6 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -58,8 +58,7 @@ module Jekyll c.option 'unpublished', '--unpublished', 'Render posts that were marked as unpublished' 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.' + c.option 'full_rebuild', '-f', '--full-rebuild', 'Disable incremental rebuild.' end end diff --git a/lib/jekyll/metadata.rb b/lib/jekyll/metadata.rb index 6a31eb25..de9731d4 100644 --- a/lib/jekyll/metadata.rb +++ b/lib/jekyll/metadata.rb @@ -5,10 +5,6 @@ module Jekyll def initialize(site) @site = site - # Configuration options - @full_rebuild = site.config['full_rebuild'] - @disabled = site.config['no_metadata'] - # Read metadata from file read_metadata @@ -48,7 +44,7 @@ module Jekyll # # Returns a boolean. def regenerate?(path, add = true) - return true if @disabled + return true if disabled? # Check for path in cache if cache.has_key? path @@ -56,7 +52,8 @@ module Jekyll end # Check path that exists in metadata - if data = metadata[path] + data = metadata[path] + if data data["deps"].each do |dependency| if regenerate?(dependency) return cache[dependency] = cache[path] = true @@ -99,6 +96,14 @@ module Jekyll site.in_source_dir('.jekyll-metadata') end + # Check if metadata has been disabled + # + # Returns a Boolean (true for disabled, false for enabled). + def disabled? + @disabled = site.config['full_rebuild'] if @disabled.nil? + @disabled + end + private # Read metadata from the metadata file, if no file is found, @@ -106,7 +111,7 @@ module Jekyll # # Returns the read metadata. def read_metadata - @metadata = if !(@full_rebuild || @disabled) && File.file?(metadata_file) + @metadata = if !disabled? && File.file?(metadata_file) SafeYAML.load(File.read(metadata_file)) else {} diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index eaf4c3cd..4b8518c2 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -319,7 +319,7 @@ module Jekyll each_site_file { |item| item.write(dest) if item.regenerate? } - metadata.write unless config['no_metadata'] + metadata.write unless config['full_rebuild'] end # Construct a Hash of Posts indexed by the specified Post attribute.