proxy_stack 0.1.0 → 0.2.0

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.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 <YOUR NAME HERE>
1
+ Copyright (c) 2009 Daniel Neighman & Lincoln Stoll
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README CHANGED
@@ -4,4 +4,4 @@ Description goes here.
4
4
 
5
5
  == Copyright
6
6
 
7
- Copyright (c) 2009 <YOUR NAME HERE>. See LICENSE for details.
7
+ Copyright (c) 2009 Daniel Neighman & Lincoln Stoll. See LICENSE for details.
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  gem.email = "has.sox@gmail.com"
11
11
  gem.homepage = "http://github.com/hassox/proxy_stack"
12
12
  gem.authors = ["Daniel Neighman", "Lincoln Stoll"]
13
- gem.add_dependency "pancake", ">=0.1.24"
13
+ gem.add_dependency "pancake", ">=0.1.25"
14
14
  gem.files = FileList["[A-Z]*", "pancake.init", "{lib,spec,rails}/**/*"]
15
15
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
16
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -66,6 +66,35 @@ class ProxyStack
66
66
  @before_proxy = []
67
67
  @after_proxy = []
68
68
 
69
+ def proxy_request
70
+ execute_blocks!(self.class.before_proxy)
71
+ @proxy_result = proxy_request!
72
+ execute_blocks!(self.class.after_proxy)
73
+ @proxy_result
74
+ end
75
+
76
+ def dispatch!
77
+ begin
78
+ result = super
79
+ if result[0] == 404
80
+ Rack::Response.new(proxy_request, status, headers).finish
81
+ else
82
+ result
83
+ end
84
+ rescue Pancake::Errors::NotFound
85
+ Rack::Response.new(proxy_request, status, headers).finish
86
+ end
87
+ end
88
+
89
+ def log_http_error?(error)
90
+ case error
91
+ when Pancake::Errors::NotFound
92
+ false
93
+ else
94
+ true
95
+ end
96
+ end
97
+
69
98
  private
70
99
  def execute_blocks!(blks)
71
100
  blks.each{|b| instance_eval(&b)}
@@ -75,13 +104,5 @@ class ProxyStack
75
104
  @proxy_result
76
105
  end
77
106
  end
78
-
79
- publish :provides => [:any]
80
- any "{.*}" do
81
- execute_blocks!(self.class.before_proxy)
82
- @proxy_result = proxy_request!
83
- execute_blocks!(self.class.after_proxy)
84
- @proxy_result
85
- end
86
107
  end
87
108
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxy_stack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-22 00:00:00 +11:00
13
+ date: 2009-11-23 00:00:00 +11:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 0.1.24
24
+ version: 0.1.25
25
25
  version:
26
26
  description:
27
27
  email: has.sox@gmail.com