wunderbar 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/wunderbar/environment.rb +10 -0
- data/lib/wunderbar/rack.rb +14 -1
- data/lib/wunderbar/version.rb +1 -1
- data/wunderbar.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 94fc2b82b048fcdf5561c4764554cabe6a28df63
|
4
|
+
data.tar.gz: 6a16efca47491680cd4330afc8fd0a1e5d8c5da5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52321292277def7fb17d371bad3d593d318a9c61a9880d379fd63c2e8301bc7def79e12c30af35250bad2885aff879ee09510cd9f49089f1910e1cbdc583465f
|
7
|
+
data.tar.gz: 07b8be504eeb533235440be6871d18d438bdb6e79d535ffd0883f98cb12e0df4210760ff62e3a53b25a89fa276f93b7d9464b2aff788c74b9923d77cd5495a5c
|
@@ -47,11 +47,16 @@ module Wunderbar
|
|
47
47
|
end
|
48
48
|
|
49
49
|
@@templates = {}
|
50
|
+
@@files = {}
|
50
51
|
|
51
52
|
def self.templates
|
52
53
|
@@templates
|
53
54
|
end
|
54
55
|
|
56
|
+
def self.files
|
57
|
+
@@files
|
58
|
+
end
|
59
|
+
|
55
60
|
module API
|
56
61
|
def _html(*args, &block)
|
57
62
|
Wunderbar.html(*args, &block)
|
@@ -77,6 +82,11 @@ module Wunderbar
|
|
77
82
|
def _template(name, &block)
|
78
83
|
Wunderbar.templates[name.to_s.gsub('_','-')] = block
|
79
84
|
end
|
85
|
+
|
86
|
+
def _file(name, options={}, &block)
|
87
|
+
options[:source] = block if block
|
88
|
+
Wunderbar.files[name] = options
|
89
|
+
end
|
80
90
|
end
|
81
91
|
|
82
92
|
#
|
data/lib/wunderbar/rack.rb
CHANGED
@@ -9,7 +9,14 @@ module Wunderbar
|
|
9
9
|
@_request = Rack::Request.new(env)
|
10
10
|
@_response = Rack::Response.new
|
11
11
|
Wunderbar.logger = @_request.logger
|
12
|
-
|
12
|
+
file = Wunderbar.files[env['PATH_INFO']]
|
13
|
+
|
14
|
+
if file
|
15
|
+
mime = file[:mime] ||
|
16
|
+
Rack::Mime::MIME_TYPES[File.extname(env['PATH_INFO'])]
|
17
|
+
@_response.set_header('Content-Type', mime) if mime
|
18
|
+
@_response.write(file[:content] || file[:source].call)
|
19
|
+
elsif Wunderbar.safe? and $SAFE==0
|
13
20
|
Proc.new { $SAFE=1; Wunderbar::CGI.call(self) }.call
|
14
21
|
else
|
15
22
|
Wunderbar::CGI.call(self)
|
@@ -43,6 +50,12 @@ module Wunderbar
|
|
43
50
|
def response
|
44
51
|
@_response
|
45
52
|
end
|
53
|
+
|
54
|
+
%w(delete get head options post put trace).each do |http_method|
|
55
|
+
define_method "#{http_method}?" do
|
56
|
+
@_env['REQUEST_METHOD'].to_s.downcase == http_method
|
57
|
+
end
|
58
|
+
end
|
46
59
|
end
|
47
60
|
end
|
48
61
|
|
data/lib/wunderbar/version.rb
CHANGED
data/wunderbar.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: wunderbar 1.3.
|
2
|
+
# stub: wunderbar 1.3.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "wunderbar".freeze
|
6
|
-
s.version = "1.3.
|
6
|
+
s.version = "1.3.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.homepage = "http://github.com/rubys/wunderbar".freeze
|
16
16
|
s.licenses = ["MIT".freeze]
|
17
17
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.3".freeze)
|
18
|
-
s.rubygems_version = "2.
|
18
|
+
s.rubygems_version = "2.5.2.3".freeze
|
19
19
|
s.summary = "HTML Generator and CGI application support".freeze
|
20
20
|
|
21
21
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
109
|
+
rubygems_version: 2.5.2.3
|
110
110
|
signing_key:
|
111
111
|
specification_version: 4
|
112
112
|
summary: HTML Generator and CGI application support
|