rackstep 0.0.10 → 0.1.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 +4 -4
- data/lib/rackstep.rb +2 -7
- data/lib/response.rb +1 -7
- data/lib/router.rb +0 -2
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3bd8c6f8ae9cfc317f6e11a402fc5e7c8985ee3ae3da9220692b5c1692a824c0
|
|
4
|
+
data.tar.gz: 4ec4e2332cebf4cf17cc6a264d531046103d762fad1d7b321fe8efa1a4e5b701
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 948dfff37ff4b6e906b746773c0574249feef96051feb643f3fff8bac17dfa649c95a7fe5bf3f4b2e487953face7754277d51842d69d73280c7b9f283863958d
|
|
7
|
+
data.tar.gz: 060c21a1a5448761d42f22f956a545aedaf5978225516ea478236af6cebef60367b74327904b8c8412205912666646a146ae539cf9706343f64de09904e4b30f
|
data/lib/rackstep.rb
CHANGED
|
@@ -27,7 +27,8 @@ module RackStep
|
|
|
27
27
|
|
|
28
28
|
# Static method called from config.ru ("run App").
|
|
29
29
|
def self.call(env)
|
|
30
|
-
new(env).process_request
|
|
30
|
+
response = new(env).process_request
|
|
31
|
+
return response.status, response.headers, response.body
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
# Initialize the request instance variable and add a default "not found" route.
|
|
@@ -47,17 +48,11 @@ module RackStep
|
|
|
47
48
|
# is responsable to find, based on the given path and http verb,
|
|
48
49
|
# the apropriate controller to handle the request.
|
|
49
50
|
route = router.find_route_for(path, verb)
|
|
50
|
-
# Initialize the correspondent controller.
|
|
51
51
|
controller = route.controller.new
|
|
52
|
-
# Inject the request into the controller.
|
|
53
52
|
controller.request = request
|
|
54
|
-
# Execute the before method of this controller.
|
|
55
53
|
controller.send(:before)
|
|
56
|
-
# Execute the apropriate method/action.
|
|
57
54
|
controller.send(:process_request)
|
|
58
|
-
# Execute the after method of this controller.
|
|
59
55
|
controller.send(:after)
|
|
60
|
-
# Get from the controller what is the response for this request.
|
|
61
56
|
response = controller.response
|
|
62
57
|
|
|
63
58
|
return response
|
data/lib/response.rb
CHANGED
|
@@ -10,25 +10,19 @@ module RackStep
|
|
|
10
10
|
# necessary.
|
|
11
11
|
def body=(value)
|
|
12
12
|
if value.is_a?(String)
|
|
13
|
-
# Convert it to an array.
|
|
14
13
|
value = [value]
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
super(value)
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
#
|
|
19
|
+
# Helpers
|
|
21
20
|
def content_type
|
|
22
21
|
header['Content-Type']
|
|
23
22
|
end
|
|
24
|
-
|
|
25
|
-
# Just a helper to set the content type on the response header.
|
|
26
23
|
def content_type=(value)
|
|
27
24
|
header['Content-Type'] = value
|
|
28
25
|
end
|
|
29
|
-
|
|
30
|
-
# A helper for redirecting to another adddress.
|
|
31
|
-
# Will send back a 302 status code.
|
|
32
26
|
def redirect_to(address)
|
|
33
27
|
@status = 302
|
|
34
28
|
header['Location'] = address
|
data/lib/router.rb
CHANGED
|
@@ -32,9 +32,7 @@ module RackStep
|
|
|
32
32
|
# 'http//localhost/' will be the same of 'http://localhost' (both will
|
|
33
33
|
# be empty strings).
|
|
34
34
|
path = path[1..-1] if path[0] == '/'
|
|
35
|
-
# Re-creating the route id (verb + path).
|
|
36
35
|
route_id = verb + path
|
|
37
|
-
# Getting the correspondent route or nil if route is invalid.
|
|
38
36
|
route = routes[route_id]
|
|
39
37
|
# If no route was found, set it to 'notfound' route (maintaining the
|
|
40
38
|
# original verb).
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rackstep
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcio Frayze David
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: RackStep is (yet another) micro ruby framework for microservices and
|
|
14
14
|
web development.
|
|
@@ -26,7 +26,7 @@ homepage: https://github.com/mfdavid/rackstep
|
|
|
26
26
|
licenses:
|
|
27
27
|
- MIT
|
|
28
28
|
metadata: {}
|
|
29
|
-
post_install_message:
|
|
29
|
+
post_install_message:
|
|
30
30
|
rdoc_options: []
|
|
31
31
|
require_paths:
|
|
32
32
|
- lib
|
|
@@ -41,9 +41,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
42
|
version: '0'
|
|
43
43
|
requirements: []
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
signing_key:
|
|
44
|
+
rubygems_version: 3.1.4
|
|
45
|
+
signing_key:
|
|
47
46
|
specification_version: 4
|
|
48
47
|
summary: RackStep micro web framework
|
|
49
48
|
test_files: []
|