jekyll 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jekyll might be problematic. Click here for more details.

Files changed (75) hide show
  1. checksums.yaml +6 -14
  2. data/History.markdown +71 -0
  3. data/README.markdown +13 -3
  4. data/Rakefile +11 -2
  5. data/bin/jekyll +6 -5
  6. data/features/permalinks.feature +20 -0
  7. data/features/site_data.feature +6 -0
  8. data/features/step_definitions/jekyll_steps.rb +1 -1
  9. data/jekyll.gemspec +8 -3
  10. data/lib/jekyll.rb +3 -1
  11. data/lib/jekyll/cleaner.rb +73 -0
  12. data/lib/jekyll/commands/doctor.rb +40 -2
  13. data/lib/jekyll/commands/new.rb +2 -2
  14. data/lib/jekyll/commands/serve.rb +10 -3
  15. data/lib/jekyll/configuration.rb +14 -1
  16. data/lib/jekyll/converters/markdown.rb +1 -1
  17. data/lib/jekyll/converters/markdown/kramdown_parser.rb +4 -8
  18. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +3 -1
  19. data/lib/jekyll/convertible.rb +14 -4
  20. data/lib/jekyll/core_ext.rb +0 -8
  21. data/lib/jekyll/deprecator.rb +13 -9
  22. data/lib/jekyll/generators/pagination.rb +1 -1
  23. data/lib/jekyll/page.rb +33 -34
  24. data/lib/jekyll/post.rb +48 -51
  25. data/lib/jekyll/site.rb +11 -50
  26. data/lib/jekyll/stevenson.rb +1 -1
  27. data/lib/jekyll/tags/include.rb +19 -13
  28. data/lib/jekyll/url.rb +67 -0
  29. data/lib/site_template/_layouts/default.html +20 -22
  30. data/site/_config.yml +3 -1
  31. data/site/_includes/docs_contents.html +50 -50
  32. data/site/_includes/docs_contents_mobile.html +25 -25
  33. data/site/_includes/footer.html +1 -1
  34. data/site/_includes/primary-nav-items.html +3 -3
  35. data/site/_includes/section_nav.html +2 -2
  36. data/site/_includes/top.html +1 -1
  37. data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +1 -1
  38. data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +1 -1
  39. data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +1 -1
  40. data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +2 -2
  41. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +4 -4
  42. data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +7 -7
  43. data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +6 -6
  44. data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
  45. data/site/css/normalize.css +1 -504
  46. data/site/docs/configuration.md +46 -6
  47. data/site/docs/contributing.md +3 -3
  48. data/site/docs/deployment-methods.md +2 -2
  49. data/site/docs/frontmatter.md +2 -2
  50. data/site/docs/github-pages.md +2 -2
  51. data/site/docs/history.md +265 -265
  52. data/site/docs/index.md +1 -1
  53. data/site/docs/installation.md +4 -4
  54. data/site/docs/migrations.md +14 -11
  55. data/site/docs/pages.md +1 -1
  56. data/site/docs/pagination.md +1 -1
  57. data/site/docs/permalinks.md +2 -2
  58. data/site/docs/plugins.md +18 -10
  59. data/site/docs/posts.md +9 -8
  60. data/site/docs/resources.md +2 -2
  61. data/site/docs/sites.md +1 -1
  62. data/site/docs/structure.md +9 -9
  63. data/site/docs/templates.md +4 -3
  64. data/site/docs/troubleshooting.md +11 -3
  65. data/site/docs/usage.md +8 -3
  66. data/site/docs/variables.md +7 -7
  67. data/site/feed.xml +1 -1
  68. data/site/index.html +3 -3
  69. data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
  70. data/test/test_configuration.rb +14 -0
  71. data/test/test_excerpt.rb +16 -0
  72. data/test/test_generated_site.rb +1 -1
  73. data/test/test_post.rb +7 -0
  74. data/test/test_url.rb +28 -0
  75. metadata +27 -21
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzE0ZjEzYzM3ZGZhYmJjODMyZDNkYTUxNWY5ZThjMWVlM2M3NWI5Yg==
5
- data.tar.gz: !binary |-
6
- NGU1MDcwYjliYjlhMjNmMjk5ZTNkZTA2ODgxMmQ5Y2E3NGM3Y2Y5Yw==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- N2Y5YmY5NDJjMGVhMGJkZDMyMmEyNWQ2ZGZlMzNlY2MxN2U1ZDY0NjVhY2U0
10
- OGY4NjE1MmYwOWRlM2E1MTU1YmYyYWY3M2MwNGYwZmYyZTI5MDQ5OTdlMmQ5
11
- OWVmMDQ0M2U5NDk1N2Y2ODEwODY5Y2I0MzkyNjdjNDE3NzBiNTg=
12
- data.tar.gz: !binary |-
13
- MzdkNjFjZjllNmI4NzIzMjJhNjU1MjY4ZjI4ZGIwNjU5Mjc4YzZjMDY1ODY1
14
- M2QxMDIwYzkzNDY0M2Y2NWYwZDUxZDcyZGM0ZTNlNGQyMmU3ZDg4NmYwNzNl
15
- ZmY5YTJlZWZlNmRiMjE4ZmEwZGZkYmU0NDMzNTFhYzRhNzM2ODY=
2
+ SHA1:
3
+ metadata.gz: aab2c87d69fc03f3df6a6b6a2baefc5e46fe5904
4
+ data.tar.gz: ae32a99eb79b9c36914dabe91b2ef4e504a2097d
5
+ SHA512:
6
+ metadata.gz: 1ce28ae2b4c0dfd9d8042f636629748ee89db13afab6b1cb913969cb64d1351ccf7630d246b27c2bd361014b26836a535893907ad89f6018058815bab7a80d47
7
+ data.tar.gz: d5e9b0f6bb303512011243caacf34e369a832d4bf26d518455798463f5885398e9877ee6433818ebd83a2f11f81502476b5716eeec8e754f2456727d51ee35b4
@@ -8,6 +8,77 @@
8
8
 
