indirect-jekyll 0.5.4

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 (72) 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 +150 -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/indirect-jekyll.gemspec +139 -0
  17. data/jekyll.gemspec +135 -0
  18. data/lib/jekyll.rb +85 -0
  19. data/lib/jekyll/albino.rb +122 -0
  20. data/lib/jekyll/converters/csv.rb +26 -0
  21. data/lib/jekyll/converters/mephisto.rb +79 -0
  22. data/lib/jekyll/converters/mt.rb +59 -0
  23. data/lib/jekyll/converters/textpattern.rb +50 -0
  24. data/lib/jekyll/converters/typo.rb +49 -0
  25. data/lib/jekyll/converters/wordpress.rb +54 -0
  26. data/lib/jekyll/convertible.rb +84 -0
  27. data/lib/jekyll/core_ext.rb +30 -0
  28. data/lib/jekyll/filters.rb +47 -0
  29. data/lib/jekyll/layout.rb +36 -0
  30. data/lib/jekyll/page.rb +112 -0
  31. data/lib/jekyll/pager.rb +45 -0
  32. data/lib/jekyll/post.rb +268 -0
  33. data/lib/jekyll/site.rb +265 -0
  34. data/lib/jekyll/tags/highlight.rb +56 -0
  35. data/lib/jekyll/tags/include.rb +31 -0
  36. data/test/helper.rb +27 -0
  37. data/test/source/_includes/sig.markdown +3 -0
  38. data/test/source/_layouts/default.html +27 -0
  39. data/test/source/_layouts/simple.html +1 -0
  40. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  41. data/test/source/_posts/2008-02-02-published.textile +8 -0
  42. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  43. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  44. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  45. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  46. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  47. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  48. data/test/source/_posts/2009-01-27-category.textile +7 -0
  49. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  50. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  51. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  52. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  53. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  54. data/test/source/about.html +6 -0
  55. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  56. data/test/source/contacts.html +5 -0
  57. data/test/source/css/screen.css +76 -0
  58. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  59. data/test/source/index.html +22 -0
  60. data/test/source/sitemap.xml +23 -0
  61. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  62. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  63. data/test/suite.rb +9 -0
  64. data/test/test_configuration.rb +29 -0
  65. data/test/test_filters.rb +49 -0
  66. data/test/test_generated_site.rb +40 -0
  67. data/test/test_page.rb +98 -0
  68. data/test/test_pager.rb +47 -0
  69. data/test/test_post.rb +302 -0
  70. data/test/test_site.rb +85 -0
  71. data/test/test_tags.rb +116 -0
  72. metadata +194 -0
