rapporteur 3.2.0 → 3.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 633181a4b53c700cdd2d1c2c0f8a9f6a5f08acda
4
- data.tar.gz: 7b29ca2a1e7c9a57424d246ff8c4aa48732cabce
3
+ metadata.gz: 1c09441f5790264d6bac686e7995dfd8de5e5eec
4
+ data.tar.gz: 0271da9fe733c0114ef50aecedfce99b72c7ed94
5
5
  SHA512:
6
- metadata.gz: 8641338d699725b6612887fa2a3b2cd5b8d3d0b76f66b6e28e0f8960356d3bf674422f1056224fba79d41c877abace918c183e53fe7fc9286350bef659edb659
7
- data.tar.gz: ddf0fe2836eb103f1a0af23d039df8a0fb66eec99fd6d01d66b5589de23526569db5d8c561bce60f1c636633e726fe3afe2c46d2c147b242a932d64a9ade2023
6
+ metadata.gz: 1428b9ee37335136b8751cf828c8de25837b4a903fe875c5b33d1540125b8f42b754d9716391d74218a780d7b6cd99550756747c24ff90fe65d40f240f6d3887
7
+ data.tar.gz: 8900d3c79a3787acdbaeb997af7f05cfcd3e516c5967d1bae3f90aa0bdf287137bd31bb8e02aa1df0e9fc0b286ba4dc0fe82fedd71b5b5f48ff12c38a7a3e7fb
data/.travis.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
+ cache:
3
+ directories:
4
+ - vendor/bundle
2
5
  rvm:
3
6
  - 1.9.3
4
- - 2.1.2
7
+ - 2.1.5
5
8
  - jruby-19mode
6
9
  gemfile:
7
10
  - gemfiles/rails3.2.gemfile
@@ -9,8 +12,3 @@ gemfile:
9
12
  - gemfiles/sinatra1.x.gemfile
10
13
  notifications:
11
14
  email: false
12
- campfire:
13
- on_success: change
14
- on_failure: always
15
- rooms:
16
- - secure: "gxEt3SeVn1kup6PfB6hiQu6eWsefmMEdd8U1qPSS6vlRjsM7Xy2IrXdz9gdl\n0nrrRgESvOxT3sqMh4/opH6M1kbtCyl3M0yvjF2QUtjWQ+4BStJGhNyXlDTp\nNAas19fuEUPBNxNqoy7aTVBiFpQRs0NisEZTS3+N3eA2tz757Qk="
data/CHANGELOG.md CHANGED
@@ -10,6 +10,17 @@
10
10
 
11
11
  * No significant changes.
12
12
 
13
+ ## [3.3.0][v3.3.0] / 2015-02-03
14
+
15
+ * Remove the customized Rapporteur::Responder (an ActionController::Responder)
16
+ since responders were removed from Rails core in version 4.2 and inline the
17
+ logic into the StatusesController.
18
+ * Register Rapporteur::Engine routes for Rails 4.2 support.
19
+ * Auto-mount the engine routes and force definition of an application `status`
20
+ route for backward compatibility. Otherwise, developers would seemingly need
21
+ to either manually mount the engine or define an application-level named
22
+ route for the status endpoint.
23
+
13
24
  ## [3.2.0][v3.2.0] / 2015-02-02
14
25
 
15
26
  * Update the Rails route definition to force (and default) a JSON format. The
@@ -105,7 +116,8 @@
105
116
  * Initial public release.
106
117
 
107
118
 
108
- [unreleased]: https://github.com/codeschool/rapporteur/compare/v3.2.0...master
119
+ [unreleased]: https://github.com/codeschool/rapporteur/compare/v3.3.0...master
120
+ [v3.3.0]: https://github.com/codeschool/rapporteur/compare/v3.2.0...v3.3.0
109
121
  [v3.2.0]: https://github.com/codeschool/rapporteur/compare/v3.1.0...v3.2.0
110
122
  [v3.1.0]: https://github.com/codeschool/rapporteur/compare/v3.0.2...v3.1.0
111
123
  [v3.0.2]: https://github.com/codeschool/rapporteur/compare/v3.0.1...v3.0.2
data/README.md CHANGED
@@ -22,7 +22,7 @@ the current application Git revision and server time:
22
22
  ```
23
23
 
24
24
  When an application validation fails, an HTTP 500 response is returned with a
25
- collection of error messages, similar to the default Rails responders for model
25
+ collection of error messages, similar to the Rails < 4.2 responders for model
26
26
  validations:
27
27
 
28
28
  ```json
@@ -1,8 +1,23 @@
1
1
  class StatusesController < ActionController::Base
2
- self.responder = Rapporteur::Responder
3
- respond_to :json
4
-
5
2
  def show
6
- respond_with(Rapporteur.run)
3
+ respond_to do |format|
4
+ format.json do
5
+ resource = Rapporteur.run
6
+
7
+ if resource.errors.empty?
8
+ render({:json => resource})
9
+ else
10
+ display_errors(resource, :json)
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+
17
+ private
18
+
19
+
20
+ def display_errors(resource, format)
21
+ render({format => {:errors => resource.errors}, :status => :internal_server_error})
7
22
  end