9
9
  ### Development Fixes
10
10
 
11
+ ### Site Enhancements
12
+
13
+ ## v1.2.0 / 2013-09-06
14
+
15
+ ### Major Enhancements
16
+ * Disable automatically-generated excerpts when `excerpt_separator` is `""`. (#1386)
17
+ * Add checking for URL conflicts when running `jekyll doctor` (#1389)
18
+
19
+ ### Minor Enhancements
20
+ * Catch and fix invalid `paginate` values (#1390)
21
+ * Remove superfluous `div.container` from the default html template for
22
+ `jekyll new` (#1315)
23
+ * Add -D short-form switch for the drafts option (#1394)
24
+ * Update the links in the site template for Twitter and GitHub (#1400)
25
+ * Update dummy email address to example.com domain (#1408)
26
+ * Update normalize.css to v2.1.2 and minify; add rake task to update
27
+ normalize.css with greater ease. (#1430)
28
+ * Add the ability to detach the server ran by `jekyll serve` from it's
29
+ controlling terminal (#1443)
30
+ * Improve permalink generation for URLs with special characters (#944)
31
+ * Expose the current Jekyll version to posts and pages via a new
32
+ `jekyll.version` variable (#1481)
33
+
34
+ ### Bug Fixes
35
+ * Markdown extension matching matches only exact matches (#1382)
36
+ * Fixed NoMethodError when message passed to `Stevenson#message` is nil (#1388)
37
+ * Use binary mode when writing file (#1364)
38
+ * Fix 'undefined method `encoding` for "mailto"' errors w/ Ruby 1.8 and
39
+ Kramdown > 0.14.0 (#1397)
40
+ * Do not force the permalink to be a dir if it ends on .html (#963)
41
+ * When a Liquid Exception is caught, show the full path rel. to site source (#1415)
42
+ * Properly read in the config options when serving the docs locally
43
+ (#1444)
44
+ * Fixed `--layouts` option for `build` and `serve` commands (#1458)
45
+ * Remove kramdown as a runtime dependency since it's optional (#1498)
46
+ * Provide proper error handling for invalid file names in the include
47
+ tag (#1494)
48
+
49
+ ### Development Fixes
50
+ * Remove redundant argument to
51
+ Jekyll::Commands::New#scaffold_post_content (#1356)
52
+ * Add new dependencies to the README (#1360)
53
+ * Fix link to contributing page in README (#1424)
54
+ * Update TomDoc in Pager#initialize to match params (#1441)
55
+ * Refactor `Site#cleanup` into `Jekyll::Site::Cleaner` class (#1429)
56
+ * Several other small minor refactorings (#1341)
57
+ * Ignore `_site` in jekyllrb.com deploy (#1480)
58
+ * Add Gem version and dependency badge to README (#1497)
59
+
60
+ ### Site Enhancements
61
+ * Add info about new releases (#1353)
62
+ * Update plugin list with jekyll-rss plugin (#1354)
63
+ * Update the site list page with Ruby's official site (#1358)
64
+ * Add `jekyll-ditaa` to list of third-party plugins (#1370)
65
+ * Add `postfiles` to list of third-party plugins (#1373)
66
+ * For internal links, use full path including trailing `/` (#1411)
67
+ * Use curly apostrophes in the docs (#1419)
68
+ * Update the docs for Redcarpet in Jekyll (#1418)
69
+ * Add `pluralize` and `reading_time` filters to docs (#1439)
70
+ * Fix markup for the Kramdown options (#1445)
71
+ * Fix typos in the History file (#1454)
72
+ * Add trailing slash to site's post URL (#1462)
73
+ * Clarify that --config will take multiple files (#1474)
74
+ * Fix docs/templates.md private gist example (#1477)
75
+ * Use `site.repository` for Jekyll's GitHub URL (#1463)
76
+ * Add `jekyll-pageless-redirects` to list of third-party plugins (#1486)
77
+ * Clarify that `date_to_xmlschema` returns an ISO 8601 string (#1488)
78
+ * Add `jekyll-good-include` to list of third-party plugins (#1491)
79
+ * XML escape the blog post title in our feed (#1501)
80
+ * Add `jekyll-toc-generator` to list of third-party plugins (#1506)
81
+
11
82
  ## v1.1.2 / 2013-07-25
12
83
 
13
84
  ### Bug Fixes
@@ -1,7 +1,10 @@
1
1
  # Jekyll
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/jekyll.png)](http://badge.fury.io/rb/jekyll)
4
+
3
5
  [![Build Status](https://secure.travis-ci.org/mojombo/jekyll.png)](https://travis-ci.org/mojombo/jekyll)
4
6
  [![Code Climate](https://codeclimate.com/github/mojombo/jekyll.png)](https://codeclimate.com/github/mojombo/jekyll)
7
+ [![Dependency Status](https://gemnasium.com/mojombo/jekyll.png)](https://gemnasium.com/mojombo/jekyll)
5
8
 
6
9
  By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
7
10
 
@@ -12,8 +15,8 @@ Jekyll is a simple, blog aware, static site generator. It takes a template direc
12
15
  * [Install](http://jekyllrb.com/docs/installation/) the gem
13
16
  * Read up about its [Usage](http://jekyllrb.com/docs/usage/) and [Configuration](http://jekyllrb.com/docs/configuration/)
14
17
  * Take a gander at some existing [Sites](http://wiki.github.com/mojombo/jekyll/sites)
15
- * Fork and [Contribute](https://github.com/mojombo/jekyll/blob/master/CONTRIBUTING.md) your own modifications
16
- * Have questions? Post them on the [Mailing List](http://groups.google.com/group/jekyll-rb)
18
+ * Fork and [Contribute](http://jekyllrb.com/docs/contributing/) your own modifications
19
+ * Have questions? Check out `#jekyll` on irc.freenode.net.
17
20
 
18
21
  ## Diving In
19
22
 
@@ -26,19 +29,26 @@ Jekyll is a simple, blog aware, static site generator. It takes a template direc
26
29
 
27
30
  ## Runtime Dependencies
28
31
 
32
+ * Commander: Command-line interface constructor (Ruby)
33
+ * Colorator: Colorizes command line output (Ruby)
29
34
  * Classifier: Generating related posts (Ruby)
30
35
  * Directory Watcher: Auto-regeneration of sites (Ruby)
31
- * Kramdown: Markdown-superset converter (Ruby)
32
36
  * Liquid: Templating system (Ruby)
33
37
  * Maruku: Default markdown engine (Ruby)
38
+ * Pygments.rb: Syntax highlighting (Ruby/Python)
39
+ * RedCarpet: Markdown engine (Ruby)
40
+ * Safe YAML: YAML Parser built for security (Ruby)
34
41
 
35
42
  ## Developer Dependencies
36
43
 
44
+ * Kramdown: Markdown-superset converter (Ruby)
45
+ * Launchy: Cross-platform file launcher (Ruby)
37
46
  * RDiscount: Discount Markdown Processor (Ruby)
38
47
  * RedCloth: Textile support (Ruby)
39
48
  * RedGreen: Nicer test output (Ruby)
40
49
  * RR: Mocking (Ruby)
41
50
  * Shoulda: Test framework (Ruby)
51
+ * SimpleCov: Coverage framework (Ruby)
42
52
 
43
53
  ## License
44
54
 
data/Rakefile CHANGED
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  def linkify_prs(markdown)
53
53
  markdown.gsub(/#(\d+)/) do |word|
54
- "[#{word}](https://github.com/mojombo/jekyll/issues/#{word.delete("#")})"
54
+ "[#{word}]({{ site.repository }}/issues/#{word.delete("#")})"
55
55
  end
56
56
  end
57
57
 
@@ -147,6 +147,15 @@ namespace :site do
147
147
  end
148
148
  end
149
149
 
150
+ desc "Update normalize.css library to the latest version and minify"
151
+ task :update_normalize_css do
152
+ Dir.chdir("site/css") do
153
+ sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
154
+ sh 'sass "normalize.scss":"normalize.css" --style compressed'
155
+ sh 'rm "normalize.scss"'
156
+ end
157
+ end
158
+
150
159
  desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
151
160
  task :publish => [:history] do
152
161
  # Ensure the gh-pages dir exists so we can generate into it.
@@ -167,7 +176,7 @@ namespace :site do
167
176
  # Copy to gh-pages dir.
168
177
  puts "Copying site to gh-pages branch..."
169
178
  Dir.glob("site/*") do |path|
170
- next if path == "_site"
179
+ next if path.include? "_site"
171
180
  sh "cp -R #{path} gh-pages/"
172
181
  end
173
182
 
data/bin/jekyll CHANGED
@@ -18,7 +18,7 @@ global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
18
18
  global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
19
19
  global_option '--safe', 'Safe mode (defaults to false)'
20
20
  global_option '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
21
- global_option '--layouts', 'Layouts directory (defaults to ./_layouts)'
21
+ global_option '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
22
22
 
23
23
  # Option names don't always directly match the configuration value we'd like.
24
24
  # This method will rename options to match what Jekyll configuration expects.
@@ -64,7 +64,7 @@ command :build do |c|
64
64
  c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
65
65
  c.option '-w', '--watch', 'Watch for changes and rebuild'
66
66
  c.option '--lsi', 'Use LSI for improved related posts'
67
- c.option '--drafts', 'Render posts in the _drafts folder'
67
+ c.option '-D', '--drafts', 'Render posts in the _drafts folder'
68
68
 
69
69
  c.action do |args, options|
70
70
  options = normalize_options(options.__hash__)
@@ -82,7 +82,8 @@ command :serve do |c|
82
82
  c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
83
83
  c.option '-w', '--watch', 'Watch for changes and rebuild'
84
84
  c.option '--lsi', 'Use LSI for improved related posts'
85
- c.option '--drafts', 'Render posts in the _drafts folder'
85
+ c.option '-B', '--detach', 'Run the server in the background (detach)'
86
+ c.option '-D', '--drafts', 'Render posts in the _drafts folder'
86
87
 
87
88
  c.option '-P', '--port [PORT]', 'Port to listen on'
88
89
  c.option '-H', '--host [HOST]', 'Host to bind to'
@@ -122,10 +123,10 @@ command :docs do |c|
122
123
 
123
124
  c.action do |args, options|
124
125
  options = normalize_options(options.__hash__)
125
- options = Jekyll.configuration(options).merge({
126
+ options = Jekyll.configuration(options.merge!({
126
127
  'source' => File.expand_path("../site", File.dirname(__FILE__)),
127
128
  'destination' => File.expand_path("../site/_site", File.dirname(__FILE__))
128
- })
129
+ }))
129
130
  puts options
130
131
  Jekyll::Commands::Build.process(options)
131
132
  Jekyll::Commands::Serve.process(options)
@@ -63,3 +63,23 @@ Feature: Fancy permalinks
63
63
  When I run jekyll
64
64
  Then the _site directory should exist
65
65
  And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"
66
+
67
+ Scenario: Use per-post permalink
68
+ Given I have a _posts directory
69
+ And I have the following post:
70
+ | title | date | permalink | content |
71
+ | Some post | 2013-04-14 | /custom/posts/1 | bla bla |
72
+ When I run jekyll
73
+ Then the _site directory should exist
74
+ And the _site/custom/posts/1 directory should exist
75
+ And I should see "bla bla" in "_site/custom/posts/1/index.html"
76
+
77
+ Scenario: Use per-post ending in .html
78
+ Given I have a _posts directory
79
+ And I have the following post:
80
+ | title | date | permalink | content |
81
+ | Some post | 2013-04-14 | /custom/posts/some.html | bla bla |
82
+ When I run jekyll
83
+ Then the _site directory should exist
84
+ And the _site/custom/posts directory should exist
85
+ And I should see "bla bla" in "_site/custom/posts/some.html"
@@ -99,3 +99,9 @@ Feature: Site data
99
99
  When I run jekyll
100
100
  Then the _site directory should exist
101
101
  And I should see "http://mysite.com" in "_site/index.html"
102
+
103
+ Scenario: Access Jekyll version via jekyll.version
104
+ Given I have an "index.html" page that contains "{{ jekyll.version }}"
105
+ When I run jekyll
106
+ Then the _site directory should exist
107
+ And I should see "\d+\.\d+\.\d+" in "_site/index.html"
@@ -65,7 +65,7 @@ Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |sta
65
65
  path = File.join(before, folder_post, after, filename)
66
66
 
67
67
  matter_hash = {}
68
- %w(title layout tag tags category categories published author path date).each do |key|
68
+ %w(title layout tag tags category categories published author path date permalink).each do |key|
69
69
  matter_hash[key] = post[key] if post[key]
70
70
  end
71
71
  matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
@@ -4,9 +4,9 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.5'
5
5
 
6
6
  s.name = 'jekyll'
7
- s.version = '1.1.2'
7
+ s.version = '1.2.0'
8
8
  s.license = 'MIT'
9
- s.date = '2013-07-25'
9
+ s.date = '2013-09-06'
10
10
  s.rubyforge_project = 'jekyll'
11
11
 
12
12
  s.summary = "A simple, blog aware, static site generator."
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
27
27
  s.add_runtime_dependency('classifier', "~> 1.3")
28
28
  s.add_runtime_dependency('directory_watcher', "~> 1.4.1")
29
29
  s.add_runtime_dependency('maruku', "~> 0.5")
30
- s.add_runtime_dependency('kramdown', "~> 1.0.2")
31
30
  s.add_runtime_dependency('pygments.rb', "~> 0.5.0")
32
31
  s.add_runtime_dependency('commander', "~> 4.1.3")
33
32
  s.add_runtime_dependency('safe_yaml', "~> 0.7.0")
@@ -41,6 +40,7 @@ Gem::Specification.new do |s|
41
40
  s.add_development_dependency('rr', "~> 1.0.0")
42
41
  s.add_development_dependency('cucumber', "~> 1.2.1", '!= 1.2.4')
43
42
  s.add_development_dependency('RedCloth', "~> 4.2")
43
+ s.add_development_dependency('kramdown', "~> 1.0.2")
44
44
  s.add_development_dependency('rdiscount', "~> 1.6")
45
45
  s.add_development_dependency('launchy', "~> 2.1.2")
46
46
  s.add_development_dependency('simplecov', "~> 0.7")
@@ -72,6 +72,7 @@ Gem::Specification.new do |s|
72
72
  features/support/env.rb
73
73
  jekyll.gemspec
74
74
  lib/jekyll.rb
75
+ lib/jekyll/cleaner.rb
75
76
  lib/jekyll/command.rb
76
77
  lib/jekyll/commands/build.rb
77
78
  lib/jekyll/commands/doctor.rb
@@ -108,6 +109,7 @@ Gem::Specification.new do |s|
108
109
  lib/jekyll/tags/highlight.rb
109
110
  lib/jekyll/tags/include.rb
110
111
  lib/jekyll/tags/post_url.rb
112
+ lib/jekyll/url.rb
111
113
  lib/site_template/.gitignore
112
114
  lib/site_template/_config.yml
113
115
  lib/site_template/_layouts/default.html
@@ -144,6 +146,7 @@ Gem::Specification.new do |s|
144
146
  site/_posts/2013-07-24-jekyll-1-1-1-released.markdown
145
147
  site/_posts/2013-07-25-jekyll-1-0-4-released.markdown
146
148
  site/_posts/2013-07-25-jekyll-1-1-2-released.markdown
149
+ site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
147
150
  site/css/gridism.css
148
151
  site/css/normalize.css
149
152
  site/css/pygments.css
@@ -233,6 +236,7 @@ Gem::Specification.new do |s|
233
236
  test/source/_posts/2013-04-11-custom-excerpt.markdown
234
237
  test/source/_posts/2013-05-10-number-category.textile
235
238
  test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown
239
+ test/source/_posts/2013-08-01-mkdn-extension.mkdn
236
240
  test/source/_posts/es/2008-11-21-nested.textile
237
241
  test/source/about.html
238
242
  test/source/category/_posts/2008-9-23-categories.textile
@@ -267,6 +271,7 @@ Gem::Specification.new do |s|
267
271
  test/test_related_posts.rb
268
272
  test/test_site.rb
269
273
  test/test_tags.rb
274
+ test/test_url.rb
270
275
  ]
271
276
  # = MANIFEST =
272
277
 
@@ -33,6 +33,7 @@ require 'jekyll/deprecator'
33
33
  require 'jekyll/configuration'
34
34
  require 'jekyll/site'
35
35
  require 'jekyll/convertible'
36
+ require 'jekyll/url'
36
37
  require 'jekyll/layout'
37
38
  require 'jekyll/page'
38
39
  require 'jekyll/post'
@@ -42,6 +43,7 @@ require 'jekyll/filters'
42
43
  require 'jekyll/static_file'
43
44
  require 'jekyll/errors'
44
45
  require 'jekyll/related_posts'
46
+ require 'jekyll/cleaner'
45
47
 
46
48
  # extensions
47
49
  require 'jekyll/plugin'
@@ -58,7 +60,7 @@ require_all 'jekyll/tags'
58
60
  SafeYAML::OPTIONS[:suppress_warnings] = true
59
61
 
60
62
  module Jekyll
61
- VERSION = '1.1.2'
63
+ VERSION = '1.2.0'
62
64
 
63
65
  # Public: Generate a Jekyll configuration Hash by merging the default
64
66
  # options with anything in _config.yml, and adding the given options on top.
@@ -0,0 +1,73 @@
1
+ require 'set'
2
+
3
+ module Jekyll
4
+ class Site
5
+ # Handles the cleanup of a site's destination before the site is built.
6
+ class Cleaner
7
+ def initialize(site)
8
+ @site = site
9
+ end
10
+
11
+ # Cleans up the site's destination directory
12
+ def cleanup!
13
+ FileUtils.rm_rf(obsolete_files)
14
+ end
15
+
16
+ private
17
+
18
+ # Private: The list of files and directories to be deleted during the cleanup process
19
+ #
20
+ # Returns an Array with the file and directory paths
21
+ def obsolete_files
22
+ (existing_files - new_files - new_dirs + replaced_files).to_a
23
+ end
24
+
25
+ # Private: The list of existing files, except those included in keep_files and hidden files.
26
+ #
27
+ # Returns a Set with the file paths
28
+ def existing_files
29
+ files = Set.new
30
+ Dir.glob(File.join(@site.dest, "**", "*"), File::FNM_DOTMATCH) do |file|
31
+ files << file unless file =~ /\/\.{1,2}$/ || file =~ keep_file_regex
32
+ end
33
+ files
34
+ end
35
+
36
+ # Private: The list of files to be created when the site is built.
37
+ #
38
+ # Returns a Set with the file paths
39
+ def new_files
40
+ files = Set.new
41
+ @site.each_site_file { |item| files << item.destination(@site.dest) }
42
+ files
43
+ end
44
+
45
+ # Private: The list of directories to be created when the site is built.
46
+ # These are the parent directories of the files in #new_files.
47
+ #
48
+ # Returns a Set with the directory paths
49
+ def new_dirs
50
+ new_files.map { |file| File.dirname(file) }.to_set
51
+ end
52
+
53
+ # Private: The list of existing files that will be replaced by a directory during build
54
+ #
55
+ # Returns a Set with the file paths
56
+ def replaced_files
57
+ new_dirs.select { |dir| File.file?(dir) }.to_set
58
+ end
59
+
60
+ # Private: creates a regular expression from the config's keep_files array
61
+ #
62
+ # Examples
63
+ # ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/
64
+ #
65
+ # Returns the regular expression
66
+ def keep_file_regex
67
+ or_list = @site.keep_files.join("|")
68
+ pattern = "\/(#{or_list.gsub(".", "\.")})"
69
+ Regexp.new pattern
70
+ end
71
+ end
72
+ end
73
+ end
@@ -6,23 +6,61 @@ module Jekyll
6
6
  site = Jekyll::Site.new(options)
7
7
  site.read
8
8
 
9
- unless deprecated_relative_permalinks(site)
9
+ if healthy?(site)
10
10
  Jekyll.logger.info "Your test results", "are in. Everything looks fine."
11
+ else
12
+ abort
11
13
  end
12
14
  end
13
15
 
16
+ def healthy?(site)
17
+ [
18
+ !deprecated_relative_permalinks(site),
19
+ !conflicting_urls(site)
20
+ ].all?
21
+ end
22
+
14
23
  def deprecated_relative_permalinks(site)
15
24
  contains_deprecated_pages = false
16
25
  site.pages.each do |page|
17
26
  if page.uses_relative_permalinks
18
27
  Jekyll.logger.warn "Deprecation:", "'#{page.path}' uses relative" +
19
28
  " permalinks which will be deprecated in" +
20
- " Jekyll v1.1 and beyond."
29
+ " Jekyll v1.2 and beyond."
21
30
  contains_deprecated_pages = true
22
31
  end
23
32
  end
24
33
  contains_deprecated_pages
25
34
  end
35
+
36
+ def conflicting_urls(site)
37
+ conflicting_urls = false
38
+ urls = {}
39
+ urls = collect_urls(urls, site.pages, site.dest)
40
+ urls = collect_urls(urls, site.posts, site.dest)
41
+ urls.each do |url, paths|
42
+ if paths.size > 1
43
+ conflicting_urls = true
44
+ Jekyll.logger.warn "Conflict:", "The URL '#{url}' is the destination" +
45
+ " for the following pages: #{paths.join(", ")}"
46
+ end
47
+ end
48
+ conflicting_urls
49
+ end
50
+
51
+ private
52
+
53
+ def collect_urls(urls, things, destination)
54
+ things.each do |thing|
55
+ dest = thing.destination(destination)
56
+ if urls[dest]
57
+ urls[dest] << thing.path
58
+ else
59
+ urls[dest] = [thing.path]
60
+ end
61
+ end
62
+ urls
63
+ end
26
64
  end
27
65
  end
28
66
  end