jekyll 0.12.1 → 1.0.0.beta1
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.
- data/CONTRIBUTING.md +67 -0
- data/Gemfile +1 -1
- data/History.txt +50 -6
- data/README.textile +10 -6
- data/Rakefile +74 -36
- data/bin/jekyll +78 -276
- data/cucumber.yml +3 -1
- data/features/create_sites.feature +1 -1
- data/features/drafts.feature +25 -0
- data/features/site_configuration.feature +1 -1
- data/features/step_definitions/jekyll_steps.rb +13 -3
- data/features/support/env.rb +3 -1
- data/jekyll.gemspec +73 -17
- data/lib/jekyll.rb +31 -21
- data/lib/jekyll/command.rb +12 -0
- data/lib/jekyll/commands/build.rb +81 -0
- data/lib/jekyll/commands/serve.rb +28 -0
- data/lib/jekyll/converter.rb +1 -3
- data/lib/jekyll/converters/identity.rb +13 -14
- data/lib/jekyll/converters/markdown.rb +128 -128
- data/lib/jekyll/converters/textile.rb +37 -37
- data/lib/jekyll/convertible.rb +6 -4
- data/lib/jekyll/core_ext.rb +9 -1
- data/lib/jekyll/draft.rb +35 -0
- data/lib/jekyll/errors.rb +1 -3
- data/lib/jekyll/filters.rb +13 -4
- data/lib/jekyll/generator.rb +1 -4
- data/lib/jekyll/generators/pagination.rb +46 -46
- data/lib/jekyll/layout.rb +0 -2
- data/lib/jekyll/mime.types +1588 -0
- data/lib/jekyll/page.rb +24 -8
- data/lib/jekyll/plugin.rb +0 -2
- data/lib/jekyll/post.rb +66 -40
- data/lib/jekyll/site.rb +96 -20
- data/lib/jekyll/static_file.rb +0 -2
- data/lib/jekyll/tags/gist.rb +19 -0
- data/lib/jekyll/tags/highlight.rb +63 -62
- data/lib/jekyll/tags/include.rb +25 -25
- data/lib/jekyll/tags/post_url.rb +30 -25
- data/script/bootstrap +2 -0
- data/site/.gitignore +4 -0
- data/site/CNAME +1 -0
- data/site/README +1 -0
- data/site/_config.yml +5 -0
- data/site/_includes/analytics.html +32 -0
- data/site/_includes/docs_contents.html +82 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +26 -0
- data/site/_includes/section_nav.html +22 -0
- data/site/_includes/top.html +14 -0
- data/site/_layouts/default.html +12 -0
- data/site/_layouts/docs.html +21 -0
- data/site/_posts/2012-07-01-configuration.md +277 -0
- data/site/_posts/2012-07-01-contributing.md +66 -0
- data/site/_posts/2012-07-01-deployment-methods.md +108 -0
- data/site/_posts/2012-07-01-extras.md +103 -0
- data/site/_posts/2012-07-01-frontmatter.md +120 -0
- data/site/_posts/2012-07-01-github-pages.md +34 -0
- data/site/_posts/2012-07-01-heroku.md +8 -0
- data/site/_posts/2012-07-01-home.md +47 -0
- data/site/_posts/2012-07-01-installation.md +43 -0
- data/site/_posts/2012-07-01-migrations.md +180 -0
- data/site/_posts/2012-07-01-pages.md +62 -0
- data/site/_posts/2012-07-01-pagination.md +116 -0
- data/site/_posts/2012-07-01-permalinks.md +163 -0
- data/site/_posts/2012-07-01-plugins.md +384 -0
- data/site/_posts/2012-07-01-posts.md +106 -0
- data/site/_posts/2012-07-01-resources.md +49 -0
- data/site/_posts/2012-07-01-sites.md +28 -0
- data/site/_posts/2012-07-01-structure.md +95 -0
- data/site/_posts/2012-07-01-templates.md +217 -0
- data/site/_posts/2012-07-01-troubleshooting.md +108 -0
- data/site/_posts/2012-07-01-usage.md +38 -0
- data/site/_posts/2012-07-01-variables.md +166 -0
- data/site/css/grid.css +62 -0
- data/site/css/normalize.css +504 -0
- data/site/css/pygments.css +70 -0
- data/site/css/style.css +697 -0
- data/site/docs/index.html +11 -0
- data/site/favicon.png +0 -0
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/img/tube.png +0 -0
- data/site/img/tube1x.png +0 -0
- data/site/index.html +77 -0
- data/site/js/modernizr-2.5.3.min.js +4 -0
- data/test/fixtures/broken_front_matter2.erb +4 -0
- data/test/fixtures/broken_front_matter3.erb +7 -0
- data/test/fixtures/exploit_front_matter.erb +4 -0
- data/test/helper.rb +16 -0
- data/test/source/_posts/2013-01-12-nil-layout.textile +6 -0
- data/test/source/_posts/2013-01-12-no-layout.textile +5 -0
- data/test/source/contacts/bar.html +5 -0
- data/test/source/contacts/index.html +5 -0
- data/test/test_configuration.rb +7 -8
- data/test/test_convertible.rb +29 -0
- data/test/test_core_ext.rb +22 -0
- data/test/test_generated_site.rb +1 -1
- data/test/test_kramdown.rb +3 -3
- data/test/test_page.rb +88 -2
- data/test/test_post.rb +42 -6
- data/test/test_rdiscount.rb +1 -1
- data/test/test_redcarpet.rb +1 -1
- data/test/test_redcloth.rb +6 -6
- data/test/test_site.rb +73 -8
- data/test/test_tags.rb +36 -13
- metadata +150 -19
- data/lib/jekyll/migrators/csv.rb +0 -26
- data/lib/jekyll/migrators/drupal.rb +0 -103
- data/lib/jekyll/migrators/enki.rb +0 -49
- data/lib/jekyll/migrators/joomla.rb +0 -53
- data/lib/jekyll/migrators/marley.rb +0 -52
- data/lib/jekyll/migrators/mephisto.rb +0 -84
- data/lib/jekyll/migrators/mt.rb +0 -86
- data/lib/jekyll/migrators/posterous.rb +0 -67
- data/lib/jekyll/migrators/rss.rb +0 -47
- data/lib/jekyll/migrators/textpattern.rb +0 -58
- data/lib/jekyll/migrators/tumblr.rb +0 -195
- data/lib/jekyll/migrators/typo.rb +0 -51
- data/lib/jekyll/migrators/wordpress.rb +0 -294
- data/lib/jekyll/migrators/wordpressdotcom.rb +0 -70
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
Contribute
|
2
|
+
==========
|
3
|
+
|
4
|
+
So you've got an awesome idea to throw into Jekyll. Great! Please keep the
|
5
|
+
following in mind:
|
6
|
+
|
7
|
+
* **Contributions will not be accepted without tests.**
|
8
|
+
* If you're creating a small fix or patch to an existing feature, just a simple
|
9
|
+
test will do. Please stay in the confines of the current test suite and use
|
10
|
+
[Shoulda](http://github.com/thoughtbot/shoulda/tree/master) and
|
11
|
+
[RR](http://github.com/btakita/rr/tree/master).
|
12
|
+
* If it's a brand new feature, make sure to create a new
|
13
|
+
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
|
14
|
+
where appropriate. Also, whipping up some documentation in your fork's wiki
|
15
|
+
would be appreciated, and once merged it will be transferred over to the main
|
16
|
+
wiki.
|
17
|
+
* If your contribution changes any Jekyll behavior, make sure to update the
|
18
|
+
documentation. It lives in site/_posts. If the docs are missing information,
|
19
|
+
please feel free to add it in. Great docs make a great project!
|
20
|
+
* Please follow the [Github Ruby Styleguide](https://github.com/styleguide/ruby) when modifying Ruby code.
|
21
|
+
|
22
|
+
Test Dependencies
|
23
|
+
-----------------
|
24
|
+
|
25
|
+
To run the test suite and build the gem you'll need to install Jekyll's
|
26
|
+
dependencies. Jekyll uses Bundler, so a quick run of the bundle command and
|
27
|
+
you're all set!
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Before you start, run the tests and make sure that they pass (to confirm your
|
32
|
+
environment is configured properly):
|
33
|
+
|
34
|
+
$ rake test
|
35
|
+
$ rake features
|
36
|
+
|
37
|
+
Workflow
|
38
|
+
--------
|
39
|
+
|
40
|
+
Here's the most direct way to get your work merged into the project:
|
41
|
+
|
42
|
+
* Fork the project.
|
43
|
+
* Clone down your fork ( `git clone git://github.com/<username>/jekyll.git` ).
|
44
|
+
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
|
45
|
+
* Hack away, add tests. Not necessarily in that order.
|
46
|
+
* Make sure everything still passes by running `rake`.
|
47
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
48
|
+
* Push the branch up ( `git push origin my_awesome_feature` ).
|
49
|
+
* Create a pull request against mojombo/jekyll and describe what your change
|
50
|
+
does and the why you think it should be merged.
|
51
|
+
|
52
|
+
Gotchas
|
53
|
+
-------
|
54
|
+
|
55
|
+
* If you want to bump the gem version, please put that in a separate commit.
|
56
|
+
This way, the maintainers can control when the gem gets released.
|
57
|
+
* Try to keep your patch(es) based from the latest commit on mojombo/jekyll.
|
58
|
+
The easier it is to apply your work, the less work the maintainers have to do,
|
59
|
+
which is always a good thing.
|
60
|
+
* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
|
61
|
+
actively read the issues and will label it once they come across it.
|
62
|
+
|
63
|
+
Finally...
|
64
|
+
----------
|
65
|
+
|
66
|
+
Thanks! Hacking on Jekyll should be fun. If you find any of this hard to figure
|
67
|
+
out, let us know so we can improve our process or documentation!
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
gemspec
|
data/History.txt
CHANGED
@@ -1,10 +1,53 @@
|
|
1
|
-
==
|
1
|
+
== HEAD
|
2
|
+
* Major Enhancements
|
3
|
+
* Refactored jekyll commands into subcommands: build, serve, and migrate. (#690)
|
4
|
+
* Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793)
|
5
|
+
* Added ability to render drafts in _drafts folder via command line (#833)
|
2
6
|
* Minor Enhancements
|
3
|
-
*
|
4
|
-
|
5
|
-
*
|
6
|
-
*
|
7
|
-
*
|
7
|
+
* Load in Apache MIME Types on `jekyll serve` (#847)
|
8
|
+
* Improve debugability of error message for a malformed highlight tag (#785)
|
9
|
+
* Allow symlinked files in unsafe mode (#824)
|
10
|
+
* Add 'gist' liquid tag to core (#822)
|
11
|
+
* New format of Jekyll output (#795)
|
12
|
+
* Reinstate --limit_posts and --future switches (#788)
|
13
|
+
* Remove ambiguity from command descriptions (#815)
|
14
|
+
* Fix SafeYAML Warnings (#807)
|
15
|
+
* Relaxed Kramdown version to 0.14 (#808)
|
16
|
+
* Aliased `jekyll server` to `jekyll serve`. (#792)
|
17
|
+
* Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744)
|
18
|
+
* Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768)
|
19
|
+
* Rescue from import errors in Wordpress.com migrator (#671)
|
20
|
+
* Massively accelerate LSI performance (#664)
|
21
|
+
* Truncate post slugs when importing from Tumblr (#496)
|
22
|
+
* Add glob support to include, exclude option (#743)
|
23
|
+
* Layout of Page or Post defaults to 'page' or 'post', respectively (#580)
|
24
|
+
* "Keep files" feature (#685)
|
25
|
+
* Output full path & name for files that don't parse (#745)
|
26
|
+
* Add source and destination directory protection (#535)
|
27
|
+
* Better YAML error message (#718)
|
28
|
+
* Bug Fixes
|
29
|
+
* Fixed Page#dir and Page#url for edge cases (#536)
|
30
|
+
* Fix broken post_url with posts with a time in their YAML Front-Matter (#831)
|
31
|
+
* Look for plugins under the source directory (#654)
|
32
|
+
* Tumblr Migrator: finds _posts dir correctly, fixes truncation of long
|
33
|
+
post names (#775)
|
34
|
+
* Force Categories to be Strings (#767)
|
35
|
+
* Safe YAML plugin to prevent vulnerability (#777)
|
36
|
+
* Add SVG support to Jekyll/WEBrick. (#407, #406)
|
37
|
+
* Prevent custom destination from causing continuous regen on watch (#528, #820)
|
38
|
+
* Site Enhancements
|
39
|
+
* Bring site into master branch with better preview/deploy (#709)
|
40
|
+
* Redesigned site (#583)
|
41
|
+
* Development fixes
|
42
|
+
* Added "features:html" rake task for debugging purposes, cleaned up
|
43
|
+
cucumber profiles (#832)
|
44
|
+
* Explicitly require HTTPS rubygems source in Gemfile (#826)
|
45
|
+
* Changed Ruby version for development to 1.9.3-p374 from p362 (#801)
|
46
|
+
* Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806)
|
47
|
+
* Added script/bootstrap (#776)
|
48
|
+
* Running Simplecov under 2 conditions: ENV(COVERAGE)=true and with Ruby version
|
49
|
+
of greater than 1.9 (#771)
|
50
|
+
* Switch to Simplecov for coverage report (#765)
|
8
51
|
|
9
52
|
== 0.12.0 / 2012-12-22
|
10
53
|
* Minor Enhancements
|
@@ -15,6 +58,7 @@
|
|
15
58
|
* Allow multiple plugin dirs to be specified (#438)
|
16
59
|
* Inline TOC token support for RDiscount (#333)
|
17
60
|
* Add the option to specify the paginated url format (#342)
|
61
|
+
* Swap out albino for pygments.rb (#569)
|
18
62
|
* Support Redcarpet 2 and fenced code blocks (#619)
|
19
63
|
* Better reporting of Liquid errors (#624)
|
20
64
|
* Bug Fixes
|
data/README.textile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
h1. Jekyll
|
2
2
|
|
3
|
+
!https://travis-ci.org/mojombo/jekyll.png?branch=master!:https://travis-ci.org/mojombo/jekyll
|
4
|
+
|
3
5
|
By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
|
4
6
|
|
5
7
|
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.
|
@@ -19,22 +21,24 @@ h2. Diving In
|
|
19
21
|
* Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data
|
20
22
|
* Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with
|
21
23
|
* Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier
|
24
|
+
* Use custom "Plugins":http://wiki.github.com/mojombo/jekyll/Plugins to generate content specific to your site
|
22
25
|
|
23
26
|
h2. Runtime Dependencies
|
24
27
|
|
25
|
-
* RedCloth: Textile support (Ruby)
|
26
|
-
* Liquid: Templating system (Ruby)
|
27
28
|
* Classifier: Generating related posts (Ruby)
|
28
|
-
* Maruku: Default markdown engine (Ruby)
|
29
29
|
* Directory Watcher: Auto-regeneration of sites (Ruby)
|
30
|
+
* Kramdown: Markdown-superset converter (Ruby)
|
31
|
+
* Liquid: Templating system (Ruby)
|
32
|
+
* Maruku: Default markdown engine (Ruby)
|
30
33
|
* Pygments: Syntax highlighting (Python)
|
31
34
|
|
32
35
|
h2. Developer Dependencies
|
33
36
|
|
34
|
-
* Shoulda: Test framework (Ruby)
|
35
|
-
* RR: Mocking (Ruby)
|
36
|
-
* RedGreen: Nicer test output (Ruby)
|
37
37
|
* RDiscount: Discount Markdown Processor (Ruby)
|
38
|
+
* RedCloth: Textile support (Ruby)
|
39
|
+
* RedGreen: Nicer test output (Ruby)
|
40
|
+
* RR: Mocking (Ruby)
|
41
|
+
* Shoulda: Test framework (Ruby)
|
38
42
|
|
39
43
|
h2. License
|
40
44
|
|
data/Rakefile
CHANGED
@@ -55,14 +55,6 @@ Rake::TestTask.new(:test) do |test|
|
|
55
55
|
test.verbose = true
|
56
56
|
end
|
57
57
|
|
58
|
-
desc "Generate RCov test coverage and open in your browser"
|
59
|
-
task :coverage do
|
60
|
-
require 'rcov'
|
61
|
-
sh "rm -fr coverage"
|
62
|
-
sh "rcov test/test_*.rb"
|
63
|
-
sh "open coverage/index.html"
|
64
|
-
end
|
65
|
-
|
66
58
|
require 'rdoc/task'
|
67
59
|
Rake::RDocTask.new do |rdoc|
|
68
60
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -71,6 +63,21 @@ Rake::RDocTask.new do |rdoc|
|
|
71
63
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
72
64
|
end
|
73
65
|
|
66
|
+
begin
|
67
|
+
require 'cucumber/rake/task'
|
68
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
69
|
+
t.profile = "travis"
|
70
|
+
end
|
71
|
+
Cucumber::Rake::Task.new(:"features:html", "Run Cucumber features and produce HTML output") do |t|
|
72
|
+
t.profile = "html_report"
|
73
|
+
end
|
74
|
+
rescue LoadError
|
75
|
+
desc 'Cucumber rake task not available'
|
76
|
+
task :features do
|
77
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
74
81
|
desc "Open an irb session preloaded with this library"
|
75
82
|
task :console do
|
76
83
|
sh "irb -rubygems -r ./lib/#{name}.rb"
|
@@ -78,34 +85,67 @@ end
|
|
78
85
|
|
79
86
|
#############################################################################
|
80
87
|
#
|
81
|
-
#
|
88
|
+
# Site tasks - http://jekyllrb.com
|
82
89
|
#
|
83
90
|
#############################################################################
|
84
91
|
|
85
|
-
namespace :
|
86
|
-
desc "
|
87
|
-
task :
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
92
|
+
namespace :site do
|
93
|
+
desc "Generate and view the site locally"
|
94
|
+
task :preview do
|
95
|
+
require "launchy"
|
96
|
+
|
97
|
+
# Yep, it's a hack! Wait a few seconds for the Jekyll site to generate and
|
98
|
+
# then open it in a browser. Someday we can do better than this, I hope.
|
99
|
+
Thread.new do
|
100
|
+
sleep 4
|
101
|
+
puts "Opening in browser..."
|
102
|
+
Launchy.open("http://localhost:4000")
|
103
|
+
end
|
104
|
+
|
105
|
+
# Generate the site in server mode.
|
106
|
+
puts "Running Jekyll..."
|
107
|
+
Dir.chdir("site") do
|
108
|
+
sh "#{File.expand_path('bin/jekyll', File.dirname(__FILE__))} serve --watch"
|
109
|
+
end
|
97
110
|
end
|
98
|
-
end
|
99
111
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
112
|
+
desc "Commit the local site to the gh-pages branch and publish to GitHub Pages"
|
113
|
+
task :publish do
|
114
|
+
# Failsafe. Remove this once it has been done.
|
115
|
+
puts "Make sure to merge #583 into gh-pages before deploying."
|
116
|
+
exit(1)
|
117
|
+
|
118
|
+
# Ensure the gh-pages dir exists so we can generate into it.
|
119
|
+
puts "Checking for gh-pages dir..."
|
120
|
+
unless File.exist?("./gh-pages")
|
121
|
+
puts "No gh-pages directory found. Run the following commands first:"
|
122
|
+
puts " `git clone git@github.com:mojombo/jekyll gh-pages"
|
123
|
+
puts " `cd gh-pages"
|
124
|
+
puts " `git checkout gh-pages`"
|
125
|
+
exit(1)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Ensure gh-pages branch is up to date.
|
129
|
+
Dir.chdir('gh-pages') do
|
130
|
+
sh "git pull origin gh-pages"
|
131
|
+
end
|
132
|
+
|
133
|
+
# Copy to gh-pages dir.
|
134
|
+
puts "Copying site to gh-pages branch..."
|
135
|
+
Dir.glob("site/*") do |path|
|
136
|
+
next if path == "_site"
|
137
|
+
sh "cp -R #{path} gh-pages/"
|
138
|
+
end
|
139
|
+
|
140
|
+
# Commit and push.
|
141
|
+
puts "Committing and pushing to GitHub Pages..."
|
142
|
+
sha = `git log`.match(/[a-z0-9]{40}/)[0]
|
143
|
+
Dir.chdir('gh-pages') do
|
144
|
+
sh "git add ."
|
145
|
+
sh "git commit -m 'Updating to #{sha}.'"
|
146
|
+
sh "git push origin gh-pages"
|
147
|
+
end
|
148
|
+
puts 'Done.'
|
109
149
|
end
|
110
150
|
end
|
111
151
|
|
@@ -116,15 +156,13 @@ end
|
|
116
156
|
#############################################################################
|
117
157
|
|
118
158
|
task :release => :build do
|
119
|
-
|
120
|
-
|
121
|
-
else
|
122
|
-
puts "Doesn't look like you're on any branch. It's too unsafe to release."
|
159
|
+
unless `git branch` =~ /^\* master$/
|
160
|
+
puts "You must be on the master branch to release!"
|
123
161
|
exit!
|
124
162
|
end
|
125
163
|
sh "git commit --allow-empty -m 'Release #{version}'"
|
126
164
|
sh "git tag v#{version}"
|
127
|
-
sh "git push origin
|
165
|
+
sh "git push origin master"
|
128
166
|
sh "git push origin v#{version}"
|
129
167
|
sh "gem push pkg/#{name}-#{version}.gem"
|
130
168
|
end
|
data/bin/jekyll
CHANGED
@@ -1,299 +1,101 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
$:.unshift File.join(File.dirname(__FILE__), *%w
|
3
|
+
$:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib })
|
4
4
|
|
5
|
-
|
6
|
-
Jekyll is a blog-aware, static site generator.
|
7
|
-
|
8
|
-
Basic Command Line Usage:
|
9
|
-
jekyll # . -> ./_site
|
10
|
-
jekyll <path to write generated site> # . -> <path>
|
11
|
-
jekyll <path to source> <path to write generated site> # <path> -> <path>
|
12
|
-
jekyll import <importer name> <options> # imports posts using named import script
|
13
|
-
|
14
|
-
Configuration is read from '<source>/_config.yml' but can be overriden
|
15
|
-
using the following options:
|
16
|
-
|
17
|
-
HELP
|
18
|
-
|
19
|
-
require 'optparse'
|
5
|
+
require 'commander/import'
|
20
6
|
require 'jekyll'
|
21
7
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
options['host'] = import_host
|
46
|
-
end
|
47
|
-
|
48
|
-
opts.on("--site [SITE NAME]", "Site to import from") do |import_site|
|
49
|
-
options['site'] = import_site
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
opts.on("--[no-]safe", "Safe mode (default unsafe)") do |safe|
|
54
|
-
options['safe'] = safe
|
55
|
-
end
|
56
|
-
|
57
|
-
opts.on("--[no-]auto", "Auto-regenerate") do |auto|
|
58
|
-
options['auto'] = auto
|
59
|
-
end
|
60
|
-
|
61
|
-
opts.on("--server [PORT]", "Start web server (default port 4000)") do |port|
|
62
|
-
options['server'] = true
|
63
|
-
options['server_port'] = port unless port.nil?
|
64
|
-
end
|
65
|
-
|
66
|
-
opts.on("--no-server", "Do not start a web server") do |part|
|
67
|
-
options['server'] = false
|
68
|
-
end
|
69
|
-
|
70
|
-
opts.on("--base-url [BASE_URL]", "Serve website from a given base URL (default '/'") do |baseurl|
|
71
|
-
options['baseurl'] = baseurl
|
72
|
-
end
|
73
|
-
|
74
|
-
opts.on("--default-mimetype [MT]", "Mimetype to use when no file extension (if --server)") do |mt|
|
75
|
-
options['default-mimetype'] = mt
|
76
|
-
end
|
77
|
-
|
78
|
-
opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
|
79
|
-
options['lsi'] = lsi
|
80
|
-
end
|
81
|
-
|
82
|
-
opts.on("--[no-]pygments", "Use pygments to highlight code") do |pygments|
|
83
|
-
options['pygments'] = pygments
|
84
|
-
end
|
85
|
-
|
86
|
-
opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
|
87
|
-
options['markdown'] = 'rdiscount'
|
88
|
-
end
|
89
|
-
|
90
|
-
opts.on("--redcarpet", "Use redcarpet gem for Markdown") do
|
91
|
-
options['markdown'] = 'redcarpet'
|
92
|
-
end
|
93
|
-
|
94
|
-
opts.on("--kramdown", "Use kramdown gem for Markdown") do
|
95
|
-
options['markdown'] = 'kramdown'
|
96
|
-
end
|
97
|
-
|
98
|
-
opts.on("--time [TIME]", "Time to generate the site for") do |time|
|
99
|
-
options['time'] = Time.parse(time)
|
100
|
-
end
|
101
|
-
|
102
|
-
opts.on("--[no-]future", "Render future dated posts") do |future|
|
103
|
-
options['future'] = future
|
104
|
-
end
|
105
|
-
|
106
|
-
opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
|
107
|
-
options['permalink'] = style unless style.nil?
|
108
|
-
end
|
109
|
-
|
110
|
-
opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
|
111
|
-
begin
|
112
|
-
options['paginate'] = per_page.to_i
|
113
|
-
raise ArgumentError if options['paginate'] == 0
|
114
|
-
rescue
|
115
|
-
puts 'you must specify a number of posts by page bigger than 0'
|
116
|
-
exit 0
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
opts.on("--paginate_path [PAGINATED_URL_FORMAT]", "Leave blank for /page<num>") do |paginate_path|
|
121
|
-
begin
|
122
|
-
options['paginate_path'] = paginate_path
|
123
|
-
raise ArgumentError if options['paginate_path'].nil?
|
124
|
-
rescue
|
125
|
-
puts 'You must specify a pagination url format'
|
126
|
-
exit 0
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
opts.on("--limit_posts [MAX_POSTS]", "Limit the number of posts to publish") do |limit_posts|
|
131
|
-
begin
|
132
|
-
options['limit_posts'] = limit_posts.to_i
|
133
|
-
raise ArgumentError if options['limit_posts'] < 1
|
134
|
-
rescue
|
135
|
-
puts 'you must specify a number of posts by page bigger than 0'
|
136
|
-
exit 0
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
opts.on("--url [URL]", "Set custom site.url") do |url|
|
141
|
-
options['url'] = url
|
142
|
-
end
|
143
|
-
|
144
|
-
opts.on("--version", "Display current version") do
|
145
|
-
puts "Jekyll " + Jekyll::VERSION
|
146
|
-
exit 0
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# Read command line options into `options` hash
|
151
|
-
opts.parse!
|
152
|
-
|
153
|
-
|
154
|
-
# Check for import stuff
|
155
|
-
if ARGV.size > 0
|
156
|
-
if ARGV[0] == 'import'
|
157
|
-
migrator = ARGV[1]
|
158
|
-
|
159
|
-
if migrator.nil?
|
160
|
-
puts "Invalid options. Run `jekyll --help` for assistance."
|
161
|
-
exit(1)
|
162
|
-
else
|
163
|
-
migrator = migrator.downcase
|
164
|
-
end
|
165
|
-
|
166
|
-
cmd_options = []
|
167
|
-
['file', 'dbname', 'user', 'pass', 'host', 'site'].each do |p|
|
168
|
-
cmd_options << "\"#{options[p]}\"" unless options[p].nil?
|
169
|
-
end
|
170
|
-
|
171
|
-
# It's import time
|
172
|
-
puts "Importing..."
|
173
|
-
|
174
|
-
# Ideally, this shouldn't be necessary. Maybe parse the actual
|
175
|
-
# src files for the migrator name?
|
176
|
-
migrators = {
|
177
|
-
:posterous => 'Posterous',
|
178
|
-
:wordpressdotcom => 'WordpressDotCom',
|
179
|
-
:wordpress => 'WordPress',
|
180
|
-
:csv => 'CSV',
|
181
|
-
:drupal => 'Drupal',
|
182
|
-
:enki => 'Enki',
|
183
|
-
:mephisto => 'Mephisto',
|
184
|
-
:mt => 'MT',
|
185
|
-
:textpattern => 'TextPattern',
|
186
|
-
:tumblr => 'Tumblr',
|
187
|
-
:typo => 'Typo'
|
188
|
-
}
|
189
|
-
|
190
|
-
app_root = File.join(File.dirname(__FILE__), '..')
|
191
|
-
|
192
|
-
require "#{app_root}/lib/jekyll/migrators/#{migrator}"
|
193
|
-
|
194
|
-
if Jekyll.const_defined?(migrators[migrator.to_sym])
|
195
|
-
migrator_class = Jekyll.const_get(migrators[migrator.to_sym])
|
196
|
-
migrator_class.process(*cmd_options)
|
197
|
-
else
|
198
|
-
puts "Invalid migrator. Run `jekyll --help` for assistance."
|
199
|
-
exit(1)
|
200
|
-
end
|
201
|
-
|
202
|
-
exit(0)
|
203
|
-
end
|
8
|
+
program :name, 'jekyll'
|
9
|
+
program :version, Jekyll::VERSION
|
10
|
+
program :description, 'Jekyll is a blog-aware, static site generator in Ruby'
|
11
|
+
|
12
|
+
default_command :help
|
13
|
+
|
14
|
+
global_option '-s', '--source [DIR]', 'Source directory (defaults to ./)'
|
15
|
+
global_option '-d', '--destination [DIR]', 'Destination directory (defaults to ./_site)'
|
16
|
+
global_option '--safe', 'Safe mode (defaults to false)'
|
17
|
+
global_option '--plugins', 'Plugins directory (defaults to ./_plugins)'
|
18
|
+
global_option '--layouts', 'Layouts directory (defaults to ./_layouts)'
|
19
|
+
|
20
|
+
# Option names don't always directly match the configuration value we'd like.
|
21
|
+
# This method will rename options to match what Jekyll configuration expects.
|
22
|
+
#
|
23
|
+
# options - The Hash of options from Commander.
|
24
|
+
#
|
25
|
+
# Returns the normalized Hash.
|
26
|
+
def normalize_options(options)
|
27
|
+
if drafts_state = options.delete(:drafts)
|
28
|
+
options[:show_drafts] = drafts_state
|
29
|
+
end
|
30
|
+
options
|
204
31
|
end
|
205
32
|
|
33
|
+
command :build do |c|
|
34
|
+
c.syntax = 'jekyll build [options]'
|
35
|
+
c.description = 'Build your site'
|
206
36
|
|
37
|
+
c.option '--future', 'Publishes posts with a future date'
|
38
|
+
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
|
39
|
+
c.option '-w', '--watch', 'Watch for changes and rebuild'
|
40
|
+
c.option '--lsi', 'Use LSI for improved related posts'
|
41
|
+
c.option '--drafts', 'Render posts in the _drafts folder'
|
207
42
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
options
|
213
|
-
when 2
|
214
|
-
options['source'] = ARGV[0]
|
215
|
-
options['destination'] = ARGV[1]
|
216
|
-
else
|
217
|
-
puts "Invalid options. Run `jekyll --help` for assistance."
|
218
|
-
exit(1)
|
219
|
-
end
|
220
|
-
|
221
|
-
options = Jekyll.configuration(options)
|
222
|
-
|
223
|
-
# Get source and destination directories (possibly set by config file)
|
224
|
-
source = options['source']
|
225
|
-
destination = options['destination']
|
226
|
-
|
227
|
-
# Files to watch
|
228
|
-
def globs(source)
|
229
|
-
Dir.chdir(source) do
|
230
|
-
dirs = Dir['*'].select { |x| File.directory?(x) }
|
231
|
-
dirs -= ['_site']
|
232
|
-
dirs = dirs.map { |x| "#{x}/**/*" }
|
233
|
-
dirs += ['*']
|
43
|
+
c.action do |args, options|
|
44
|
+
options.defaults :serving => false
|
45
|
+
options = normalize_options(options.__hash__)
|
46
|
+
options = Jekyll.configuration(options)
|
47
|
+
Jekyll::Commands::Build.process(options)
|
234
48
|
end
|
235
49
|
end
|
236
50
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
# Run the directory watcher for auto-generation, if required
|
241
|
-
if options['auto']
|
242
|
-
require 'directory_watcher'
|
51
|
+
command :serve do |c|
|
52
|
+
c.syntax = 'jekyll serve [options]'
|
53
|
+
c.description = 'Serve your site locally'
|
243
54
|
|
244
|
-
|
55
|
+
c.option '--future', 'Publishes posts with a future date'
|
56
|
+
c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish'
|
57
|
+
c.option '-w', '--watch', 'Watch for changes and rebuild'
|
58
|
+
c.option '--lsi', 'Use LSI for improved related posts'
|
59
|
+
c.option '--drafts', 'Render posts in the _drafts folder'
|
245
60
|
|
246
|
-
|
247
|
-
|
248
|
-
|
61
|
+
c.option '-p', '--port [PORT]', 'Port to listen on'
|
62
|
+
c.option '-h', '--host [HOST]', 'Host to bind to'
|
63
|
+
c.option '-b', '--baseurl [URL]', 'Base URL'
|
249
64
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
65
|
+
c.action do |args, options|
|
66
|
+
options.default :port => '4000',
|
67
|
+
:host => '0.0.0.0',
|
68
|
+
:baseurl => '/',
|
69
|
+
:serving => true
|
255
70
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
end
|
261
|
-
else
|
262
|
-
puts "Building site: #{source} -> #{destination}"
|
263
|
-
begin
|
264
|
-
site.process
|
265
|
-
rescue Jekyll::FatalException => e
|
266
|
-
puts
|
267
|
-
puts "ERROR: YOUR SITE COULD NOT BE BUILT:"
|
268
|
-
puts "------------------------------------"
|
269
|
-
puts e.message
|
270
|
-
exit(1)
|
71
|
+
options = normalize_options(options.__hash__)
|
72
|
+
options = Jekyll.configuration(options)
|
73
|
+
Jekyll::Commands::Build.process(options)
|
74
|
+
Jekyll::Commands::Serve.process(options)
|
271
75
|
end
|
272
|
-
puts "Successfully generated site: #{source} -> #{destination}"
|
273
76
|
end
|
77
|
+
alias_command :server, :serve
|
274
78
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
include WEBrick
|
79
|
+
command :import do |c|
|
80
|
+
c.syntax = 'jekyll import <platform> [options]'
|
81
|
+
c.description = 'Import your old blog to Jekyll'
|
279
82
|
|
280
|
-
|
83
|
+
c.option '--source', 'Source file or URL to migrate from'
|
84
|
+
c.option '--file', 'File to migrate from'
|
85
|
+
c.option '--dbname', 'Database name to migrate from'
|
86
|
+
c.option '--user', 'Username to use when migrating'
|
87
|
+
c.option '--pass', 'Password to use when migrating'
|
88
|
+
c.option '--host', 'Host address to use when migrating'
|
281
89
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
90
|
+
c.action do |args, options|
|
91
|
+
begin
|
92
|
+
require 'jekyll-import'
|
93
|
+
rescue LoadError
|
94
|
+
msg = "You must install the 'jekyll-import' gem before continuing.\n"
|
95
|
+
msg += "* Do this by running `gem install jekyll-import`.\n"
|
96
|
+
msg += "* Or if you need root privileges, run `sudo gem install jekyll-import`."
|
97
|
+
abort msg
|
98
|
+
end
|
99
|
+
Jekyll::Commands::Import.process(args.first, options)
|
286
100
|
end
|
287
|
-
|
288
|
-
s = HTTPServer.new(
|
289
|
-
:Port => options['server_port'],
|
290
|
-
:MimeTypes => mime_types
|
291
|
-
)
|
292
|
-
s.mount(options['baseurl'], HTTPServlet::FileHandler, destination)
|
293
|
-
t = Thread.new {
|
294
|
-
s.start
|
295
|
-
}
|
296
|
-
|
297
|
-
trap("INT") { s.shutdown }
|
298
|
-
t.join()
|
299
101
|
end
|