diff --git a/.travis.yml b/.travis.yml index 4c50a297..b1aacd13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby +cache: bundler before_install: - gem install bundler rvm: diff --git a/Gemfile b/Gemfile index d9266971..851fabc2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,2 @@ source 'https://rubygems.org' -gemspec \ No newline at end of file +gemspec diff --git a/History.markdown b/History.markdown index 5592a1d7..24d1cd5d 100644 --- a/History.markdown +++ b/History.markdown @@ -1,9 +1,61 @@ ## HEAD +### Major Enhancements + * Add support for TOML config files (#1765) + +### Minor Enhancements + * Sort plugins as a way to establish a load order (#1682) + +### Bug Fixes + * Add a space between two words in a Pagination warning message (#1769) + +### Development Fixes + * Remove some whitespace in the code (#1755) + +### Site Enhancements + * Fixed case of a word in the Jekyll v1.3.0 release post (#1762) + * Fixed the mime type for the favicon (#1772) + +## 1.3.1 / 2013-11/26 + +### Minor Enhancements + * Add a `--prefix` option to passthrough for the importers (#1669) + * Push the paginator plugin lower in the plugin priority order so + other plugins run before it (#1759) + +### Bug Fixes + * Fix the include tag when ran in a loop (#1726) + * Fix errors when using `--watch` on 1.8.7 (#1730) + * Specify where the include is called from if an included file is + missing (#1746) + +### Development Fixes + * Extract `Site#filter_entries` into its own object (#1697) + * Enable Travis' bundle caching (#1734) + * Remove trailing whitespace in some files (#1736) + * Fix a duplicate test name (#1754) + +### Site Enhancements + * Update link to example Rakefile to point to specific commit (#1741) + * Fix drafts docs to indicate that draft time is based on file modification + time, not `Time.now` (#1695) + * Add `jekyll-monthly-archive-plugin` and `jekyll-category-archive-plugin` to + list of third-party plugins (#1693) + * Add `jekyll-asset-path-plugin` to list of third-party plugins (#1670) + * Add `emoji-for-jekyll` to list of third-part plugins (#1708) + * Fix previous section link on plugins page to point to pagination page (#1707) + * Add `org-mode` converter plugin to third-party plugins (#1711) + * Point "Blog migrations" page to http://import.jekyllrb.com (#1732) + * Add docs for `post_url` when posts are in subdirectories (#1718) + * Update the docs to point to `example.com` (#1448) + +## 1.3.0 / 2013-11-04 + ### Major Enhancements * Add support for adding data as YAML files under a site's `_data` directory (#1003) * Allow variables to be used with `include` tags (#1495) + * Allow using gems for plugin management (#1557) ### Minor Enhancements * Decrease the specificity in the site template CSS (#1574) @@ -17,6 +69,10 @@ * Update Kramdown dependency to `~> 1.2` (#1610) * Update `safe_yaml` dependency to `~> 0.9.7` (#1602) * Allow layouts to be in subfolders like includes (#1622) + * Switch to listen for site watching while serving (#1589) + * Add a `json` liquid filter to be used in sites (#1651) + * Point people to the migration docs when the `jekyll-import` gem is + missing (#1662) ### Bug Fixes * Fix up matching against source and destination when the two @@ -27,6 +83,11 @@ * Downgrade to Maruku `~> 0.6.0` in order to avoid changes in rendering (#1598) * Fix error with failing include tag when variable was file name (#1613) * Downcase lexers before passing them to pygments (#1615) + * Capitalize the short verbose switch because it conflicts with the + built-in Commander switch (#1660) + * Fix compatibility with 1.8.x (#1665) + * Fix an error with the new file watching code due to library version + incompatibilities (#1687) ### Development Fixes * Add coverage reporting with Coveralls (#1539) @@ -37,6 +98,12 @@ * Update coveralls dependency to `~> 0.7.0` (#1606) * Update rake dependency to `~> 10.1` (#1603) * Clean up `site.rb` comments to be more concise/uniform (#1616) + * Use the master branch for the build badge in the readme (#1636) + * Refactor Site#render (#1638) + * Remove duplication in command line options (#1637) + * Add tests for all the coderay options (#1543) + * Improve some of the cucumber test code (#1493) + * Improve comparisons of timestamps by ignoring the seconds (#1582) ### Site Enhancements * Fix params for `JekyllImport::WordPress.process` arguments (#1554) @@ -49,6 +116,12 @@ * Improve the instructions for mimicking GitHub Flavored Markdown (#1614) * Add `jekyll-import` warning note of missing dependencies (#1626) + * Fix grammar in the Usage section (#1635) + * Add documentation for the use of gems as plugins (#1656) + * Document the existence of a few additional plugins (#1405) + * Document that the `date_to_string` always returns a two digit day (#1663) + * Fix navigation in the "Working with Drafts" page (#1667) + * Fix an error with the data documentation (#1691) ## 1.2.1 / 2013-09-14 diff --git a/README.markdown b/README.markdown index 94080ed1..3d75f281 100644 --- a/README.markdown +++ b/README.markdown @@ -2,7 +2,7 @@ [](http://badge.fury.io/rb/jekyll) -[](https://travis-ci.org/mojombo/jekyll) +[](https://travis-ci.org/mojombo/jekyll) [](https://codeclimate.com/github/mojombo/jekyll) [](https://gemnasium.com/mojombo/jekyll) [](https://coveralls.io/r/mojombo/jekyll) diff --git a/Rakefile b/Rakefile index b65b2dd2..d76ec053 100644 --- a/Rakefile +++ b/Rakefile @@ -218,7 +218,7 @@ namespace :site do abort "You seem to have misplaced your History.markdown file. I can haz?" end end - + namespace :releases do desc "Create new release post" task :new, :version do |t, args| diff --git a/bin/jekyll b/bin/jekyll index ee497c25..8f91698c 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -33,6 +33,16 @@ def normalize_options(options) options end +def add_build_options(c) + c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' + c.option '--future', 'Publishes posts with a future date' + c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish' + c.option '-w', '--watch', 'Watch for changes and rebuild' + c.option '--lsi', 'Use LSI for improved related posts' + c.option '-D', '--drafts', 'Render posts in the _drafts folder' + c.option '-V', '--verbose', 'Print verbose output.' +end + command :default do |c| c.action do |args, options| if args.empty? @@ -59,13 +69,7 @@ command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site' - c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' - c.option '--future', 'Publishes posts with a future date' - c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish' - c.option '-w', '--watch', 'Watch for changes and rebuild' - c.option '--lsi', 'Use LSI for improved related posts' - c.option '-D', '--drafts', 'Render posts in the _drafts folder' - c.option '-v', '--verbose', 'Print verbose output.' + add_build_options(c) c.action do |args, options| options = normalize_options(options.__hash__) @@ -78,15 +82,9 @@ command :serve do |c| c.syntax = 'jekyll serve [options]' c.description = 'Serve your site locally' - c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' - c.option '--future', 'Publishes posts with a future date' - c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish' - c.option '-w', '--watch', 'Watch for changes and rebuild' - c.option '--lsi', 'Use LSI for improved related posts' - c.option '-B', '--detach', 'Run the server in the background (detach)' - c.option '-D', '--drafts', 'Render posts in the _drafts folder' - c.option '-v', '--verbose', 'Print verbose output.' + add_build_options(c) + c.option '-B', '--detach', 'Run the server in the background (detach)' c.option '-P', '--port [PORT]', 'Port to listen on' c.option '-H', '--host [HOST]', 'Host to bind to' c.option '-b', '--baseurl [URL]', 'Base URL' @@ -145,14 +143,14 @@ command :import do |c| c.option '--user STRING', 'Username to use when migrating' c.option '--pass STRING', 'Password to use when migrating' c.option '--host STRING', 'Host address to use when migrating' + c.option '--prefix STRING', 'Database table prefix to use when migrating' c.action do |args, options| begin require 'jekyll-import' rescue LoadError msg = "You must install the 'jekyll-import' gem before continuing.\n" - msg += "* Do this by running `gem install jekyll-import`.\n" - msg += "* Or if you need root privileges, run `sudo gem install jekyll-import`." + msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n" abort msg end Jekyll::Commands::Import.process(args.first, options) diff --git a/features/include_tag.feature b/features/include_tag.feature index 3abff4c7..587784dc 100644 --- a/features/include_tag.feature +++ b/features/include_tag.feature @@ -46,3 +46,12 @@ Feature: Include tags When I run jekyll Then the _site directory should exist And I should see "a snippet that works with parameters" in "_site/index.html" + + Scenario: Include a variable file in a loop + Given I have an _includes directory + And I have an "_includes/one.html" file that contains "one" + And I have an "_includes/two.html" file that contains "two" + And I have an "index.html" page with files "[one.html, two.html]" that contains "{% for file in page.files %}{% include {{file}} %} {% endfor %}" + When I run jekyll + Then the _site directory should exist + And I should see "one two" in "_site/index.html" diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 89324cb1..4f807eae 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -225,3 +225,11 @@ Feature: Site configuration And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" And I should see "Post Layout:
content for entry1.
" in "_site/2007/12/31/entry1.html" And I should see "Post Layout:content for entry2.
" in "_site/2020/01/31/entry2.html" + + Scenario: Add a gem-based plugin + Given I have an "index.html" file that contains "Whatever" + And I have a configuration file with "gems" set to "[jekyll_test_plugin]" + When I run jekyll + Then the _site directory should exist + And I should see "Whatever" in "_site/index.html" + And I should see "this is a test" in "_site/test.txt" diff --git a/features/site_data.feature b/features/site_data.feature index 9ab94056..faa266b7 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -4,10 +4,10 @@ Feature: Site data In order to make the site slightly dynamic Scenario: Use page variable in a page - Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@me.com" + Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@example.com" When I run jekyll Then the _site directory should exist - And I should see "Contact: email@me.com" in "_site/contact.html" + And I should see "Contact: email@example.com" in "_site/contact.html" Scenario Outline: Use page.path variable in a page Given I have aIf you are importing your blog from Drupal 6,7, Joomla, - Mephisto, Movable Type, Textpattern, or Typo (with mysql db), you need to install - `mysql` and `sequel` gems. If you are importing from a WordPress database, you - need to install `mysql2` and `sequel` gems, and if you are importing from Enki - or Typo (with postgresql db) you need to install `pg` and `sequel` gems.
-- - Importers may not distinguish between published or private posts, so - you should always check that the content Jekyll generates for you appears as - you intended. - -
-If you are migrating from a WordPress.com account, you can - access the export tool at the following URL: - `https://YOUR-USER-NAME.wordpress.com/wp-admin/export.php`.
-_plugins
and gems
+ can be used simultaneously
+ + You may use both of the aforementioned plugin options simultaneously in the + same site if you so choose. Use of one does not restrict the use of the other +
+{% raw %}{{ site.time | date_to_xmlschema }}{% endraw %}
- 2008-11-17T13:07:54-08:00
+ 2008-11-07T13:07:54-08:00
{% raw %}{{ site.time | date_to_rfc822 }}{% endraw %}
- Mon, 17 Nov 2008 13:07:54 -0800
+ Mon, 07 Nov 2008 13:07:54 -0800
{% raw %}{{ site.time | date_to_string }}{% endraw %}
- 17 Nov 2008
+ 07 Nov 2008
{% raw %}{{ site.time | date_to_long_string }}{% endraw %}
- 17 November 2008
+ 07 November 2008
Data To JSON
+Convert Hash or Array to JSON.
+
+ {% raw %}{{ site.data.projects | jsonify }}{% endraw %}
+
- Starting with Jekyll v1.1.0, `relative_permalinks` will default to `false`, + Starting with Jekyll v2.0, `relative_permalinks` will default to `false`, meaning all pages will be built using the absolute permalink behaviour. The switch will still exist until v2.0.
diff --git a/site/docs/usage.md b/site/docs/usage.md index 0a72e3d3..6db3a112 100644 --- a/site/docs/usage.md +++ b/site/docs/usage.md @@ -40,7 +40,7 @@ $ jekyll serve --watch # => Same as `jekyll serve`, but watch for changes and regenerate automatically. {% endhighlight %} -This is just a few of the available [configuration options](../configuration/). +These are just a few of the available [configuration options](../configuration/). Many configuration options can either be specified as flags on the command line, or alternatively (and more commonly) they can be specified in a `_config.yml` file at the root of the source directory. Jekyll will automatically use the diff --git a/test/source/_config.dev.toml b/test/source/_config.dev.toml new file mode 100644 index 00000000..7ac863f8 --- /dev/null +++ b/test/source/_config.dev.toml @@ -0,0 +1,2 @@ +baseurl = "/you-beautiful-blog-you" +title = "My magnificent site, wut" diff --git a/test/test_configuration.rb b/test/test_configuration.rb index c57408e5..d911b779 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -30,7 +30,7 @@ class TestConfiguration < Test::Unit::TestCase @config = Configuration[{"source" => source_dir}] @no_override = {} @one_config_file = {"config" => "config.yml"} - @multiple_files = {"config" => %w[config/site.yml config/deploy.yml configuration.yml]} + @multiple_files = {"config" => %w[config/site.yml config/deploy.toml configuration.yml]} end should "always return an array" do @@ -45,7 +45,7 @@ class TestConfiguration < Test::Unit::TestCase assert_equal %w[config.yml], @config.config_files(@one_config_file) end should "return an array of the config files if given many config files" do - assert_equal %w[config/site.yml config/deploy.yml configuration.yml], @config.config_files(@multiple_files) + assert_equal %w[config/site.yml config/deploy.toml configuration.yml], @config.config_files(@multiple_files) end end context "#backwards_compatibilize" do @@ -131,6 +131,7 @@ class TestConfiguration < Test::Unit::TestCase @paths = { :default => File.join(Dir.pwd, '_config.yml'), :other => File.join(Dir.pwd, '_config.live.yml'), + :toml => source_dir('_config.dev.toml'), :empty => "" } end @@ -153,12 +154,20 @@ class TestConfiguration < Test::Unit::TestCase assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) end + should "successfully load a TOML file" do + Jekyll.logger.log_level = Jekyll::Stevenson::WARN + assert_equal Jekyll::Configuration::DEFAULTS.merge({ "baseurl" => "/you-beautiful-blog-you", "title" => "My magnificent site, wut" }), Jekyll.configuration({ "config" => [@paths[:toml]] }) + Jekyll.logger.log_level = Jekyll::Stevenson::INFO + end + should "load multiple config files" do mock(YAML).safe_load_file(@paths[:default]) { Hash.new } mock(YAML).safe_load_file(@paths[:other]) { Hash.new } + mock(TOML).load_file(@paths[:toml]) { Hash.new } mock($stdout).puts("Configuration file: #{@paths[:default]}") mock($stdout).puts("Configuration file: #{@paths[:other]}") - assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] }) + mock($stdout).puts("Configuration file: #{@paths[:toml]}") + assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other], @paths[:toml]] }) end should "load multiple config files and last config should win" do diff --git a/test/test_entry_filter.rb b/test/test_entry_filter.rb new file mode 100644 index 00000000..c295a57c --- /dev/null +++ b/test/test_entry_filter.rb @@ -0,0 +1,74 @@ +require 'helper' + +class TestEntryFilter < Test::Unit::TestCase + context "Filtering entries" 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 "filter entries" do + ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown# + .baz.markdow foo.markdown~ .htaccess _posts _pages] + + entries = EntryFilter.new(@site).filter(ent1) + assert_equal %w[foo.markdown bar.markdown baz.markdown .htaccess], entries + end + + should "filter entries with exclude" do + excludes = %w[README TODO] + files = %w[index.html site.css .htaccess] + + @site.exclude = excludes + ["exclude*"] + assert_equal files, @site.filter_entries(excludes + files + ["excludeA"]) + end + + should "not filter entries within include" do + includes = %w[_index.html .htaccess include*] + files = %w[index.html _index.html .htaccess includeA] + + @site.include = includes + assert_equal files, @site.filter_entries(files) + end + + should "filter symlink entries when safe mode enabled" do + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true}) + end + site = Site.new(Jekyll.configuration) + stub(File).symlink?('symlink.js') {true} + files = %w[symlink.js] + assert_equal [], site.filter_entries(files) + end + + should "not filter symlink entries when safe mode disabled" do + stub(File).symlink?('symlink.js') {true} + files = %w[symlink.js] + assert_equal files, @site.filter_entries(files) + end + + should "not include symlinks in safe mode" do + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true}) + end + site = Site.new(Jekyll.configuration) + + site.read_directories("symlink-test") + assert_equal [], site.pages + assert_equal [], site.static_files + end + + should "include symlinks in unsafe mode" do + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false}) + end + site = Site.new(Jekyll.configuration) + + site.read_directories("symlink-test") + assert_not_equal [], site.pages + assert_not_equal [], site.static_files + end + end +end diff --git a/test/test_filters.rb b/test/test_filters.rb index 6af0d705..28e9612d 100644 --- a/test/test_filters.rb +++ b/test/test_filters.rb @@ -98,5 +98,16 @@ class TestFilters < Test::Unit::TestCase should "escape space as %20" do assert_equal "my%20things", @filter.uri_escape("my things") end + + context "jsonify filter" do + should "convert hash to json" do + assert_equal "{\"age\":18}", @filter.jsonify({:age => 18}) + end + + should "convert array to json" do + assert_equal "[1,2]", @filter.jsonify([1, 2]) + assert_equal "[{\"name\":\"Jack\"},{\"name\":\"Smith\"}]", @filter.jsonify([{:name => 'Jack'}, {:name => 'Smith'}]) + end + end end end diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index eed8b97f..1d4c09ff 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -12,24 +12,51 @@ class TestKramdown < Test::Unit::TestCase 'footnote_nr' => 1, 'entity_output' => 'as_char', 'toc_levels' => '1..6', - 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo' + 'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo', + + 'use_coderay' => true, + 'coderay_bold_every'=> 12, + 'coderay' => { + 'coderay_css' => :style, + 'coderay_bold_every' => 8 + } } } + @config = Jekyll.configuration(@config) + @markdown = Converters::Markdown.new(@config) end # http://kramdown.rubyforge.org/converter/html.html#options should "pass kramdown options" do - markdown = Converters::Markdown.new(@config) - assert_equal "(“|“)Pit(’|’)hy(”|”)<\/p>/, markdown.convert(%{"Pit'hy"}).strip + assert_match /
(“|“)Pit(’|’)hy(”|”)<\/p>/, @markdown.convert(%{"Pit'hy"}).strip override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } } markdown = Converters::Markdown.new(@config.deep_merge(override)) assert_match /
(«|«)Pit(›|›)hy(»|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip end + + context "moving up nested coderay options" do + setup do + @markdown.convert('some markup') + @converter_config = @markdown.instance_variable_get(:@config)['kramdown'] + end + + should "work correctly" do + assert_equal :style, @converter_config['coderay_css'] + end + + should "also work for defaults" do + default = Jekyll::Configuration::DEFAULTS['kramdown']['coderay']['coderay_tab_width'] + assert_equal default, @converter_config['coderay_tab_width'] + end + + should "not overwrite" do + assert_equal 12, @converter_config['coderay_bold_every'] + end + end end end diff --git a/test/test_redcloth.rb b/test/test_redcloth.rb index 94cc9f49..964591be 100644 --- a/test/test_redcloth.rb +++ b/test/test_redcloth.rb @@ -7,7 +7,7 @@ class TestRedCloth < Test::Unit::TestCase @textile = Converters::Textile.new end - should "preserve single line breaks in HTML output" do + should "preserve single line breaks in HTML output" do assert_equal "
line1
\nline2
line1
\nline2
line1
\nline2