jekyll 1.5.1 → 2.0.0.alpha.1

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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.markdown +6 -6
  3. data/History.markdown +99 -23
  4. data/README.markdown +7 -3
  5. data/Rakefile +5 -5
  6. data/bin/jekyll +101 -116
  7. data/features/embed_filters.feature +13 -0
  8. data/features/include_tag.feature +11 -0
  9. data/features/markdown.feature +3 -3
  10. data/features/site_configuration.feature +34 -3
  11. data/features/step_definitions/jekyll_steps.rb +47 -34
  12. data/features/support/env.rb +25 -28
  13. data/jekyll.gemspec +38 -18
  14. data/lib/jekyll.rb +7 -15
  15. data/lib/jekyll/commands/build.rb +2 -0
  16. data/lib/jekyll/commands/serve.rb +11 -1
  17. data/lib/jekyll/configuration.rb +22 -6
  18. data/lib/jekyll/converter.rb +16 -16
  19. data/lib/jekyll/converters/markdown.rb +30 -15
  20. data/lib/jekyll/converters/markdown/maruku_parser.rb +4 -5
  21. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +34 -3
  22. data/lib/jekyll/converters/sass.rb +58 -0
  23. data/lib/jekyll/converters/textile.rb +2 -2
  24. data/lib/jekyll/convertible.rb +25 -6
  25. data/lib/jekyll/core_ext.rb +0 -35
  26. data/lib/jekyll/deprecator.rb +2 -2
  27. data/lib/jekyll/entry_filter.rb +61 -25
  28. data/lib/jekyll/excerpt.rb +8 -6
  29. data/lib/jekyll/filters.rb +46 -2
  30. data/lib/jekyll/layout_reader.rb +40 -0
  31. data/lib/jekyll/mime.types +19 -9
  32. data/lib/jekyll/page.rb +6 -4
  33. data/lib/jekyll/post.rb +11 -18
  34. data/lib/jekyll/site.rb +34 -32
  35. data/lib/jekyll/tags/highlight.rb +26 -4
  36. data/lib/jekyll/tags/include.rb +29 -17
  37. data/lib/jekyll/tags/post_url.rb +10 -1
  38. data/lib/jekyll/url.rb +0 -2
  39. data/lib/site_template/_config.yml +1 -1
  40. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +1 -1
  41. data/lib/site_template/css/main.css +8 -1
  42. data/script/bootstrap +2 -0
  43. data/script/branding +11 -0
  44. data/script/cibuild +5 -0
  45. data/script/rebund +140 -0
  46. data/site/_config.yml +2 -2
  47. data/site/_data/docs.yml +44 -0
  48. data/site/{css → _includes/css}/gridism.css +0 -0
  49. data/site/_includes/css/normalize.css +1 -0
  50. data/site/{css → _includes/css}/pygments.css +2 -0
  51. data/site/{css → _includes/css}/style.css +10 -0
  52. data/site/_includes/docs_contents.html +4 -12
  53. data/site/_includes/docs_contents_mobile.html +4 -17
  54. data/site/_includes/docs_option.html +1 -1
  55. data/site/_includes/docs_ul.html +2 -2
  56. data/site/_includes/footer.html +1 -1
  57. data/site/_includes/top.html +1 -4
  58. data/site/_layouts/news_item.html +2 -2
  59. data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +4 -4
  60. data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +1 -1
  61. data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +1 -1
  62. data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +20 -0
  63. data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +1 -2
  64. data/site/css/screen.css +27 -0
  65. data/site/docs/assets.md +46 -0
  66. data/site/docs/configuration.md +18 -4
  67. data/site/docs/contributing.md +2 -2
  68. data/site/docs/datafiles.md +6 -6
  69. data/site/docs/deployment-methods.md +5 -0
  70. data/site/docs/extras.md +38 -2
  71. data/site/docs/frontmatter.md +2 -1
  72. data/site/docs/history.md +0 -22
  73. data/site/docs/installation.md +7 -7
  74. data/site/docs/migrations.md +1 -1
  75. data/site/docs/plugins.md +11 -2
  76. data/site/docs/posts.md +25 -4
  77. data/site/docs/sites.md +1 -1
  78. data/site/docs/structure.md +1 -1
  79. data/site/docs/templates.md +13 -8
  80. data/site/docs/troubleshooting.md +8 -5
  81. data/site/docs/usage.md +11 -0
  82. data/site/docs/variables.md +18 -0
  83. data/site/docs/windows.md +44 -0
  84. data/test/helper.rb +5 -8
  85. data/test/source/_includes/include.html +1 -0
  86. data/test/source/_includes/sig.markdown +2 -2
  87. data/test/source/_posts/2013-12-17-include-variable-filters.markdown +21 -0
  88. data/test/source/_posts/2013-12-20-properties.text +11 -0
  89. data/test/source/_sass/_grid.scss +1 -0
  90. data/test/source/css/main.scss +4 -0
  91. data/test/source/js/coffeescript.coffee +10 -0
  92. data/test/source/properties.html +8 -0
  93. data/test/source/unpublished.html +7 -0
  94. data/test/test_coffeescript.rb +49 -0
  95. data/test/test_configuration.rb +29 -18
  96. data/test/test_convertible.rb +7 -9
  97. data/test/test_core_ext.rb +0 -22
  98. data/test/test_entry_filter.rb +36 -2
  99. data/test/test_excerpt.rb +43 -1
  100. data/test/test_filters.rb +44 -5
  101. data/test/test_generated_site.rb +5 -1
  102. data/test/test_layout_reader.rb +17 -0
  103. data/test/test_page.rb +28 -10
  104. data/test/test_post.rb +32 -15
  105. data/test/test_redcarpet.rb +19 -3
  106. data/test/test_sass.rb +122 -0
  107. data/test/test_site.rb +56 -7
  108. data/test/test_tags.rb +102 -51
  109. metadata +154 -80
  110. data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
  111. data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
  112. data/site/css/normalize.css +0 -1
  113. data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
  114. data/test/source/exploit.md +0 -5
  115. data/test/test_path_sanitization.rb +0 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7774f515b69590f22a19d6d02f549f16176acfdc
