crnixon-jekyll 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. data/.gitignore +6 -0
  2. data/History.txt +115 -0
  3. data/README.textile +649 -0
  4. data/Rakefile +91 -0
  5. data/TODO +3 -0
  6. data/VERSION.yml +4 -0
  7. data/bin/jekyll +156 -0
  8. data/crnixon-jekyll.gemspec +125 -0
  9. data/features/create_sites.feature +46 -0
  10. data/features/embed_filters.feature +60 -0
  11. data/features/permalinks.feature +54 -0
  12. data/features/post_data.feature +155 -0
  13. data/features/site_configuration.feature +40 -0
  14. data/features/site_data.feature +51 -0
  15. data/features/step_definitions/jekyll_steps.rb +118 -0
  16. data/features/support/env.rb +18 -0
  17. data/lib/jekyll/albino.rb +122 -0
  18. data/lib/jekyll/converters/csv.rb +26 -0
  19. data/lib/jekyll/converters/mephisto.rb +79 -0
  20. data/lib/jekyll/converters/mt.rb +59 -0
  21. data/lib/jekyll/converters/textpattern.rb +50 -0
  22. data/lib/jekyll/converters/typo.rb +49 -0
  23. data/lib/jekyll/converters/wordpress.rb +54 -0
  24. data/lib/jekyll/convertible.rb +117 -0
  25. data/lib/jekyll/core_ext.rb +29 -0
  26. data/lib/jekyll/filters.rb +47 -0
  27. data/lib/jekyll/haml_helpers.rb +17 -0
  28. data/lib/jekyll/layout.rb +37 -0
  29. data/lib/jekyll/page.rb +67 -0
  30. data/lib/jekyll/post.rb +305 -0
  31. data/lib/jekyll/site.rb +310 -0
  32. data/lib/jekyll/tags/highlight.rb +68 -0
  33. data/lib/jekyll/tags/include.rb +31 -0
  34. data/lib/jekyll.rb +84 -0
  35. data/test/helper.rb +24 -0
  36. data/test/source/_includes/sig.markdown +3 -0
  37. data/test/source/_layouts/default.html +27 -0
  38. data/test/source/_layouts/simple.html +1 -0
  39. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  40. data/test/source/_posts/2008-02-02-published.textile +8 -0
  41. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  42. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  43. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  44. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  45. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  46. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  47. data/test/source/_posts/2009-01-27-category.textile +7 -0
  48. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  49. data/test/source/css/screen.css +76 -0
  50. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  51. data/test/source/index.html +22 -0
  52. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  53. data/test/suite.rb +9 -0
  54. data/test/test_filters.rb +41 -0
  55. data/test/test_generated_site.rb +38 -0
  56. data/test/test_post.rb +262 -0
  57. data/test/test_site.rb +61 -0
  58. data/test/test_tags.rb +51 -0
  59. metadata +180 -0
