kiss 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/kiss/rack/file.rb +0 -0
- data/lib/kiss.rb +20 -13
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
File without changes
|
data/lib/kiss.rb
CHANGED
@@ -43,20 +43,16 @@ class Kiss
|
|
43
43
|
autoload :SequelSession, 'kiss/sequel_session'
|
44
44
|
|
45
45
|
attr_reader :action, :action_subdir, :action_path, :extension, :host, :template_dir,
|
46
|
-
:email_template_dir, :upload_dir, :evolution_dir, :public_dir, :params, :args, :db,
|
47
|
-
:login, :request, :environment
|
46
|
+
:email_template_dir, :upload_dir, :evolution_dir, :asset_dir, :public_dir, :params, :args, :db,
|
47
|
+
:login, :request, :environment
|
48
48
|
|
49
49
|
@@default_action = 'index'
|
50
50
|
|
51
51
|
@@cookie_name = 'Kiss'
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
:txt => 'text/plain',
|
57
|
-
:xml => 'application/xml',
|
58
|
-
:doc => 'application/msword',
|
59
|
-
:xls => 'application/application/vnd.ms-excel'
|
53
|
+
# these supplement the mime types from Rack::File
|
54
|
+
@@mime_types = {
|
55
|
+
'rhtml' => 'text/html'
|
60
56
|
}
|
61
57
|
|
62
58
|
# Purposely empty class.
|
@@ -221,10 +217,11 @@ class Kiss
|
|
221
217
|
alias_method :dbm, :models
|
222
218
|
|
223
219
|
# Returns URL/URI of app's static assets (asset_host or public_uri).
|
224
|
-
def
|
225
|
-
@pub ||= @options[:asset_host]
|
220
|
+
def assets(suffix = nil)
|
221
|
+
@pub ||= @options[:asset_host]
|
226
222
|
suffix ? @pub + '/' + suffix : @pub
|
227
223
|
end
|
224
|
+
alias_method :pub, :assets
|
228
225
|
|
229
226
|
# Returns true if specified path is a directory.
|
230
227
|
# Cache result if file_cache_no_reload option is set; otherwise, always check filesystem.
|
@@ -339,7 +336,7 @@ class Kiss
|
|
339
336
|
@action_dir = @options[:action_dir] || 'actions'
|
340
337
|
@template_dir = @options[:template_dir] ? @options[:template_dir] : @action_dir
|
341
338
|
|
342
|
-
@public_dir = @options[:public_dir] || 'public_html'
|
339
|
+
@asset_dir = @public_dir = @options[:asset_dir] || @options[:public_dir] || 'public_html'
|
343
340
|
|
344
341
|
@model_dir = @options[:model_dir] || 'models'
|
345
342
|
@evolution_dir = @options[:evolution_dir] || 'evolutions'
|
@@ -351,6 +348,10 @@ class Kiss
|
|
351
348
|
@default_action = @options[:default_action] || @@default_action
|
352
349
|
@action_root_class = @options[:action_class] || Class.new(Kiss::Action)
|
353
350
|
|
351
|
+
# public_uri: uri of requests to serve from public_dir
|
352
|
+
@asset_uri = @public_uri = @options[:asset_uri] || @options[:public_uri]
|
353
|
+
@rack_file = Rack::File.new(@asset_dir) if @asset_uri
|
354
|
+
|
354
355
|
# include lib dirs
|
355
356
|
$LOAD_PATH.unshift(*( @lib_dirs.flatten.select {|dir| File.directory?(dir) } ))
|
356
357
|
|
@@ -459,6 +460,11 @@ class Kiss
|
|
459
460
|
def call(env)
|
460
461
|
clear_exception_cache
|
461
462
|
|
463
|
+
if (env["PATH_INFO"] == '/favicon.ico') ||
|
464
|
+
(@asset_uri && env["PATH_INFO"].sub!(Regexp.new("\\A#{@asset_uri}"),''))
|
465
|
+
return @rack_file.call(env)
|
466
|
+
end
|
467
|
+
|
462
468
|
check_evolution_number if @db
|
463
469
|
|
464
470
|
@files_cached_this_request = {}
|
@@ -710,7 +716,8 @@ class Kiss
|
|
710
716
|
# Raises Kiss::ActionDone exception to bypass caller stack and return directly
|
711
717
|
# to Kiss#call.
|
712
718
|
def send_response(output = '',options = {})
|
713
|
-
content_type = options[:content_type] || @content_type ||
|
719
|
+
content_type = options[:content_type] || @content_type ||
|
720
|
+
(extension ? Rack::File::MIME_TYPES[extension] || @@mime_types[extension] : nil)
|
714
721
|
document_encoding ||= 'utf-8'
|
715
722
|
|
716
723
|
@response['Content-Type'] = "#{content_type}; #{document_encoding}" if content_type
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shawn Van Ittersum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/kiss/rack/bench.rb
|
68
68
|
- lib/kiss/rack/email_errors.rb
|
69
69
|
- lib/kiss/rack/facebook.rb
|
70
|
+
- lib/kiss/rack/file.rb
|
70
71
|
- lib/kiss/rack/file_not_found.rb
|
71
72
|
- lib/kiss/rack/log_exceptions.rb
|
72
73
|
- lib/kiss/rack/show_debug.rb
|