Add an option to easily disable disk-cache (#7928)
Merge pull request 7928
This commit is contained in:
parent
ba3e3002c4
commit
558e05eb73
|
@ -43,13 +43,35 @@ class="flag">flags</code> (specified on the command-line) that control them.
|
||||||
<tr class="setting">
|
<tr class="setting">
|
||||||
<td>
|
<td>
|
||||||
<p class="name"><strong>Safe</strong></p>
|
<p class="name"><strong>Safe</strong></p>
|
||||||
<p class="description">Disable <a href="/docs/plugins/">custom plugins, and ignore symbolic links</a>.</p>
|
<p class="description">
|
||||||
|
Disable <a href="/docs/plugins/">custom plugins</a>, caching to disk
|
||||||
|
and ignore symbolic links.
|
||||||
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-center">
|
<td class="align-center">
|
||||||
<p><code class="option">safe: BOOL</code></p>
|
<p><code class="option">safe: BOOL</code></p>
|
||||||
<p><code class="flag">--safe</code></p>
|
<p><code class="flag">--safe</code></p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="setting">
|
||||||
|
<td>
|
||||||
|
<p class="name">
|
||||||
|
<strong>Disable Disk Cache</strong>
|
||||||
|
<span class="version-badge" title="Introduced in v4.1.0">4.1.0</span>
|
||||||
|
</p>
|
||||||
|
<p class="description">
|
||||||
|
Disable caching of content to disk in order to skip creating a
|
||||||
|
<code>.jekyll-cache</code> or similar directory at the source
|
||||||
|
to avoid interference with virtual environments and third-party
|
||||||
|
directory watchers.
|
||||||
|
Caching to disk is always disabled in <code>safe</code> mode.
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class="align-center">
|
||||||
|
<p><code class="option">disable_disk_cache: BOOL</code></p>
|
||||||
|
<p><code class="flag">--disable-disk-cache</code></p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr class="setting">
|
<tr class="setting">
|
||||||
<td>
|
<td>
|
||||||
<p class="name"><strong>Exclude</strong></p>
|
<p class="name"><strong>Exclude</strong></p>
|
||||||
|
|
|
@ -35,3 +35,12 @@ Feature: Cache
|
||||||
But the .jekyll-cache directory should not exist
|
But the .jekyll-cache directory should not exist
|
||||||
And the _site directory should exist
|
And the _site directory should exist
|
||||||
And I should see "<p>Hello World</p>" in "_site/index.html"
|
And I should see "<p>Hello World</p>" in "_site/index.html"
|
||||||
|
|
||||||
|
Scenario: Disabling disk usage in non-safe mode
|
||||||
|
Given I have an "index.md" page that contains "{{ site.title }}"
|
||||||
|
And I have a configuration file with "title" set to "Hello World"
|
||||||
|
When I run jekyll build --disable-disk-cache
|
||||||
|
Then I should get a zero exit status
|
||||||
|
And the _site directory should exist
|
||||||
|
And I should see "<p>Hello World</p>" in "_site/index.html"
|
||||||
|
But the .jekyll-cache directory should not exist
|
||||||
|
|
|
@ -67,6 +67,8 @@ module Jekyll
|
||||||
cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
|
cmd.option "show_drafts", "-D", "--drafts", "Render posts in the _drafts folder"
|
||||||
cmd.option "unpublished", "--unpublished",
|
cmd.option "unpublished", "--unpublished",
|
||||||
"Render posts that were marked as unpublished"
|
"Render posts that were marked as unpublished"
|
||||||
|
cmd.option "disable_disk_cache", "--disable-disk-cache",
|
||||||
|
"Disable caching to disk in non-safe mode"
|
||||||
cmd.option "quiet", "-q", "--quiet", "Silence output."
|
cmd.option "quiet", "-q", "--quiet", "Silence output."
|
||||||
cmd.option "verbose", "-V", "--verbose", "Print verbose output."
|
cmd.option "verbose", "-V", "--verbose", "Print verbose output."
|
||||||
cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
|
cmd.option "incremental", "-I", "--incremental", "Enable incremental rebuild."
|
||||||
|
|
|
@ -470,7 +470,7 @@ module Jekyll
|
||||||
# Disable Marshaling cache to disk in Safe Mode
|
# Disable Marshaling cache to disk in Safe Mode
|
||||||
def configure_cache
|
def configure_cache
|
||||||
Jekyll::Cache.cache_dir = in_source_dir(config["cache_dir"], "Jekyll/Cache")
|
Jekyll::Cache.cache_dir = in_source_dir(config["cache_dir"], "Jekyll/Cache")
|
||||||
Jekyll::Cache.disable_disk_cache! if safe
|
Jekyll::Cache.disable_disk_cache! if safe || config["disable_disk_cache"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_plugins
|
def configure_plugins
|
||||||
|
|
Loading…
Reference in New Issue