diff --git a/Rakefile b/Rakefile index 98610a3c..fb177f16 100644 --- a/Rakefile +++ b/Rakefile @@ -209,8 +209,7 @@ namespace :site do Jekyll::Commands::Build.process({ "source" => File.expand_path("site"), "destination" => File.expand_path("gh-pages"), - "sass" => { "style" => "compressed" }, - "full_rebuild" => true + "sass" => { "style" => "compressed" } }) File.open('gh-pages/.nojekyll', 'wb') { |f| f.puts(":dog: food.") } diff --git a/features/incremental_rebuild.feature b/features/incremental_rebuild.feature index 08739d3e..fb95e0c5 100644 --- a/features/incremental_rebuild.feature +++ b/features/incremental_rebuild.feature @@ -10,26 +10,26 @@ Feature: Incremental rebuild | title | date | layout | content | | Wargames | 2009-03-27 | default | The only winning move is not to play. | And I have a default layout that contains "Post Layout: {{ content }}" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Post Layout:
The only winning move is not to play.
" in "_site/2009/03/27/wargames.html" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Post Layout:The only winning move is not to play.
" in "_site/2009/03/27/wargames.html" Scenario: Generate a metadata file Given I have an "index.html" file that contains "Basic Site" - When I run jekyll build + When I run jekyll build -I Then the ".jekyll-metadata" file should exist Scenario: Rebuild when content is changed Given I have an "index.html" file that contains "Basic Site" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Basic Site" in "_site/index.html" When I wait 1 second Then I have an "index.html" file that contains "Bacon Site" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Bacon Site" in "_site/index.html" @@ -37,12 +37,12 @@ Feature: Incremental rebuild Given I have a _layouts directory And I have an "index.html" page with layout "default" that contains "Basic Site with Layout" And I have a default layout that contains "Page Layout: {{ content }}" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Page Layout: Basic Site with Layout" in "_site/index.html" When I wait 1 second Then I have a default layout that contains "Page Layout Changed: {{ content }}" - When I run jekyll build --full-rebuild + When I run jekyll build Then the _site directory should exist And I should see "Page Layout Changed: Basic Site with Layout" in "_site/index.html" @@ -50,11 +50,11 @@ Feature: Incremental rebuild Given I have a _includes directory And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" And I have an "_includes/about.textile" file that contains "Generated by Jekyll" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" When I wait 1 second Then I have an "_includes/about.textile" file that contains "Regenerated by Jekyll" - When I run jekyll build + When I run jekyll build -I Then the _site directory should exist And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html" diff --git a/lib/jekyll/cleaner.rb b/lib/jekyll/cleaner.rb index 30c0a432..d23da78f 100644 --- a/lib/jekyll/cleaner.rb +++ b/lib/jekyll/cleaner.rb @@ -13,7 +13,7 @@ module Jekyll # Cleans up the site's destination directory def cleanup! FileUtils.rm_rf(obsolete_files) - FileUtils.rm_rf(metadata_file) if @site.full_rebuild? + FileUtils.rm_rf(metadata_file) if !@site.incremental? end private diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index a72640fb..f3c89dfd 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -60,7 +60,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', 'Disable incremental rebuild.' + c.option 'incremental', '-I', '--incremental', 'Enable incremental rebuild.' end end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index b6db514d..de0cc8bc 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -52,10 +52,10 @@ module Jekyll t = Time.now source = options['source'] destination = options['destination'] - full_build = options['full_rebuild'] + incremental = options['incremental'] Jekyll.logger.info "Source:", source Jekyll.logger.info "Destination:", destination - Jekyll.logger.info "Incremental build:", (full_build ? "disabled" : "enabled") + Jekyll.logger.info "Incremental build:", (incremental ? "enabled" : "disabled. Enable with --incremental") Jekyll.logger.info "Generating..." process_site(site) Jekyll.logger.info "", "done in #{(Time.now - t).round(3)} seconds." diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 04f7dac2..f57b3ae4 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -22,7 +22,6 @@ module Jekyll 'keep_files' => ['.git','.svn'], 'encoding' => 'utf-8', 'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md', - 'full_rebuild' => true, # Filtering Content 'show_drafts' => nil, @@ -39,6 +38,7 @@ module Jekyll 'highlighter' => 'rouge', 'lsi' => false, 'excerpt_separator' => "\n\n", + 'incremental' => false, # Serving 'detach' => false, # default to not detaching the server diff --git a/lib/jekyll/regenerator.rb b/lib/jekyll/regenerator.rb index 18b94f6b..911ca18b 100644 --- a/lib/jekyll/regenerator.rb +++ b/lib/jekyll/regenerator.rb @@ -144,7 +144,7 @@ module Jekyll # # Returns a Boolean (true for disabled, false for enabled). def disabled? - @disabled = site.full_rebuild? if @disabled.nil? + @disabled = !site.incremental? if @disabled.nil? @disabled end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 66bfd163..6859c2d6 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -351,8 +351,8 @@ module Jekyll # Whether to perform a full rebuild without incremental regeneration # # Returns a Boolean: true for a full rebuild, false for normal build - def full_rebuild?(override = {}) - override['full_rebuild'] || config['full_rebuild'] + def incremental?(override = {}) + override['incremental'] || config['incremental'] end # Returns the publisher or creates a new publisher if it doesn't diff --git a/script/rubyprof b/script/rubyprof index 520dc86e..18c5777b 100755 --- a/script/rubyprof +++ b/script/rubyprof @@ -2,7 +2,7 @@ export BENCHMARK=1 -TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site', 'full_rebuild' => true})" +TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site'})" RUBY=$(cat < /dev/null || script/bootstrap -TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site', 'full_rebuild' => true})" +TEST_SCRIPT="Jekyll::Commands::Build.process({'source' => 'site'})" PROF_OUTPUT_FILE=tmp/stackprof-$(date +%Y%m%d%H%M).dump test -f "$PROF_OUTPUT_FILE" || { diff --git a/test/helper.rb b/test/helper.rb index 16f015b7..dc021767 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -74,7 +74,7 @@ class JekyllUnitTest < Minitest::Test def site_configuration(overrides = {}) full_overrides = build_configs(overrides, build_configs({ "destination" => dest_dir, - "full_rebuild" => true + "incremental" => false })) build_configs({ "source" => source_dir diff --git a/test/test_regenerator.rb b/test/test_regenerator.rb index d74c14d5..ebd30aec 100644 --- a/test/test_regenerator.rb +++ b/test/test_regenerator.rb @@ -11,7 +11,7 @@ class TestRegenerator < JekyllUnitTest "output" => true } }, - "full_rebuild" => false + "incremental" => true }) @site.read @@ -94,7 +94,7 @@ class TestRegenerator < JekyllUnitTest FileUtils.rm_rf(source_dir(".jekyll-metadata")) @site = fixture_site({ - "full_rebuild" => false + "incremental" => true }) @site.read @@ -131,7 +131,7 @@ class TestRegenerator < JekyllUnitTest @site = Site.new(Jekyll.configuration({ "source" => source_dir, "destination" => dest_dir, - "full_rebuild" => false + "incremental" => true })) @site.process @@ -297,7 +297,7 @@ class TestRegenerator < JekyllUnitTest end should "regenerate everything if metadata is disabled" do - @site.config["full_rebuild"] = true + @site.config["incremental"] = false @regenerator.clear @regenerator.add(@path) @regenerator.write_metadata diff --git a/test/test_site.rb b/test/test_site.rb index 811d79d0..66f1408d 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -330,7 +330,7 @@ class TestSite < JekyllUnitTest end bad_processor = "Custom::Markdown" - s = Site.new(site_configuration('markdown' => bad_processor, 'full_rebuild' => true)) + s = Site.new(site_configuration('markdown' => bad_processor, 'incremental' => false)) assert_raises Jekyll::Errors::FatalException do s.process end @@ -348,7 +348,7 @@ class TestSite < JekyllUnitTest should 'throw FatalException at process time' do bad_processor = 'not a processor name' - s = Site.new(site_configuration('markdown' => bad_processor, 'full_rebuild' => true)) + s = Site.new(site_configuration('markdown' => bad_processor, 'incremental' => false)) assert_raises Jekyll::Errors::FatalException do s.process end @@ -429,7 +429,7 @@ class TestSite < JekyllUnitTest context "manipulating the Jekyll environment" do setup do @site = Site.new(site_configuration({ - 'full_rebuild' => true + 'incremental' => false })) @site.process @page = @site.pages.find { |p| p.name == "environment.html" } @@ -443,7 +443,7 @@ class TestSite < JekyllUnitTest setup do ENV["JEKYLL_ENV"] = "production" @site = Site.new(site_configuration({ - 'full_rebuild' => true + 'incremental' => false })) @site.process @page = @site.pages.find { |p| p.name == "environment.html" } @@ -473,7 +473,7 @@ class TestSite < JekyllUnitTest context "incremental build" do setup do @site = Site.new(site_configuration({ - 'full_rebuild' => false + 'incremental' => true })) @site.read end