Permalink
Browse files

Merge branch 'include' of https://github.com/lukebayes/jekyll into lu…

…kebayes-include

Conflicts:
	lib/jekyll.rb
	lib/jekyll/site.rb
  • Loading branch information...
2 parents b66840c + 717a254 commit 89180169a433d0565bdd95537b8632924f4ddfe9 @mojombo mojombo committed Jan 15, 2012
Showing with 19 additions and 5 deletions.
  1. +4 −0 History.txt
  2. +2 −1 lib/jekyll.rb
  3. +3 −2 lib/jekyll/site.rb
  4. +10 −2 test/test_site.rb
View
4 History.txt
@@ -1,3 +1,7 @@
+== HEAD
+ * Minor Enhancements
+ * Add ability to explicitly specify included files (#261)
+
== 0.11.2 / 2011-12-27
* Bug Fixes
* Fix gemspec
View
3 lib/jekyll.rb
@@ -65,7 +65,8 @@ module Jekyll
'pygments' => false,
'markdown' => 'maruku',
'permalink' => 'date',
-
+ 'include' => ['.htaccess'],
+
'markdown_ext' => 'markdown,mkd,mkdn,md',
'textile_ext' => 'textile',
View
5 lib/jekyll/site.rb
@@ -4,7 +4,7 @@ module Jekyll
class Site
attr_accessor :config, :layouts, :posts, :pages, :static_files,
- :categories, :exclude, :source, :dest, :lsi, :pygments,
+ :categories, :exclude, :include, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts
attr_accessor :converters, :generators
@@ -23,6 +23,7 @@ def initialize(config)
self.pygments = config['pygments']
self.permalink_style = config['permalink'].to_sym
self.exclude = config['exclude'] || []
+ self.include = config['include'] || []
self.future = config['future']
self.limit_posts = config['limit_posts'] || nil
@@ -305,7 +306,7 @@ def site_payload
# Returns the Array of filtered entries.
def filter_entries(entries)
entries = entries.reject do |e|
- unless ['.htaccess'].include?(e)
+ unless self.include.include?(e)
['.', '_', '#'].include?(e[0..0]) ||
e[-1..-1] == '~' ||
self.exclude.include?(e) ||
View
12 test/test_site.rb
@@ -126,12 +126,20 @@ class TestSite < Test::Unit::TestCase
should "filter entries with exclude" do
excludes = %w[README TODO]
- includes = %w[index.html site.css]
+ files = %w[index.html site.css .htaccess]
@site.exclude = excludes
- assert_equal includes, @site.filter_entries(excludes + includes)
+ assert_equal files, @site.filter_entries(excludes + files)
end
+ should "not filter entries within include" do
+ includes = %w[_index.html .htaccess]
+ files = %w[index.html _index.html .htaccess]
+
+ @site.include = includes
+ assert_equal files, @site.filter_entries(files)
+ end
+
context 'with orphaned files in destination' do
setup do
clear_dest

0 comments on commit 8918016

Please sign in to comment.