4
- data.tar.gz: a43d5a1e9ebd75da9f4d8445d6c738593ea11c9d
3
+ metadata.gz: 4e35c918f0934bb55de7b1591e07da3f0aec52aa
4
+ data.tar.gz: 3898da127bf6315ae05408642f5109286ab906d1
5
5
  SHA512:
6
- metadata.gz: 70cc97ba0736a056ceef606efec097fd966b4dc414780e643bd8f72f5881a276f74824e3faadd9fac0c02e96008662048935693a776386cfcf1112fcd4e336ae
7
- data.tar.gz: a9f7b7f9a267a81f8de02195e1dad705f1452dd0639ffb623872d6602cf2fdab3b3130a0a72c41f30e86baece917ffa9fd6447f05e7a75e2d1bad0d49a49d295
6
+ metadata.gz: 8c0eb8bcf642c692a0ee7ca5fbb8d4185c0abd27b052d6eae1da056929b6b38694cc662d8f8ad9a3fbd0c4cd45f535512c31fde81f9f008195e7c80f88fcd957
7
+ data.tar.gz: 528a7516fb6aa1919008e7d9a9310271b93e0e7cc7c87ce51dc963019b90adb27dcc9fcddb648b4f38610ad740b9bc857a7bac9ab9a95a16a31fa9895837a971
@@ -53,7 +53,7 @@ Here's the most direct way to get your work merged into the project:
53
53
  * Make sure everything still passes by running `rake`.
54
54
  * If necessary, rebase your commits into logical chunks, without errors.
55
55
  * Push the branch up ( `git push origin my_awesome_feature` ).
56
- * Create a pull request against mojombo/jekyll and describe what your change
56
+ * Create a pull request against jekyll/jekyll and describe what your change
57
57
  does and the why you think it should be merged.
