mojombo-jekyll 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -1
- data/README.textile +1 -1
- data/bin/jekyll +13 -12
- data/jekyll.gemspec +1 -1
- data/lib/jekyll.rb +1 -1
- data/lib/jekyll/post.rb +17 -3
- data/test/test_post.rb +16 -0
- metadata +1 -1
data/History.txt
CHANGED
data/README.textile
CHANGED
@@ -50,7 +50,7 @@ And if you don't want to be in the proto site root to run Jekyll:
|
|
50
50
|
|
51
51
|
$ jekyll /path/to/proto/site /path/to/place/generated/site
|
52
52
|
|
53
|
-
The
|
53
|
+
The autobuild feature can be used on any of the invocations.
|
54
54
|
|
55
55
|
h2. Contribute
|
56
56
|
|
data/bin/jekyll
CHANGED
@@ -2,13 +2,24 @@
|
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
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
|
+
Options:
|
14
|
+
HELP
|
15
|
+
|
5
16
|
require 'optparse'
|
6
17
|
require 'jekyll'
|
7
18
|
|
8
19
|
options = {}
|
9
20
|
|
10
21
|
opts = OptionParser.new do |opts|
|
11
|
-
opts.banner =
|
22
|
+
opts.banner = help
|
12
23
|
|
13
24
|
opts.on("--auto", "Auto-regenerate") do
|
14
25
|
options[:auto] = true
|
@@ -67,14 +78,4 @@ if options[:auto]
|
|
67
78
|
loop { sleep 1000 }
|
68
79
|
else
|
69
80
|
Jekyll.process(source, destination)
|
70
|
-
end
|
71
|
-
|
72
|
-
__END__
|
73
|
-
Jekyll is a blog-aware, static site generator.
|
74
|
-
|
75
|
-
Basic Command Line Usage:
|
76
|
-
jekyll # . -> ./_site
|
77
|
-
jekyll <path to write generated site> # . -> <path>
|
78
|
-
jekyll <path to source> <path to write generated site> # <path> -> <path>
|
79
|
-
|
80
|
-
Options:
|
81
|
+
end
|
data/jekyll.gemspec
CHANGED
data/lib/jekyll.rb
CHANGED
data/lib/jekyll/post.rb
CHANGED
@@ -55,13 +55,27 @@ module Jekyll
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# The generated directory into which the post will be placed
|
58
|
-
# upon generation.
|
58
|
+
# upon generation. This is derived from the permalink or, if
|
59
|
+
# permalink is absent, set to the default date
|
60
|
+
# e.g. "/2008/11/05/"
|
59
61
|
#
|
60
62
|
# Returns <String>
|
61
63
|
def dir
|
62
|
-
|
64
|
+
permalink ?
|
65
|
+
permalink.to_s.split("/")[0..-2].join("/") :
|
66
|
+
date.strftime("/%Y/%m/%d/")
|
63
67
|
end
|
64
68
|
|
69
|
+
# The full path and filename of the post.
|
70
|
+
# Defined in the YAML of the post body
|
71
|
+
# (Optional)
|
72
|
+
#
|
73
|
+
# Returns <String>
|
74
|
+
def permalink
|
75
|
+
self.data && self.data['permalink']
|
76
|
+
end
|
77
|
+
|
78
|
+
|
65
79
|
# The generated relative url of this post
|
66
80
|
# e.g. /2008/11/05/my-awesome-post.html
|
67
81
|
#
|
@@ -111,7 +125,7 @@ module Jekyll
|
|
111
125
|
#
|
112
126
|
# Returns nothing
|
113
127
|
def write(dest)
|
114
|
-
FileUtils.mkdir_p(File.join(dest,
|
128
|
+
FileUtils.mkdir_p(File.join(dest, dir))
|
115
129
|
|
116
130
|
path = File.join(dest, self.url)
|
117
131
|
File.open(path, 'w') do |f|
|
data/test/test_post.rb
CHANGED
@@ -26,6 +26,22 @@ class TestPost < Test::Unit::TestCase
|
|
26
26
|
assert_equal "/2008/10/19/foo-bar.html", p.url
|
27
27
|
end
|
28
28
|
|
29
|
+
def test_permalink
|
30
|
+
p = Post.allocate
|
31
|
+
p.process("2008-12-03-permalinked-post.textile")
|
32
|
+
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source posts]), "2008-12-03-permalinked-post.textile")
|
33
|
+
|
34
|
+
assert_equal "my_category/permalinked-post", p.permalink
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_dir_respects_permalink
|
38
|
+
p = Post.allocate
|
39
|
+
p.process("2008-12-03-permalinked-post.textile")
|
40
|
+
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source posts]), "2008-12-03-permalinked-post.textile")
|
41
|
+
|
42
|
+
assert_equal "my_category", p.dir
|
43
|
+
end
|
44
|
+
|
29
45
|
def test_read_yaml
|
30
46
|
p = Post.allocate
|
31
47
|
p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
|