wallaby 5.1.6 → 5.1.7

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: ad9fb3be960036fe7cb2726cd9fd30a9ee111aaa
4
- data.tar.gz: f49cb2db9f22cfb9022624b30f0a718fabd2e93e
3
+ metadata.gz: 04e4d77dd4f0c389084731a11677f20d1642110c
4
+ data.tar.gz: 73de158010b2874fcfe05aaf97124a5d74242c05
5
5
  SHA512:
6
- metadata.gz: 54a406b351d36c99269a644db761d88198379204832ab17aef026353d5b0f06d6ec0f3ca63290f23cb5fda5e1d68adca32ee9a63c146db5b1bfcef3d8ed28cf2
7
- data.tar.gz: 0c5011125fc765c9a1d1a8b064cc1cf9665f220df1130232f6b8ee6cad3cbb928ecbedeff1ded060943a144421ec6aaf222d60b8b7ce12335f5c0703cddaaa39
6
+ metadata.gz: 1466a5835767aa9c31ade8afa89fd04d5a28e78550f95ca70d086344adc756a6df54c362cc5f90da04ca05728b56f13d62251344f68c924eae01f3f48d8f8195
7
+ data.tar.gz: ed032ac4752e3c61567126a501b9b012be88c8e77aa3d0deffb76e4760ca352d7ce97fa15ddc5c74d11a69b71aef8640cf63c6177ad37ffaf1333f51ad8dc65d
@@ -15,6 +15,11 @@ module Wallaby
15
15
 
16
16
  layout 'wallaby/application'
17
17
 
18
+ # Health check page
19
+ def healthy
20
+ render plain: 'healthy'
21
+ end
22
+
18
23
  # Not found page
19
24
  # @param exception [Exception]
20
25
  def not_found(exception = nil)
@@ -8,11 +8,6 @@ module Wallaby
8
8
 
9
9
  before_action :authenticate_user!, except: [:status]
10
10
 
11
- # Health check page
12
- def healthy
13
- render plain: 'healthy'
14
- end
15
-
16
11
  # @return [String] the resources name coming from params
17
12
  def current_resources_name
18
13
  @current_resources_name ||= params[:resources]
@@ -1,23 +1,21 @@
1
1
  Wallaby::Engine.routes.draw do
2
- root to: 'wallaby/resources#home'
3
-
4
2
  # NOTE: For health check if needed
5
3
  # @see Wallaby::BaseController#healthy
6
- get 'status', to: 'wallaby/resources#healthy'
4
+ get 'status', to: 'wallaby/application#healthy'
7
5
 
8
- # To generate error pages for all HTTP status
9
- Wallaby::ERRORS.each do |status|
10
- code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status]
11
- get status, to: "wallaby/resources##{status}"
12
- get code.to_s, to: "wallaby/resources##{status}"
13
- end
6
+ with_options to: Wallaby::ResourcesRouter.new do |route|
7
+ route.root defaults: { action: 'home' }
8
+
9
+ # To generate error pages for all supported HTTP status
10
+ Wallaby::ERRORS.each do |status|
11
+ code = Rack::Utils::SYMBOL_TO_STATUS_CODE[status]
12
+ route.get status, defaults: { action: status }
13
+ route.get code.to_s, defaults: { action: status }
14
+ end
14
15
 
15
- # This is to pass :resources and :action params onto
16
- # `Wallaby::ResourcesRouter`.
17
- # So that it could handle the request dispatching.
18
- # Currently, it has implemented general CRUD resourceful routes
19
- scope path: ':resources' do
20
- with_options to: Wallaby::ResourcesRouter.new do |route|
16
+ # To generate general CRUD resourceful routes
17
+ # @see Wallaby::ResourcesRouter
18
+ scope path: ':resources' do
21
19
  # @see Wallaby::AbstractResourcesController#index
22
20
  route.get '', defaults: { action: 'index' }, as: :resources
23
21
  # @see Wallaby::AbstractResourcesController#new
@@ -10,13 +10,13 @@ module Wallaby
10
10
  # @param env [Hash] @see http://www.rubydoc.info/github/rack/rack/master/file/SPEC
11
11
  def call(env)
12
12
  params = env[ActionDispatch::Http::Parameters::PARAMETERS_KEY]
13
- controller = find_controller_by params[:resources]
13
+ controller = find_controller_by(params[:resources]) || default_controller
14
14
  params[:action] = find_action_by params
15
15
 
16
16
  controller.action(params[:action]).call env
17
17
  rescue ::AbstractController::ActionNotFound, ModelNotFound => e
18
18
  params[:error] = e
19
- ResourcesController.action(:not_found).call env
19
+ default_controller.action(:not_found).call env
20
20
  end
21
21
 
22
22
  private
@@ -35,5 +35,11 @@ module Wallaby
35
35
  # @see Wallaby::Engine.routes
36
36
  (params.delete(:defaults) || params)[:action]
37
37
  end
38
+
39
+ # TODO: change to reflect the mount path changes
40
+ # @return [Class] controller class from configuration
41
+ def default_controller
42
+ Wallaby.configuration.mapping.resources_controller
43
+ end
38
44
  end
39
45
  end
@@ -1,3 +1,3 @@
1
1
  module Wallaby
2
- VERSION = '5.1.6'.freeze
2
+ VERSION = '5.1.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wallaby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.6
4
+ version: 5.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tianwen Chen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-13 00:00:00.000000000 Z
11
+ date: 2018-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootstrap-sass