rack-jekyll 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c907df8de234f7065a12637743064344d3422664
4
- data.tar.gz: a19269d5a37bc93b98d71894b833b272eff44193
3
+ metadata.gz: ff66ebdda97455aea827328639ec115c78ea52ca
4
+ data.tar.gz: e250fa094a11503db4a51a6e360ee5bfa5022119
5
5
  SHA512:
6
- metadata.gz: f570ae029c2ac5f496fc29d7a17edec2b0a44561820f004961fb86a0a635ae9cc4e6061130f37c409c76997e1bbe63ca8542adcb4bc0f7bb603fd8136bdd30d8
7
- data.tar.gz: aaa2be27ebaac8503902bf941964b560646a45c00198f70fb8ff2818dc515ffc6a24f75d0a06b23c83242e55200997118dc9b125f8647a456d07487d1be5aef4
6
+ metadata.gz: 6872f504907bb61f822d9b37aa2db5272e8b6e4d5969de0728947d800914545689b856dbd5db061f72dc847766998fe164303fef0e08cc77a11055e494830d5d
7
+ data.tar.gz: 126d49203f5fb68b8d6297ab9c8af1f92c607016e507b17c0b14adfb13e5fe3abcde81c7a2253b06ee8a72a6cd9031b147b491dd1c157365ec2ad32d4ae813ce
data/Rakefile CHANGED
@@ -1,5 +1,9 @@
1
+ require 'rubygems'
2
+ require 'rubygems/specification'
3
+ require 'rubygems/package_task'
1
4
  require 'rake/testtask'
2
-
5
+ #require 'extensions/all'
6
+ require_relative 'lib/rack/jekyll'
3
7
 
4
8
  task :default => :test
5
9
 
@@ -1,9 +1,11 @@
1
1
  require "rack"
2
2
  require "jekyll"
3
-
4
- require_relative "jekyll/filehandler"
5
- require_relative "jekyll/utils"
6
- require_relative "jekyll/version"
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
- media_type = Utils.media_type(filename)
80
+ mime = mime(filename)
79
81
 
80
- file = Utils.file_info(filename)
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" => media_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 ? Utils.file_info(filename)[:body] : nil
126
+ filename ? file_info(filename)[:body] : nil
125
127
  end
126
128
 
127
129
  def remove_body(response)
@@ -0,0 +1,7 @@
1
+ class String
2
+ if RUBY_VERSION < "1.9"
3
+ def bytesize
4
+ size
5
+ end
6
+ end
7
+ end
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  class Jekyll
3
3
  def self.version
4
- '0.4.4'
4
+ '0.4.5'
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- require_relative "lib/rack/jekyll/version"
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 = %w[README.markdown LICENSE]
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
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/utils.rb
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: 1.9.3
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
@@ -1,10 +0,0 @@
1
- ---
2
- layout: default
3
- title: 404
4
- ---
5
-
6
- # 404: Not Found
7
-
8
- The requested page does not exist.
9
-
10
- [Go back to home page](/)
@@ -1,5 +0,0 @@
1
- permalink: /:year/:month/:day/:title/
2
- markdown: kramdown
3
-
4
- exclude:
5
- - config.ru
@@ -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>
@@ -1,7 +0,0 @@
1
- ---
2
- layout: default
3
- ---
4
-
5
- {{ content }}
6
-
7
- <p><a href="/">Go back to home page</a></p>
@@ -1,8 +0,0 @@
1
- ---
2
- layout: post
3
- title: Hello World!
4
- ---
5
-
6
- # Hello World!
7
-
8
- A demo blog post for Rack-Jekyll.
@@ -1,6 +0,0 @@
1
- require_relative "../lib/rack/jekyll"
2
-
3
- # Middleware
4
- use Rack::ShowExceptions # Nice looking errors
5
-
6
- run Rack::Jekyll.new
@@ -1,6 +0,0 @@
1
- body {
2
- background-color: #f0f0f0;
3
- font-family: sans-serif;
4
- }
5
-
6
- .date { color: #808080; }
@@ -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>
@@ -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
@@ -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