rack-jekyll 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +22 -0
- data/README.markdown +29 -0
- data/lib/rack/jekyll.rb +38 -0
- metadata +76 -0
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2009, Bryan Goines
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Rack-Jekyll
|
2
|
+
===========
|
3
|
+
|
4
|
+
Transform your Jekyll app into Rack application
|
5
|
+
|
6
|
+
You can run it with rackup and shotgun.
|
7
|
+
|
8
|
+
Demo: [http://bry4n.heroku.com/](http://bry4n.heroku.com/)
|
9
|
+
|
10
|
+
### How to use it?
|
11
|
+
|
12
|
+
*config.ru* is required in order to run with shotgun and rackup. Even you can deploy your jekyll app to Heroku!
|
13
|
+
|
14
|
+
Copy this and put in config.ru in your jekyll's root directory.
|
15
|
+
|
16
|
+
|
17
|
+
config.ru:
|
18
|
+
|
19
|
+
require "rack/jekyll"
|
20
|
+
|
21
|
+
run Rack::Jekyll.new
|
22
|
+
|
23
|
+
|
24
|
+
That's it.
|
25
|
+
|
26
|
+
|
27
|
+
## TODO
|
28
|
+
|
29
|
+
Rails
|
data/lib/rack/jekyll.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require "rack"
|
2
|
+
require "rack/request"
|
3
|
+
require "rack/response"
|
4
|
+
|
5
|
+
module Rack
|
6
|
+
class Jekyll
|
7
|
+
|
8
|
+
def initialize(opts = {})
|
9
|
+
@path = opts[:path].nil? ? "_site" : opts[:path]
|
10
|
+
@files = Dir[@path + "/**/*"].inspect
|
11
|
+
if Dir[@path + "/**/*"].empty?
|
12
|
+
system("jekyll")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def call(env)
|
17
|
+
request = Request.new(env)
|
18
|
+
path_info = request.path_info
|
19
|
+
ext = ''
|
20
|
+
if @files.include?(path_info)
|
21
|
+
if path_info =~ /(\/?)$/
|
22
|
+
if path_info !~ /\.(css|js|jpe?g|gif|png|mov|mp3)$/i
|
23
|
+
path_info += $1.nil? ? "/index.html" : "index.html"
|
24
|
+
end
|
25
|
+
ext = $1 if path_info =~ /(\.\S+)$/i
|
26
|
+
end
|
27
|
+
mime = Mime.mime_type(ext)
|
28
|
+
body = ::File.read(::File.expand_path(@path + path_info))
|
29
|
+
[200, {"Content-Type" => mime, "Content-length" => body.length.to_s}, [body]]
|
30
|
+
else
|
31
|
+
ext = $1 if path_info =~ /(\.\S+)$/i
|
32
|
+
mime = Mime.mime_type(ext)
|
33
|
+
[404, {"Content-Type" => mime}, ["Not found"]]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rack-jekyll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryan Goines
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-15 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: jekyll
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rack
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: Transform your jekyll based app into a Rack application
|
36
|
+
email: bryan@ffiirree.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- README.markdown
|
43
|
+
files:
|
44
|
+
- README.markdown
|
45
|
+
- LICENSE
|
46
|
+
- lib/rack/jekyll.rb
|
47
|
+
has_rdoc: false
|
48
|
+
homepage: http://github.com/bry4n/rack-jekyll
|
49
|
+
licenses: []
|
50
|
+
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project: rack-jekyll
|
71
|
+
rubygems_version: 1.3.5
|
72
|
+
signing_key:
|
73
|
+
specification_version: 1
|
74
|
+
summary: rack-jekyll
|
75
|
+
test_files: []
|
76
|
+
|