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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: a7f6f11a34c8540709e572a829025fd0d28e8522d9882d336e842caafe91c9f2
4
- data.tar.gz: 57a8d1338c347dacc8beea0ffbf5de77181f88cb5f472ce6078a4e18ae14a08c
2
+ SHA1:
3
+ metadata.gz: 94fc2b82b048fcdf5561c4764554cabe6a28df63
4
+ data.tar.gz: 6a16efca47491680cd4330afc8fd0a1e5d8c5da5
5
5
  SHA512:
6
- metadata.gz: 59c38775e59733f8255c29f251cdd6770084517913c0b10fceb3eb809301ddf4487ba01c6b831109fd5d516fdb816ef3ba64729da86b1a0c29d3f5f3e1cd9d82
7
- data.tar.gz: b0b57ca9a258115bb3eb1edb4aaf2df2eee16cbb0229e20f497f70734741e116c21fc045a55fe6bc9e1b04f8f87acd29625f50c061dcdf30840b889435ffdce9
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
  #
@@ -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
- if Wunderbar.safe? and $SAFE==0
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
 
@@ -2,7 +2,7 @@ module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 3
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/wunderbar.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: wunderbar 1.3.0 ruby lib
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.0"
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.7.6".freeze
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.0
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.7.6
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