rack-golem 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rack/golem.rb CHANGED
@@ -49,16 +49,18 @@ module Rack::Golem
49
49
  def call(env); dup.call!(env); end
50
50
 
51
51
  def call!(env)
52
- @r = ::Rack::Request.new(env)
53
- @res = ::Rack::Response.new
54
- @session = env['rack.session'] || {}
55
- begin
56
- instance_eval(&self.class.dispatcher_block)
57
- rescue => e
58
- raise if DEV_ENV.include?(ENV['RACK_ENV'])
59
- @res.write(self.__send__('error', e, @path_atoms))
60
- end
61
- @res.status==404&&!@app.nil? ? @app.call(env) : @res.finish
52
+ catch(:response) {
53
+ @r = ::Rack::Request.new(env)
54
+ @res = ::Rack::Response.new
55
+ @session = env['rack.session'] || {}
56
+ begin
57
+ instance_eval(&self.class.dispatcher_block)
58
+ rescue => e
59
+ raise if DEV_ENV.include?(ENV['RACK_ENV'])
60
+ @res.write(self.__send__('error', e, @path_atoms))
61
+ end
62
+ @res.status==404&&!@app.nil? ? @app.call(env) : @res.finish
63
+ }
62
64
  end
63
65
 
64
66
  def not_found(*args)
data/rack-golem.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rack-golem'
3
- s.version = "0.0.4"
3
+ s.version = "0.1.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.summary = "A Controller middleware that is euh... basic"
6
6
  s.description = "A Controller middleware that is euh... basic. I would say it is a sort of Ramaze for kids"
data/test/spec_golem.rb CHANGED
@@ -22,6 +22,10 @@ class Basic
22
22
  def no_arg; 'nothing'; end
23
23
  def with_args(a,b); '%s+%s' % [a,b]; end
24
24
  def splat_arg(*a); a.join('+'); end
25
+ def test_throw
26
+ throw :response, [200,{'Content-Type'=>'text/html'},['Growl']]
27
+ 'Grrr'
28
+ end
25
29
  private
26
30
  def no_way; 'This is private'; end
27
31
  end
@@ -156,4 +160,8 @@ describe "Golem" do
156
160
  res_2.body.should=='ichigo'
157
161
  end
158
162
 
163
+ it "Should catch :response if needed" do
164
+ BasicR.get('/test_throw').body.should=='Growl'
165
+ end
166
+
159
167
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-golem
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 4
10
- version: 0.0.4
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mickael Riga
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-20 00:00:00 Z
18
+ date: 2012-03-30 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: tilt