wd_sinatra 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Weasel Diesel Sinatra Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ * Added `post_dispatch_hook`.
6
+ * Fixed a few default settings.
7
+
3
8
  ## 0.3.0
4
9
 
5
10
  * Added a service generator using thor. `$ thor :service get /foo/bar foo_bar.rb` (Thanks DrNic)
data/README.md CHANGED
@@ -174,6 +174,7 @@ 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)`
177
178
 
178
179
  The two first hooks are used to process the params and when implemented
179
180
  are expected to return the params that will be used in the request.
@@ -186,6 +187,9 @@ The `pre_dispatch_hook` is called just before the request is dispatched
186
187
  to the service implementation. This is where you might want to implement
187
188
  an authentication verification system for instance.
188
189
 
190
+ The `post_dispatch_hook` is called, as you might have guessed it, after
191
+ the response is dispatched but before it gets sent back to the client.
192
+
189
193
  These hooks have access to the entire request context, including the
190
194
  `service` being called. You can use the service `extra` option to set
191
195
  some custom settings that can then be used in this pre dispatch hook.
@@ -78,10 +78,14 @@ class WeaselDiesel
78
78
  end
79
79
  end
80
80
 
81
- # Define WeaselDiesel::RequestHandler#authorization_check in your app if
82
- # you want to use an auth check.
83
81
  pre_dispatch_hook if self.respond_to?(:pre_dispatch_hook)
84
- service_dispatch
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
85
89
  end
86
90
 
87
91
  # Forwarding some methods to the underlying app object
@@ -1,5 +1,5 @@
1
1
  module WD
2
2
  module Sinatra
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
data/templates/Gemfile CHANGED
@@ -7,12 +7,10 @@ gem "weasel_diesel"
7
7
  gem "wd_sinatra"
8
8
  # gem 'wd_newrelic_rpm', :require => 'newrelic_rpm'
9
9
 
10
- if RUBY_VERSION =~ /1.8/
11
- gem 'backports', '2.3.0'
12
- gem 'json'
13
- end
10
+ gem 'backports', '2.3.0', :platform => 'ruby_18'
11
+ gem 'json', :platform => 'ruby_18'
14
12
 
15
- if ENV['RACK_ENV'] != "production"
13
+ group :development, :test do
16
14
  gem "rack-test", "0.6.1"
17
15
  # gem "foreman"
18
16
  # gem "puma"
@@ -1,2 +1,3 @@
1
1
  require 'logger'
2
+ LOGGER = Logger.new($stdout)
2
3
  LOGGER.level = Logger::INFO
data/wd-sinatra.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["mattaimonetti@gmail.com"]
7
7
  gem.description = %q{Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL}
8
8
  gem.summary = %q{Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL}
9
- gem.homepage = "https://github.com/mattetti/wd_sinatra"
9
+ gem.homepage = "https://github.com/mattetti/wd-sinatra"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wd_sinatra
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 0
10
- version: 0.3.0
9
+ - 1
10
+ version: 0.3.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Aimonetti
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-20 00:00:00 Z
18
+ date: 2012-06-28 00:00:00 -07:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: weasel_diesel
@@ -75,7 +76,7 @@ files:
75
76
  - templates/api/hello_world.rb
76
77
  - templates/bin/console
77
78
  - templates/config.ru
78
- - templates/config/airbrake.yml
79
+ - templates/config/airbrake.yml.sample
79
80
  - templates/config/environments/default.rb
80
81
  - templates/config/environments/production.rb
81
82
  - templates/config/environments/test.rb
@@ -145,7 +146,8 @@ files:
145
146
  - templates/test/integration/hello_world_test.rb
146
147
  - templates/test/test_helpers.rb
147
148
  - wd-sinatra.gemspec
148
- homepage: https://github.com/mattetti/wd_sinatra
149
+ has_rdoc: true
150
+ homepage: https://github.com/mattetti/wd-sinatra
149
151
  licenses: []
150
152
 
151
153
  post_install_message:
@@ -174,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
176
  requirements: []
175
177
 
176
178
  rubyforge_project:
177
- rubygems_version: 1.8.18
179
+ rubygems_version: 1.5.3
178
180
  signing_key:
179
181
  specification_version: 3
180
182
  summary: Weasel-Diesel Sinatra app gem, allowing you to generate/update sinatra apps using the Weasel Diesel DSL