nirvdrum-jekyll 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.gitignore +7 -0
  2. data/History.txt +143 -0
  3. data/README.textile +42 -0
  4. data/Rakefile +92 -0
  5. data/VERSION.yml +4 -0
  6. data/bin/jekyll +150 -0
  7. data/features/create_sites.feature +60 -0
  8. data/features/embed_filters.feature +60 -0
  9. data/features/pagination.feature +40 -0
  10. data/features/permalinks.feature +63 -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 +134 -0
  17. data/lib/jekyll.rb +86 -0
  18. data/lib/jekyll/albino.rb +122 -0
  19. data/lib/jekyll/converters/csv.rb +26 -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 +89 -0
  26. data/lib/jekyll/core_ext.rb +30 -0
  27. data/lib/jekyll/filters.rb +47 -0
  28. data/lib/jekyll/layout.rb +36 -0
  29. data/lib/jekyll/page.rb +112 -0
  30. data/lib/jekyll/pager.rb +45 -0
  31. data/lib/jekyll/post.rb +251 -0
  32. data/lib/jekyll/site.rb +295 -0
  33. data/lib/jekyll/stylesheet.rb +88 -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/_stylesheets/nested/override.less +1 -0
  55. data/test/source/_stylesheets/simple.less +3 -0
  56. data/test/source/about.html +6 -0
  57. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  58. data/test/source/contacts.html +5 -0
  59. data/test/source/css/screen.css +76 -0
  60. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  61. data/test/source/index.html +22 -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 +53 -0
  68. data/test/test_page.rb +87 -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_stylesheet.rb +67 -0
  73. data/test/test_tags.rb +116 -0
  74. metadata +196 -0
