rack-directory-index 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +0 -0
  2. data/lib/rack/directory_index.rb +18 -0
  3. metadata +57 -0
data/README ADDED
File without changes
@@ -0,0 +1,18 @@
1
+ module Rack
2
+ class DirectoryIndex
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+ def call(env)
7
+ index_path = ::File.join(Rails.root, 'public', Rack::Request.new(env).path.split('/'), 'index.html')
8
+
9
+ p index_path
10
+
11
+ if ::File.exists?(index_path)
12
+ return [200, {"Content-Type" => "text/html"}, ::File.read(index_path)]
13
+ else
14
+ @app.call(env)
15
+ end
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-directory-index
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Craig Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-03-23 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: craigmarksmith@hotmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - README
26
+ - lib/rack/directory_index.rb
27
+ has_rdoc: true
28
+ homepage: http://craigmarksmith.com
29
+ licenses: []
30
+
31
+ post_install_message:
32
+ rdoc_options:
33
+ - --main
34
+ - README
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: "0"
42
+ version:
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ requirements: []
50
+
51
+ rubyforge_project:
52
+ rubygems_version: 1.3.5
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Acts like DirectoryIndex is set to index.html for all public folders in Heroku.
56
+ test_files: []
57
+