rack-jekyll 0.4.4 → 0.4.5
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.
- checksums.yaml +4 -4
- data/Rakefile +5 -1
- data/lib/rack/jekyll.rb +10 -8
- data/lib/rack/jekyll/ext.rb +7 -0
- data/lib/rack/jekyll/helpers.rb +16 -0
- data/lib/rack/jekyll/version.rb +1 -1
- data/rack-jekyll.gemspec +3 -6
- metadata +4 -14
- data/example/404.md +0 -10
- data/example/_config.yml +0 -5
- data/example/_layouts/default.html +0 -15
- data/example/_layouts/post.html +0 -7
- data/example/_posts/2009-12-21-hello-world.md +0 -8
- data/example/config.ru +0 -6
- data/example/css/site.css +0 -6
- data/example/index.md +0 -16
- data/lib/rack/jekyll/utils.rb +0 -21
- data/test/test_utils.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff66ebdda97455aea827328639ec115c78ea52ca
|
4
|
+
data.tar.gz: e250fa094a11503db4a51a6e360ee5bfa5022119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6872f504907bb61f822d9b37aa2db5272e8b6e4d5969de0728947d800914545689b856dbd5db061f72dc847766998fe164303fef0e08cc77a11055e494830d5d
|
7
|
+
data.tar.gz: 126d49203f5fb68b8d6297ab9c8af1f92c607016e507b17c0b14adfb13e5fe3abcde81c7a2253b06ee8a72a6cd9031b147b491dd1c157365ec2ad32d4ae813ce
|
data/Rakefile
CHANGED
data/lib/rack/jekyll.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require "rack"
|
2
2
|
require "jekyll"
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
require "rack/request"
|
4
|
+
require "rack/response"
|
5
|
+
require File.join(File.dirname(__FILE__), 'jekyll', 'filehandler')
|
6
|
+
require File.join(File.dirname(__FILE__), 'jekyll', 'helpers')
|
7
|
+
require File.join(File.dirname(__FILE__), 'jekyll', 'version')
|
8
|
+
require File.join(File.dirname(__FILE__), 'jekyll', 'ext')
|
7
9
|
|
8
10
|
module Rack
|
9
11
|
class Jekyll
|
@@ -75,9 +77,9 @@ module Rack
|
|
75
77
|
filename = @files.get_filename(request.path_info)
|
76
78
|
|
77
79
|
if filename
|
78
|
-
|
80
|
+
mime = mime(filename)
|
79
81
|
|
80
|
-
file
|
82
|
+
file = file_info(filename)
|
81
83
|
body = file[:body]
|
82
84
|
time = file[:time]
|
83
85
|
hdrs = { "Last-Modified" => time }
|
@@ -86,7 +88,7 @@ module Rack
|
|
86
88
|
response = [304, hdrs, []]
|
87
89
|
else
|
88
90
|
hdrs.update({ "Content-Length" => body.bytesize.to_s,
|
89
|
-
"Content-Type" =>
|
91
|
+
"Content-Type" => mime })
|
90
92
|
response = [200, hdrs, [body]]
|
91
93
|
end
|
92
94
|
|
@@ -121,7 +123,7 @@ module Rack
|
|
121
123
|
def custom_404
|
122
124
|
filename = @files.get_filename("/404.html")
|
123
125
|
|
124
|
-
filename ?
|
126
|
+
filename ? file_info(filename)[:body] : nil
|
125
127
|
end
|
126
128
|
|
127
129
|
def remove_body(response)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Rack
|
2
|
+
class Jekyll
|
3
|
+
def mime(filename)
|
4
|
+
ext = ::File.extname(filename)
|
5
|
+
|
6
|
+
Rack::Mime.mime_type(ext)
|
7
|
+
end
|
8
|
+
|
9
|
+
def file_info(path)
|
10
|
+
expand_path = ::File.expand_path(path)
|
11
|
+
::File.open(expand_path, 'r') do |f|
|
12
|
+
{:body => f.read, :time => f.mtime.httpdate, :expand_path => expand_path}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/rack/jekyll/version.rb
CHANGED
data/rack-jekyll.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
require File.join(File.dirname(__FILE__), "lib", "rack", "jekyll", "version")
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.required_rubygems_version = ">= 1.3.6"
|
@@ -22,16 +22,13 @@ Gem::Specification.new do |s|
|
|
22
22
|
Rakefile
|
23
23
|
LICENSE
|
24
24
|
} +
|
25
|
-
Dir.glob("lib/**/*")
|
26
|
-
Dir.glob("example/**/*").reject {|f| f =~ %r(\Aexample/_site/) }
|
25
|
+
Dir.glob("lib/**/*")
|
27
26
|
s.test_files = Dir.glob("{test,features}/**/*")
|
28
27
|
s.require_paths = ["lib"]
|
29
28
|
|
30
|
-
s.extra_rdoc_files =
|
29
|
+
s.extra_rdoc_files = ["README.markdown"]
|
31
30
|
s.rdoc_options = ['--charset=UTF-8', '--main=README.markdown']
|
32
31
|
|
33
|
-
s.required_ruby_version = '>= 1.9.3'
|
34
|
-
|
35
32
|
s.add_dependency "jekyll", ">= 1.3"
|
36
33
|
s.add_dependency "rack", "~> 1.5"
|
37
34
|
s.add_dependency "listen", ">= 1.3"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Goines
|
@@ -87,26 +87,18 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files:
|
89
89
|
- README.markdown
|
90
|
-
- LICENSE
|
91
90
|
files:
|
92
91
|
- Gemfile
|
93
92
|
- LICENSE
|
94
93
|
- README.markdown
|
95
94
|
- Rakefile
|
96
|
-
- example/404.md
|
97
|
-
- example/_config.yml
|
98
|
-
- example/_layouts/default.html
|
99
|
-
- example/_layouts/post.html
|
100
|
-
- example/_posts/2009-12-21-hello-world.md
|
101
|
-
- example/config.ru
|
102
|
-
- example/css/site.css
|
103
|
-
- example/index.md
|
104
95
|
- features/requests.feature
|
105
96
|
- features/step_definitions/rack_jekyll_steps.rb
|
106
97
|
- features/support/env.rb
|
107
98
|
- lib/rack/jekyll.rb
|
99
|
+
- lib/rack/jekyll/ext.rb
|
108
100
|
- lib/rack/jekyll/filehandler.rb
|
109
|
-
- lib/rack/jekyll/
|
101
|
+
- lib/rack/jekyll/helpers.rb
|
110
102
|
- lib/rack/jekyll/version.rb
|
111
103
|
- rack-jekyll.gemspec
|
112
104
|
- test/helper.rb
|
@@ -124,7 +116,6 @@ files:
|
|
124
116
|
- test/test_configuration.rb
|
125
117
|
- test/test_filehandler.rb
|
126
118
|
- test/test_requests.rb
|
127
|
-
- test/test_utils.rb
|
128
119
|
homepage: https://github.com/adaoraul/rack-jekyll
|
129
120
|
licenses: []
|
130
121
|
metadata: {}
|
@@ -138,7 +129,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
129
|
requirements:
|
139
130
|
- - ">="
|
140
131
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
132
|
+
version: '0'
|
142
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
134
|
requirements:
|
144
135
|
- - ">="
|
@@ -166,7 +157,6 @@ test_files:
|
|
166
157
|
- test/test_configuration.rb
|
167
158
|
- test/test_filehandler.rb
|
168
159
|
- test/test_requests.rb
|
169
|
-
- test/test_utils.rb
|
170
160
|
- features/requests.feature
|
171
161
|
- features/step_definitions/rack_jekyll_steps.rb
|
172
162
|
- features/support/env.rb
|
data/example/404.md
DELETED
data/example/_config.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<link rel="stylesheet" type="text/css" href="/css/site.css">
|
6
|
-
{% if page.title != null %}
|
7
|
-
<title>Rack-Jekyll Demo - {{ page.title }}</title>
|
8
|
-
{% else %}
|
9
|
-
<title>Rack-Jekyll Demo</title>
|
10
|
-
{% endif %}
|
11
|
-
</head>
|
12
|
-
<body>
|
13
|
-
{{ content }}
|
14
|
-
</body>
|
15
|
-
</html>
|
data/example/_layouts/post.html
DELETED
data/example/config.ru
DELETED
data/example/css/site.css
DELETED
data/example/index.md
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
---
|
2
|
-
layout: default
|
3
|
-
---
|
4
|
-
|
5
|
-
# Rack-Jekyll Demo
|
6
|
-
|
7
|
-
Blog posts:
|
8
|
-
|
9
|
-
<ul>
|
10
|
-
{% for post in site.posts %}
|
11
|
-
<li>
|
12
|
-
<span class="date">{{ post.date | date_to_string }}:</span>
|
13
|
-
<a href="{{ post.url }}">{{ post.title }}</a>
|
14
|
-
</li>
|
15
|
-
{% endfor %}
|
16
|
-
</ul>
|
data/lib/rack/jekyll/utils.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
module Rack
|
2
|
-
class Jekyll
|
3
|
-
module Utils
|
4
|
-
|
5
|
-
def self.media_type(filename)
|
6
|
-
extension = ::File.extname(filename)
|
7
|
-
|
8
|
-
Rack::Mime.mime_type(extension)
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.file_info(path)
|
12
|
-
info = {
|
13
|
-
:body => ::File.read(path),
|
14
|
-
:time => ::File.mtime(path).httpdate
|
15
|
-
}
|
16
|
-
|
17
|
-
info
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/test/test_utils.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require_relative "helper"
|
2
|
-
|
3
|
-
|
4
|
-
describe Rack::Jekyll::Utils do
|
5
|
-
|
6
|
-
before do
|
7
|
-
@utils = Rack::Jekyll::Utils
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
describe "when asked for #media_type" do
|
12
|
-
|
13
|
-
it "returns correct type for HTML" do
|
14
|
-
@utils.media_type("index.html").must_equal "text/html"
|
15
|
-
end
|
16
|
-
|
17
|
-
it "returns correct type for HTML with full path" do
|
18
|
-
@utils.media_type("/path/index.html").must_equal "text/html"
|
19
|
-
end
|
20
|
-
|
21
|
-
it "returns correct type for CSS" do
|
22
|
-
@utils.media_type("/path/style.css").must_equal "text/css"
|
23
|
-
end
|
24
|
-
|
25
|
-
it "returns correct type for *.min.js" do
|
26
|
-
@utils.media_type("script.min.js").must_equal "application/javascript"
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns correct default type for files without extension" do
|
30
|
-
@utils.media_type("README").must_equal "application/octet-stream"
|
31
|
-
end
|
32
|
-
|
33
|
-
it "ignores lower/upper case in file extensions" do
|
34
|
-
@utils.media_type("image.JpG").must_equal "image/jpeg"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
describe "when asked for #file_info" do
|
40
|
-
|
41
|
-
before do
|
42
|
-
@filename = __FILE__
|
43
|
-
@info = @utils.file_info(@filename)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "has the file content" do
|
47
|
-
@info[:body].must_equal ::File.read(@filename)
|
48
|
-
end
|
49
|
-
|
50
|
-
it "has the modification time in httpdate format" do
|
51
|
-
@info[:time].must_equal ::File.mtime(@filename).httpdate
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|