wd_sinatra 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Weasel Diesel Sinatra Changelog
2
2
 
3
+ ## 0.3.2
4
+ * Removed `post_dispatch_hook` since it doesn't work well with `halt`
5
+ and file responses. Use Sinatra's `after` filter instead.
6
+ * Fixed a bug with `params_postprocessor_hook`.
7
+ * Added a 'wd.service' entry to `env` that points to the dispatched
8
+ service.
9
+
3
10
  ## 0.3.1
4
11
 
5
12
  * Added `post_dispatch_hook`.
data/README.md CHANGED
@@ -174,7 +174,6 @@ The request dispatcher offers a fews hooks which you can see demonstrated in
174
174
  * `params_postprocessor_hook(params)`
175
175
  * `params_exception_handler(exception)`
176
176
  * `pre_dispatch_hook`
177
- * `post_dispatch_hook(response)`
178
177
 
179
178
  The two first hooks are used to process the params and when implemented
180
179
  are expected to return the params that will be used in the request.
@@ -67,7 +67,7 @@ class WeaselDiesel
67
67
  @params = (processed_params || app.params)
68
68
  @params = params_preprocessor_hook(@params) if self.respond_to?(:params_preprocessor_hook)
69
69
  @params = ParamsVerification.validate!(@params, service.defined_params)
70
- @params = params_postrocessor_hook(@params) if self.respond_to?(:params_postprocessor_hook)
70
+ @params = params_postprocessor_hook(@params) if self.respond_to?(:params_postprocessor_hook)
71
71
  rescue Exception => e
72
72
  LOGGER.error e.message
73
73
  LOGGER.error "passed params: #{app.params.inspect}"
@@ -79,13 +79,7 @@ class WeaselDiesel
79
79
  end
80
80
 
81
81
  pre_dispatch_hook if self.respond_to?(:pre_dispatch_hook)
82
- if self.respond_to?(:post_dispatch_hook)
83
- body = service_dispatch
84
- post_dispatch_hook
85
- body
86
- else
87
- service_dispatch
88
- end
82
+ service_dispatch
89
83
  end
90
84
 
91
85
  # Forwarding some methods to the underlying app object
@@ -117,6 +111,7 @@ class WeaselDiesel
117
111
  # Note that we are using a private API to define the route and that unlike sinatra usual DSL
118
112
  # we do NOT define a HEAD route for every GET route.
119
113
  Sinatra::Base.send(:route, upcase_verb, "/#{self.url}") do
114
+ env['wd.service'] = service
120
115
  service.handler.dispatch(self)
121
116
  end
122
117
 
@@ -1,5 +1,5 @@
1
1
  module WD
2
2
  module Sinatra
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -66,7 +66,7 @@ module WDSinatraHooks
66
66
  halt 403 # protect by default
67
67
  end
68
68
  end
69
- #
69
+
70
70
  #########################################
71
71
 
72
72
  # AUTHENTICATION
metadata CHANGED
@@ -1,61 +1,47 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: wd_sinatra
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 1
10
- version: 0.3.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Matt Aimonetti
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-06-28 00:00:00 -07:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: weasel_diesel
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70164648069100 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: thor
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70164648069100
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70164648068640 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
47
33
  type: :runtime
48
- version_requirements: *id002
49
- description: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL
50
- email:
34
+ prerelease: false
35
+ version_requirements: *70164648068640
36
+ description: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra
37
+ apps using the Weasel Diesel DSL
38
+ email:
51
39
  - mattaimonetti@gmail.com
52
- executables:
40
+ executables:
53
41
  - wd_sinatra
54
42
  extensions: []
55
-
56
43
  extra_rdoc_files: []
57
-
58
- files:
44
+ files:
59
45
  - .gitignore
60
46
  - CHANGELOG.md
61
47
  - Gemfile
@@ -146,39 +132,29 @@ files:
146
132
  - templates/test/integration/hello_world_test.rb
147
133
  - templates/test/test_helpers.rb
148
134
  - wd-sinatra.gemspec
149
- has_rdoc: true
150
135
  homepage: https://github.com/mattetti/wd-sinatra
151
136
  licenses: []
152
-
153
137
  post_install_message:
154
138
  rdoc_options: []
155
-
156
- require_paths:
139
+ require_paths:
157
140
  - lib
158
- required_ruby_version: !ruby/object:Gem::Requirement
141
+ required_ruby_version: !ruby/object:Gem::Requirement
159
142
  none: false
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- hash: 3
164
- segments:
165
- - 0
166
- version: "0"
167
- required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
148
  none: false
169
- requirements:
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- hash: 3
173
- segments:
174
- - 0
175
- version: "0"
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
176
153
  requirements: []
177
-
178
154
  rubyforge_project:
179
- rubygems_version: 1.5.3
155
+ rubygems_version: 1.8.16
180
156
  signing_key:
181
157
  specification_version: 3
182
- summary: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL
158
+ summary: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps
159
+ using the Weasel Diesel DSL
183
160
  test_files: []
184
-