jberkel-jekyll 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/.gitignore +6 -0
  2. data/History.txt +151 -0
  3. data/README.textile +42 -0
  4. data/Rakefile +90 -0
  5. data/VERSION.yml +4 -0
  6. data/bin/jekyll +168 -0
  7. data/features/create_sites.feature +46 -0
  8. data/features/embed_filters.feature +60 -0
  9. data/features/pagination.feature +40 -0
  10. data/features/permalinks.feature +65 -0
  11. data/features/post_data.feature +153 -0
  12. data/features/site_configuration.feature +63 -0
  13. data/features/site_data.feature +82 -0
  14. data/features/step_definitions/jekyll_steps.rb +136 -0
  15. data/features/support/env.rb +16 -0
  16. data/jekyll.gemspec +141 -0
  17. data/lib/jekyll/albino.rb +122 -0
  18. data/lib/jekyll/converters/csv.rb +26 -0
  19. data/lib/jekyll/converters/marley.rb +53 -0
  20. data/lib/jekyll/converters/mephisto.rb +79 -0
  21. data/lib/jekyll/converters/mt.rb +59 -0
  22. data/lib/jekyll/converters/textpattern.rb +50 -0
  23. data/lib/jekyll/converters/typo.rb +49 -0
  24. data/lib/jekyll/converters/wordpress.rb +54 -0
  25. data/lib/jekyll/convertible.rb +117 -0
  26. data/lib/jekyll/core_ext.rb +38 -0
  27. data/lib/jekyll/filters.rb +51 -0
  28. data/lib/jekyll/haml_helpers.rb +15 -0
  29. data/lib/jekyll/layout.rb +37 -0
  30. data/lib/jekyll/page.rb +112 -0
  31. data/lib/jekyll/pager.rb +45 -0
  32. data/lib/jekyll/post.rb +310 -0
  33. data/lib/jekyll/site.rb +316 -0
  34. data/lib/jekyll/tags/highlight.rb +56 -0
  35. data/lib/jekyll/tags/include.rb +31 -0
  36. data/lib/jekyll.rb +86 -0
  37. data/test/helper.rb +27 -0
  38. data/test/source/_includes/sig.markdown +3 -0
  39. data/test/source/_layouts/default.html +27 -0
  40. data/test/source/_layouts/simple.html +1 -0
  41. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  42. data/test/source/_posts/2008-02-02-published.textile +8 -0
  43. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  44. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  45. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  46. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  47. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  48. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  49. data/test/source/_posts/2009-01-27-category.textile +7 -0
  50. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  51. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  52. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  53. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  54. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  55. data/test/source/about.html +6 -0
  56. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  57. data/test/source/contacts.html +5 -0
  58. data/test/source/css/screen.css +76 -0
  59. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  60. data/test/source/index.html +22 -0
  61. data/test/source/sitemap.xml +23 -0
  62. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  63. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  64. data/test/suite.rb +9 -0
  65. data/test/test_configuration.rb +29 -0
  66. data/test/test_filters.rb +49 -0
  67. data/test/test_generated_site.rb +40 -0
  68. data/test/test_page.rb +98 -0
  69. data/test/test_pager.rb +47 -0
  70. data/test/test_post.rb +302 -0
  71. data/test/test_site.rb +85 -0
  72. data/test/test_tags.rb +116 -0
  73. metadata +194 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ test/dest
