serve-this 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. data/lib/serve-this.rb +7 -2
  2. metadata +7 -5
data/lib/serve-this.rb CHANGED
@@ -2,7 +2,7 @@ require 'rack'
2
2
 
3
3
  module ServeThis
4
4
 
5
- VERSION = "0.0.5"
5
+ VERSION = "0.0.6"
6
6
 
7
7
  def self.from(root)
8
8
  Rack::Builder.new do
@@ -23,8 +23,11 @@ module ServeThis
23
23
  def initialize(root)
24
24
  @root = root
25
25
  @file_server = ::Rack::File.new(root)
26
+
27
+ res_path = ::File.join(::File.dirname(__FILE__), "..", "res")
28
+ @res_server = ::Rack::File.new(::File.expand_path(res_path))
26
29
  end
27
- attr_reader :root, :file_server
30
+ attr_reader :root, :file_server, :res_server
28
31
 
29
32
  def call(env)
30
33
  path = env["PATH_INFO"]
@@ -36,6 +39,8 @@ module ServeThis
36
39
  # if we are looking at / lets try index.html
37
40
  if path == "/" && exists?("index.html")
38
41
  env["PATH_INFO"] = "/index.html"
42
+ elsif path == "/favicon.ico" && !exists?("favicon.ico")
43
+ return self.res_server.call(env)
39
44
  elsif !exists?(path) && exists?(path+".html")
40
45
  env["PATH_INFO"] += ".html"
41
46
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serve-this
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matthew Rudy Jacobs
@@ -26,10 +26,12 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- hash: 3
29
+ hash: 31
30
30
  segments:
31
+ - 1
32
+ - 2
31
33
  - 0
32
- version: "0"
34
+ version: 1.2.0
33
35
  type: :runtime
34
36
  version_requirements: *id001
35
37
  description: