fix(cleanup): Stop deleting files from destination
This commit is contained in:
parent
1caeb018cf
commit
112dc9bd18
@ -73,9 +73,13 @@ module Jekyll
|
||||
end
|
||||
|
||||
# A Jekyll::Site subclass that overrides #write from the parent class to
|
||||
# create JSON records out of rendered documents and push those records
|
||||
# to Algolia instead of writing files to disk.
|
||||
# create JSON records out of rendered documents and push those records to
|
||||
# Algolia instead of writing files to disk.
|
||||
class Site < Jekyll::Site
|
||||
# We make the cleanup method a noop, otherwise it will remove excluded
|
||||
# files from destination
|
||||
def cleanup; end
|
||||
|
||||
def write
|
||||
records = []
|
||||
files = []
|
||||
|
||||
@ -65,6 +65,20 @@ describe(Jekyll::Algolia) do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'overriding Jekyll::Site#cleanup' do
|
||||
# Given
|
||||
let(:configuration) { Jekyll.configuration }
|
||||
let(:jekyll_site) { Jekyll::Site.new(configuration) }
|
||||
let(:algolia_site) { Jekyll::Algolia::Site.new(configuration) }
|
||||
let!(:initial_method) { jekyll_site.method(:cleanup).source_location }
|
||||
let!(:overridden_method) { algolia_site.method(:cleanup).source_location }
|
||||
|
||||
# Then
|
||||
it 'should change the initial .cleanup method' do
|
||||
expect(overridden_method).to_not eq initial_method
|
||||
end
|
||||
end
|
||||
|
||||
describe '.run (mocked build)' do
|
||||
# Prevent the whole process to stop if Algolia config is not available
|
||||
before do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user