serve 0.11.4 → 0.11.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/serve.rb +1 -0
- data/lib/serve/file_resolver.rb +1 -1
- data/lib/serve/handlers/static_handler.rb +22 -0
- metadata +5 -4
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.11.
|
1
|
+
0.11.5
|
data/lib/serve.rb
CHANGED
@@ -9,5 +9,6 @@ require 'serve/handlers/dynamic_handler'
|
|
9
9
|
require 'serve/handlers/sass_handler'
|
10
10
|
require 'serve/handlers/email_handler'
|
11
11
|
require 'serve/handlers/redirect_handler'
|
12
|
+
require 'serve/handlers/static_handler'
|
12
13
|
require 'serve/response_cache'
|
13
14
|
require 'serve/rack'
|
data/lib/serve/file_resolver.rb
CHANGED
@@ -3,7 +3,7 @@ module Serve
|
|
3
3
|
|
4
4
|
class FileResolver
|
5
5
|
cattr_accessor :alternate_extensions
|
6
|
-
self.alternate_extensions = %w(html txt text haml erb rhtml html.erb html.haml textile markdown email redirect)
|
6
|
+
self.alternate_extensions = %w(htm html txt text xml atom rss rdf haml erb rhtml html.erb html.haml textile markdown email redirect)
|
7
7
|
|
8
8
|
def resolve(root, path)
|
9
9
|
return nil if path.nil?
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Serve #:nodoc:
|
2
|
+
class StaticHandler < FileTypeHandler #:nodoc:
|
3
|
+
extension 'txt', 'text', 'xml', 'atom', 'rss', 'rdf', 'htm', 'html'
|
4
|
+
|
5
|
+
def content_type
|
6
|
+
case File.extname(@script_filename)
|
7
|
+
when '.txt', '.text'
|
8
|
+
'text/plain'
|
9
|
+
when '.xml'
|
10
|
+
'text/xml'
|
11
|
+
when '.atom'
|
12
|
+
'application/atom+xml'
|
13
|
+
when '.rss'
|
14
|
+
'application/rss+xml'
|
15
|
+
when '.rdf'
|
16
|
+
'application/rdf+xml'
|
17
|
+
else
|
18
|
+
'text/html'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 11
|
9
|
-
-
|
10
|
-
version: 0.11.
|
9
|
+
- 5
|
10
|
+
version: 0.11.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John W. Long
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05
|
19
|
+
date: 2010-06-05 00:00:00 -04:00
|
20
20
|
default_executable: serve
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/serve/handlers/markdown_handler.rb
|
94
94
|
- lib/serve/handlers/redirect_handler.rb
|
95
95
|
- lib/serve/handlers/sass_handler.rb
|
96
|
+
- lib/serve/handlers/static_handler.rb
|
96
97
|
- lib/serve/handlers/textile_handler.rb
|
97
98
|
- lib/serve/rack.rb
|
98
99
|
- lib/serve/rails.rb
|