8
23
  end
data/config/routes.rb CHANGED
@@ -1,3 +1,20 @@
1
+ Rapporteur::Engine.routes.draw do
2
+ get("status.:format", {
3
+ :as => :status,
4
+ :constraints => {:format => "json"},
5
+ :defaults => {:format => "json"},
6
+ :to => "statuses#show"
7
+ })
8
+ end
9
+
1
10
  Rails.application.routes.draw do
2
- get 'status.:format', :to => 'statuses#show', :defaults => {:format => 'json'}, :constraints => {:format => 'json'}, :as => :status
11
+ unless Rails.application.routes.named_routes.routes[:status]
12
+ mount Rapporteur::Engine => "/"
13
+ get("/status.:format", {
14
+ :as => :status,
15
+ :constraints => {:format => "json"},
16
+ :defaults => {:format => "json"},
17
+ :to => "statuses#show"
18
+ })
19
+ end
3
20
  end
@@ -163,8 +163,7 @@ module Rapporteur
163
163
  end
164
164
 
165
165
  ##
166
- # Internal: Used by Rails' JSON serialization, specifically in
167
- # ActionController::Responder.
166
+ # Internal: Used by Rails' JSON serialization.
168
167
  #
169
168
  def read_attribute_for_serialization(key)
170
169
  @messages[key]
@@ -1,3 +1,3 @@
1
1
  module Rapporteur
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
3
3
  end
data/lib/rapporteur.rb CHANGED
@@ -10,7 +10,6 @@ module Rapporteur
10
10
  autoload :CheckerDeprecations, 'rapporteur/checker_deprecations'
11
11
  autoload :Checks, 'rapporteur/checks'
12
12
  autoload :MessageList, 'rapporteur/message_list'
13
- autoload :Responder, 'rapporteur/responder'
14
13
  autoload :Revision, 'rapporteur/revision'
15
14
 
16
15
 
data/rapporteur.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "appraisal", "~> 1.0"
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "combustion", "~> 0.5", ">= 0.5.1"
26
- spec.add_development_dependency "rails", ">= 3.1", "< 4.2"
26
+ spec.add_development_dependency "rails", ">= 3.1", "< 4.3"
27
27
  spec.add_development_dependency "rspec-rails", "~> 3.0"
28
28
  spec.add_development_dependency "rspec-collection_matchers", "~> 1.0"
29
29
  end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper.rb'
2
2
 
3
- describe "status routes", :type => :routing do
3
+ describe "status route", :type => :routing do
4
4
  it 'routes /status.json to statuses#show' do
5
5
  expect({ :get => '/status.json'}).to route_to({
6
6
  :action => 'show',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapporteur
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Envy Labs
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-02 00:00:00.000000000 Z
12
+ date: 2015-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
@@ -82,7 +82,7 @@ dependencies:
82
82
  version: '3.1'
83
83
  - - "<"
84
84
  - !ruby/object:Gem::Version
85
- version: '4.2'
85
+ version: '4.3'
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -92,7 +92,7 @@ dependencies:
92
92
  version: '3.1'
93
93
  - - "<"
94
94
  - !ruby/object:Gem::Version
95
- version: '4.2'
95
+ version: '4.3'
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: rspec-rails
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -152,7 +152,6 @@ files:
152
152
  - lib/rapporteur/checks/active_record_check.rb
153
153
  - lib/rapporteur/engine.rb
154
154
  - lib/rapporteur/message_list.rb
155
- - lib/rapporteur/responder.rb
156
155
  - lib/rapporteur/revision.rb
157
156
  - lib/rapporteur/rspec.rb
158
157
  - lib/rapporteur/rspec3.rb
@@ -194,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
193
  version: '0'
195
194
  requirements: []
196
195
  rubyforge_project:
197
- rubygems_version: 2.4.2
196
+ rubygems_version: 2.4.5
198
197
  signing_key:
199
198
  specification_version: 4
200
199
  summary: An engine that provides common status polling endpoint.
@@ -1,32 +0,0 @@
1
- module Rapporteur
2
- # A customization of the default Rails ActionController::Responder.
3
- # Primarily, this is used to smooth out the differences between Rails
4
- # responder versions and allow for error messages in GET requests.
5
- #
6
- class Responder < ActionController::Responder
7
- # Internal: Overrides the default behavior by ignoring the HTTP verb and
8
- # always responding with errors if the rendering resource contains errors.
9
- #
10
- def to_format
11
- if has_errors?
12
- display_errors
13
- else
14
- super
15
- end
16
- end
17
-
18
-
19
- protected
20
-
21
-
22
- if Rails::VERSION::MAJOR == 3 && Rails::VERSION::MINOR == 1
23
- def display_errors
24
- controller.render format => {:errors => resource.errors}, :status => :internal_server_error
25
- end
26
- else
27
- def display_errors
28
- controller.render format => resource_errors, :status => :internal_server_error
29
- end
30
- end
31
- end
32
- end