Rename incremental regeneration flag

Rename from `full_rebuild` to disable, to `incremental` to enable
This commit is contained in:
Alfred Xing 2015-10-26 14:20:44 -07:00
parent d9b12bc090
commit 2a040fd527
13 changed files with 30 additions and 31 deletions

View File

@ -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.") }

View File

@ -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: <p>The only winning move is not to play.</p>" 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: <p>The only winning move is not to play.</p>" 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"

View File

@ -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

View File

@ -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

View File

@ -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."

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <<RUBY
require 'ruby-prof'

View File

@ -5,7 +5,7 @@ set -e
export BENCHMARK=true
command -v stackprof > /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" || {

View File

@ -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

View File

@ -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

View File

@ -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