Skip to content

Commit

Permalink
Revert "Incrementally rebuild when a data file is changed (#8771)" (#…
Browse files Browse the repository at this point in the history
…9170)

Merge pull request 9170
  • Loading branch information
ashmaroli committed Oct 26, 2022
1 parent f3fa91e commit 590d0b5
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 315 deletions.
53 changes: 0 additions & 53 deletions features/incremental_rebuild.feature
Original file line number Diff line number Diff line change
Expand Up @@ -67,59 +67,6 @@ Feature: Incremental rebuild
And the _site directory should exist
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"

Scenario: Rebuild when a data file is changed
Given I have a _data directory
And I have a "_data/colors.yml" file that contains "[red, green, blue]"
And I have a _data/members/core directory
And I have a "_data/members/core/emeritus.yml" file with content:
"""
- name: John Doe
role: Admin
"""
And I have an _includes directory
And I have an "_includes/about.html" file with content:
"""
<ul>
{% for entry in site.data.members.core.emeritus %}
<li title="{{ entry.name }} -- {{ entry.role }}">{{ entry.name }}</li>
{% endfor %}
</ul>
"""
And I have a _layouts directory
And I have a page layout that contains "{{ content }}\n\n{% include about.html %}"
And I have a home layout that contains "{{ content }}\n\nGenerated by Jekyll"
And I have a "_layouts/post.html" page with layout "page" that contains "{{ content }}"
And I have a "_layouts/static.html" page with layout "home" that contains "{{ content }}"
And I have an "index.html" page with layout "home" that contains "{{ site.data.colors | join: '_' }}"
And I have an "about.html" page with layout "page" that contains "About Us"
And I have a configuration file with "collections_dir" set to "collections"
And I have a collections/_posts directory
And I have the following post within the "collections" directory:
| title | date | layout | content |
| Table | 2009-03-26 | post | Post with data dependency |
| Wargames | 2009-03-27 | static | Post without data dependency |
When I run jekyll build -IV
Then I should get a zero exit status
And the _site directory should exist
And I should see "red_green_blue" in "_site/index.html"
And I should see "John Doe -- Admin" in "_site/about.html"
And I should see "Rendering: index.html" in the build output
And I should see "Rendering: _posts/2009-03-27-wargames.markdown" in the build output
When I wait 1 second
Then I have a "_data/members/core/emeritus.yml" file with content:
"""
- name: Jane Doe
role: Admin
"""
When I run jekyll build -IV
Then I should get a zero exit status
And the _site directory should exist
And I should see "red_green_blue" in "_site/index.html"
And I should see "Jane Doe -- Admin" in "_site/about.html"
And I should see "Rendering: _posts/2009-03-26-table.markdown" in the build output
But I should not see "Rendering: index.html" in the build output
And I should not see "Rendering: _posts/2009-03-27-wargames.markdown" in the build output

Scenario: Rebuild when a dependency of document in custom collection_dir is changed
Given I have a _includes directory
And I have a configuration file with "collections_dir" set to "collections"
Expand Down
2 changes: 0 additions & 2 deletions lib/jekyll.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ module Jekyll
autoload :Collection, "jekyll/collection"
autoload :Configuration, "jekyll/configuration"
autoload :Convertible, "jekyll/convertible"
autoload :DataEntry, "jekyll/data_entry"
autoload :DataHash, "jekyll/data_hash"
autoload :Deprecator, "jekyll/deprecator"
autoload :Document, "jekyll/document"
autoload :EntryFilter, "jekyll/entry_filter"
Expand Down
83 changes: 0 additions & 83 deletions lib/jekyll/data_entry.rb

This file was deleted.

61 changes: 0 additions & 61 deletions lib/jekyll/data_hash.rb

This file was deleted.

7 changes: 1 addition & 6 deletions lib/jekyll/drops/site_drop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class SiteDrop < Drop

mutable false

delegate_method_as :site_data, :data
delegate_methods :time, :pages, :static_files, :tags, :categories

private delegate_method_as :config, :fallback_data
Expand All @@ -23,12 +24,6 @@ def key?(key)
(key != "posts" && @obj.collections.key?(key)) || super
end

def data
@obj.site_data.tap do |value|
value.context = @context if value.respond_to?(:context=)
end
end

def posts
@site_posts ||= @obj.posts.docs.sort { |a, b| b <=> a }
end
Expand Down
9 changes: 3 additions & 6 deletions lib/jekyll/readers/data_reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DataReader

def initialize(site, in_source_dir: nil)
@site = site
@content = DataHash.new
@content = {}
@entry_filter = EntryFilter.new(site)
@in_source_dir = in_source_dir || @site.method(:in_source_dir)
@source_dir = @in_source_dir.call("/")
Expand All @@ -24,8 +24,6 @@ def read(dir)
@content
end

# rubocop:disable Metrics/AbcSize

# Read and parse all .yaml, .yml, .json, .csv and .tsv
# files under <dir> and add them to the <data> variable.
#
Expand All @@ -45,14 +43,13 @@ def read_data_to(dir, data)
next if @entry_filter.symlink?(path)

if File.directory?(path)
read_data_to(path, data[sanitize_filename(entry)] = DataHash.new)
read_data_to(path, data[sanitize_filename(entry)] = {})
else
key = sanitize_filename(File.basename(entry, ".*"))
data[key] = DataEntry.new(site, path, read_data_file(path))
data[key] = read_data_file(path)
end
end
end
# rubocop:enable Metrics/AbcSize

# Determines how to read a data file.
#
Expand Down
9 changes: 1 addition & 8 deletions lib/jekyll/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,7 @@ def deep_merge_hashes!(target, overwrite)
end

def mergable?(value)
case value
when Hash, Drops::Drop, DataHash
true
when DataEntry
mergable?(value.data)
else
false
end
value.is_a?(Hash) || value.is_a?(Drops::Drop)
end

def duplicable?(obj)
Expand Down
1 change: 0 additions & 1 deletion test/source/_data/boolean.yml

This file was deleted.

4 changes: 0 additions & 4 deletions test/source/_data/languages_plus.yml

This file was deleted.

34 changes: 0 additions & 34 deletions test/test_data_entry.rb

This file was deleted.

57 changes: 0 additions & 57 deletions test/test_data_hash.rb

This file was deleted.

0 comments on commit 590d0b5

Please sign in to comment.