yaframework 0.4.3 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/Gemfile +0 -3
- data/Gemfile.lock +2 -5
- data/lib/yaframework/base.rb +10 -0
- data/lib/yaframework/response.rb +8 -0
- data/lib/yaframework/version.rb +1 -1
- data/yaframework.gemspec +2 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7911725bae2b9c6c1a8e575f35c32002950733011474ef711ecfbb486349f7
|
4
|
+
data.tar.gz: 3aebe5de332841aa193423f2796415e9b5f7842a6f28f4d71f56d9d6f1fa6ff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1155c9b2c1989b62ffa01d56134fa40e1c61babaed7a570b489db0c2b1e385b5c17158818fa1a61f23f7a94585a483ba897fb91ede42f1ce1948204c5566abf2
|
7
|
+
data.tar.gz: c14ad19ffb1e5504bac06a64534cabd590b2531798444d44773557e55111208f115b3d7a11b99df3fbf7c1583c5f7021274fdbe9063c5d3b54d454a864941c1a
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
## [0.4.
|
1
|
+
## [0.4.5] - 2021-07-25
|
2
|
+
|
3
|
+
- Error handling added
|
4
|
+
|
5
|
+
## [0.4.4] - 2021-07-25
|
6
|
+
|
7
|
+
- Interaction with cookies has been updated
|
8
|
+
|
9
|
+
## [0.4.3] - 2021-07-25
|
2
10
|
|
3
11
|
- Updated the method for changing the Content-Type
|
4
12
|
- Interaction with headers has been improved
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
yaframework (0.4.
|
5
|
-
rack (~> 2.2)
|
4
|
+
yaframework (0.4.5)
|
5
|
+
rack (~> 2.2, >= 2.2.3)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -12,7 +12,6 @@ GEM
|
|
12
12
|
parallel (1.20.1)
|
13
13
|
parser (3.0.2.0)
|
14
14
|
ast (~> 2.4.1)
|
15
|
-
pg (1.2.3)
|
16
15
|
rack (2.2.3)
|
17
16
|
rainbow (3.0.0)
|
18
17
|
rake (13.0.6)
|
@@ -38,8 +37,6 @@ PLATFORMS
|
|
38
37
|
DEPENDENCIES
|
39
38
|
bundler (>= 2.2.10)
|
40
39
|
minitest (~> 5.0)
|
41
|
-
pg (~> 1.2, >= 1.2.3)
|
42
|
-
rack (~> 2.2, >= 2.2.3)
|
43
40
|
rake (~> 13.0)
|
44
41
|
rubocop (~> 1.7)
|
45
42
|
yaframework!
|
data/lib/yaframework/base.rb
CHANGED
@@ -8,6 +8,7 @@ module Yaframework
|
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@routes = Hash.new([])
|
11
|
+
@inbox = {}
|
11
12
|
end
|
12
13
|
|
13
14
|
%w[GET POST PATCH PUT DELETE HEAD OPTIONS].each do |verb|
|
@@ -27,6 +28,10 @@ module Yaframework
|
|
27
28
|
throw :halt, response
|
28
29
|
end
|
29
30
|
|
31
|
+
def handle(status, &block)
|
32
|
+
@inbox[status] = block
|
33
|
+
end
|
34
|
+
|
30
35
|
def listen(port = 5000)
|
31
36
|
Rack::Handler::WEBrick.run self, Port: port
|
32
37
|
end
|
@@ -50,6 +55,11 @@ module Yaframework
|
|
50
55
|
end
|
51
56
|
|
52
57
|
def route_eval
|
58
|
+
if @inbox[response.status]
|
59
|
+
response.write instance_eval(&@inbox[response.status])
|
60
|
+
return response.finish
|
61
|
+
end
|
62
|
+
|
53
63
|
route = find_route
|
54
64
|
if route
|
55
65
|
response.write instance_eval(&route[:handler])
|
data/lib/yaframework/response.rb
CHANGED
@@ -66,5 +66,13 @@ module Yaframework
|
|
66
66
|
@headers[Rack::CONTENT_TYPE] = ContentType::JSON
|
67
67
|
write(str)
|
68
68
|
end
|
69
|
+
|
70
|
+
def set_cookie(key, value)
|
71
|
+
Rack::Utils.set_cookie_header!(@headers, key, value)
|
72
|
+
end
|
73
|
+
|
74
|
+
def delete_cookie(key, value = {})
|
75
|
+
Rack::Utils.delete_cookie_header!(@headers, key, value)
|
76
|
+
end
|
69
77
|
end
|
70
78
|
end
|
data/lib/yaframework/version.rb
CHANGED
data/yaframework.gemspec
CHANGED
@@ -29,8 +29,9 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler", ">= 2.2.10"
|
32
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
32
33
|
spec.add_development_dependency "rake", "~> 13.0"
|
33
34
|
spec.add_development_dependency "rubocop", "~> 1.7"
|
34
35
|
|
35
|
-
spec.add_runtime_dependency "rack", "~> 2.2"
|
36
|
+
spec.add_runtime_dependency "rack", "~> 2.2", ">= 2.2.3"
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaframework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maxbarsukov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.2.10
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,6 +73,9 @@ dependencies:
|
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '2.2'
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 2.2.3
|
62
79
|
type: :runtime
|
63
80
|
prerelease: false
|
64
81
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -66,6 +83,9 @@ dependencies:
|
|
66
83
|
- - "~>"
|
67
84
|
- !ruby/object:Gem::Version
|
68
85
|
version: '2.2'
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.2.3
|
69
89
|
description: What could be better than one more Sinatra?
|
70
90
|
email:
|
71
91
|
- maximbarsukov@bk.ru
|