@@ -0,0 +1,136 @@
1
+ Before do
2
+ FileUtils.mkdir(TEST_DIR)
3
+ Dir.chdir(TEST_DIR)
4
+ end
5
+
6
+ After do
7
+ Dir.chdir(TEST_DIR)
8
+ FileUtils.rm_rf(TEST_DIR)
9
+ end
10
+
11
+ Given /^I have a blank site in "(.*)"$/ do |path|
12
+ FileUtils.mkdir(path)
13
+ end
14
+
15
+ # Like "I have a foo file" but gives a yaml front matter so jekyll actually processes it
16
+ Given /^I have an "(.*)" page(?: with (.*) "(.*)")? that contains "(.*)"$/ do |file, key, value, text|
17
+ File.open(file, 'w') do |f|
18
+ f.write <<EOF
19
+ ---
20
+ #{key || 'layout'}: #{value || 'nil'}
21
+ ---
22
+ #{text}
23
+ EOF
24
+ f.close
25
+ end
26
+ end
27
+
28
+ Given /^I have an "(.*)" file that contains "(.*)"$/ do |file, text|
29
+ File.open(file, 'w') do |f|
30
+ f.write(text)
31
+ f.close
32
+ end
33
+ end
34
+
35
+ Given /^I have a (.*) layout that contains "(.*)"$/ do |layout, text|
36
+ File.open(File.join('_layouts', layout + '.html'), 'w') do |f|
37
+ f.write(text)
38
+ f.close
39
+ end
40
+ end
41
+
42
+ Given /^I have a (.*) directory$/ do |dir|
43
+ FileUtils.mkdir(dir)
44
+ end
45
+
46
+ Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, table|
47
+ table.hashes.each do |post|
48
+ date = Date.parse(post['date']).strftime('%Y-%m-%d')
49
+ title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
50
+
51
+ if direction && direction == "in"
52
+ before = folder || '.'
53
+ elsif direction && direction == "under"
54
+ after = folder || '.'
55
+ end
56
+
57
+ path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{post['type'] || 'textile'}")
58
+
59
+ matter_hash = {}
60
+ %w(title layout tag tags category categories published author).each do |key|
61
+ matter_hash[key] = post[key] if post[key]
62
+ end
63
+ matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
64
+
65
+ content = post['content']
66
+ if post['input'] && post['filter']
67
+ content = "{{ #{post['input']} | #{post['filter']} }}"
68
+ end
69
+
70
+ File.open(path, 'w') do |f|
71
+ f.write <<EOF
72
+ ---
73
+ #{matter}
74
+ ---
75
+ #{content}
76
+ EOF
77
+ f.close
78
+ end
79
+ end
80
+ end
81
+
82
+ Given /^I have a configuration file with "(.*)" set to "(.*)"$/ do |key, value|
83
+ File.open('_config.yml', 'w') do |f|
84
+ f.write("#{key}: #{value}")
85
+ f.close
86
+ end
87
+ end
88
+
89
+ Given /^I have a configuration file with "([^\"]*)" set to:$/ do |key, table|
90
+ File.open('_config.yml', 'w') do |f|
91
+ f.write("#{key}:\n")
92
+ table.hashes.each do |row|
93
+ f.write("- #{row["Value"]}\n")
94
+ end
95
+ f.close
96
+ end
97
+ end
98
+
99
+
100
+ When /^I run jekyll$/ do
101
+ run_jekyll
102
+ end
103
+
104
+ When /^I debug jekyll$/ do
105
+ run_jekyll(:debug => true)
106
+ end
107
+
108
+ When /^I change "(.*)" to contain "(.*)"$/ do |file, text|
109
+ File.open(file, 'a') do |f|
110
+ f.write(text)
111
+ end
112
+ end
113
+
114
+ Then /^the (.*) directory should exist$/ do |dir|
115
+ assert File.directory?(dir)
116
+ end
117
+
118
+ Then /^the (.*) file should exist$/ do |file|
119
+ assert File.file?(file)
120
+ end
121
+
122
+ Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
123
+ assert_match Regexp.new(text), File.open(file).readlines.join
124
+ end
125
+
126
+ Then /^the "(.*)" file should not exist$/ do |file|
127
+ assert !File.exists?(file)
128
+ end
129
+
130
+ Then /^I should see today's time in "(.*)"$/ do |file|
131
+ assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.open(file).readlines.join
132
+ end
133
+
134
+ Then /^I should see today's date in "(.*)"$/ do |file|
135
+ assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join
136
+ end
@@ -0,0 +1,16 @@
1
+ require 'fileutils'
2
+ require 'rr'
3
+ require 'test/unit'
4
+
5
+ World do
6
+ include Test::Unit::Assertions
7
+ end
8
+
9
+ TEST_DIR = File.join('/', 'tmp', 'jekyll')
10
+ JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll')
11
+
12
+ def run_jekyll(opts = {})
13
+ command = JEKYLL_PATH
14
+ command << " >> /dev/null 2>&1" if opts[:debug].nil?
15
+ system command
16
+ end
@@ -0,0 +1,139 @@
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{indirect-jekyll}
8
+ s.version = "0.5.4"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Andre Arko", "Tom Preston-Werner"]
12
+ s.date = %q{2009-12-30}
13
+ s.default_executable = %q{jekyll}
14
+ s.description = %q{Jekyll is a simple, blog aware, static site generator.}
15
+ s.email = %q{andre@arko.net}
16
+ s.executables = ["jekyll"]
17
+ s.extra_rdoc_files = [
18
+ "README.textile"
19
+ ]
20
+ s.files = [
21
+ ".gitignore",
22
+ "History.txt",
23
+ "README.textile",
24
+ "Rakefile",
25
+ "VERSION.yml",
26
+ "bin/jekyll",
27
+ "features/create_sites.feature",
28
+ "features/embed_filters.feature",
29
+ "features/pagination.feature",
30
+ "features/permalinks.feature",
31
+ "features/post_data.feature",
32
+ "features/site_configuration.feature",
33
+ "features/site_data.feature",
34
+ "features/step_definitions/jekyll_steps.rb",
35
+ "features/support/env.rb",
36
+ "indirect-jekyll.gemspec",
37
+ "jekyll.gemspec",
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/layout.rb",
50
+ "lib/jekyll/page.rb",
51
+ "lib/jekyll/pager.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/_posts/2009-03-12-hash-#1.markdown",
70
+ "test/source/_posts/2009-05-18-tag.textile",
71
+ "test/source/_posts/2009-05-18-tags.textile",
72
+ "test/source/_posts/2009-06-22-empty-yaml.textile",
73
+ "test/source/_posts/2009-06-22-no-yaml.textile",
74
+ "test/source/about.html",
75
+ "test/source/category/_posts/2008-9-23-categories.textile",
76
+ "test/source/contacts.html",
77
+ "test/source/css/screen.css",
78
+ "test/source/foo/_posts/bar/2008-12-12-topical-post.textile",
79
+ "test/source/index.html",
80
+ "test/source/sitemap.xml",
81
+ "test/source/win/_posts/2009-05-24-yaml-linebreak.markdown",
82
+ "test/source/z_category/_posts/2008-9-23-categories.textile",
83
+ "test/suite.rb",
84
+ "test/test_configuration.rb",
85
+ "test/test_filters.rb",
86
+ "test/test_generated_site.rb",
87
+ "test/test_page.rb",
88
+ "test/test_pager.rb",
89
+ "test/test_post.rb",
90
+ "test/test_site.rb",
91
+ "test/test_tags.rb"
92
+ ]
93
+ s.homepage = %q{http://github.com/indirect/jekyll}
94
+ s.rdoc_options = ["--charset=UTF-8"]
95
+ s.require_paths = ["lib"]
96
+ s.rubygems_version = %q{1.3.5}
97
+ s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
98
+ s.test_files = [
99
+ "test/helper.rb",
100
+ "test/suite.rb",
101
+ "test/test_configuration.rb",
102
+ "test/test_filters.rb",
103
+ "test/test_generated_site.rb",
104
+ "test/test_page.rb",
105
+ "test/test_pager.rb",
106
+ "test/test_post.rb",
107
+ "test/test_site.rb",
108
+ "test/test_tags.rb"
109
+ ]
110
+
111
+ if s.respond_to? :specification_version then
112
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
113
+ s.specification_version = 3
114
+
115
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
116
+ s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.1"])
117
+ s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
118
+ s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
119
+ s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
120
+ s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
121
+ s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
122
+ else
123
+ s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
124
+ s.add_dependency(%q<liquid>, [">= 1.9.0"])
125
+ s.add_dependency(%q<classifier>, [">= 1.3.1"])
126
+ s.add_dependency(%q<maruku>, [">= 0.5.9"])
127
+ s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
128
+ s.add_dependency(%q<open4>, [">= 0.9.6"])
129
+ end
130
+ else
131
+ s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
132
+ s.add_dependency(%q<liquid>, [">= 1.9.0"])
133
+ s.add_dependency(%q<classifier>, [">= 1.3.1"])
134
+ s.add_dependency(%q<maruku>, [">= 0.5.9"])
135
+ s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
136
+ s.add_dependency(%q<open4>, [">= 0.9.6"])
137
+ end
138
+ end
139
+
data/jekyll.gemspec ADDED
@@ -0,0 +1,135 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{jekyll}
5
+ s.version = "0.5.4"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Tom Preston-Werner"]
9
+ s.date = %q{2009-08-24}
10
+ s.default_executable = %q{jekyll}
11
+ s.description = %q{Jekyll is a simple, blog aware, static site generator.}
12
+ s.email = %q{tom@mojombo.com}
13
+ s.executables = ["jekyll"]
14
+ s.extra_rdoc_files = [
15
+ "README.textile"
16
+ ]
17
+ s.files = [
18
+ ".gitignore",
19
+ "History.txt",
20
+ "README.textile",
21
+ "Rakefile",
22
+ "VERSION.yml",
23
+ "bin/jekyll",
24
+ "features/create_sites.feature",
25
+ "features/embed_filters.feature",
26
+ "features/pagination.feature",
27
+ "features/permalinks.feature",
28
+ "features/post_data.feature",
29
+ "features/site_configuration.feature",
30
+ "features/site_data.feature",
31
+ "features/step_definitions/jekyll_steps.rb",
32
+ "features/support/env.rb",
33
+ "jekyll.gemspec",
34
+ "lib/jekyll.rb",
35
+ "lib/jekyll/albino.rb",
36
+ "lib/jekyll/converters/csv.rb",
37
+ "lib/jekyll/converters/mephisto.rb",
38
+ "lib/jekyll/converters/mt.rb",
39
+ "lib/jekyll/converters/textpattern.rb",
40
+ "lib/jekyll/converters/typo.rb",
41
+ "lib/jekyll/converters/wordpress.rb",
42
+ "lib/jekyll/convertible.rb",
43
+ "lib/jekyll/core_ext.rb",
44
+ "lib/jekyll/filters.rb",
45
+ "lib/jekyll/layout.rb",
46
+ "lib/jekyll/page.rb",
47
+ "lib/jekyll/pager.rb",
48
+ "lib/jekyll/post.rb",
49
+ "lib/jekyll/site.rb",
50
+ "lib/jekyll/tags/highlight.rb",
51
+ "lib/jekyll/tags/include.rb",
52
+ "test/helper.rb",
53
+ "test/source/_includes/sig.markdown",
54
+ "test/source/_layouts/default.html",
55
+ "test/source/_layouts/simple.html",
56
+ "test/source/_posts/2008-02-02-not-published.textile",
57
+ "test/source/_posts/2008-02-02-published.textile",
58
+ "test/source/_posts/2008-10-18-foo-bar.textile",
59
+ "test/source/_posts/2008-11-21-complex.textile",
60
+ "test/source/_posts/2008-12-03-permalinked-post.textile",
61
+ "test/source/_posts/2008-12-13-include.markdown",
62
+ "test/source/_posts/2009-01-27-array-categories.textile",
63
+ "test/source/_posts/2009-01-27-categories.textile",
64
+ "test/source/_posts/2009-01-27-category.textile",
65
+ "test/source/_posts/2009-03-12-hash-#1.markdown",
66
+ "test/source/_posts/2009-05-18-tag.textile",
67
+ "test/source/_posts/2009-05-18-tags.textile",
68
+ "test/source/_posts/2009-06-22-empty-yaml.textile",
69
+ "test/source/_posts/2009-06-22-no-yaml.textile",
70
+ "test/source/about.html",
71
+ "test/source/category/_posts/2008-9-23-categories.textile",
72
+ "test/source/contacts.html",
73
+ "test/source/css/screen.css",
74
+ "test/source/foo/_posts/bar/2008-12-12-topical-post.textile",
75
+ "test/source/index.html",
76
+ "test/source/sitemap.xml",
77
+ "test/source/win/_posts/2009-05-24-yaml-linebreak.markdown",
78
+ "test/source/z_category/_posts/2008-9-23-categories.textile",
79
+ "test/suite.rb",
80
+ "test/test_configuration.rb",
81
+ "test/test_filters.rb",
82
+ "test/test_generated_site.rb",
83
+ "test/test_page.rb",
84
+ "test/test_pager.rb",
85
+ "test/test_post.rb",
86
+ "test/test_site.rb",
87
+ "test/test_tags.rb"
88
+ ]
89
+ s.homepage = %q{http://github.com/mojombo/jekyll}
90
+ s.rdoc_options = ["--charset=UTF-8"]
91
+ s.require_paths = ["lib"]
92
+ s.rubyforge_project = %q{jekyll}
93
+ s.rubygems_version = %q{1.3.5}
94
+ s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
95
+ s.test_files = [
96
+ "test/helper.rb",
97
+ "test/suite.rb",
98
+ "test/test_configuration.rb",
99
+ "test/test_filters.rb",
100
+ "test/test_generated_site.rb",
101
+ "test/test_page.rb",
102
+ "test/test_pager.rb",
103
+ "test/test_post.rb",
104
+ "test/test_site.rb",
105
+ "test/test_tags.rb"
106
+ ]
107
+
108
+ if s.respond_to? :specification_version then
109
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
110
+ s.specification_version = 3
111
+
112
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
113
+ s.add_runtime_dependency(%q<RedCloth>, [">= 4.2.1"])
114
+ s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
115
+ s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
116
+ s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
117
+ s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
118
+ s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
119
+ else
120
+ s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
121
+ s.add_dependency(%q<liquid>, [">= 1.9.0"])
122
+ s.add_dependency(%q<classifier>, [">= 1.3.1"])
123
+ s.add_dependency(%q<maruku>, [">= 0.5.9"])
124
+ s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
125
+ s.add_dependency(%q<open4>, [">= 0.9.6"])
126
+ end
127
+ else
128
+ s.add_dependency(%q<RedCloth>, [">= 4.2.1"])
129
+ s.add_dependency(%q<liquid>, [">= 1.9.0"])
130
+ s.add_dependency(%q<classifier>, [">= 1.3.1"])
131
+ s.add_dependency(%q<maruku>, [">= 0.5.9"])
132
+ s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
133
+ s.add_dependency(%q<open4>, [">= 0.9.6"])
134
+ end
135
+ end
data/lib/jekyll.rb ADDED
@@ -0,0 +1,85 @@
1
+ $:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
2
+
3
+ # rubygems
4
+ require 'rubygems'
5
+
6
+ # core
7
+ require 'fileutils'
8
+ require 'time'
9
+ require 'yaml'
10
+
11
+ # stdlib
12
+
13
+ # 3rd party
14
+ require 'liquid'
15
+ require 'redcloth'
16
+
17
+ # internal requires
18
+ require 'jekyll/core_ext'
19
+ require 'jekyll/pager'
20
+ require 'jekyll/site'
21
+ require 'jekyll/convertible'
22
+ require 'jekyll/layout'
23
+ require 'jekyll/page'
24
+ require 'jekyll/post'
25
+ require 'jekyll/filters'
26
+ require 'jekyll/tags/highlight'
27
+ require 'jekyll/tags/include'
28
+ require 'jekyll/albino'
29
+
30
+ module Jekyll
31
+ # Default options. Overriden by values in _config.yml or command-line opts.
32
+ # (Strings rather symbols used for compatability with YAML)
33
+ DEFAULTS = {
34
+ 'auto' => false,
35
+ 'server' => false,
36
+ 'server_port' => 4000,
37
+
38
+ 'source' => '.',
39
+ 'destination' => File.join('.', '_site'),
40
+
41
+ 'lsi' => false,
42
+ 'pygments' => false,
43
+ 'markdown' => 'maruku',
44
+ 'permalink' => 'date',
45
+
46
+ 'maruku' => {
47
+ 'use_tex' => false,
48
+ 'use_divs' => false,
49
+ 'png_engine' => 'blahtex',
50
+ 'png_dir' => 'images/latex',
51
+ 'png_url' => '/images/latex'
52
+ }
53
+ }
54
+
55
+ # Generate a Jekyll configuration Hash by merging the default options
56
+ # with anything in _config.yml, and adding the given options on top
57
+ # +override+ is a Hash of config directives
58
+ #
59
+ # Returns Hash
60
+ def self.configuration(override)
61
+ # _config.yml may override default source location, but until
62
+ # then, we need to know where to look for _config.yml
63
+ source = override['source'] || Jekyll::DEFAULTS['source']
64
+
65
+ # Get configuration from <source>/_config.yml
66
+ config_file = File.join(source, '_config.yml')
67
+ begin
68
+ config = YAML.load_file(config_file)
69
+ raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash)
70
+ STDOUT.puts "Configuration from #{config_file}"
71
+ rescue => err
72
+ STDERR.puts "WARNING: Could not read configuration. Using defaults (and options)."
73
+ STDERR.puts "\t" + err.to_s
74
+ config = {}
75
+ end
76
+
77
+ # Merge DEFAULTS < _config.yml < override
78
+ Jekyll::DEFAULTS.deep_merge(config).deep_merge(override)
79
+ end
80
+
81
+ def self.version
82
+ yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
83
+ "#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
84
+ end
85
+ end