58
58
 
59
59
  Updating Documentation
@@ -63,14 +63,14 @@ We want the Jekyll documentation to be the best it can be. We've
63
63
  open-sourced our docs and we welcome any pull requests if you find it
64
64
  lacking.
65
65
 
66
- You can find the documentation for jekyllrb.com in the
67
- [site](https://github.com/mojombo/jekyll/tree/master/site) directory of
66
+ You can find the documentation for jekyllrb.com in the
67
+ [site](https://github.com/jekyll/jekyll/tree/master/site) directory of
68
68
  Jekyll's repo on GitHub.com.
69
69
 
70
70
  All documentation pull requests should be directed at `master`. Pull
71
- requests directed at another branch will not be accepted.
71
+ requests directed at another branch will not be accepted.
72
72
 
73
- The [Jekyll wiki](https://github.com/mojombo/jekyll/wiki) on GitHub
73
+ The [Jekyll wiki](https://github.com/jekyll/jekyll/wiki) on GitHub
74
74
  can be freely updated without a pull request as all GitHub users have access.
75
75
 
76
76
  Gotchas
@@ -78,7 +78,7 @@ Gotchas
78
78
 
79
79
  * If you want to bump the gem version, please put that in a separate commit.
80
80
  This way, the maintainers can control when the gem gets released.
81
- * Try to keep your patch(es) based from the latest commit on mojombo/jekyll.
81
+ * Try to keep your patch(es) based from the latest commit on jekyll/jekyll.
82
82
  The easier it is to apply your work, the less work the maintainers have to do,
83
83
  which is always a good thing.
84
84
  * Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
@@ -1,41 +1,117 @@
1
1
  ## HEAD
2
2
 
3
3
  ### Major Enhancements
4
+ * Add gem-based plugin whitelist to safe mode (#1657)
5
+ * Replace the commander command line parser with a more robust
6
+ solution for our needs called `mercenary` (#1706)
7
+ * Remove support for Ruby 1.8.x (#1780)
8
+ * Move to jekyll/jekyll from mojombo/jekyll (#1817)
9
+ * Allow custom markdown processors (#1872)
10
+ * Provide support for the Rouge syntax highlighter (#1859)
11
+ * Provide support for Sass (#1932)
12
+ * Provide a 300% improvement when generating sites that use
13
+ `Post#next` or `Post#previous` (#1983)
14
+ * Provide support for CoffeeScript (#1991)
15
+ * Replace Maruku with Kramdown as Default Markdown Processor (#1988)
4
16
 
5
17
  ### Minor Enhancements
18
+ * Move the EntryFilter class into the Jekyll module to avoid polluting the
19
+ global namespace (#1800)
20
+ * Add `group_by` Liquid filter create lists of items grouped by a common
21
+ property's value (#1788)
22
+ * Add support for Maruku's `fenced_code_blocks` option (#1799)
23
+ * Update Redcarpet dependency to ~> 3.0 (#1815)
24
+ * Automatically sort all pages by name (#1848)
25
+ * Better error message when time is not parseable (#1847)
26
+ * Allow `include` tag variable arguments to use filters (#1841)
27
+ * `post_url` tag should raise `ArgumentError` for invalid name (#1825)
28
+ * Bump dependency `mercenary` to `~> 0.2.0` (#1879)
29
+ * Bump dependency `safe_yaml` to `~> 1.0` (#1886)
30
+ * Allow sorting of content by custom properties (#1849)
31
+ * Add `--quiet` flag to silence output during build and serve (#1898)
32
+ * Add a `where` filter to filter arrays based on a key/value pair
33
+ (#1875)
34
+ * Route 404 errors to a custom 404 page in development (#1899)
35
+ * Excludes are now relative to the site source (#1916)
36
+ * Bring MIME Types file for `jekyll serve` to complete parity with GH Pages
37
+ servers (#1993)
38
+ * Adding Breakpoint to make new site template more responsive (#2038)
39
+ * Default to using the UTF-8 encoding when reading files. (#2031)
6
40
 
7
41
  ### Bug Fixes
42
+ * Don't allow nil entries when loading posts (#1796)
43
+ * Remove the scrollbar that's always displayed in new sites generated
44
+ from the site template (#1805)
45
+ * Add `#path` to required methods in `Jekyll::Convertible` (#1866)
46
+ * Default Maruku fenced code blocks to ON for 2.0.0-dev (#1831)
47
+ * Change short opts for host and port for `jekyll docs` to be consistent with
48
+ other subcommands (#1877)
49
+ * Fix typos (#1910)
50
+ * Lock Maruku at 0.7.0 to prevent bugs caused by Maruku 0.7.1 (#1958)
51
+ * Fixes full path leak to source directory when using include tag (#1951)
52
+ * Don't generate pages that aren't being published (#1931)
53
+ * Use `SafeYAML.load` to avoid conflicts with other projects (#1982)
54
+ * Relative posts should never fail to build (#1976)
8
55
 
9
56
  ### Development Fixes
57
+ * Add a link to the site in the README.md file (#1795)
58
+ * Add in History and site changes from `v1-stable` branch (#1836)
59
+ * Testing additions on the Excerpt class (#1893)
60
+ * Update Kramdown to `~> 1.3` (#1894)
61
+ * Fix the `highlight` tag feature (#1859)
62
+ * Test Jekyll under Ruby 2.1.0 (#1900)
63
+ * Add script/cibuild for fun and profit (#1912)
64
+ * Use `Forwardable` for delegation between `Excerpt` and `Post`
65
+ (#1927)
66
+ * Rename `read_things` to `read_content` (#1928)
67
+ * Add `script/branding` script for ASCII art lovin' (#1936)
68
+ * Update the README to reflect the repo move (#1943)
69
+ * Add the project vision to the README (#1935)
70
+ * Speed up Travis CI builds by using Rebund (#1985)
71
+ * Use Yarp as a Gem proxy for Travis CI (#1984)
72
+ * Remove Yarp as a Gem proxy for Travis CI (#2004)
73
+ * Move the reading of layouts into its own class (#2020)
74
+ * Test Sass import (#2009)
10
75
 
11
76
  ### Site Enhancements
12
-
13
- ## 1.5.1 / 2014-03-27
14
-
15
- ### Bug Fixes
16
-
17
- * Only strip the drive name if it begins the string (#2176)
18
-
19
- ## 1.5.0 / 2014-03-24
20
-
21
- ### Minor Enhancements
22
-
23
- * Loosen `safe_yaml` dependency to `~> 1.0` (#2167)
24
- * Bump `safe_yaml` dependency to `~> 1.0.0` (#1942)
25
-
26
- ### Bug Fixes
27
-
28
- * Fix issue where filesystem traversal restriction broke Windows (#2167)
29
- * Lock `maruku` at `0.7.0` (#2167)
30
-
31
- ### Development Fixes
32
-
33
- * Lock `cucmber` at `1.3.11` (#2167)
77
+ * Document Kramdown's GFM parser option (#1791)
78
+ * Move CSS to includes & update normalize.css to v2.1.3 (#1787)
79
+ * Minify CSS only in production (#1803)
80
+ * Fix broken link to installation of Ruby on Mountain Lion blog post on
81
+ Troubleshooting docs page (#1797)
82
+ * Fix issues with 1.4.1 release blog post (#1804)
83
+ * Add note about deploying to OpenShift (#1812)
84
+ * Collect all Windows-related docs onto one page (#1818)
85
+ * Fixed typo in datafiles doc page (#1854)
86
+ * Clarify how to access `site` in docs (#1864)
87
+ * Add closing `<code>` tag to `context.registers[:site]` note (#1867)
88
+ * Fix link to @mojombo's site source (#1897)
89
+ * Add `paginate: nil` to default configuration in docs (#1896)
90
+ * Add link to our License in the site footer (#1889)
91
+ * Add a charset note in "Writing Posts" doc page (#1902)
92
+ * Disallow selection of path and prompt in bash examples
93
+ * Add jekyll-compass to the plugin list (#1923)
94
+ * Add note in Posts docs about stripping `<p>` tags from excerpt (#1933)
95
+ * Add additional info about the new exclude behavior (#1938)
96
+ * Linkify 'awesome contributors' to point to the contributors graph on
97
+ GitHub (#1940)
98
+ * Update `docs/sites.md` link to GitHub Training materials (#1949)
99
+ * Update `master` with the release info from 1.4.3 (#1947)
100
+ * Define docs nav in datafile (#1953)
101
+ * Clarify the docs around the naming convention for posts (#1971)
102
+ * Add missing `next` and `previous` docs for post layouts and templates (#1970)
103
+ * Add note to `Writing posts` page about how to strip html from excerpt (#1962)
104
+ * Add `jekyll-humanize` plugin to plugin list (#1998)
105
+ * Add `jekyll-font-awesome` plugin to plugin list (#1999)
106
+ * Add `sublime-jekyll` to list of Editor plugins (#2001)
107
+ * Add `vim-jekyll` to the list of Editor plugins (#2005)
108
+ * Fix non-semantic nesting of `p` tags in `news_item` layout (#2013)
109
+ * Document destination folder cleaning (#2016)
110
+ * Updated instructions for NearlyFreeSpeech.NET installation (#2015)
34
111
 
35
112
  ## 1.4.3 / 2014-01-13
36
113
 
37
114
  ### Bug Fixes
38
-
39
115
  * Patch show-stopping security vulnerabilities (#1944)
40
116
 
41
117
  ## 1.4.2 / 2013-12-16
@@ -1,4 +1,4 @@
1
- # Jekyll
1
+ # [Jekyll](http://jekyllrb.com/)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/jekyll.png)](http://badge.fury.io/rb/jekyll)
4
4
 
@@ -7,9 +7,13 @@
7
7
  [![Dependency Status](https://gemnasium.com/jekyll/jekyll.png)](https://gemnasium.com/jekyll/jekyll)
8
8
  [![Coverage Status](https://coveralls.io/repos/jekyll/jekyll/badge.png)](https://coveralls.io/r/jekyll/jekyll)
9
9
 
10
- By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
10
+ By Tom Preston-Werner, Nick Quaranto, and many [awesome contributors](https://github.com/jekyll/jekyll/graphs/contributors)!
11
11
 
12
- Jekyll is a simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server. This is also the engine behind [GitHub Pages](http://pages.github.com), which you can use to host your project's page or blog right here from GitHub.
12
+ Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind [GitHub Pages](http://pages.github.com), which you can use to host sites right from your GitHub repositories.
13
+
14
+ ## Philosophy
15
+
16
+ Jekyll does what you tell it to do — no more, no less. It doesn't try to outsmart users by making bold assumptions, nor does it burden them with needless complexity and configuration. Put simply, Jekyll gets out of your way and allows you to concentrate on what truly matters: your content.
13
17
 
14
18
  ## Getting Started
15
19
 
data/Rakefile CHANGED
@@ -84,7 +84,7 @@ end
84
84
  #
85
85
  #############################################################################
86
86
 
87
- if RUBY_VERSION > '1.9' && ENV["TRAVIS"] == "true"
87
+ if ENV["TRAVIS"] == "true"
88
88
  require 'coveralls/rake/task'
89
89
  Coveralls::RakeTask.new
90
90
 
@@ -156,7 +156,7 @@ namespace :site do
156
156
 
157
157
  desc "Update normalize.css library to the latest version and minify"
158
158
  task :update_normalize_css do
159
- Dir.chdir("site/css") do
159
+ Dir.chdir("site/_includes/css") do
160
160
  sh 'curl "http://necolas.github.io/normalize.css/latest/normalize.css" -o "normalize.scss"'
161
161
  sh 'sass "normalize.scss":"normalize.css" --style compressed'
162
162
  sh 'rm "normalize.scss"'
@@ -169,7 +169,7 @@ namespace :site do
169
169
  puts "Checking for gh-pages dir..."
170
170
  unless File.exist?("./gh-pages")
171
171
  puts "No gh-pages directory found. Run the following commands first:"
172
- puts " `git clone git@github.com:mojombo/jekyll gh-pages"
172
+ puts " `git clone git@github.com:jekyll/jekyll gh-pages"
173
173
  puts " `cd gh-pages"
174
174
  puts " `git checkout gh-pages`"
175
175
  exit(1)
@@ -252,8 +252,8 @@ end
252
252
  #############################################################################
253
253
 
254
254
  task :release => :build do
255
- unless `git branch` =~ /^(\* master|\* v1-stable)$/
256
- puts "You must be on the master branch or the v1-stable branch to release!"
255
+ unless `git branch` =~ /^\* master$/
256
+ puts "You must be on the master branch to release!"
257
257
  exit!
258
258
  end
259
259
  sh "git commit --allow-empty -m 'Release #{version}'"
data/bin/jekyll CHANGED
@@ -3,156 +3,141 @@ STDOUT.sync = true
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
5
5
 
6
- require 'commander/import'
7
6
  require 'jekyll'
7
+ require 'mercenary'
8
8
 
9
9
  Jekyll::Deprecator.process(ARGV)
10
10
 
11
- program :name, 'jekyll'
12
- program :version, Jekyll::VERSION
13
- program :description, 'Jekyll is a blog-aware, static site generator in Ruby'
14
-
15
- default_command :default
16
-
17
- global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
18
- global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
19
- global_option '--safe', 'Safe mode (defaults to false)'
20
- global_option '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
21
- global_option '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
22
-
23
- # Option names don't always directly match the configuration value we'd like.
24
- # This method will rename options to match what Jekyll configuration expects.
25
- #
26
- # options - The Hash of options from Commander.
27
- #
28
- # Returns the normalized Hash.
29
- def normalize_options(options)
30
- if drafts_state = options.delete(:drafts)
31
- options[:show_drafts] = drafts_state
32
- end
33
- options
34
- end
35
-
36
11
  def add_build_options(c)
37
- c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
38
- c.option '--future', 'Publishes posts with a future date'
39
- c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
40
- c.option '-w', '--watch', 'Watch for changes and rebuild'
41
- c.option '--lsi', 'Use LSI for improved related posts'
42
- c.option '-D', '--drafts', 'Render posts in the _drafts folder'
43
- c.option '-V', '--verbose', 'Print verbose output.'
12
+ c.option 'config', '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
13
+ c.option 'future', '--future', 'Publishes posts with a future date'
14
+ c.option 'limit_posts', '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
15
+ c.option 'watch', '-w', '--watch', 'Watch for changes and rebuild'
16
+ c.option 'lsi', '--lsi', 'Use LSI for improved related posts'
17
+ c.option 'show_drafts', '-D', '--drafts', 'Render posts in the _drafts folder'
18
+ c.option 'quiet', '-q', '--quiet', 'Silence output.'
19
+ c.option 'verbose', '-V', '--verbose', 'Print verbose output.'
44
20
  end
45
21
 
46
- command :default do |c|
47
- c.action do |args, options|
22
+ Mercenary.program(:jekyll) do |p|
23
+ p.version Jekyll::VERSION
24
+ p.description 'Jekyll is a blog-aware, static site generator in Ruby'
25
+ p.syntax 'jekyll <subcommand> [options]'
26
+
27
+ p.option 'source', '-s', '--source [DIR]', 'Source directory (defaults to ./)'
28
+ p.option 'destination', '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
29
+ p.option 'safe', '--safe', 'Safe mode (defaults to false)'
30
+ p.option 'plugins', '-p', '--plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]', Array, 'Plugins directory (defaults to ./_plugins)'
31
+ p.option 'layouts', '--layouts DIR', String, 'Layouts directory (defaults to ./_layouts)'
32
+
33
+ p.action do |args, options|
48
34
  if args.empty?
49
- command(:help).run
35
+ p.go(["-h"])
50
36
  else
51
- Jekyll.logger.abort_with "Invalid command. Use --help for more information"
37
+ unless p.has_command?(args.first)
38
+ Jekyll.logger.abort_with "Invalid command. Use --help for more information"
39
+ end
52
40
  end
53
41
  end
54
- end
55
42
 
56
- command :new do |c|
57
- c.syntax = 'jekyll new PATH'
58
- c.description = 'Creates a new Jekyll site scaffold in PATH'
43
+ p.command(:new) do |c|
44
+ c.syntax 'jekyll new PATH'
45
+ c.description 'Creates a new Jekyll site scaffold in PATH'
59
46
 
60
- c.option '--force', 'Force creation even if PATH already exists'
61
- c.option '--blank', 'Creates scaffolding but with empty files'
47
+ c.option 'force', '--force', 'Force creation even if PATH already exists'
48
+ c.option 'blank', '--blank', 'Creates scaffolding but with empty files'
62
49
 
63
- c.action do |args, options|
64
- Jekyll::Commands::New.process(args, options.__hash__)
50
+ c.action do |args, options|
51
+ Jekyll::Commands::New.process(args)
52
+ end
65
53
  end
66
- end
67
54
 
68
- command :build do |c|
69
- c.syntax = 'jekyll build [options]'
70
- c.description = 'Build your site'
55
+ p.command(:build) do |c|
56
+ c.syntax 'jekyll build [options]'
57
+ c.description 'Build your site'
71
58
 
72
- add_build_options(c)
59
+ add_build_options(c)
73
60
 
74
- c.action do |args, options|
75
- options = normalize_options(options.__hash__)
76
- options = Jekyll.configuration(options)
77
- Jekyll::Commands::Build.process(options)
61
+ c.action do |args, options|
62
+ options["serving"] = false
63
+ config = Jekyll.configuration(options)
64
+ Jekyll::Commands::Build.process(config)
65
+ end
78
66
  end
79
- end
80
-
81
- command :serve do |c|
82
- c.syntax = 'jekyll serve [options]'
83
- c.description = 'Serve your site locally'
84
67
 
85
- add_build_options(c)
68
+ p.command(:serve) do |c|
69
+ c.syntax 'jekyll serve [options]'
70
+ c.description 'Serve your site locally'
71
+ c.alias :server
86
72
 
87
- c.option '-B', '--detach', 'Run the server in the background (detach)'
88
- c.option '-P', '--port [PORT]', 'Port to listen on'
89
- c.option '-H', '--host [HOST]', 'Host to bind to'
90
- c.option '-b', '--baseurl [URL]', 'Base URL'
73
+ add_build_options(c)
91
74
 
92
- c.action do |args, options|
93
- options.default :serving => true
75
+ c.option 'detach', '-B', '--detach', 'Run the server in the background (detach)'
76
+ c.option 'port', '-P', '--port [PORT]', 'Port to listen on'
77
+ c.option 'host', '-H', '--host [HOST]', 'Host to bind to'
78
+ c.option 'baseurl', '-b', '--baseurl [URL]', 'Base URL'
94
79
 
95
- options = normalize_options(options.__hash__)
96
- options = Jekyll.configuration(options)
97
- Jekyll::Commands::Build.process(options)
98
- Jekyll::Commands::Serve.process(options)
80
+ c.action do |args, options|
81
+ options["serving"] ||= true
82
+ options = Jekyll.configuration(options)
83
+ Jekyll::Commands::Build.process(options)
84
+ Jekyll::Commands::Serve.process(options)
85
+ end
99
86
  end
100
- end
101
- alias_command :server, :serve
102
87
 
103
- command :doctor do |c|
104
- c.syntax = 'jekyll doctor'
105
- c.description = 'Search site and print specific deprecation warnings'
88
+ p.command(:doctor) do |c|
89
+ c.syntax 'jekyll doctor'
90
+ c.description 'Search site and print specific deprecation warnings'
91
+ c.alias(:hyde)
106
92
 
107
- c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
93
+ c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
108
94
 
109
- c.action do |args, options|
110
- options = normalize_options(options.__hash__)
111
- options = Jekyll.configuration(options)
112
- Jekyll::Commands::Doctor.process(options)
113
- end
114
- end
115
- alias_command :hyde, :doctor
116
-
117
- command :docs do |c|
118
- c.syntax = 'jekyll docs'
119
- c.description = "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
120
-
121
- c.option '-p', '--port [PORT]', 'Port to listen on'
122
- c.option '-u', '--host [HOST]', 'Host to bind to'
123
-
124
- c.action do |args, options|
125
- options = normalize_options(options.__hash__)
126
- options = Jekyll.configuration(options.merge!({
127
- 'source' => File.expand_path("../site", File.dirname(__FILE__)),
128
- 'destination' => File.expand_path("../site/_site", File.dirname(__FILE__))
129
- }))
130
- puts options
131
- Jekyll::Commands::Build.process(options)
132
- Jekyll::Commands::Serve.process(options)
95
+ c.action do |args, options|
96
+ options = Jekyll.configuration(options)
97
+ Jekyll::Commands::Doctor.process(options)
98
+ end
133
99
  end
134
- end
135
100
 
136
- command :import do |c|
137
- c.syntax = 'jekyll import <platform> [options]'
138
- c.description = 'Import your old blog to Jekyll'
101
+ p.command(:docs) do |c|
102
+ c.syntax 'jekyll docs'
103
+ c.description "Launch local server with docs for Jekyll v#{Jekyll::VERSION}"
104
+
105
+ c.option 'port', '-P', '--port [PORT]', 'Port to listen on'
106
+ c.option 'host', '-H', '--host [HOST]', 'Host to bind to'
107
+
108
+ c.action do |args, options|
109
+ options = normalize_options(options)
110
+ options = Jekyll.configuration(options.merge!({
111
+ 'source' => File.expand_path("../site", File.dirname(__FILE__)),
112
+ 'destination' => File.expand_path("../site/_site", File.dirname(__FILE__))
113
+ }))
114
+ Jekyll::Commands::Build.process(options)
115
+ Jekyll::Commands::Serve.process(options)
116
+ end
117
+ end
139
118
 
140
- c.option '--source STRING', 'Source file or URL to migrate from'
141
- c.option '--file STRING', 'File to migrate from'
142
- c.option '--dbname STRING', 'Database name to migrate from'
143
- c.option '--user STRING', 'Username to use when migrating'
144
- c.option '--pass STRING', 'Password to use when migrating'
145
- c.option '--host STRING', 'Host address to use when migrating'
146
- c.option '--prefix STRING', 'Database table prefix to use when migrating'
119
+ p.command(:import) do |c|
120
+ c.syntax 'jekyll import <platform> [options]'
121
+ c.description 'Import your old blog to Jekyll'
122
+ importers = []
147
123
 
148
- c.action do |args, options|
149
124
  begin
150
125
  require 'jekyll-import'
126
+ importers = JekyllImport.add_importer_commands(c)
151
127
  rescue LoadError
152
- msg = "You must install the 'jekyll-import' gem before continuing.\n"
153
- msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n"
154
- abort msg
155
128
  end
156
- Jekyll::Commands::Import.process(args.first, options)
129
+
130
+ c.action do |args, options|
131
+ unless Object.const_defined?(:JekyllImport)
132
+ msg = "You must install the 'jekyll-import' gem before continuing.\n"
133
+ msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n"
134
+ abort msg
135
+ end
136
+ if args.empty?
137
+ Jekyll.logger.warn "You must specify an importer."
138
+ Jekyll.logger.info "Valid options are:"
139
+ importers.each { |i| Jekyll.logger.info "*", "#{i}" }
140
+ end
141
+ end
157
142
  end
158
143
  end