data/test/test_site.rb ADDED
@@ -0,0 +1,85 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestSite < Test::Unit::TestCase
4
+ context "creating sites" do
5
+ setup do
6
+ stub(Jekyll).configuration do
7
+ Jekyll::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir})
8
+ end
9
+ @site = Site.new(Jekyll.configuration)
10
+ end
11
+
12
+ should "have an empty tag hash by default" do
13
+ assert_equal Hash.new, @site.tags
14
+ end
15
+
16
+ should "reset data before processing" do
17
+ clear_dest
18
+ @site.process
19
+ before_posts = @site.posts.length
20
+ before_layouts = @site.layouts.length
21
+ before_categories = @site.categories.length
22
+
23
+ @site.process
24
+ assert_equal before_posts, @site.posts.length
25
+ assert_equal before_layouts, @site.layouts.length
26
+ assert_equal before_categories, @site.categories.length
27
+ end
28
+
29
+ should "read layouts" do
30
+ @site.read_layouts
31
+ assert_equal ["default", "simple"].sort, @site.layouts.keys.sort
32
+ end
33
+
34
+ should "read posts" do
35
+ @site.read_posts('')
36
+ posts = Dir[source_dir('_posts', '*')]
37
+ assert_equal posts.size - 1, @site.posts.size
38
+ end
39
+
40
+ should "deploy payload" do
41
+ clear_dest
42
+ @site.process
43
+
44
+ posts = Dir[source_dir("**", "_posts", "*")]
45
+ categories = %w(bar baz category foo z_category publish_test win).sort
46
+
47
+ assert_equal posts.size - 1, @site.posts.size
48
+ assert_equal categories, @site.categories.keys.sort
49
+ assert_equal 4, @site.categories['foo'].size
50
+ end
51
+
52
+ should "filter entries" do
53
+ ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
54
+ .baz.markdow foo.markdown~]
55
+ ent2 = %w[.htaccess _posts bla.bla]
56
+
57
+ assert_equal %w[foo.markdown bar.markdown baz.markdown], @site.filter_entries(ent1)
58
+ assert_equal ent2, @site.filter_entries(ent2)
59
+ end
60
+
61
+ should "filter entries with exclude" do
62
+ excludes = %w[README TODO]
63
+ includes = %w[index.html site.css]
64
+
65
+ @site.exclude = excludes
66
+ assert_equal includes, @site.filter_entries(excludes + includes)
67
+ end
68
+
69
+ context 'with an invalid markdown processor in the configuration' do
70
+
71
+ should 'give a meaningful error message' do
72
+ bad_processor = 'not a processor name'
73
+ begin
74
+ Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
75
+ flunk 'Invalid markdown processors should cause a failure on site creation'
76
+ rescue RuntimeError => e
77
+ assert e.to_s =~ /invalid|bad/i
78
+ assert e.to_s =~ %r{#{bad_processor}}
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ end
85
+ end
@@ -0,0 +1,67 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestStylesheet < Test::Unit::TestCase
4
+ def setup_stylesheet(file)
5
+ @stylesheet = Stylesheet.new(@site, source_dir, '_stylesheets', file)
6
+ end
7
+
8
+ context "A Stylesheet" do
9
+ setup do
10
+ clear_dest
11
+ stub(Jekyll).configuration { Jekyll::DEFAULTS }
12
+ @site = Site.new(Jekyll.configuration)
13
+ end
14
+
15
+ context "processing stylesheets" do
16
+ should "create url based on filename" do
17
+ @stylesheet = setup_stylesheet('simple.less')
18
+ assert_equal "/css/simple.css", @stylesheet.url
19
+ end
20
+ end
21
+
22
+ context "rendering" do
23
+ setup do
24
+ clear_dest
25
+ end
26
+
27
+ should "write properly" do
28
+ stylesheet = setup_stylesheet('simple.less')
29
+ stylesheet.render()
30
+ stylesheet.write(dest_dir)
31
+
32
+ assert File.directory?(dest_dir)
33
+ assert File.exists?(File.join(File.join(dest_dir, 'css'), 'simple.css'))
34
+ end
35
+ end
36
+ end
37
+
38
+ context "A Nested Stylesheet" do
39
+ setup do
40
+ clear_dest
41
+ stub(Jekyll).configuration { Jekyll::DEFAULTS }
42
+ @site = Site.new(Jekyll.configuration)
43
+ end
44
+
45
+ context "processing stylesheets" do
46
+ should "create url based on filename" do
47
+ @stylesheet = setup_stylesheet(File.join('nested', 'override.less'))
48
+ assert_equal "/css/nested/override.css", @stylesheet.url
49
+ end
50
+ end
51
+
52
+ context "rendering" do
53
+ setup do
54
+ clear_dest
55
+ end
56
+
57
+ should "write properly" do
58
+ stylesheet = setup_stylesheet(File.join('nested', 'override.less'))
59
+ stylesheet.render()
60
+ stylesheet.write(dest_dir)
61
+
62
+ assert File.directory?(dest_dir)
63
+ assert File.exists?(File.join(File.join(File.join(dest_dir, 'css'), 'nested'), 'override.css'))
64
+ end
65
+ end
66
+ end
67
+ end
data/test/test_tags.rb ADDED
@@ -0,0 +1,116 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestTags < Test::Unit::TestCase
4
+
5
+ def create_post(content, override = {}, markdown = true)
6
+ stub(Jekyll).configuration do
7
+ Jekyll::DEFAULTS.merge({'pygments' => true}).merge(override)
8
+ end
9
+ site = Site.new(Jekyll.configuration)
10
+ info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
11
+
12
+ if markdown
13
+ payload = {"content_type" => "markdown"}
14
+ else
15
+ payload = {"content_type" => "textile"}
16
+ end
17
+
18
+ @result = Liquid::Template.parse(content).render(payload, info)
19
+
20
+ if markdown
21
+ @result = site.markdown(@result)
22
+ else
23
+ @result = site.textile(@result)
24
+ end
25
+ end
26
+
27
+ def fill_post(code, override = {})
28
+ content = <<CONTENT
29
+ ---
30
+ title: This is a test
31
+ ---
32
+
33
+ This document results in a markdown error with maruku
34
+
35
+ {% highlight text %}
36
+ #{code}
37
+ {% endhighlight %}
38
+ CONTENT
39
+ create_post(content, override)
40
+ end
41
+
42
+ context "post content has highlight tag" do
43
+ setup do
44
+ fill_post("test")
45
+ end
46
+
47
+ should "not cause a markdown error" do
48
+ assert_no_match /markdown\-html\-error/, @result
49
+ end
50
+
51
+ should "render markdown with pygments line handling" do
52
+ assert_match %{<pre>test\n</pre>}, @result
53
+ end
54
+ end
55
+
56
+ context "post content has highlight tag with UTF character" do
57
+ setup do
58
+ fill_post("Æ")
59
+ end
60
+
61
+ should "render markdown with pygments line handling" do
62
+ assert_match %{<pre>Æ\n</pre>}, @result
63
+ end
64
+ end
65
+
66
+ context "simple post with markdown and pre tags" do
67
+ setup do
68
+ @content = <<CONTENT
69
+ ---
70
+ title: Maruku vs. RDiscount
71
+ ---
72
+
73
+ _FIGHT!_
74
+
75
+ {% highlight ruby %}
76
+ puts "3..2..1.."
77
+ {% endhighlight %}
78
+
79
+ *FINISH HIM*
80
+ CONTENT
81
+ end
82
+
83
+ context "using Textile" do
84
+ setup do
85
+ create_post(@content, {}, false)
86
+ end
87
+
88
+ # Broken in RedCloth 4.1.9
89
+ should "not textilize highlight block" do
90
+ assert_no_match %r{3\.\.2\.\.1\.\.&quot;</span><br />}, @result
91
+ end
92
+ end
93
+
94
+ context "using Maruku" do
95
+ setup do
96
+ create_post(@content)
97
+ end
98
+
99
+ should "parse correctly" do
100
+ assert_match %r{<em>FIGHT!</em>}, @result
101
+ assert_match %r{<em>FINISH HIM</em>}, @result
102
+ end
103
+ end
104
+
105
+ context "using RDiscount" do
106
+ setup do
107
+ create_post(@content, 'markdown' => 'rdiscount')
108
+ end
109
+
110
+ should "parse correctly" do
111
+ assert_match %r{<em>FIGHT!</em>}, @result
112
+ assert_match %r{<em>FINISH HIM</em>}, @result
113
+ end
114
+ end
115
+ end
116
+ end
metadata ADDED
@@ -0,0 +1,196 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nirvdrum-jekyll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.2
5
+ platform: ruby
6
+ authors:
7
+ - Tom Preston-Werner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-18 00:00:00 -05:00
13
+ default_executable: jekyll
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: RedCloth
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 4.2.1
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: liquid
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.9.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: classifier
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.3.1
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: maruku
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.5.9
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: directory_watcher
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.1.1
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: open4
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 0.9.6
74
+ version:
75
+ description: Jekyll is a simple, blog aware, static site generator.
76
+ email: tom@mojombo.com
77
+ executables:
78
+ - jekyll
79
+ extensions: []
80
+
81
+ extra_rdoc_files:
82
+ - README.textile
83
+ files:
84
+ - .gitignore
85
+ - History.txt
86
+ - README.textile
87
+ - Rakefile
88
+ - VERSION.yml
89
+ - bin/jekyll
90
+ - features/create_sites.feature
91
+ - features/embed_filters.feature
92
+ - features/pagination.feature
93
+ - features/permalinks.feature
94
+ - features/post_data.feature
95
+ - features/site_configuration.feature
96
+ - features/site_data.feature
97
+ - features/step_definitions/jekyll_steps.rb
98
+ - features/support/env.rb
99
+ - jekyll.gemspec
100
+ - lib/jekyll.rb
101
+ - lib/jekyll/albino.rb
102
+ - lib/jekyll/converters/csv.rb
103
+ - lib/jekyll/converters/mephisto.rb
104
+ - lib/jekyll/converters/mt.rb
105
+ - lib/jekyll/converters/textpattern.rb
106
+ - lib/jekyll/converters/typo.rb
107
+ - lib/jekyll/converters/wordpress.rb
108
+ - lib/jekyll/convertible.rb
109
+ - lib/jekyll/core_ext.rb
110
+ - lib/jekyll/filters.rb
111
+ - lib/jekyll/layout.rb
112
+ - lib/jekyll/page.rb
113
+ - lib/jekyll/pager.rb
114
+ - lib/jekyll/post.rb
115
+ - lib/jekyll/site.rb
116
+ - lib/jekyll/stylesheet.rb
117
+ - lib/jekyll/tags/highlight.rb
118
+ - lib/jekyll/tags/include.rb
119
+ - test/helper.rb
120
+ - test/source/_includes/sig.markdown
121
+ - test/source/_layouts/default.html
122
+ - test/source/_layouts/simple.html
123
+ - test/source/_posts/2008-02-02-not-published.textile
124
+ - test/source/_posts/2008-02-02-published.textile
125
+ - test/source/_posts/2008-10-18-foo-bar.textile
126
+ - test/source/_posts/2008-11-21-complex.textile
127
+ - test/source/_posts/2008-12-03-permalinked-post.textile
128
+ - test/source/_posts/2008-12-13-include.markdown
129
+ - test/source/_posts/2009-01-27-array-categories.textile
130
+ - test/source/_posts/2009-01-27-categories.textile
131
+ - test/source/_posts/2009-01-27-category.textile
132
+ - test/source/_posts/2009-03-12-hash-#1.markdown
133
+ - test/source/_posts/2009-05-18-tag.textile
134
+ - test/source/_posts/2009-05-18-tags.textile
135
+ - test/source/_posts/2009-06-22-empty-yaml.textile
136
+ - test/source/_posts/2009-06-22-no-yaml.textile
137
+ - test/source/_stylesheets/nested/override.less
138
+ - test/source/_stylesheets/simple.less
139
+ - test/source/about.html
140
+ - test/source/category/_posts/2008-9-23-categories.textile
141
+ - test/source/contacts.html
142
+ - test/source/css/screen.css
143
+ - test/source/foo/_posts/bar/2008-12-12-topical-post.textile
144
+ - test/source/index.html
145
+ - test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
146
+ - test/source/z_category/_posts/2008-9-23-categories.textile
147
+ - test/suite.rb
148
+ - test/test_configuration.rb
149
+ - test/test_filters.rb
150
+ - test/test_generated_site.rb
151
+ - test/test_page.rb
152
+ - test/test_pager.rb
153
+ - test/test_post.rb
154
+ - test/test_site.rb
155
+ - test/test_stylesheet.rb
156
+ - test/test_tags.rb
157
+ has_rdoc: true
158
+ homepage: http://github.com/mojombo/jekyll
159
+ licenses: []
160
+
161
+ post_install_message:
162
+ rdoc_options:
163
+ - --charset=UTF-8
164
+ require_paths:
165
+ - lib
166
+ required_ruby_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: "0"
171
+ version:
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: "0"
177
+ version:
178
+ requirements: []
179
+
180
+ rubyforge_project: jekyll
181
+ rubygems_version: 1.3.5
182
+ signing_key:
183
+ specification_version: 3
184
+ summary: Jekyll is a simple, blog aware, static site generator.
185
+ test_files:
186
+ - test/helper.rb
187
+ - test/suite.rb
188
+ - test/test_configuration.rb
189
+ - test/test_filters.rb
190
+ - test/test_generated_site.rb
191
+ - test/test_page.rb
192
+ - test/test_pager.rb
193
+ - test/test_post.rb
194
+ - test/test_site.rb
195
+ - test/test_stylesheet.rb
196
+ - test/test_tags.rb