low_loop 0.6.1 → 0.7.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/factories/response_factory.rb +3 -3
- data/lib/low_loop.rb +9 -9
- data/lib/responses/file_response.rb +1 -1
- data/lib/responses/response_builder.rb +1 -1
- data/lib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86d7096079d428e5b977514b850c2c8d7d22c692ff5f6b24c31836edfb5a26c3
|
|
4
|
+
data.tar.gz: eb5ce84e3edaa8eadde575b0133d0096e738d9ef58f2b57d5d89051238f3bec4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f37c5de2f7322c8cdc639e7037a1686b29c4396823aef2436e3263f88a606f22f266afb494758172d1a10efb23ef0868870135d3e7ca0c14766bb8bde8901455
|
|
7
|
+
data.tar.gz: 69df08688e56bc974a6e204b4c3e309373dc8907191548c97fdfebf08ee59f981626ed51ec5de0b4fddc5323a04700ebf38b91566c7d0a486441d49b441d6d5f
|
|
@@ -8,14 +8,14 @@ module Low
|
|
|
8
8
|
class ResponseFactory
|
|
9
9
|
class << self
|
|
10
10
|
def html(body:)
|
|
11
|
-
headers = Protocol::HTTP::Headers.new(['content-type', 'text/html'])
|
|
12
|
-
body = Protocol::HTTP::Body::Buffered.wrap(body)
|
|
11
|
+
headers = Protocol::HTTP::Headers.new([['content-type', 'text/html']])
|
|
12
|
+
body = Protocol::HTTP::Body::Buffered.wrap(body.strip)
|
|
13
13
|
|
|
14
14
|
Protocol::HTTP::Response.new('HTTP/1.1', 200, headers, body)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def file(path:, content_type:)
|
|
18
|
-
headers = Protocol::HTTP::Headers.new(['content-type', content_type])
|
|
18
|
+
headers = Protocol::HTTP::Headers.new([['content-type', content_type]])
|
|
19
19
|
file = File.open(path, 'rb')
|
|
20
20
|
body = Protocol::HTTP::Body::File.new(file)
|
|
21
21
|
|
data/lib/low_loop.rb
CHANGED
|
@@ -90,18 +90,18 @@ class LowLoop
|
|
|
90
90
|
|
|
91
91
|
private
|
|
92
92
|
|
|
93
|
-
def render_error(
|
|
93
|
+
def render_error(error)
|
|
94
94
|
puts "\nException:"
|
|
95
|
-
puts Paint[
|
|
95
|
+
puts Paint[error.message, :red]
|
|
96
96
|
puts ''
|
|
97
97
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
return unless @config.debug_mode
|
|
99
|
+
|
|
100
|
+
Fiber.blocking do
|
|
101
|
+
puts Paint[error.backtrace.join("\n"), :blue]
|
|
102
|
+
puts ''
|
|
103
|
+
puts 'Press ENTER to continue...'
|
|
104
|
+
gets
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
|
|
@@ -10,7 +10,7 @@ module Low
|
|
|
10
10
|
|
|
11
11
|
if File.exist?(file.path)
|
|
12
12
|
response = Factories::ResponseFactory.file(path: file.path, content_type: file.content_type)
|
|
13
|
-
return Events::ResponseEvent.new(response:).tap
|
|
13
|
+
return Events::ResponseEvent.new(response:).tap(&:branch)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
nil
|
|
@@ -37,7 +37,7 @@ module Low
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def write_response_headers(socket, response)
|
|
40
|
-
response.headers.fields.
|
|
40
|
+
response.headers.fields.each do |key, value|
|
|
41
41
|
next if %w[content-length connection].include?(key.to_s.downcase)
|
|
42
42
|
|
|
43
43
|
socket.puts "#{key}: #{value}\r\n"
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: low_loop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- maedi
|
|
@@ -152,14 +152,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
152
152
|
requirements:
|
|
153
153
|
- - ">="
|
|
154
154
|
- !ruby/object:Gem::Version
|
|
155
|
-
version: 3.
|
|
155
|
+
version: 3.4.0
|
|
156
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
requirements:
|
|
158
158
|
- - ">="
|
|
159
159
|
- !ruby/object:Gem::Version
|
|
160
160
|
version: '0'
|
|
161
161
|
requirements: []
|
|
162
|
-
rubygems_version: 4.0.
|
|
162
|
+
rubygems_version: 4.0.6
|
|
163
163
|
specification_version: 4
|
|
164
164
|
summary: An event-driven event loop
|
|
165
165
|
test_files: []
|