diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 7d8a3885..0c59a2b9 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -18,6 +18,16 @@ Feature: Site configuration Then the _mysite directory should exist And I should see "Changing destination directory" in "_mysite/index.html" + Scenario: Exclude files + Given I have an "Rakefile" file that contains "I want to be excluded" + And I have an "README" file that contains "I want to be excluded" + And I have an "index.html" file that contains "I want to be included" + And I have a configuration file with "exclude" set to "Rakefile", "README" + When I run jekyll + Then I should see "I want to be included" in "_site/index.html" + And the "_site/Rakefile" file should not exist + And the "_site/README" file should not exist + Scenario: Use RDiscount for markup Given I have an "index.markdown" page that contains "[Google](http://google.com)" And I have a configuration file with "markdown" set to "rdiscount" diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 7b41c900..1ed3836a 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -1,7 +1,7 @@ module Jekyll class Site - attr_accessor :config, :layouts, :posts, :categories + attr_accessor :config, :layouts, :posts, :categories, :exclude attr_accessor :source, :dest, :lsi, :pygments, :permalink_style # Initialize the site @@ -17,6 +17,8 @@ module Jekyll self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym + self.exclude = config['exclude'] || [] + self.reset self.setup end @@ -229,7 +231,7 @@ module Jekyll entries = entries.reject do |e| unless ['_posts', '.htaccess'].include?(e) # Reject backup/hidden - ['.', '_', '#'].include?(e[0..0]) or e[-1..-1] == '~' + ['.', '_', '#'].include?(e[0..0]) or e[-1..-1] == '~' or self.exclude.include?(e) end end end