From 6b74454a07cf1a3d8ac4d76bbafc50ceb47d13cb Mon Sep 17 00:00:00 2001 From: Kris Brown Date: Sat, 9 Jan 2010 18:55:07 +0000 Subject: [PATCH] resetting to upstream --- History.txt | 4 ---- Rakefile | 8 ++++---- bin/jekyll | 8 -------- features/embed_filters.feature | 6 +++--- features/post_data.feature | 22 +++++++++++----------- features/site_configuration.feature | 18 ------------------ features/step_definitions/jekyll_steps.rb | 4 ---- jekyll.gemspec | 6 +++--- lib/jekyll.rb | 1 - lib/jekyll/convertible.rb | 4 ---- lib/jekyll/post.rb | 13 ++++++++----- lib/jekyll/site.rb | 10 +--------- test/test_post.rb | 8 -------- 13 files changed, 30 insertions(+), 82 deletions(-) diff --git a/History.txt b/History.txt index f71f8582..8e5220f5 100644 --- a/History.txt +++ b/History.txt @@ -1,7 +1,3 @@ -== Edge - * Enhancements - * added support for extensions [issue #100] - == 0.5.6 / 2010-01-08 * Bug Fixes * Require redcloth >= 4.2.1 in tests (#92) diff --git a/Rakefile b/Rakefile index a700d07c..ceea1cea 100644 --- a/Rakefile +++ b/Rakefile @@ -6,13 +6,13 @@ begin gem 'jeweler', '>= 0.11.0' require 'jeweler' Jeweler::Tasks.new do |s| - s.name = "krisb-jekyll" + s.name = "jekyll" s.summary = %Q{Jekyll is a simple, blog aware, static site generator.} - s.email = "kris@kris.me.uk" + s.email = "tom@mojombo.com" s.homepage = "http://github.com/mojombo/jekyll" s.description = "Jekyll is a simple, blog aware, static site generator." - s.authors = ["Tom Preston-Werner", "Kris Brown"] - s.rubyforge_project = "krisb-jekyll" + s.authors = ["Tom Preston-Werner"] + s.rubyforge_project = "jekyll" s.files.exclude 'test/dest' s.test_files.exclude 'test/dest' s.add_dependency('RedCloth', '>= 4.2.1') diff --git a/bin/jekyll b/bin/jekyll index 76a6eb96..6e03d48b 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -62,14 +62,6 @@ opts = OptionParser.new do |opts| end end - opts.on("--extensions", "Load Jekyll extensions from _lib directory") do - options['extensions'] = true - end - - opts.on("--no-extensions", "Do not load Jekyll extensions") do - options['extensions'] = false - end - opts.on("--version", "Display current version") do puts "Jekyll " + Jekyll.version exit 0 diff --git a/features/embed_filters.feature b/features/embed_filters.feature index 61bd8da0..f71dfb8f 100644 --- a/features/embed_filters.feature +++ b/features/embed_filters.feature @@ -20,7 +20,7 @@ Feature: Embed filters And I have the following post: | title | date | layout | content | | Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. | - And I have a default layout that contains "{{ page.title | xml_escape }}" + And I have a default layout that contains "{{ site.posts.first.title | xml_escape }}" When I run jekyll Then the _site directory should exist And I should see "Star & Wars" in "_site/2009/03/27/star-wars.html" @@ -31,7 +31,7 @@ Feature: Embed filters And I have the following post: | title | date | layout | content | | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. | - And I have a default layout that contains "{{ content | xml_escape }}" + And I have a default layout that contains "{{ site.posts.first.content | xml_escape }}" When I run jekyll Then the _site directory should exist And I should see "7" in "_site/2009/03/27/star-wars.html" @@ -42,7 +42,7 @@ Feature: Embed filters And I have the following post: | title | date | layout | tags | content | | Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. | - And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}" + And I have a default layout that contains "{{ site.posts.first.tags | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html" diff --git a/features/post_data.feature b/features/post_data.feature index 1751f3f4..87f5d851 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -9,7 +9,7 @@ Feature: Post data And I have the following post: | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post title: {{ page.title }}" + And I have a simple layout that contains "Post title: {{ site.posts.first.title }}" When I run jekyll Then the _site directory should exist And I should see "Post title: Star Wars" in "_site/2009/03/27/star-wars.html" @@ -20,7 +20,7 @@ Feature: Post data And I have the following post: | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post url: {{ page.url }}" + And I have a simple layout that contains "Post url: {{ site.posts.first.url }}" When I run jekyll Then the _site directory should exist And I should see "Post url: /2009/03/27/star-wars.html" in "_site/2009/03/27/star-wars.html" @@ -31,7 +31,7 @@ Feature: Post data And I have the following post: | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post date: {{ page.date }}" + And I have a simple layout that contains "Post date: {{ site.posts.first.date }}" When I run jekyll Then the _site directory should exist And I should see "Post date: Fri Mar 27" in "_site/2009/03/27/star-wars.html" @@ -42,7 +42,7 @@ Feature: Post data And I have the following post: | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post id: {{ page.id }}" + And I have a simple layout that contains "Post id: {{ site.posts.first.id }}" When I run jekyll Then the _site directory should exist And I should see "Post id: /2009/03/27/star-wars" in "_site/2009/03/27/star-wars.html" @@ -53,7 +53,7 @@ Feature: Post data And I have the following post: | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post content: {{ content }}" + And I have a simple layout that contains "Post content: {{ site.posts.first.content }}" When I run jekyll Then the _site directory should exist And I should see "Post content:

Luke, I am your father.

" in "_site/2009/03/27/star-wars.html" @@ -65,7 +65,7 @@ Feature: Post data And I have the following post in "movies": | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post category: {{ page.categories }}" + And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}" When I run jekyll Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" @@ -76,7 +76,7 @@ Feature: Post data And I have the following post: | title | date | layout | tag | content | | Star Wars | 5/18/2009 | simple | twist | Luke, I am your father. | - And I have a simple layout that contains "Post tags: {{ page.tags }}" + And I have a simple layout that contains "Post tags: {{ site.posts.first.tags }}" When I run jekyll Then the _site directory should exist And I should see "Post tags: twist" in "_site/2009/05/18/star-wars.html" @@ -89,7 +89,7 @@ Feature: Post data And I have the following post in "movies/scifi": | title | date | layout | content | | Star Wars | 3/27/2009 | simple | Luke, I am your father. | - And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" + And I have a simple layout that contains "Post categories: {{ site.posts.first.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html" @@ -100,7 +100,7 @@ Feature: Post data And I have the following post: | title | date | layout | category | content | | Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. | - And I have a simple layout that contains "Post category: {{ page.categories }}" + And I have a simple layout that contains "Post category: {{ site.posts.first.categories }}" When I run jekyll Then the _site directory should exist And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html" @@ -111,7 +111,7 @@ Feature: Post data And I have the following post: | title | date | layout | categories | content | | Star Wars | 3/27/2009 | simple | ['movies', 'scifi'] | Luke, I am your father. | - And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" + And I have a simple layout that contains "Post categories: {{ site.posts.first.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist And I should see "Post categories: movies and scifi" in "_site/movies/scifi/2009/03/27/star-wars.html" @@ -133,7 +133,7 @@ Feature: Post data And I have the following post: | title | date | layout | author | content | | Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. | - And I have a simple layout that contains "Post author: {{ page.author }}" + And I have a simple layout that contains "Post author: {{ site.posts.first.author }}" When I run jekyll Then the _site directory should exist And I should see "Post author: Darth Vader" in "_site/2009/03/27/star-wars.html" diff --git a/features/site_configuration.feature b/features/site_configuration.feature index a2b7d0ca..31b8c71e 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -61,21 +61,3 @@ Feature: Site configuration When I run jekyll Then the _site directory should exist And I should see "puts 'Hello world!'" in "_site/index.html" - - Scenario: Load an extension from _lib - Given I have an "index.html" page that contains "{{ 'extension' | hello }}" - And I have a _lib directory - And I have a "_lib/hello.rb" file that contains "module Jekyll::Filters ; def hello(input) ; "hello #{input}" ; end ; end" - And I have a configuration file with "extensions" set to "true" - When I run jekyll - Then the _site directory should exist - And I should see "hello extension" in "_site/index.html" - - Scenario: Skip loading extensions from _lib - Given I have an "index.html" page that contains "{{ 'extension' | hello }}" - And I have a _lib directory - And I have a "_lib/hello.rb" file that contains "module Jekyll::Filters ; def hello(input) ; "hello #{input}" ; end ; end" - And I have a configuration file with "extensions" set to "false" - When I run jekyll - Then the _site directory should exist - And I should not see "hello extension" in "_site/index.html" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index f8dfec71..9fc91013 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -119,10 +119,6 @@ Then /^I should see "(.*)" in "(.*)"$/ do |text, file| assert_match Regexp.new(text), File.open(file).readlines.join end -Then /^I should not see "(.*)" in "(.*)"$/ do |text, file| - assert_no_match Regexp.new(text), File.open(file).readlines.join -end - Then /^the "(.*)" file should exist$/ do |file| assert File.file?(file) end diff --git a/jekyll.gemspec b/jekyll.gemspec index 180cbd53..9bac5718 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |s| s.date = %q{2010-01-08} s.default_executable = %q{jekyll} s.description = %q{Jekyll is a simple, blog aware, static site generator.} - s.email = %q{kris@kris.me.uk} + s.email = %q{tom@mojombo.com} s.executables = ["jekyll"] s.extra_rdoc_files = [ "README.textile" @@ -33,7 +33,7 @@ Gem::Specification.new do |s| "features/site_data.feature", "features/step_definitions/jekyll_steps.rb", "features/support/env.rb", - "krisb-jekyll.gemspec", + "jekyll.gemspec", "lib/jekyll.rb", "lib/jekyll/albino.rb", "lib/jekyll/converters/csv.rb", @@ -94,7 +94,7 @@ Gem::Specification.new do |s| s.homepage = %q{http://github.com/mojombo/jekyll} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] - s.rubyforge_project = %q{krisb-jekyll} + s.rubyforge_project = %q{jekyll} s.rubygems_version = %q{1.3.5} s.summary = %q{Jekyll is a simple, blog aware, static site generator.} s.test_files = [ diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 8f94ecc8..0e631b51 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -43,7 +43,6 @@ module Jekyll 'pygments' => false, 'markdown' => 'maruku', 'permalink' => 'date', - 'extensions' => false, 'maruku' => { 'use_tex' => false, diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index f3da5579..fd63f57a 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -3,10 +3,6 @@ # # Requires # self.site -> Jekyll::Site -# self.content= -# self.data= -# self.ext= -# self.output= module Jekyll module Convertible # Return the contents as a string diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 55d4d1e3..914cfd59 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -18,9 +18,12 @@ module Jekyll name =~ MATCHER end - attr_accessor :site - attr_accessor :data, :content, :output, :ext - attr_accessor :date, :slug, :published, :tags, :categories + attr_accessor :site, :date, :slug, :ext, :published, :data, :content, :output, :tags + attr_writer :categories + + def categories + @categories ||= [] + end # Initialize this Post instance. # +site+ is the Site @@ -48,8 +51,9 @@ module Jekyll self.tags = [self.data["tag"]] elsif self.data.has_key?("tags") self.tags = self.data['tags'] + else + self.tags = [] end - self.tags ||= [] if self.categories.empty? if self.data.has_key?('category') @@ -64,7 +68,6 @@ module Jekyll end end end - self.categories ||= [] end # Spaceship is based on Post#date, slug diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 64d989f1..3d47d16e 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -2,8 +2,7 @@ module Jekyll class Site attr_accessor :config, :layouts, :posts, :pages, :static_files, :categories, :exclude, - :source, :dest, :lsi, :pygments, :permalink_style, :tags, - :extensions + :source, :dest, :lsi, :pygments, :permalink_style, :tags # Initialize the site # +config+ is a Hash containing site configurations details @@ -18,7 +17,6 @@ module Jekyll self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym self.exclude = config['exclude'] || [] - self.extensions = config['extensions'] self.reset self.setup @@ -84,12 +82,6 @@ module Jekyll else raise "Invalid Markdown processor: '#{self.config['markdown']}' -- did you mean 'maruku' or 'rdiscount'?" end - - # Load extensions from _lib folder - if self.extensions - # load instead of require so that jekyll --auto reloads changes - Dir["#{source}/_lib/*.rb"].each {|f| load f} - end end def textile(content) diff --git a/test/test_post.rb b/test/test_post.rb index 36a3f287..b4b4502d 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -36,7 +36,6 @@ class TestPost < Test::Unit::TestCase end should "keep date, title, and markup type" do - @post.categories = [] @post.process(@fake_file) assert_equal Time.parse("2008-10-19"), @post.date @@ -215,13 +214,6 @@ class TestPost < Test::Unit::TestCase end context "initializing posts" do - - should "ensure suitable defaults for attributes" do - post = setup_post("2009-06-22-no-yaml.textile") - assert_equal [], post.tags - assert_equal [], post.categories - end - should "publish when published yaml is no specified" do post = setup_post("2008-02-02-published.textile") assert_equal true, post.published