diff --git a/.travis.yml b/.travis.yml index e193e371..05ea74ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ rvm: - 2.1.0 - 2.0.0 - 1.9.3 -- 1.9.2 script: script/cibuild after_script: - script/rebund upload @@ -24,5 +23,5 @@ notifications: on_failure: never env: global: - - secure: YFgVNymO2MvA7ieB3hJKQ9cF8zhi5uc3NnBx+ngs6+XF7lV7zYZGMYJ9ufEuPRkXFEI1sSNQJjOQwjmqC71xABrWw6B69XDdYgoTX+53GryVfsrDIPksQo89WAAMKqoPznWtj5fA3OTxUWjHVye2JsduPNuihpniI5j79IzDFQY= - - secure: YrDB4baCV00FPyRafR9UTAUsSgK/07Re+7T+blgX2gK/j54DJdof+EYbQPjc3HeWdfQgIzal2+KkwBItEu2lA8/j6qPwUngd9oRWJPLm19xFizECRY9SD1BxU53T3qmnoYqG0jFvKgYfnn9ggHRDEL31YDOA1monhFhq/8S3SdA= + - secure: bt5nglPTdsc0N5fB1dOJz2WbM81dGpDuVD8PnhEsxgUfoo6xavhU4+pNrUADlSUqQ1aJrdU+MKW4x+JZ2ZnJS8vOpNzRymuMZSbFaljK4pgFGiKFgBdMKxVikvoYcxKCjLAl7NJZ11W6hUw+JtJScClDZwrJJAQB6I7Isp/LsdM= + - secure: Ym8nx7nbfGYGo47my92M+deJykaiMkdZdb615EO51liv/xy/0aQ919Jpfieugc9d3zVnm+zFGPbpv4YzRpsik6OlVBNa4lP+BnQ27ptf5YcLWD8Hksi7845WFLecXMoaTCoYer/TvYZsIWJb2nSDMH9qbfZhnd1YZKuvUpK0rEU= diff --git a/History.markdown b/History.markdown index a6ffeeaf..0d5145bf 100644 --- a/History.markdown +++ b/History.markdown @@ -12,6 +12,7 @@ * Provide a 300% improvement when generating sites that use `Post#next` or `Post#previous` (#1983) * Provide support for CoffeeScript (#1991) + * Replace Maruku with Kramdown as Default Markdown Processor (#1988) ### Minor Enhancements * Move the EntryFilter class into the Jekyll module to avoid polluting the @@ -34,6 +35,11 @@ * Excludes are now relative to the site source (#1916) * Bring MIME Types file for `jekyll serve` to complete parity with GH Pages servers (#1993) + * Adding Breakpoint to make new site template more responsive (#2038) + * Default to using the UTF-8 encoding when reading files. (#2031) + * Update Redcarpet dependency to ~> 3.1 (#2044) + * Remove support for Ruby 1.9.2 (#2045) + * Add `.mkdown` as valid Markdown extension (#2048) ### Bug Fixes * Don't allow nil entries when loading posts (#1796) @@ -48,6 +54,9 @@ * Fixes full path leak to source directory when using include tag (#1951) * Don't generate pages that aren't being published (#1931) * Use `SafeYAML.load` to avoid conflicts with other projects (#1982) + * Relative posts should never fail to build (#1976) + * Remove executable bits of non executable files (#2056) + * `#path` for a draft is now `_drafts` instead of `_posts` (#2042) ### Development Fixes * Add a link to the site in the README.md file (#1795) @@ -66,6 +75,9 @@ * Speed up Travis CI builds by using Rebund (#1985) * Use Yarp as a Gem proxy for Travis CI (#1984) * Remove Yarp as a Gem proxy for Travis CI (#2004) + * Move the reading of layouts into its own class (#2020) + * Test Sass import (#2009) + * Switch Maruku and Kramdown in lists of Runtime vs. Development dependencies (#2049) ### Site Enhancements * Document Kramdown's GFM parser option (#1791) @@ -100,6 +112,9 @@ * Add `sublime-jekyll` to list of Editor plugins (#2001) * Add `vim-jekyll` to the list of Editor plugins (#2005) * Fix non-semantic nesting of `p` tags in `news_item` layout (#2013) + * Document destination folder cleaning (#2016) + * Updated instructions for NearlyFreeSpeech.NET installation (#2015) + * Update link to rack-jekyll on "Deployment Methods" page (#2047) ## 1.4.3 / 2014-01-13 diff --git a/README.markdown b/README.markdown index 228881db..f920db28 100644 --- a/README.markdown +++ b/README.markdown @@ -38,16 +38,16 @@ Jekyll does what you tell it to do — no more, no less. It doesn't try to outs * Colorator: Colorizes command line output (Ruby) * Classifier: Generating related posts (Ruby) * Directory Watcher: Auto-regeneration of sites (Ruby) +* Kramdown: Default Markdown engine (Ruby) * Liquid: Templating system (Ruby) -* Maruku: Default markdown engine (Ruby) * Pygments.rb: Syntax highlighting (Ruby/Python) * RedCarpet: Markdown engine (Ruby) * Safe YAML: YAML Parser built for security (Ruby) ## Developer Dependencies -* Kramdown: Markdown-superset converter (Ruby) * Launchy: Cross-platform file launcher (Ruby) +* Maruku: Markdown-superset interpreter (Ruby) * RDiscount: Discount Markdown Processor (Ruby) * RedCloth: Textile support (Ruby) * RedGreen: Nicer test output (Ruby) diff --git a/features/drafts.feature b/features/drafts.feature index 5271120b..efff9823 100644 --- a/features/drafts.feature +++ b/features/drafts.feature @@ -23,3 +23,13 @@ Feature: Draft Posts When I run jekyll Then the _site directory should exist And the "_site/recipe.html" file should not exist + + Scenario: Use page.path variable + Given I have a configuration file with "permalink" set to "none" + And I have a _drafts directory + And I have the following draft: + | title | date | layout | content | + | Recipe | 2009-03-27 | simple | Post path: {{ page.path }} | + When I run jekyll with drafts + Then the _site directory should exist + And I should see "Post path: _drafts/recipe.textile" in "_site/recipe.html" diff --git a/features/markdown.feature b/features/markdown.feature index c76b0611..778fc5d2 100644 --- a/features/markdown.feature +++ b/features/markdown.feature @@ -13,8 +13,8 @@ Feature: Markdown When I run jekyll Then the _site directory should exist And I should see "Index" in "_site/index.html" - And I should see "

My Title

" in "_site/2009/03/27/hackers.html" - And I should see "

My Title

" in "_site/index.html" + And I should see "

My Title

" in "_site/2009/03/27/hackers.html" + And I should see "

My Title

" in "_site/index.html" Scenario: Markdown in pagination on index Given I have a configuration file with "paginate" set to "5" @@ -26,7 +26,7 @@ Feature: Markdown When I run jekyll Then the _site directory should exist And I should see "Index" in "_site/index.html" - And I should see "

My Title

" in "_site/index.html" + And I should see "

My Title

" in "_site/index.html" Scenario: Maruku fenced codeblocks Given I have a configuration file with "markdown" set to "maruku" diff --git a/jekyll.gemspec b/jekyll.gemspec index b78a6e13..0104b565 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -2,12 +2,12 @@ Gem::Specification.new do |s| s.specification_version = 2 if s.respond_to? :specification_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.rubygems_version = '1.3.5' - s.required_ruby_version = '>= 1.9.2' + s.required_ruby_version = '>= 1.9.3' s.name = 'jekyll' - s.version = '1.4.3' + s.version = '2.0.0.alpha.1' s.license = 'MIT' - s.date = '2014-01-13' + s.date = '2014-02-13' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." @@ -32,7 +32,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('mercenary', "~> 0.2.0") s.add_runtime_dependency('safe_yaml', "~> 1.0") s.add_runtime_dependency('colorator', "~> 0.1") - s.add_runtime_dependency('redcarpet', "~> 3.0") + s.add_runtime_dependency('redcarpet', "~> 3.1") s.add_runtime_dependency('toml', '~> 0.1.0') s.add_runtime_dependency('sass', '~> 3.2') s.add_runtime_dependency('jekyll-coffeescript', '~> 1.0') @@ -109,6 +109,7 @@ Gem::Specification.new do |s| lib/jekyll/generator.rb lib/jekyll/generators/pagination.rb lib/jekyll/layout.rb + lib/jekyll/layout_reader.rb lib/jekyll/mime.types lib/jekyll/page.rb lib/jekyll/plugin.rb @@ -232,6 +233,7 @@ Gem::Specification.new do |s| test/source/_config.dev.toml test/source/_data/languages.yml test/source/_data/members.yaml + test/source/_data/products.yml test/source/_includes/include.html test/source/_includes/params.html test/source/_includes/sig.markdown @@ -275,11 +277,13 @@ Gem::Specification.new do |s| test/source/_posts/2013-12-17-include-variable-filters.markdown test/source/_posts/2013-12-20-properties.text test/source/_posts/es/2008-11-21-nested.textile + test/source/_sass/_grid.scss test/source/about.html test/source/category/_posts/2008-9-23-categories.textile test/source/contacts.html test/source/contacts/bar.html test/source/contacts/index.html + test/source/css/main.scss test/source/css/screen.css test/source/deal.with.dots.html test/source/foo/_posts/bar/2008-12-12-topical-post.textile @@ -288,6 +292,9 @@ Gem::Specification.new do |s| test/source/products.yml test/source/properties.html test/source/sitemap.xml + test/source/symlink-test/_data + test/source/symlink-test/symlinked-dir + test/source/symlink-test/symlinked-file test/source/unpublished.html test/source/win/_posts/2009-05-24-yaml-linebreak.markdown test/source/z_category/_posts/2008-9-23-categories.textile @@ -302,6 +309,7 @@ Gem::Specification.new do |s| test/test_filters.rb test/test_generated_site.rb test/test_kramdown.rb + test/test_layout_reader.rb test/test_new_command.rb test/test_page.rb test/test_pager.rb diff --git a/lib/jekyll.rb b/lib/jekyll.rb index caa45e50..c4cbc8a0 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -48,6 +48,7 @@ require 'jekyll/errors' require 'jekyll/related_posts' require 'jekyll/cleaner' require 'jekyll/entry_filter' +require 'jekyll/layout_reader' # extensions require 'jekyll/plugin' @@ -67,7 +68,7 @@ require 'jekyll-coffeescript' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll - VERSION = '1.4.0' + VERSION = '2.0.0.alpha.1' # Public: Generate a Jekyll configuration Hash by merging the default # options with anything in _config.yml, and adding the given options on top. diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index afa43d30..ad84f0b4 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -16,7 +16,7 @@ module Jekyll 'timezone' => nil, # use the local timezone - 'encoding' => nil, # use the system encoding + 'encoding' => 'utf-8', # always use utf-8 encoding. NEVER FORGET 'safe' => false, 'detach' => false, # default to not detaching the server @@ -28,7 +28,7 @@ module Jekyll 'relative_permalinks' => true, # backwards-compatibility with < 1.0 # will be set to false once 2.0 hits - 'markdown' => 'maruku', + 'markdown' => 'kramdown', 'highlighter' => 'pygments', 'permalink' => 'date', 'baseurl' => '/', @@ -36,7 +36,7 @@ module Jekyll 'exclude' => [], 'paginate_path' => '/page:num', - 'markdown_ext' => 'markdown,mkd,mkdn,md', + 'markdown_ext' => 'markdown,mkdown,mkdn,mkd,md', 'textile_ext' => 'textile', 'port' => '4000', @@ -229,6 +229,12 @@ module Jekyll config[option] = csv_to_array(config[option]) end end + + if config.fetch('markdown', 'kramdown').to_s.downcase.eql?("maruku") + Jekyll::Deprecator.deprecation_message "You're using the 'maruku' " + + "Markdown processor. Maruku support has been deprecated and will " + + "be removed in 3.0.0. We recommend you switch to Kramdown." + end config end diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index 321a6e58..7b1d9aca 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -18,6 +18,11 @@ module Jekyll File.join(source, dir, '_drafts') end + # The path to the draft source file, relative to the site source + def relative_path + File.join(@dir, '_drafts', @name) + end + # Extract information from the post filename. # # name - The String filename of the post file. diff --git a/lib/jekyll/layout_reader.rb b/lib/jekyll/layout_reader.rb new file mode 100644 index 00000000..1b07c724 --- /dev/null +++ b/lib/jekyll/layout_reader.rb @@ -0,0 +1,40 @@ +module Jekyll + class LayoutReader + attr_reader :site + def initialize(site) + @site = site + @layouts = {} + end + + def read + layout_entries.each do |f| + @layouts[layout_name(f)] = Layout.new(site, layout_directory, f) + end + + @layouts + end + + private + + def layout_entries + entries = [] + within(layout_directory) do + entries = EntryFilter.new(site).filter(Dir['**/*.*']) + end + entries + end + + def layout_name(file) + file.split(".")[0..-2].join(".") + end + + def within(directory) + return unless File.exists?(directory) + Dir.chdir(directory) { yield } + end + + def layout_directory + File.join(site.source, site.config['layouts']) + end + end +end diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index b2dfe361..1d9380b1 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -126,7 +126,7 @@ module Jekyll # The path to the page source file, relative to the site source def relative_path - File.join(@dir, @name) + File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)) end # Obtain destination path. diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 31ed2032..553c12cf 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -123,7 +123,7 @@ module Jekyll # The path to the post source file, relative to the site source def relative_path - File.join(@dir, '_posts', @name) + File.join(*[@dir, "_posts", @name].map(&:to_s).reject(&:empty?)) end # Compares Post objects. First compares the Post date. If the dates are diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 7457ca6d..ed55598f 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -127,27 +127,11 @@ module Jekyll # # Returns nothing. def read - self.read_layouts + self.layouts = LayoutReader.new(self).read self.read_directories self.read_data(config['data_source']) end - # Read all the files in / and create a new Layout object - # with each one. - # - # Returns nothing. - def read_layouts - base = File.join(self.source, self.config['layouts']) - return unless File.exists?(base) - entries = [] - Dir.chdir(base) { entries = filter_entries(Dir['**/*.*'], base) } - - entries.each do |f| - name = f.split(".")[0..-2].join(".") - self.layouts[name] = Layout.new(self, base, f) - end - end - # Recursively traverse directories to find posts, pages and static files # that will become part of the site according to the rules in # filter_entries. diff --git a/lib/site_template/css/main.css b/lib/site_template/css/main.css old mode 100755 new mode 100644 index b11b5b8d..2ce8e749 --- a/lib/site_template/css/main.css +++ b/lib/site_template/css/main.css @@ -64,6 +64,12 @@ a:visited { color: #a0a; } line-height: 1.5em; } +@media screen and (max-width: 44em) { + .site { + width: 90%; + } +} + .header a { font-weight: bold; text-decoration: none; diff --git a/site/docs/configuration.md b/site/docs/configuration.md index 8ca54f86..ca6ea87e 100644 --- a/site/docs/configuration.md +++ b/site/docs/configuration.md @@ -300,7 +300,7 @@ permalink: date paginate_path: 'page:num' paginate: nil -markdown: maruku +markdown: kramdown markdown_ext: markdown,mkd,mkdn,md textile_ext: textile diff --git a/site/docs/deployment-methods.md b/site/docs/deployment-methods.md index f07edb84..d10aabc7 100644 --- a/site/docs/deployment-methods.md +++ b/site/docs/deployment-methods.md @@ -86,7 +86,7 @@ this script from within Textmate. ## Rack-Jekyll -[Rack-Jekyll](http://github.com/bry4n/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](http://github.com/rtomakyo/shotgun/), [rackup](http://github.com/rack/rack), [mongrel](http://github.com/mongrel/mongrel), [unicorn](http://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme). +[Rack-Jekyll](http://github.com/adaoraul/rack-jekyll/) is an easy way to deploy your site on any Rack server such as Amazon EC2, Slicehost, Heroku, and so forth. It also can run with [shotgun](http://github.com/rtomakyo/shotgun/), [rackup](http://github.com/rack/rack), [mongrel](http://github.com/mongrel/mongrel), [unicorn](http://github.com/defunkt/unicorn/), and [others](https://github.com/adaoraul/rack-jekyll#readme). Read [this post](http://blog.crowdint.com/2010/08/02/instant-blog-using-jekyll-and-heroku.html) on how to deploy to Heroku using Rack-Jekyll. diff --git a/site/docs/troubleshooting.md b/site/docs/troubleshooting.md index c27c1665..8219ded7 100644 --- a/site/docs/troubleshooting.md +++ b/site/docs/troubleshooting.md @@ -28,10 +28,13 @@ sudo yum install ruby-devel {% endhighlight %} On [NearlyFreeSpeech](http://nearlyfreespeech.net/) you need to run the -command with the following environment variable: +following commands before installing Jekyll: {% highlight bash %} -RB_USER_INSTALL=true gem install jekyll +export GEM_HOME=/home/private/gems +export GEM_PATH=/home/private/gems:/usr/local/lib/ruby/gems/1.8/ +export PATH=$PATH:/home/private/gems/bin +export RB_USER_INSTALL='true' {% endhighlight %} On OSX, you may need to update RubyGems: diff --git a/site/docs/usage.md b/site/docs/usage.md index 6db3a112..6f5c9a3b 100644 --- a/site/docs/usage.md +++ b/site/docs/usage.md @@ -24,6 +24,17 @@ $ jekyll build --watch # watched for changes, and regenerated automatically. {% endhighlight %} +
+
Destination folders are cleaned on site builds
+

+ The contents of <destination> are automatically + cleaned when the site is built. Files or folders that are not + created by your site will be removed. Do not use an important + location for <destination>; instead, use it as + a staging area and copy files from there to your web server. +

+
+ Jekyll also comes with a built-in development server that will allow you to preview what the generated site will look like in your browser locally. diff --git a/site/js/modernizr-2.5.3.min.js b/site/js/modernizr-2.5.3.min.js old mode 100755 new mode 100644 diff --git a/test/source/_drafts/draft-properties.text b/test/source/_drafts/draft-properties.text new file mode 100644 index 00000000..da33d072 --- /dev/null +++ b/test/source/_drafts/draft-properties.text @@ -0,0 +1,11 @@ +--- +categories: foo bar baz +foo: bar +layout: default +tags: ay bee cee +title: Properties Draft +--- + +All the properties. + +Plus an excerpt. diff --git a/test/source/_includes/sig.markdown b/test/source/_includes/sig.markdown index d280e8cc..fbbf563a 100644 --- a/test/source/_includes/sig.markdown +++ b/test/source/_includes/sig.markdown @@ -1,3 +1,3 @@ --- +--- Tom Preston-Werner -github.com/mojombo \ No newline at end of file +github.com/mojombo diff --git a/test/source/_sass/_grid.scss b/test/source/_sass/_grid.scss new file mode 100644 index 00000000..606aaf29 --- /dev/null +++ b/test/source/_sass/_grid.scss @@ -0,0 +1 @@ +.half { width: 50%; } \ No newline at end of file diff --git a/test/source/css/main.scss b/test/source/css/main.scss new file mode 100644 index 00000000..abc9ecd8 --- /dev/null +++ b/test/source/css/main.scss @@ -0,0 +1,4 @@ +--- +--- + +@import "grid"; \ No newline at end of file diff --git a/test/test_configuration.rb b/test/test_configuration.rb index a96141fa..a390da81 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -4,14 +4,14 @@ class TestConfiguration < Test::Unit::TestCase context "#stringify_keys" do setup do @mixed_keys = Configuration[{ - 'markdown' => 'maruku', + 'markdown' => 'kramdown', :permalink => 'date', 'baseurl' => '/', :include => ['.htaccess'], :source => './' }] @string_keys = Configuration[{ - 'markdown' => 'maruku', + 'markdown' => 'kramdown', 'permalink' => 'date', 'baseurl' => '/', 'include' => ['.htaccess'], diff --git a/test/test_draft.rb b/test/test_draft.rb new file mode 100644 index 00000000..b1b3d08d --- /dev/null +++ b/test/test_draft.rb @@ -0,0 +1,56 @@ +require 'helper' + +class TestDraft < Test::Unit::TestCase + def setup_draft(file) + Draft.new(@site, source_dir, '', file) + end + + context "A Draft" do + setup do + clear_dest + stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS } + @site = Site.new(Jekyll.configuration) + end + + should "ensure valid drafts are valid" do + assert Draft.valid?("2008-09-09-foo-bar.textile") + assert Draft.valid?("foo/bar/2008-09-09-foo-bar.textile") + assert Draft.valid?("lol2008-09-09-foo-bar.textile") + + assert !Draft.valid?("blah") + end + + should "make properties accessible through #[]" do + draft = setup_draft('draft-properties.text') + # ! need to touch the file! Or get its timestamp + date = File.mtime(File.join(source_dir, '_drafts', 'draft-properties.text')) + ymd = date.strftime("%Y/%m/%d") + + attrs = { + categories: %w(foo bar baz), + content: "All the properties.\n\nPlus an excerpt.\n", + date: date, + dir: "/foo/bar/baz/#{ymd}", + excerpt: "All the properties.\n\n", + foo: 'bar', + id: "/foo/bar/baz/#{ymd}/draft-properties", + layout: 'default', + name: nil, + path: "_drafts/draft-properties.text", + permalink: nil, + published: nil, + tags: %w(ay bee cee), + title: 'Properties Draft', + url: "/foo/bar/baz/#{ymd}/draft-properties.html" + } + + attrs.each do |attr, val| + attr_str = attr.to_s + result = draft[attr_str] + assert_equal val, result, "For :" + end + end + + end + +end diff --git a/test/test_excerpt.rb b/test/test_excerpt.rb index 5255551c..43fe9b43 100644 --- a/test/test_excerpt.rb +++ b/test/test_excerpt.rb @@ -108,7 +108,7 @@ class TestExcerpt < Test::Unit::TestCase end should "be the first paragraph of the page" do - assert_equal "

First paragraph with link ref.

", @extracted_excerpt.content + assert_equal "

First paragraph with link ref.

\n\n", @extracted_excerpt.content end should "link properly" do diff --git a/test/test_filters.rb b/test/test_filters.rb index a1cec1c7..1959e6f9 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -28,7 +28,7 @@ class TestFilters < Test::Unit::TestCase end should "markdownify with simple string" do - assert_equal "

something really simple

", @filter.markdownify("something **really** simple") + assert_equal "

something really simple

\n", @filter.markdownify("something **really** simple") end should "convert array to sentence string with no args" do @@ -131,7 +131,7 @@ class TestFilters < Test::Unit::TestCase assert_equal 2, g["items"].size when "" assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array." - assert_equal 7, g["items"].size + assert_equal 9, g["items"].size end end end diff --git a/test/test_layout_reader.rb b/test/test_layout_reader.rb new file mode 100644 index 00000000..eead655a --- /dev/null +++ b/test/test_layout_reader.rb @@ -0,0 +1,17 @@ +require 'helper' + +class TestLayoutReader < Test::Unit::TestCase + context "reading layouts" do + setup do + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir}) + end + @site = Site.new(Jekyll.configuration) + end + + should "read layouts" do + layouts = LayoutReader.new(@site).read + assert_equal ["default", "simple", "post/simple"].sort, layouts.keys.sort + end + end +end diff --git a/test/test_post.rb b/test/test_post.rb index 66ca7e45..7d4ab599 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -38,7 +38,7 @@ class TestPost < Test::Unit::TestCase id: "/foo/bar/baz/2013/12/20/properties", layout: 'default', name: nil, - # path: "properties.html", + path: "_posts/2013-12-20-properties.text", permalink: nil, published: nil, tags: %w(ay bee cee), @@ -323,7 +323,7 @@ class TestPost < Test::Unit::TestCase end should "return rendered HTML" do - assert_equal "

