mattmatt-jekyll 0.4.1 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/bin/jekyll +5 -1
- data/lib/jekyll/converters/wordpress.rb +9 -8
- data/lib/jekyll/post.rb +2 -2
- data/lib/jekyll.rb +5 -2
- data/test/source/_posts/2009-01-27-no-categories.textile +7 -0
- data/test/test_post.rb +8 -0
- metadata +14 -2
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
==
|
2
|
+
* Minor Enhancements
|
3
|
+
* Changed date format on wordpress converter (zeropadding) [github.com/dysinger]
|
4
|
+
* Bug Fixes
|
5
|
+
* Add jekyll binary as executable to gemspec [github.com/dysinger]
|
6
|
+
|
1
7
|
== 0.4.0 / 2009-02-03
|
2
8
|
* Major Enhancements
|
3
9
|
* Switch to Jeweler for packaging tasks
|
data/Rakefile
CHANGED
data/VERSION.yml
CHANGED
data/bin/jekyll
CHANGED
@@ -61,7 +61,11 @@ opts = OptionParser.new do |opts|
|
|
61
61
|
opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
|
62
62
|
Jekyll.permalink_style = (style || 'date').to_sym
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
|
+
opts.on("--version", "Display current version") do
|
66
|
+
puts "Jekyll " + Jekyll.version
|
67
|
+
exit 0
|
68
|
+
end
|
65
69
|
end
|
66
70
|
|
67
71
|
opts.parse!
|
@@ -10,8 +10,8 @@ require 'fileutils'
|
|
10
10
|
|
11
11
|
module Jekyll
|
12
12
|
module WordPress
|
13
|
-
|
14
|
-
# Reads a MySQL database via Sequel and creates a post file for each
|
13
|
+
|
14
|
+
# Reads a MySQL database via Sequel and creates a post file for each
|
15
15
|
# post in wp_posts that has post_status = 'publish'.
|
16
16
|
# This restriction is made because 'draft' posts are not guaranteed to
|
17
17
|
# have valid dates.
|
@@ -19,20 +19,21 @@ module Jekyll
|
|
19
19
|
|
20
20
|
def self.process(dbname, user, pass, host = 'localhost')
|
21
21
|
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host)
|
22
|
-
|
22
|
+
|
23
23
|
FileUtils.mkdir_p "_posts"
|
24
|
-
|
24
|
+
|
25
25
|
db[QUERY].each do |post|
|
26
26
|
# Get required fields and construct Jekyll compatible name
|
27
27
|
title = post[:post_title]
|
28
28
|
slug = post[:post_name]
|
29
29
|
date = post[:post_date]
|
30
30
|
content = post[:post_content]
|
31
|
-
|
32
|
-
name = [date.year, date.month, date.day,
|
31
|
+
|
32
|
+
name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, date.day,
|
33
|
+
slug]
|
33
34
|
|
34
35
|
# Get the relevant fields as a hash, delete empty fields and convert
|
35
|
-
# to YAML for the header
|
36
|
+
# to YAML for the header
|
36
37
|
data = {
|
37
38
|
'layout' => 'post',
|
38
39
|
'title' => title.to_s,
|
@@ -51,4 +52,4 @@ module Jekyll
|
|
51
52
|
|
52
53
|
end
|
53
54
|
end
|
54
|
-
end
|
55
|
+
end
|
data/lib/jekyll/post.rb
CHANGED
@@ -46,11 +46,11 @@ module Jekyll
|
|
46
46
|
self.published = true
|
47
47
|
end
|
48
48
|
|
49
|
-
if self.categories.empty?
|
49
|
+
self.data['categories'] = if self.categories.empty?
|
50
50
|
if self.data.has_key?('category')
|
51
51
|
self.categories << self.data['category']
|
52
52
|
elsif self.data.has_key?('categories')
|
53
|
-
self.categories = self.data['categories'].split
|
53
|
+
self.categories = (self.data['categories'] || "").split
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/jekyll.rb
CHANGED
@@ -43,8 +43,6 @@ require 'jekyll/tags/include'
|
|
43
43
|
require 'jekyll/albino'
|
44
44
|
|
45
45
|
module Jekyll
|
46
|
-
VERSION = '0.3.0'
|
47
|
-
|
48
46
|
class << self
|
49
47
|
attr_accessor :source, :dest, :lsi, :pygments, :markdown_proc, :content_type, :permalink_style
|
50
48
|
end
|
@@ -61,4 +59,9 @@ module Jekyll
|
|
61
59
|
Jekyll.dest = dest
|
62
60
|
Jekyll::Site.new(source, dest).process
|
63
61
|
end
|
62
|
+
|
63
|
+
def self.version
|
64
|
+
yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
|
65
|
+
"#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
|
66
|
+
end
|
64
67
|
end
|
data/test/test_post.rb
CHANGED
@@ -84,6 +84,7 @@ class TestPost < Test::Unit::TestCase
|
|
84
84
|
def test_yaml_category
|
85
85
|
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-category.textile")
|
86
86
|
assert p.categories.include?('foo')
|
87
|
+
assert p.data['categories'].include?('foo')
|
87
88
|
end
|
88
89
|
|
89
90
|
def test_yaml_categories
|
@@ -91,6 +92,13 @@ class TestPost < Test::Unit::TestCase
|
|
91
92
|
assert p.categories.include?('foo')
|
92
93
|
assert p.categories.include?('bar')
|
93
94
|
assert p.categories.include?('baz')
|
95
|
+
assert p.data['categories'].include?('foo')
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_empty_yaml_categories
|
99
|
+
p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2009-01-27-no-categories.textile")
|
100
|
+
assert p.categories.empty?
|
101
|
+
assert p.data['categories'].empty?
|
94
102
|
end
|
95
103
|
|
96
104
|
def test_render
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mattmatt-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -9,11 +9,12 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-16 00:00:00 -08:00
|
13
13
|
default_executable: jekyll
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: RedCloth
|
17
|
+
type: :runtime
|
17
18
|
version_requirement:
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
19
20
|
requirements:
|
@@ -23,6 +24,7 @@ dependencies:
|
|
23
24
|
version:
|
24
25
|
- !ruby/object:Gem::Dependency
|
25
26
|
name: liquid
|
27
|
+
type: :runtime
|
26
28
|
version_requirement:
|
27
29
|
version_requirements: !ruby/object:Gem::Requirement
|
28
30
|
requirements:
|
@@ -32,6 +34,7 @@ dependencies:
|
|
32
34
|
version:
|
33
35
|
- !ruby/object:Gem::Dependency
|
34
36
|
name: classifier
|
37
|
+
type: :runtime
|
35
38
|
version_requirement:
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
@@ -41,6 +44,7 @@ dependencies:
|
|
41
44
|
version:
|
42
45
|
- !ruby/object:Gem::Dependency
|
43
46
|
name: maruku
|
47
|
+
type: :runtime
|
44
48
|
version_requirement:
|
45
49
|
version_requirements: !ruby/object:Gem::Requirement
|
46
50
|
requirements:
|
@@ -50,6 +54,7 @@ dependencies:
|
|
50
54
|
version:
|
51
55
|
- !ruby/object:Gem::Dependency
|
52
56
|
name: directory_watcher
|
57
|
+
type: :runtime
|
53
58
|
version_requirement:
|
54
59
|
version_requirements: !ruby/object:Gem::Requirement
|
55
60
|
requirements:
|
@@ -59,6 +64,7 @@ dependencies:
|
|
59
64
|
version:
|
60
65
|
- !ruby/object:Gem::Dependency
|
61
66
|
name: open4
|
67
|
+
type: :runtime
|
62
68
|
version_requirement:
|
63
69
|
version_requirements: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
@@ -112,6 +118,10 @@ files:
|
|
112
118
|
- test/dest/2008/12
|
113
119
|
- test/dest/2008/12/13
|
114
120
|
- test/dest/2008/12/13/include.html
|
121
|
+
- test/dest/2009
|
122
|
+
- test/dest/2009/01
|
123
|
+
- test/dest/2009/01/27
|
124
|
+
- test/dest/2009/01/27/no-categories.html
|
115
125
|
- test/dest/_posts
|
116
126
|
- test/dest/_posts/2008-02-02-not-published.html
|
117
127
|
- test/dest/_posts/2008-02-02-published.html
|
@@ -121,6 +131,7 @@ files:
|
|
121
131
|
- test/dest/_posts/2008-12-13-include.html
|
122
132
|
- test/dest/_posts/2009-01-27-categories.html
|
123
133
|
- test/dest/_posts/2009-01-27-category.html
|
134
|
+
- test/dest/_posts/2009-01-27-no-categories.html
|
124
135
|
- test/dest/category
|
125
136
|
- test/dest/category/2008
|
126
137
|
- test/dest/category/2008/09
|
@@ -179,6 +190,7 @@ files:
|
|
179
190
|
- test/source/_posts/2008-12-13-include.markdown
|
180
191
|
- test/source/_posts/2009-01-27-categories.textile
|
181
192
|
- test/source/_posts/2009-01-27-category.textile
|
193
|
+
- test/source/_posts/2009-01-27-no-categories.textile
|
182
194
|
- test/source/category
|
183
195
|
- test/source/category/_posts
|
184
196
|
- test/source/category/_posts/2008-9-23-categories.textile
|