clay 1.5 → 1.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 (3) hide show
  1. data/src/clay.rb +1 -1
  2. data/src/rack/clay.rb +5 -9
  3. metadata +3 -3
@@ -6,7 +6,7 @@ require 'fileutils'
6
6
  require 'yaml'
7
7
 
8
8
  module Clay
9
- VERSION = "1.5"
9
+ VERSION = "1.6"
10
10
 
11
11
  def self.init project_name
12
12
  puts "Creating the folder structure... "
@@ -33,13 +33,14 @@ module Rack
33
33
  request = Request.new(env)
34
34
  path_info = request.path_info
35
35
  @files = ::Dir[@path + "/**/*"].inspect
36
+ path_info += ".html" if @files.include?(path_info+".html")
36
37
  if @files.include?(path_info)
37
38
  if path_info =~ /(\/?)$/
38
39
  if @mimes.collect {|regex| path_info =~ regex }.compact.empty?
39
40
  path_info += $1.nil? ? "/index.html" : "index.html"
40
41
  end
41
42
  end
42
- mime = mime(path_info)
43
+ mime_type = mime(path_info)
43
44
 
44
45
  file = file_info(@path + path_info)
45
46
  body = file[:body]
@@ -48,17 +49,12 @@ module Rack
48
49
  if time == request.env['HTTP_IF_MODIFIED_SINCE']
49
50
  [304, {'Last-Modified' => time}, []]
50
51
  else
51
- [200, {"Content-Type" => mime, "Content-length" => body.length.to_s, 'Last-Modified' => time}, [body]]
52
+ [200, {"Content-Type" => mime_type, "Content-length" => body.length.to_s, 'Last-Modified' => time}, [body]]
52
53
  end
53
-
54
54
  else
55
55
  status, body, path_info = ::File.exist?(@path+"/404.html") ? [404,file_info(@path+"/404.html")[:body],"404.html"] : [404,"Not found","404.html"]
56
- mime = mime(path_info)
57
- if !@compiling
58
- [status, {"Content-Type" => mime, "Content-length" => body.length.to_s}, [body]]
59
- else
60
- [200, {"Content-Type" => "text/plain"}, ["This site is currently generating pages. Please reload this page after 10 secs."]]
61
- end
56
+ mime_type = mime(path_info)
57
+ [status, {"Content-Type" => mime_type, "Content-length" => body.length.to_s}, [body]]
62
58
  end
63
59
  end
64
60
 
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clay
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 5
9
- version: "1.5"
8
+ - 6
9
+ version: "1.6"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pavlo Kerestey