First paragraph with link ref.

", + assert_equal "

First paragraph with link ref.

\n\n", @post.excerpt end @@ -543,7 +543,7 @@ class TestPost < Test::Unit::TestCase post.site.source = File.join(File.dirname(__FILE__), 'source') do_render(post) - assert_equal "<<<
\n

Tom Preston-Werner github.com/mojombo

\n\n

This is cool

>>>", post.output + assert_equal "<<<
\n

Tom Preston-Werner\ngithub.com/mojombo

\n\n

This is cool

\n >>>", post.output end should "render date specified in front matter properly" do diff --git a/test/test_sass.rb b/test/test_sass.rb index d13fbcfe..0daa4f1d 100644 --- a/test/test_sass.rb +++ b/test/test_sass.rb @@ -104,4 +104,19 @@ CSS assert_equal css_output, converter.convert(scss_content) end end + + context "importing partials" do + setup do + @site = Jekyll::Site.new(Jekyll.configuration({ + "source" => source_dir, + "destination" => dest_dir + })) + @site.process + @test_css_file = dest_dir("css/main.css") + end + + should "import SCSS partial" do + assert_equal ".half {\n width: 50%; }\n", File.read(@test_css_file) + end + end end diff --git a/test/test_site.rb b/test/test_site.rb index 7dc78dbc..7e593c86 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -157,15 +157,11 @@ class TestSite < Test::Unit::TestCase should "sort pages alphabetically" do stub.proxy(Dir).entries { |entries| entries.reverse } @site.process - sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html exploit.md foo.md index.html index.html properties.html sitemap.xml symlinked-file) + # files in symlinked directories may appear twice + sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html exploit.md foo.md index.html index.html main.scss main.scss properties.html sitemap.xml symlinked-file) assert_equal sorted_pages, @site.pages.map(&:name) end - should "read layouts" do - @site.read_layouts - assert_equal ["default", "simple", "post/simple"].sort, @site.layouts.keys.sort - end - should "read posts" do @site.read_posts('') posts = Dir[source_dir('_posts', '**', '*')] diff --git a/test/test_tags.rb b/test/test_tags.rb index e6887ef6..d7c8df24 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -54,7 +54,7 @@ CONTENT end context "initialized tag" do - should "work" do + should "set the correct options" do tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"]) assert_equal({}, tag.instance_variable_get(:@options)) @@ -85,11 +85,11 @@ CONTENT end should "render markdown with pygments" do - assert_match %{
test\n
}, @result + assert_match %{
test\n
}, @result end should "render markdown with pygments with line numbers" do - assert_match %{
1 test\n
}, @result + assert_match %{
1 test\n
}, @result end end @@ -99,7 +99,7 @@ CONTENT end should "not embed the file" do - assert_match %{
./jekyll.gemspec\n
}, @result + assert_match %{
./jekyll.gemspec\n
}, @result end end @@ -109,7 +109,7 @@ CONTENT end should "render markdown with pygments line handling" do - assert_match %{
Æ\n
}, @result + assert_match %{
Æ\n
}, @result end end @@ -268,7 +268,7 @@ CONTENT end should "write script tag" do - assert_match "", @result + assert_match "", @result end end @@ -288,7 +288,7 @@ CONTENT end should "write script tag with specific file in gist" do - assert_match "", @result + assert_match "", @result end end @@ -324,7 +324,7 @@ CONTENT end should "write script tag with specific file in gist" do - assert_match "", @result + assert_match "", @result end end @@ -413,11 +413,11 @@ CONTENT end should "correctly output include variable" do - assert_match "value", @result.strip + assert_match "value", @result.strip end should "ignore parameters if unused" do - assert_match "
\n

Tom Preston-Werner github.com/mojombo

\n", @result + assert_match "
\n

Tom Preston-Werner\ngithub.com/mojombo

\n", @result end end @@ -465,7 +465,7 @@ CONTENT end should "not include previously used parameters" do - assert_match "", @result + assert_match "", @result end end @@ -482,7 +482,7 @@ CONTENT end should "include file with empty parameters" do - assert_match "", @result + assert_match "", @result end end @@ -499,7 +499,7 @@ CONTENT end should "include file with empty parameters within if statement" do - assert_match "", @result + assert_match "", @result end end @@ -512,6 +512,7 @@ puts "Hello world" ``` CONTENT create_post(content, { + 'markdown' => 'maruku', 'maruku' => {'fenced_code_blocks' => true}} ) end