data/Rakefile ADDED
@@ -0,0 +1,91 @@
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 = "crnixon-jekyll"
10
+ s.summary = %Q{Jekyll is a simple, blog aware, static site generator.}
11
+ s.email = "crnixon@gmail.com"
12
+ s.homepage = "http://github.com/crnixon/jekyll"
13
+ s.description = "Jekyll is a simple, blog aware, static site generator."
14
+ s.authors = ["Tom Preston-Werner", "Henrik Nyh", "Clinton R. Nixon"]
15
+ s.rubyforge_project = "crnixon-jekyll"
16
+ s.files.exclude 'test/dest'
17
+ s.test_files.exclude 'test/dest'
18
+ s.add_dependency('RedCloth', '>= 4.0.4')
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
+ exit(1)
28
+ end
29
+
30
+ Rake::TestTask.new do |t|
31
+ t.libs << 'lib'
32
+ t.pattern = 'test/**/test_*.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+ Rake::RDocTask.new do |rdoc|
37
+ rdoc.rdoc_dir = 'rdoc'
38
+ rdoc.title = 'jekyll'
39
+ rdoc.options << '--line-numbers' << '--inline-source'
40
+ rdoc.rdoc_files.include('README*')
41
+ rdoc.rdoc_files.include('lib/**/*.rb')
42
+ end
43
+
44
+ begin
45
+ require 'rcov/rcovtask'
46
+ Rcov::RcovTask.new do |t|
47
+ t.libs << 'test'
48
+ t.test_files = FileList['test/**/test_*.rb']
49
+ t.verbose = true
50
+ end
51
+ rescue LoadError
52
+ end
53
+
54
+ task :default => [:test, :features]
55
+
56
+ # console
57
+
58
+ desc "Open an irb session preloaded with this library"
59
+ task :console do
60
+ sh "irb -rubygems -I lib -r jekyll.rb"
61
+ end
62
+
63
+ # converters
64
+
65
+ namespace :convert do
66
+ desc "Migrate from mephisto in the current directory"
67
+ task :mephisto do
68
+ sh %q(ruby -r './lib/jekyll/converters/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
69
+ end
70
+ desc "Migrate from Movable Type in the current directory"
71
+ task :mt do
72
+ sh %q(ruby -r './lib/jekyll/converters/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
73
+ end
74
+ desc "Migrate from Typo in the current directory"
75
+ task :typo do
76
+ sh %q(ruby -r './lib/jekyll/converters/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
77
+ end
78
+ end
79
+
80
+ begin
81
+ require 'cucumber/rake/task'
82
+
83
+ Cucumber::Rake::Task.new(:features) do |t|
84
+ t.cucumber_opts = "--format pretty"
85
+ end
86
+ rescue LoadError
87
+ desc 'Cucumber rake task not available'
88
+ task :features do
89
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
90
+ end
91
+ end
data/TODO ADDED
@@ -0,0 +1,3 @@
1
+ [ ] Easier configuration of Maruka and blahtex directories [mdreid]
2
+ [ ] Accurate "related posts" calculator
3
+ [ ] Autobuild
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 5
4
+ :patch: 1
data/bin/jekyll ADDED
@@ -0,0 +1,156 @@
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("--pygments-cache [PATH]", "Path to cache pygments output in, for faster re-rendering") do |path|
48
+ options['pygments_cache'] = path
49
+ end
50
+
51
+ opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
52
+ options['markdown'] = 'rdiscount'
53
+ end
54
+
55
+ opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
56
+ options['permalink'] = style unless style.nil?
57
+ end
58
+
59
+ opts.on("--multiviews", "Don't use .html in links since Apache has 'Options +MultiViews'") do |style|
60
+ options['multiviews'] = true
61
+ end
62
+
63
+ opts.on("--sass", "Use Sass from haml gem for CSS generation") do
64
+ options['sass'] = true
65
+ end
66
+
67
+ opts.on("--haml", "Enable using Haml for posts and pages") do
68
+ options['haml'] = true
69
+ end
70
+
71
+ opts.on("--version", "Display current version") do
72
+ puts "Jekyll " + Jekyll.version
73
+ exit 0
74
+ end
75
+ end
76
+
77
+ # Read command line options into `options` hash
78
+ opts.parse!
79
+
80
+ # Get source and destintation from command line
81
+ case ARGV.size
82
+ when 0
83
+ when 1
84
+ options['destination'] = ARGV[0]
85
+ when 2
86
+ options['source'] = ARGV[0]
87
+ options['destination'] = ARGV[1]
88
+ else
89
+ puts "Invalid options. Run `jekyll --help` for assistance."
90
+ exit(1)
91
+ end
92
+
93
+ options = Jekyll.configuration(options)
94
+
95
+ # Get source and destination directories (possibly set by config file)
96
+ source = options['source']
97
+ destination = options['destination']
98
+
99
+ # Files to watch
100
+ def globs(source)
101
+ Dir.chdir(source) do
102
+ dirs = Dir['*'].select { |x| File.directory?(x) }
103
+ dirs -= ['_site']
104
+ dirs = dirs.map { |x| "#{x}/**/*" }
105
+ dirs += ['*']
106
+ end
107
+ end
108
+
109
+ # Create the Site
110
+ site = Jekyll::Site.new(options)
111
+
112
+ # Run the directory watcher for auto-generation, if required
113
+ if options['auto']
114
+ require 'directory_watcher'
115
+
116
+ puts "Auto-regenerating enabled: #{source} -> #{destination}"
117
+
118
+ dw = DirectoryWatcher.new(source)
119
+ dw.interval = 1
120
+ dw.glob = globs(source)
121
+
122
+ dw.add_observer do |*args|
123
+ t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
124
+ puts "[#{t}] regeneration: #{args.size} files changed"
125
+ site.process
126
+ end
127
+
128
+ dw.start
129
+
130
+ unless options['server']
131
+ loop { sleep 1000 }
132
+ end
133
+ else
134
+ puts "Building site: #{source} -> #{destination}"
135
+ site.process
136
+ puts "Successfully generated site: #{source} -> #{destination}"
137
+ end
138
+
139
+ # Run the server on the specified port, if required
140
+ if options['server']
141
+ require 'webrick'
142
+ include WEBrick
143
+
144
+ FileUtils.mkdir_p(destination)
145
+
146
+ s = HTTPServer.new(
147
+ :Port => options['server_port'],
148
+ :DocumentRoot => destination
149
+ )
150
+ t = Thread.new {
151
+ s.start
152
+ }
153
+
154
+ trap("INT") { s.shutdown }
155
+ t.join()
156
+ end
@@ -0,0 +1,125 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{crnixon-jekyll}
8
+ s.version = "0.5.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Tom Preston-Werner", "Henrik Nyh", "Clinton R. Nixon"]
12
+ s.date = %q{2010-01-23}
13
+ s.default_executable = %q{jekyll}
14
+ s.description = %q{Jekyll is a simple, blog aware, static site generator.}
15
+ s.email = %q{crnixon@gmail.com}
16
+ s.executables = ["jekyll"]
17
+ s.extra_rdoc_files = [
18
+ "README.textile",
19
+ "TODO"
20
+ ]
21
+ s.files = [
22
+ ".gitignore",
23
+ "History.txt",
24
+ "README.textile",
25
+ "Rakefile",
26
+ "TODO",
27
+ "VERSION.yml",
28
+ "bin/jekyll",
29
+ "crnixon-jekyll.gemspec",
30
+ "features/create_sites.feature",
31
+ "features/embed_filters.feature",
32
+ "features/permalinks.feature",
33
+ "features/post_data.feature",
34
+ "features/site_configuration.feature",
35
+ "features/site_data.feature",
36
+ "features/step_definitions/jekyll_steps.rb",
37
+ "features/support/env.rb",
38
+ "lib/jekyll.rb",
39
+ "lib/jekyll/albino.rb",
40
+ "lib/jekyll/converters/csv.rb",
41
+ "lib/jekyll/converters/mephisto.rb",
42
+ "lib/jekyll/converters/mt.rb",
43
+ "lib/jekyll/converters/textpattern.rb",
44
+ "lib/jekyll/converters/typo.rb",
45
+ "lib/jekyll/converters/wordpress.rb",
46
+ "lib/jekyll/convertible.rb",
47
+ "lib/jekyll/core_ext.rb",
48
+ "lib/jekyll/filters.rb",
49
+ "lib/jekyll/haml_helpers.rb",
50
+ "lib/jekyll/layout.rb",
51
+ "lib/jekyll/page.rb",
52
+ "lib/jekyll/post.rb",
53
+ "lib/jekyll/site.rb",
54
+ "lib/jekyll/tags/highlight.rb",
55
+ "lib/jekyll/tags/include.rb",
56
+ "test/helper.rb",
57
+ "test/source/_includes/sig.markdown",
58
+ "test/source/_layouts/default.html",
59
+ "test/source/_layouts/simple.html",
60
+ "test/source/_posts/2008-02-02-not-published.textile",
61
+ "test/source/_posts/2008-02-02-published.textile",
62
+ "test/source/_posts/2008-10-18-foo-bar.textile",
63
+ "test/source/_posts/2008-11-21-complex.textile",
64
+ "test/source/_posts/2008-12-03-permalinked-post.textile",
65
+ "test/source/_posts/2008-12-13-include.markdown",
66
+ "test/source/_posts/2009-01-27-array-categories.textile",
67
+ "test/source/_posts/2009-01-27-categories.textile",
68
+ "test/source/_posts/2009-01-27-category.textile",
69
+ "test/source/category/_posts/2008-9-23-categories.textile",
70
+ "test/source/css/screen.css",
71
+ "test/source/foo/_posts/bar/2008-12-12-topical-post.textile",
72
+ "test/source/index.html",
73
+ "test/source/z_category/_posts/2008-9-23-categories.textile",
74
+ "test/suite.rb",
75
+ "test/test_filters.rb",
76
+ "test/test_generated_site.rb",
77
+ "test/test_post.rb",
78
+ "test/test_site.rb",
79
+ "test/test_tags.rb"
80
+ ]
81
+ s.homepage = %q{http://github.com/crnixon/jekyll}
82
+ s.rdoc_options = ["--charset=UTF-8"]
83
+ s.require_paths = ["lib"]
84
+ s.rubyforge_project = %q{crnixon-jekyll}
85
+ s.rubygems_version = %q{1.3.5}
86
+ s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
87
+ s.test_files = [
88
+ "test/helper.rb",
89
+ "test/suite.rb",
90
+ "test/test_filters.rb",
91
+ "test/test_generated_site.rb",
92
+ "test/test_post.rb",
93
+ "test/test_site.rb",
94
+ "test/test_tags.rb"
95
+ ]
96
+
97
+ if s.respond_to? :specification_version then
98
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
99
+ s.specification_version = 3
100
+
101
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
102
+ s.add_runtime_dependency(%q<RedCloth>, [">= 4.0.4"])
103
+ s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
104
+ s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
105
+ s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
106
+ s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
107
+ s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
108
+ else
109
+ s.add_dependency(%q<RedCloth>, [">= 4.0.4"])
110
+ s.add_dependency(%q<liquid>, [">= 1.9.0"])
111
+ s.add_dependency(%q<classifier>, [">= 1.3.1"])
112
+ s.add_dependency(%q<maruku>, [">= 0.5.9"])
113
+ s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
114
+ s.add_dependency(%q<open4>, [">= 0.9.6"])
115
+ end
116
+ else
117
+ s.add_dependency(%q<RedCloth>, [">= 4.0.4"])
118
+ s.add_dependency(%q<liquid>, [">= 1.9.0"])
119
+ s.add_dependency(%q<classifier>, [">= 1.3.1"])
120
+ s.add_dependency(%q<maruku>, [">= 0.5.9"])
121
+ s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
122
+ s.add_dependency(%q<open4>, [">= 0.9.6"])
123
+ end
124
+ end
125
+
@@ -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
+