2
+ *.gem
3
+ pkg/
4
+ *.swp
5
+ *~
6
+ _site/
data/History.txt ADDED
@@ -0,0 +1,151 @@
1
+ == 0.5.4 / 2009-08-23
2
+ * Bug Fixes
3
+ * Do not allow symlinks (security vulnerability)
4
+
5
+ == 0.5.3 / 2009-07-14
6
+ * Bug Fixes
7
+ * Solving the permalink bug where non-html files wouldn't work [github.com/jeffrydegrande]
8
+
9
+ == 0.5.2 / 2009-06-24
10
+ * Enhancements
11
+ * Added --paginate option to the executable along with a paginator object for the payload [github.com/calavera]
12
+ * Upgraded RedCloth to 4.2.1, which makes <notextile> tags work once again.
13
+ * Configuration options set in config.yml are now available through the site payload [github.com/vilcans]
14
+ * Posts can now have an empty YAML front matter or none at all [github.com/bahuvrihi]
15
+ * Bug Fixes
16
+ * Fixing Ruby 1.9 issue that requires to_s on the err object [github.com/Chrononaut]
17
+ * Fixes for pagination and ordering posts on the same day [github.com/ujh]
18
+ * Made pages respect permalinks style and permalinks in yml front matter [github.com/eugenebolshakov]
19
+ * Index.html file should always have index.html permalink [github.com/eugenebolshakov]
20
+ * Added trailing slash to pretty permalink style so Apache is happy [github.com/eugenebolshakov]
21
+ * Bad markdown processor in config fails sooner and with better message [github.com/gcnovus]
22
+ * Allow CRLFs in yaml frontmatter [github.com/juretta]
23
+ * Added Date#xmlschema for Ruby versions < 1.9
24
+
25
+ == 0.5.1 / 2009-05-06
26
+ * Major Enhancements
27
+ * Next/previous posts in site payload [github.com/pantulis, github.com/tomo]
28
+ * Permalink templating system
29
+ * Moved most of the README out to the GitHub wiki
30
+ * Exclude option in configuration so specified files won't be brought over with generated site [github.com/duritong]
31
+ * Bug Fixes
32
+ * Making sure config.yaml references are all gone, using only config.yml
33
+ * Fixed syntax highlighting breaking for UTF-8 code [github.com/henrik]
34
+ * Worked around RDiscount bug that prevents Markdown from getting parsed after highlight [github.com/henrik]
35
+ * CGI escaped post titles [github.com/Chrononaut]
36
+
37
+ == 0.5.0 / 2009-04-07
38
+ * Minor Enhancements
39
+ * Ability to set post categories via YAML [github.com/qrush]
40
+ * Ability to set prevent a post from publishing via YAML [github.com/qrush]
41
+ * Add textilize filter [github.com/willcodeforfoo]
42
+ * Add 'pretty' permalink style for wordpress-like urls [github.com/dysinger]
43
+ * Made it possible to enter categories from YAML as an array [github.com/Chrononaut]
44
+ * Ignore Emacs autosave files [github.com/Chrononaut]
45
+ * Bug Fixes
46
+ * Use block syntax of popen4 to ensure that subprocesses are properly disposed [github.com/jqr]
47
+ * Close open4 streams to prevent zombies [github.com/rtomayko]
48
+ * Only query required fields from the WP Database [github.com/ariejan]
49
+ * Prevent _posts from being copied to the destination directory [github.com/bdimcheff]
50
+ * Refactors
51
+ * Factored the filtering code into a method [github.com/Chrononaut]
52
+ * Fix tests and convert to Shoulda [github.com/qrush, github.com/technicalpickles]
53
+ * Add Cucumber acceptance test suite [github.com/qrush, github.com/technicalpickles]
54
+
55
+ == 0.4.1
56
+ * Minor Enhancements
57
+ * Changed date format on wordpress converter (zeropadding) [github.com/dysinger]
58
+ * Bug Fixes
59
+ * Add jekyll binary as executable to gemspec [github.com/dysinger]
60
+
61
+ == 0.4.0 / 2009-02-03
62
+ * Major Enhancements
63
+ * Switch to Jeweler for packaging tasks
64
+ * Minor Enhancements
65
+ * Type importer [github.com/codeslinger]
66
+ * site.topics accessor [github.com/baz]
67
+ * Add array_to_sentence_string filter [github.com/mchung]
68
+ * Add a converter for textpattern [github.com/PerfectlyNormal]
69
+ * Add a working Mephisto / MySQL converter [github.com/ivey]
70
+ * Allowing .htaccess files to be copied over into the generated site [github.com/briandoll]
71
+ * Add option to not put file date in permalink URL [github.com/mreid]
72
+ * Add line number capabilities to highlight blocks [github.com/jcon]
73
+ * Bug Fixes
74
+ * Fix permalink behavior [github.com/cavalle]
75
+ * Fixed an issue with pygments, markdown, and newlines [github.com/zpinter]
76
+ * Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
77
+ * Test and fix the site.categories hash [github.com/zzot]
78
+ * Fix site payload available to files [github.com/matrix9180]
79
+
80
+ == 0.3.0 / 2008-12-24
81
+ * Major Enhancements
82
+ * Added --server option to start a simple WEBrick server on destination directory [github.com/johnreilly and github.com/mchung]
83
+ * Minor Enhancements
84
+ * Added post categories based on directories containing _posts [github.com/mreid]
85
+ * Added post topics based on directories underneath _posts
86
+ * Added new date filter that shows the full month name [github.com/mreid]
87
+ * Merge Post's YAML front matter into its to_liquid payload [github.com/remi]
88
+ * Restrict includes to regular files underneath _includes
89
+ * Bug Fixes
90
+ * Change YAML delimiter matcher so as to not chew up 2nd level markdown headers [github.com/mreid]
91
+ * Fix bug that meant page data (such as the date) was not available in templates [github.com/mreid]
92
+ * Properly reject directories in _layouts
93
+
94
+ == 0.2.1 / 2008-12-15
95
+ * Major Changes
96
+ * Use Maruku (pure Ruby) for Markdown by default [github.com/mreid]
97
+ * Allow use of RDiscount with --rdiscount flag
98
+ * Minor Enhancements
99
+ * Don't load directory_watcher unless it's needed [github.com/pjhyett]
100
+
101
+ == 0.2.0 / 2008-12-14
102
+ * Major Changes
103
+ * related_posts is now found in site.related_posts
104
+
105
+ == 0.1.6 / 2008-12-13
106
+ * Major Features
107
+ * Include files in _includes with {% include x.textile %}
108
+
109
+ == 0.1.5 / 2008-12-12
110
+ * Major Features
111
+ * Code highlighting with Pygments if --pygments is specified
112
+ * Disable true LSI by default, enable with --lsi
113
+ * Minor Enhancements
114
+ * Output informative message if RDiscount is not available [github.com/JackDanger]
115
+ * Bug Fixes
116
+ * Prevent Jekyll from picking up the output directory as a source [github.com/JackDanger]
117
+ * Skip related_posts when there is only one post [github.com/JackDanger]
118
+
119
+ == 0.1.4 / 2008-12-08
120
+ * Bug Fixes
121
+ * DATA does not work properly with rubygems
122
+
123
+ == 0.1.3 / 2008-12-06
124
+ * Major Features
125
+ * Markdown support [github.com/vanpelt]
126
+ * Mephisto and CSV converters [github.com/vanpelt]
127
+ * Code hilighting [github.com/vanpelt]
128
+ * Autobuild
129
+ * Bug Fixes
130
+ * Accept both \r\n and \n in YAML header [github.com/vanpelt]
131
+
132
+ == 0.1.2 / 2008-11-22
133
+ * Major Features
134
+ * Add a real "related posts" implementation using Classifier
135
+ * Command Line Changes
136
+ * Allow cli to be called with 0, 1, or 2 args intuiting dir paths
137
+ if they are omitted
138
+
139
+ == 0.1.1 / 2008-11-22
140
+ * Minor Additions
141
+ * Posts now support introspectional data e.g. {{ page.url }}
142
+
143
+ == 0.1.0 / 2008-11-05
144
+ * First release
145
+ * Converts posts written in Textile
146
+ * Converts regular site pages
147
+ * Simple copy of binary files
148
+
149
+ == 0.0.0 / 2008-10-19
150
+ * Birthday!
151
+
data/README.textile ADDED
@@ -0,0 +1,42 @@
1
+ h1. Jekyll
2
+
3
+ By Tom Preston-Werner, Nick Quaranto, and many awesome contributors!
4
+
5
+ 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.
6
+
7
+ h2. Getting Started
8
+
9
+ * "Install":http://wiki.github.com/mojombo/jekyll/install the gem
10
+ * Read up about its "Usage":http://wiki.github.com/mojombo/jekyll/usage and "Configuration":http://wiki.github.com/mojombo/jekyll/configuration
11
+ * Take a gander at some existing "Sites":http://wiki.github.com/mojombo/jekyll/sites
12
+ * Fork and "Contribute":http://wiki.github.com/mojombo/jekyll/contribute your own modifications
13
+ * Have questions? Post them on the "Mailing List":http://groups.google.com/group/jekyll-rb
14
+
15
+ h2. Diving In
16
+
17
+ * "Migrate":http://wiki.github.com/mojombo/jekyll/blog-migrations from your previous system
18
+ * Learn how the "YAML Front Matter":http://wiki.github.com/mojombo/jekyll/yaml-front-matter works
19
+ * Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data
20
+ * Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with
21
+ * Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier
22
+
23
+ h2. Dependencies
24
+
25
+ * RedCloth: Textile support
26
+ * Liquid: Templating system
27
+ * Classifier: Generating related posts
28
+ * Maruku: Default markdown engine
29
+ * Directory Watcher: Auto-regeneration of sites
30
+ * Open4: Talking to pygments for syntax highlighting
31
+
32
+ h2. License
33
+
34
+ (The MIT License)
35
+
36
+ Copyright (c) 2008 Tom Preston-Werner
37
+
38
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,90 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ begin
6
+ gem 'jeweler', '>= 0.11.0'
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |s|
9
+ s.name = "jberkel-jekyll"
10
+ s.summary = %Q{Jekyll is a simple, blog aware, static site generator.}
11
+ s.email = "tom@mojombo.com"
12
+ s.homepage = "http://github.com/mojombo/jekyll"
13
+ s.description = "Jekyll is a simple, blog aware, static site generator."
14
+ s.authors = ["Tom Preston-Werner"]
15
+ s.rubyforge_project = "jekyll"
16
+ s.files.exclude 'test/dest'
17
+ s.test_files.exclude 'test/dest'
18
+ s.add_dependency('RedCloth', '>= 4.2.1')
19
+ s.add_dependency('liquid', '>= 1.9.0')
20
+ s.add_dependency('classifier', '>= 1.3.1')
21
+ s.add_dependency('maruku', '>= 0.5.9')
22
+ s.add_dependency('directory_watcher', '>= 1.1.1')
23
+ s.add_dependency('open4', '>= 0.9.6')
24
+ end
25
+ rescue LoadError
26
+ puts "Jeweler not available. Install it with: sudo gem install jeweler --version '>= 0.11.0'"
27
+ end
28
+
29
+ Rake::TestTask.new do |t|
30
+ t.libs << 'lib'
31
+ t.pattern = 'test/**/test_*.rb'
32
+ t.verbose = false
33
+ end
34
+
35
+ Rake::RDocTask.new do |rdoc|
36
+ rdoc.rdoc_dir = 'rdoc'
37
+ rdoc.title = 'jekyll'
38
+ rdoc.options << '--line-numbers' << '--inline-source'
39
+ rdoc.rdoc_files.include('README*')
40
+ rdoc.rdoc_files.include('lib/**/*.rb')
41
+ end
42
+
43
+ begin
44
+ require 'rcov/rcovtask'
45
+ Rcov::RcovTask.new do |t|
46
+ t.libs << 'test'
47
+ t.test_files = FileList['test/**/test_*.rb']
48
+ t.verbose = true
49
+ end
50
+ rescue LoadError
51
+ end
52
+
53
+ task :default => [:test, :features]
54
+
55
+ # console
56
+
57
+ desc "Open an irb session preloaded with this library"
58
+ task :console do
59
+ sh "irb -rubygems -I lib -r jekyll.rb"
60
+ end
61
+
62
+ # converters
63
+
64
+ namespace :convert do
65
+ desc "Migrate from mephisto in the current directory"
66
+ task :mephisto do
67
+ sh %q(ruby -r './lib/jekyll/converters/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
68
+ end
69
+ desc "Migrate from Movable Type in the current directory"
70
+ task :mt do
71
+ sh %q(ruby -r './lib/jekyll/converters/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
72
+ end
73
+ desc "Migrate from Typo in the current directory"
74
+ task :typo do
75
+ sh %q(ruby -r './lib/jekyll/converters/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
76
+ end
77
+ end
78
+
79
+ begin
80
+ require 'cucumber/rake/task'
81
+
82
+ Cucumber::Rake::Task.new(:features) do |t|
83
+ t.cucumber_opts = "--format progress"
84
+ end
85
+ rescue LoadError
86
+ desc 'Cucumber rake task not available'
87
+ task :features do
88
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
89
+ end
90
+ end
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 4
3
+ :major: 0
4
+ :minor: 5
data/bin/jekyll ADDED
@@ -0,0 +1,168 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ help = <<HELP
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
+
13
+ Configuration is read from '<source>/_config.yml' but can be overriden
14
+ using the following options:
15
+
16
+ HELP
17
+
18
+ require 'optparse'
19
+ require 'jekyll'
20
+
21
+ exec = {}
22
+ options = {}
23
+ opts = OptionParser.new do |opts|
24
+ opts.banner = help
25
+
26
+ opts.on("--auto", "Auto-regenerate") do
27
+ options['auto'] = true
28
+ end
29
+
30
+ opts.on("--no-auto", "No auto-regenerate") do
31
+ options['auto'] = false
32
+ end
33
+
34
+ opts.on("--server [PORT]", "Start web server (default port 4000)") do |port|
35
+ options['server'] = true
36
+ options['server_port'] = port unless port.nil?
37
+ end
38
+
39
+ opts.on("--lsi", "Use LSI for better related posts") do
40
+ options['lsi'] = true
41
+ end
42
+
43
+ opts.on("--pygments", "Use pygments to highlight code") do
44
+ options['pygments'] = true
45
+ end
46
+
47
+ opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
48
+ options['markdown'] = 'rdiscount'
49
+ end
50
+
51
+ opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
52
+ options['permalink'] = style unless style.nil?
53
+ end
54
+
55
+ opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
56
+ begin
57
+ options['paginate'] = per_page.to_i
58
+ raise ArgumentError if options['paginate'] == 0
59
+ rescue
60
+ puts 'you must specify a number of posts by page bigger than 0'
61
+ exit 0
62
+ end
63
+ end
64
+
65
+ opts.on("--multiviews", "Don't use .html in links since Apache has 'Options +MultiViews'") do |style|
66
+ options['multiviews'] = true
67
+ end
68
+
69
+ opts.on("--sass", "Use Sass from haml gem for CSS generation") do
70
+ options['sass'] = true
71
+ end
72
+
73
+ opts.on("--haml", "Enable using Haml for posts and pages") do
74
+ options['haml'] = true
75
+ end
76
+
77
+ opts.on("--version", "Display current version") do
78
+ puts "Jekyll " + Jekyll.version
79
+ exit 0
80
+ end
81
+ end
82
+
83
+ # Read command line options into `options` hash
84
+ opts.parse!
85
+
86
+ # Get source and destintation from command line
87
+ case ARGV.size
88
+ when 0
89
+ when 1
90
+ options['destination'] = ARGV[0]
91
+ when 2
92
+ options['source'] = ARGV[0]
93
+ options['destination'] = ARGV[1]
94
+ else
95
+ puts "Invalid options. Run `jekyll --help` for assistance."
96
+ exit(1)
97
+ end
98
+
99
+ options = Jekyll.configuration(options)
100
+
101
+ # Get source and destination directories (possibly set by config file)
102
+ source = options['source']
103
+ destination = options['destination']
104
+
105
+ # Files to watch
106
+ def globs(source)
107
+ Dir.chdir(source) do
108
+ dirs = Dir['*'].select { |x| File.directory?(x) }
109
+ dirs -= ['_site']
110
+ dirs = dirs.map { |x| "#{x}/**/*" }
111
+ dirs += ['*']
112
+ end
113
+ end
114
+
115
+ # Create the Site
116
+ site = Jekyll::Site.new(options)
117
+
118
+ # Run the directory watcher for auto-generation, if required
119
+ if options['auto']
120
+ require 'directory_watcher'
121
+
122
+ puts "Auto-regenerating enabled: #{source} -> #{destination}"
123
+
124
+ dw = DirectoryWatcher.new(source)
125
+ dw.interval = 1
126
+ dw.glob = globs(source)
127
+
128
+ dw.add_observer do |*args|
129
+ t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
130
+ puts "[#{t}] regeneration: #{args.size} files changed"
131
+ begin
132
+ site.process
133
+ rescue Exception => e
134
+ STDERR.puts e
135
+ STDERR.puts e.backtrace.join("\n")
136
+ raise
137
+ end
138
+ end
139
+
140
+ dw.start
141
+
142
+ unless options['server']
143
+ loop { sleep 1000 }
144
+ end
145
+ else
146
+ puts "Building site: #{source} -> #{destination}"
147
+ site.process
148
+ puts "Successfully generated site: #{source} -> #{destination}"
149
+ end
150
+
151
+ # Run the server on the specified port, if required
152
+ if options['server']
153
+ require 'webrick'
154
+ include WEBrick
155
+
156
+ FileUtils.mkdir_p(destination)
157
+
158
+ s = HTTPServer.new(
159
+ :Port => options['server_port'],
160
+ :DocumentRoot => destination
161
+ )
162
+ t = Thread.new {
163
+ s.start
164
+ }
165
+
166
+ trap("INT") { s.shutdown }
167
+ t.join()
168
+ end
@@ -0,0 +1,46 @@
1
+ Feature: Create sites
2
+ As a hacker who likes to blog
3
+ I want to be able to make a static site
4
+ In order to share my awesome ideas with the interwebs
5
+
6
+ Scenario: Basic site
7
+ Given I have an "index.html" file that contains "Basic Site"
8
+ When I run jekyll
9
+ Then the _site directory should exist
10
+ And I should see "Basic Site" in "_site/index.html"
11
+
12
+ Scenario: Basic site with a post
13
+ Given I have a _posts directory
14
+ And I have the following post:
15
+ | title | date | content |
16
+ | Hackers | 3/27/2009 | My First Exploit |
17
+ When I run jekyll
18
+ Then the _site directory should exist
19
+ And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
20
+
21
+ Scenario: Basic site with layout and a page
22
+ Given I have a _layouts directory
23
+ And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
24
+ And I have a default layout that contains "Page Layout: {{ content }}"
25
+ When I run jekyll
26
+ Then the _site directory should exist
27
+ And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
28
+
29
+ Scenario: Basic site with layout and a post
30
+ Given I have a _layouts directory
31
+ And I have a _posts directory
32
+ And I have the following post:
33
+ | title | date | layout | content |
34
+ | Wargames | 3/27/2009 | default | The only winning move is not to play. |
35
+ And I have a default layout that contains "Post Layout: {{ content }}"
36
+ When I run jekyll
37
+ Then the _site directory should exist
38
+ And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
39
+
40
+ Scenario: Basic site with include tag
41
+ Given I have a _includes directory
42
+ And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
43
+ And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
44
+ When I run jekyll
45
+ Then the _site directory should exist
46
+ And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
@@ -0,0 +1,60 @@
1
+ Feature: Embed filters
2
+ As a hacker who likes to blog
3
+ I want to be able to transform text inside a post or page
4
+ In order to perform cool stuff in my posts
5
+
6
+ Scenario: Convert date to XML schema
7
+ Given I have a _posts directory
8
+ And I have a _layouts directory
9
+ And I have the following post:
10
+ | title | date | layout | content |
11
+ | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
12
+ And I have a default layout that contains "{{ site.time | date_to_xmlschema }}"
13
+ When I run jekyll
14
+ Then the _site directory should exist
15
+ And I should see today's date in "_site/2009/03/27/star-wars.html"
16
+
17
+ Scenario: Escape text for XML
18
+ Given I have a _posts directory
19
+ And I have a _layouts directory
20
+ And I have the following post:
21
+ | title | date | layout | content |
22
+ | Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
23
+ And I have a default layout that contains "{{ site.posts.first.title | xml_escape }}"
24
+ When I run jekyll
25
+ Then the _site directory should exist
26
+ And I should see "Star &amp; Wars" in "_site/2009/03/27/star-wars.html"
27
+
28
+ Scenario: Calculate number of words
29
+ Given I have a _posts directory
30
+ And I have a _layouts directory
31
+ And I have the following post:
32
+ | title | date | layout | content |
33
+ | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
34
+ And I have a default layout that contains "{{ site.posts.first.content | xml_escape }}"
35
+ When I run jekyll
36
+ Then the _site directory should exist
37
+ And I should see "7" in "_site/2009/03/27/star-wars.html"
38
+
39
+ Scenario: Convert an array into a sentence
40
+ Given I have a _posts directory
41
+ And I have a _layouts directory
42
+ And I have the following post:
43
+ | title | date | layout | tags | content |
44
+ | Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
45
+ And I have a default layout that contains "{{ site.posts.first.tags | array_to_sentence_string }}"
46
+ When I run jekyll
47
+ Then the _site directory should exist
48
+ And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
49
+
50
+ Scenario: Textilize a given string
51
+ Given I have a _posts directory
52
+ And I have a _layouts directory
53
+ And I have the following post:
54
+ | title | date | layout | content |
55
+ | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
56
+ And I have a default layout that contains "By {{ '_Obi-wan_' | textilize }}"
57
+ When I run jekyll
58
+ Then the _site directory should exist
59
+ And I should see "By <p><em>Obi-wan</em></p>" in "_site/2009/03/27/star-wars.html"
60
+
@@ -0,0 +1,40 @@
1
+ Feature: Site pagination
2
+ In order to paginate my blog
3
+ As a blog's user
4
+ I want divide the posts in several pages
5
+
6
+ Scenario Outline: Paginate with N posts per page
7
+ Given I have a configuration file with "paginate" set to "<num>"
8
+ And I have a _layouts directory
9
+ And I have an "index.html" file that contains "Basic Site"
10
+ And I have a _posts directory
11
+ And I have the following post:
12
+ | title | date | layout | content |
13
+ | Wargames | 3/27/2009 | default | The only winning move is not to play. |
14
+ | Wargames2 | 4/27/2009 | default | The only winning move is not to play2. |
15
+ | Wargames3 | 5/27/2009 | default | The only winning move is not to play2. |
16
+ When I run jekyll
17
+ Then the _site/page2 directory should exist
18
+ And the _site/page2/index.html file should exist
19
+
20
+ Examples:
21
+ | num |
22
+ | 1 |
23
+ | 2 |
24
+
25
+ Scenario: Correct liquid paginator replacements
26
+ Given I have a configuration file with "paginate" set to "1"
27
+ And I have a _layouts directory
28
+ And I have an "index.html" file that contains "{{ paginator.page }}"
29
+ And I have a _posts directory
30
+ And I have the following post:
31
+ | title | date | layout | content |
32
+ | Wargames | 3/27/2009 | default | The only winning move is not to play. |
33
+ | Wargames2 | 4/27/2009 | default | The only winning move is not to play2. |
34
+ When I run jekyll
35
+ Then the _site/index.html file should exist
36
+ And I should see "1" in "_site/index.html"
37
+ Then the _site/page2 directory should exist
38
+ And the _site/page2/index.html file should exist
39
+ And I should see "2" in "_site/page2/index.html"
40
+
@@ -0,0 +1,65 @@
1
+ Feature: Fancy permalinks
2
+ As a hacker who likes to blog
3
+ I want to be able to set permalinks
4
+ In order to make my blog URLs awesome
5
+
6
+ Scenario: Use none permalink schema
7
+ Given I have a _posts directory
8
+ And I have the following post:
9
+ | title | date | content |
10
+ | None Permalink Schema | 3/27/2009 | Totally nothing. |
11
+ And I have a configuration file with "permalink" set to "none"
12
+ When I run jekyll
13
+ Then the _site directory should exist
14
+ And I should see "Totally nothing." in "_site/none-permalink-schema.html"
15
+
16
+ Scenario: Use pretty permalink schema
17
+ Given I have a _posts directory
18
+ And I have the following post:
19
+ | title | date | content |
20
+ | Pretty Permalink Schema | 3/27/2009 | Totally wordpress. |
21
+ And I have a configuration file with "permalink" set to "pretty"
22
+ When I run jekyll
23
+ Then the _site directory should exist
24
+ And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
25
+
26
+ Scenario: Use pretty permalink schema for pages
27
+ Given I have an "index.html" page that contains "Totally index"
28
+ And I have an "awesome.html" page that contains "Totally awesome"
29
+ And I have an "sitemap.xml" page that contains "Totally uhm, sitemap"
30
+ And I have a configuration file with "permalink" set to "pretty"
31
+ When I run jekyll
32
+ Then the _site directory should exist
33
+ And I should see "Totally index" in "_site/index.html"
34
+ And I should see "Totally awesome" in "_site/awesome/index.html"
35
+ And I should see "Totally uhm, sitemap" in "_site/sitemap.xml"
36
+
37
+ Scenario: Use custom permalink schema with prefix
38
+ Given I have a _posts directory
39
+ And I have the following post:
40
+ | title | category | date | content |
41
+ | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
42
+ And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title"
43
+ When I run jekyll
44
+ Then the _site directory should exist
45
+ And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html"
46
+
47
+ Scenario: Use custom permalink schema with category
48
+ Given I have a _posts directory
49
+ And I have the following post:
50
+ | title | category | date | content |
51
+ | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
52
+ And I have a configuration file with "permalink" set to "/:categories/:title.html"
53
+ When I run jekyll
54
+ Then the _site directory should exist
55
+ And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html"
56
+
57
+ Scenario: Use custom permalink schema with squished date
58
+ Given I have a _posts directory
59
+ And I have the following post:
60
+ | title | category | date | content |
61
+ | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
62
+ And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html"
63
+ When I run jekyll
64
+ Then the _site directory should exist
65
+ And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"