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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04e4d77dd4f0c389084731a11677f20d1642110c
|
4
|
+
data.tar.gz: 73de158010b2874fcfe05aaf97124a5d74242c05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1466a5835767aa9c31ade8afa89fd04d5a28e78550f95ca70d086344adc756a6df54c362cc5f90da04ca05728b56f13d62251344f68c924eae01f3f48d8f8195
|
7
|
+
data.tar.gz: ed032ac4752e3c61567126a501b9b012be88c8e77aa3d0deffb76e4760ca352d7ce97fa15ddc5c74d11a69b71aef8640cf63c6177ad37ffaf1333f51ad8dc65d
|
@@ -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]
|
data/config/routes.rb
CHANGED
@@ -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/
|
4
|
+
get 'status', to: 'wallaby/application#healthy'
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
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
|
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
|
-
|
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
|
data/lib/wallaby/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap-sass
|