chase 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/chase.gemspec +23 -0
- data/lib/chase/events.rb +18 -0
- data/lib/chase/http_parser.rb +56 -0
- data/lib/chase/request.rb +16 -0
- data/lib/chase/response.rb +88 -0
- data/lib/chase/server.rb +42 -0
- data/lib/chase/version.rb +3 -0
- data/lib/chase.rb +5 -0
- data/spec/chase/events_spec.rb +33 -0
- data/spec/chase/response_spec.rb +43 -0
- data/spec/chase/server_spec.rb +67 -0
- data/spec/examples.txt +13 -0
- data/spec/spec_helper.rb +103 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 72eefdf46b326be759f69345fb5234e1a873137c
|
4
|
+
data.tar.gz: a603c8ce78dba15cfe203aeb18b84cfc7c72a436
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f3e270e13da9d72c0f22a7ae199499295455befd9b035c6ee3f625516a9942ea90262b9a7ee22cdc592a436167fad2bf4dafefe7acb7e5b3452a6e7a88b81b11
|
7
|
+
data.tar.gz: 92856fd255a979f89b91a664e651ab91d456c8263e0feac5858a823d118490b8c19ebd557e13daf24a0ae7eac7a3947e6531b1dbaf7cb19350c34940efcc08c1
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/chase.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chase/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'chase'
|
8
|
+
spec.version = Chase::VERSION
|
9
|
+
spec.licenses = ['MIT']
|
10
|
+
spec.authors = ['Joe Osburn']
|
11
|
+
spec.email = ['joe@jnodev.com']
|
12
|
+
|
13
|
+
spec.summary = 'Chase is an event machine http server'
|
14
|
+
spec.homepage = 'https://github.com/joeosburn/chase'
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.require_paths = ['lib']
|
17
|
+
spec.test_files = Dir['spec/**/*']
|
18
|
+
|
19
|
+
spec.add_dependency 'eventmachine', '~> 1.2', '>= 1.2.0'
|
20
|
+
spec.add_dependency 'http-parser-lite', '~> 0.6.0'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.5', '>= 3.5.0'
|
23
|
+
end
|
data/lib/chase/events.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module Chase
|
2
|
+
# Basic events emitter
|
3
|
+
module Events
|
4
|
+
def on(event, &block)
|
5
|
+
__events[event] << block
|
6
|
+
end
|
7
|
+
|
8
|
+
def emit(event, *args)
|
9
|
+
__events[event].each { |cb| cb.call(*args) }
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def __events
|
15
|
+
@__events ||= Hash.new { |hash, key| hash[key] = [] }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'http-parser-lite'
|
2
|
+
|
3
|
+
module Chase
|
4
|
+
# Handle parsing of incoming http requests
|
5
|
+
module HttpParser
|
6
|
+
VALID_METHODS = %w(GET POST PUT DELETE PATCH HEAD OPTIONS).freeze
|
7
|
+
MAPPED_HEADERS = { 'cookie' => 'HTTP_COOKIE', 'if-none-match' => 'IF_NONE_MATCH',
|
8
|
+
'content-type' => 'CONTENT_TYPE', 'content-length' => 'CONTENT_LENGTH' }.freeze
|
9
|
+
|
10
|
+
def http_parser
|
11
|
+
@parser ||= HTTP::Parser.new.tap do |parser|
|
12
|
+
parser.on_headers_complete { @current_header = nil }
|
13
|
+
|
14
|
+
parser.on_url do |url|
|
15
|
+
raise HTTP::Parser::Error, 'Invalid method' unless VALID_METHODS.include?(http_method)
|
16
|
+
|
17
|
+
set_env('HTTP_METHOD', http_method)
|
18
|
+
set_env('REQUEST_URI', url)
|
19
|
+
matches = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)
|
20
|
+
matches ||= Hash.new('')
|
21
|
+
set_env('PROTOCOL', matches[2])
|
22
|
+
set_env('PATH_INFO', matches[5])
|
23
|
+
set_env('QUERY_STRING', matches[7])
|
24
|
+
end
|
25
|
+
|
26
|
+
parser.on_header_field { |name| @current_header = name }
|
27
|
+
|
28
|
+
parser.on_header_value do |value|
|
29
|
+
if key = MAPPED_HEADERS[@current_header.downcase]
|
30
|
+
set_env(key, value)
|
31
|
+
else
|
32
|
+
request.headers[@current_header] = value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
parser.on_body { |body| set_env('POST_CONTENT', body) }
|
37
|
+
|
38
|
+
# parser.on_message_begin do
|
39
|
+
# puts "message begin"
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# parser.on_message_complete do
|
43
|
+
# puts "message complete"
|
44
|
+
# end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def http_method
|
49
|
+
http_parser.http_method
|
50
|
+
end
|
51
|
+
|
52
|
+
def set_env(key, value)
|
53
|
+
request.env[key] = value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Chase
|
2
|
+
# HTTP Response Class
|
3
|
+
class Response
|
4
|
+
include Events
|
5
|
+
|
6
|
+
STATUS_CODES = {
|
7
|
+
100 => '100 Continue',
|
8
|
+
101 => '101 Switching Protocols',
|
9
|
+
200 => '200 OK',
|
10
|
+
201 => '201 Created',
|
11
|
+
202 => '202 Accepted',
|
12
|
+
203 => '203 Non-Authoritative Information',
|
13
|
+
204 => '204 No Content',
|
14
|
+
205 => '205 Reset Content',
|
15
|
+
206 => '206 Partial Content',
|
16
|
+
300 => '300 Multiple Choices',
|
17
|
+
301 => '301 Moved Permanently',
|
18
|
+
302 => '302 Found',
|
19
|
+
303 => '303 See Other',
|
20
|
+
304 => '304 Not Modified',
|
21
|
+
305 => '305 Use Proxy',
|
22
|
+
307 => '307 Temporary Redirect',
|
23
|
+
400 => '400 Bad Request',
|
24
|
+
401 => '401 Unauthorized',
|
25
|
+
402 => '402 Payment Required',
|
26
|
+
403 => '403 Forbidden',
|
27
|
+
404 => '404 Not Found',
|
28
|
+
405 => '405 Method Not Allowed',
|
29
|
+
406 => '406 Not Acceptable',
|
30
|
+
407 => '407 Proxy Authentication Required',
|
31
|
+
408 => '408 Request Timeout',
|
32
|
+
409 => '409 Conflict',
|
33
|
+
410 => '410 Gone',
|
34
|
+
411 => '411 Length Required',
|
35
|
+
412 => '412 Precondition Failed',
|
36
|
+
413 => '413 Request Entity Too Large',
|
37
|
+
414 => '414 Request-URI Too Long',
|
38
|
+
415 => '415 Unsupported Media Type',
|
39
|
+
416 => '416 Requested Range Not Satisfiable',
|
40
|
+
417 => '417 Expectation Failed',
|
41
|
+
500 => '500 Internal Server Error',
|
42
|
+
501 => '501 Not Implemented',
|
43
|
+
502 => '502 Bad Gateway',
|
44
|
+
503 => '503 Service Unavailable',
|
45
|
+
504 => '504 Gateway Timeout',
|
46
|
+
505 => '505 HTTP Version Not Supported'
|
47
|
+
}.freeze
|
48
|
+
|
49
|
+
attr_accessor :status
|
50
|
+
attr_reader :content, :headers
|
51
|
+
|
52
|
+
def initialize
|
53
|
+
@content = ''
|
54
|
+
@headers = {}
|
55
|
+
|
56
|
+
on(:flushed) { @flushed = true }
|
57
|
+
end
|
58
|
+
|
59
|
+
def content=(value)
|
60
|
+
@content = value.to_s
|
61
|
+
end
|
62
|
+
|
63
|
+
def flush
|
64
|
+
return if flushed?
|
65
|
+
|
66
|
+
send_headers
|
67
|
+
send("\r\n")
|
68
|
+
send(content)
|
69
|
+
|
70
|
+
emit(:flushed)
|
71
|
+
end
|
72
|
+
|
73
|
+
def flushed?
|
74
|
+
@flushed ||= false
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def send(data)
|
80
|
+
emit(:send, data)
|
81
|
+
end
|
82
|
+
|
83
|
+
def send_headers
|
84
|
+
send "HTTP/1.1 #{STATUS_CODES[status] || '200 OK'}\r\n"
|
85
|
+
headers.each { |key, value| send("#{key}: #{value}\r\n") }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/lib/chase/server.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'eventmachine'
|
2
|
+
|
3
|
+
module Chase
|
4
|
+
# General server error
|
5
|
+
class ServerError < StandardError; end
|
6
|
+
|
7
|
+
# HTTP Server Module
|
8
|
+
module Server
|
9
|
+
include HttpParser
|
10
|
+
|
11
|
+
def receive_data(data)
|
12
|
+
parse_request data
|
13
|
+
prepare_response
|
14
|
+
handle
|
15
|
+
rescue ServerError, HTTP::Parser::Error
|
16
|
+
send_error('400 Bad Request')
|
17
|
+
end
|
18
|
+
|
19
|
+
def request
|
20
|
+
@request ||= Request.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def response
|
24
|
+
@response ||= Response.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def send_error(status_code)
|
28
|
+
send_data "HTTP/1.1 #{status_code}\r\nConnection: close\r\nContent-Type: text/plain\r\n"
|
29
|
+
close_connection_after_writing
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse_request(data)
|
33
|
+
http_parser << data
|
34
|
+
raise ServerError unless request.env['HTTP_METHOD']
|
35
|
+
end
|
36
|
+
|
37
|
+
def prepare_response
|
38
|
+
response.on(:flushed) { close_connection_after_writing }
|
39
|
+
response.on(:send) { |data| send_data(data) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/chase.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Chase::Events do
|
4
|
+
let(:example_class) { Class.new { include Chase::Events } }
|
5
|
+
subject { example_class.new }
|
6
|
+
let(:dummy) { double }
|
7
|
+
|
8
|
+
describe 'emitting events' do
|
9
|
+
before { allow(dummy).to receive(:call) }
|
10
|
+
|
11
|
+
it 'calls the block on emit' do
|
12
|
+
subject.on(:event) { dummy.call }
|
13
|
+
expect(dummy).to receive(:call)
|
14
|
+
subject.emit(:event)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'passes arguments to the block' do
|
18
|
+
subject.on(:bad_event) { dummy.call(:x, 1) }
|
19
|
+
subject.on(:good_event) { |a, b| dummy.call(a, b) }
|
20
|
+
expect(dummy).to receive(:call).with(3, :y)
|
21
|
+
expect(dummy).to_not receive(:call).with(:x, 1)
|
22
|
+
subject.emit(:good_event, 3, :y)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'calls multiple event listeners in the order they were added' do
|
26
|
+
subject.on(:event) { dummy.call(1) }
|
27
|
+
subject.on(:event) { dummy.call(2) }
|
28
|
+
expect(dummy).to receive(:call).with(1).exactly(1).times.ordered
|
29
|
+
expect(dummy).to receive(:call).with(2).exactly(1).times.ordered
|
30
|
+
subject.emit(:event)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Chase::Response do
|
4
|
+
describe '#flush' do
|
5
|
+
before do
|
6
|
+
subject.headers['Content-Type'] = 'text/plain'
|
7
|
+
subject.headers['Content-Length'] = 40
|
8
|
+
subject.content = 'Some content'
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'flushes the response' do
|
12
|
+
subject.flush
|
13
|
+
expect(subject).to be_flushed
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'emits the headers and content' do
|
17
|
+
output = ''
|
18
|
+
subject.on(:send) { |data| output += data }
|
19
|
+
|
20
|
+
subject.flush
|
21
|
+
|
22
|
+
expect(output).to eq(<<~eos.strip)
|
23
|
+
HTTP/1.1 200 OK\r
|
24
|
+
Content-Type: text/plain\r
|
25
|
+
Content-Length: 40\r
|
26
|
+
\r
|
27
|
+
Some content
|
28
|
+
eos
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'has been run' do
|
32
|
+
before { subject.flush }
|
33
|
+
|
34
|
+
it 'does not emit content again' do
|
35
|
+
output = ''
|
36
|
+
subject.on(:send) { |data| output += data }
|
37
|
+
|
38
|
+
subject.flush
|
39
|
+
expect(output).to eq('')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe Chase::Server do
|
4
|
+
let(:included_class) do
|
5
|
+
Class.new do
|
6
|
+
include Chase::Server
|
7
|
+
|
8
|
+
def handle; end
|
9
|
+
def send_data(_data); end
|
10
|
+
def close_connection_after_writing; end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
subject { included_class.new }
|
14
|
+
|
15
|
+
describe '#receive_data' do
|
16
|
+
context 'invalid request' do
|
17
|
+
it 'sends a 400 error response' do
|
18
|
+
expect(subject).to receive(:send_data).with(/400 Bad Request/).ordered
|
19
|
+
expect(subject).to receive(:close_connection_after_writing).ordered
|
20
|
+
subject.receive_data('BAD REQUEST')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'valid request' do
|
25
|
+
it 'calls #handle' do
|
26
|
+
expect(subject).to receive(:handle)
|
27
|
+
subject.receive_data('GET / HTTP/1.1')
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'creates a request object' do
|
31
|
+
subject.receive_data('GET / HTTP/1.1')
|
32
|
+
expect(subject.request).to be_a(Chase::Request)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'creates a response object' do
|
36
|
+
subject.receive_data('GET / HTTP/1.1')
|
37
|
+
expect(subject.response).to be_a(Chase::Response)
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'the request object' do
|
41
|
+
it 'sets env and header variables' do
|
42
|
+
subject.receive_data(<<~eos)
|
43
|
+
PATCH https://www.google.com/chase/request?key=value&other=123 HTTP/1.1
|
44
|
+
Content-Type: text/plain
|
45
|
+
Content-Length: 45
|
46
|
+
Cookie: cookie-content
|
47
|
+
If-None-Match: *
|
48
|
+
Random-Header: Value
|
49
|
+
|
50
|
+
Some-Post-Content=Value&Some-Other=abc2
|
51
|
+
eos
|
52
|
+
expect(subject.request.env['HTTP_METHOD']).to eq('PATCH')
|
53
|
+
expect(subject.request.env['REQUEST_URI']).to eq('https://www.google.com/chase/request?key=value&other=123')
|
54
|
+
expect(subject.request.env['PROTOCOL']).to eq('https')
|
55
|
+
expect(subject.request.env['PATH_INFO']).to eq('/chase/request')
|
56
|
+
expect(subject.request.env['QUERY_STRING']).to eq('key=value&other=123')
|
57
|
+
expect(subject.request.env['CONTENT_TYPE']).to eq('text/plain')
|
58
|
+
expect(subject.request.env['CONTENT_LENGTH']).to eq('45')
|
59
|
+
expect(subject.request.env['HTTP_COOKIE']).to eq('cookie-content')
|
60
|
+
expect(subject.request.env['IF_NONE_MATCH']).to eq('*')
|
61
|
+
expect(subject.request.env['POST_CONTENT']).to eq("Some-Post-Content=Value&Some-Other=abc2\n")
|
62
|
+
expect(subject.request.headers['Random-Header']).to eq('Value')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/spec/examples.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
example_id | status | run_time |
|
2
|
+
-------------------------------------- | ------ | --------------- |
|
3
|
+
./spec/chase/events_spec.rb[1:1:1] | passed | 0.00025 seconds |
|
4
|
+
./spec/chase/events_spec.rb[1:1:2] | passed | 0.00047 seconds |
|
5
|
+
./spec/chase/events_spec.rb[1:1:3] | passed | 0.0048 seconds |
|
6
|
+
./spec/chase/response_spec.rb[1:1:1] | passed | 0.00131 seconds |
|
7
|
+
./spec/chase/response_spec.rb[1:1:2] | passed | 0.00041 seconds |
|
8
|
+
./spec/chase/response_spec.rb[1:1:3:1] | passed | 0.0001 seconds |
|
9
|
+
./spec/chase/server_spec.rb[1:1:1:1] | passed | 0.00046 seconds |
|
10
|
+
./spec/chase/server_spec.rb[1:1:2:1] | passed | 0.00042 seconds |
|
11
|
+
./spec/chase/server_spec.rb[1:1:2:2] | passed | 0.00045 seconds |
|
12
|
+
./spec/chase/server_spec.rb[1:1:2:3] | passed | 0.00019 seconds |
|
13
|
+
./spec/chase/server_spec.rb[1:1:2:4:1] | passed | 0.00017 seconds |
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'chase'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
6
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
7
|
+
# files.
|
8
|
+
#
|
9
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
10
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
11
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
12
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
13
|
+
# a separate helper file that requires the additional dependencies and performs
|
14
|
+
# the additional setup, and require it from the spec files that actually need
|
15
|
+
# it.
|
16
|
+
#
|
17
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
18
|
+
# users commonly want.
|
19
|
+
#
|
20
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
21
|
+
RSpec.configure do |config|
|
22
|
+
# rspec-expectations config goes here. You can use an alternate
|
23
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
24
|
+
# assertions if you prefer.
|
25
|
+
config.expect_with :rspec do |expectations|
|
26
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
27
|
+
# and `failure_message` of custom matchers include text for helper methods
|
28
|
+
# defined using `chain`, e.g.:
|
29
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
30
|
+
# # => "be bigger than 2 and smaller than 4"
|
31
|
+
# ...rather than:
|
32
|
+
# # => "be bigger than 2"
|
33
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
34
|
+
end
|
35
|
+
|
36
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
37
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
38
|
+
config.mock_with :rspec do |mocks|
|
39
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
40
|
+
# a real object. This is generally recommended, and will default to
|
41
|
+
# `true` in RSpec 4.
|
42
|
+
mocks.verify_partial_doubles = true
|
43
|
+
end
|
44
|
+
|
45
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
46
|
+
# have no way to turn it off -- the option exists only for backwards
|
47
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
48
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
49
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
50
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
51
|
+
|
52
|
+
# The settings below are suggested to provide a good initial experience
|
53
|
+
# with RSpec, but feel free to customize to your heart's content.
|
54
|
+
# This allows you to limit a spec run to individual examples or groups
|
55
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
56
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
57
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
58
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
59
|
+
config.filter_run_when_matching :focus
|
60
|
+
|
61
|
+
# Allows RSpec to persist some state between runs in order to support
|
62
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
63
|
+
# you configure your source control system to ignore this file.
|
64
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
65
|
+
|
66
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
67
|
+
# recommended. For more details, see:
|
68
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
69
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
71
|
+
config.disable_monkey_patching!
|
72
|
+
|
73
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
74
|
+
# be too noisy due to issues in dependencies.
|
75
|
+
config.warnings = true
|
76
|
+
|
77
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
78
|
+
# file, and it's useful to allow more verbose output when running an
|
79
|
+
# individual spec file.
|
80
|
+
if config.files_to_run.one?
|
81
|
+
# Use the documentation formatter for detailed output,
|
82
|
+
# unless a formatter has already been configured
|
83
|
+
# (e.g. via a command-line flag).
|
84
|
+
config.default_formatter = 'doc'
|
85
|
+
end
|
86
|
+
|
87
|
+
# Print the 10 slowest examples and example groups at the
|
88
|
+
# end of the spec run, to help surface which specs are running
|
89
|
+
# particularly slow.
|
90
|
+
config.profile_examples = 10
|
91
|
+
|
92
|
+
# Run specs in random order to surface order dependencies. If you find an
|
93
|
+
# order dependency and want to debug it, you can fix the order by providing
|
94
|
+
# the seed, which is printed after each run.
|
95
|
+
# --seed 1234
|
96
|
+
config.order = :random
|
97
|
+
|
98
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
99
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
100
|
+
# test failures related to randomization by passing the same `--seed` value
|
101
|
+
# as the one that triggered the failure.
|
102
|
+
Kernel.srand config.seed
|
103
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chase
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joe Osburn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: eventmachine
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.2.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: http-parser-lite
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.6.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.6.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.5'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 3.5.0
|
57
|
+
type: :development
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '3.5'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 3.5.0
|
67
|
+
description:
|
68
|
+
email:
|
69
|
+
- joe@jnodev.com
|
70
|
+
executables: []
|
71
|
+
extensions: []
|
72
|
+
extra_rdoc_files: []
|
73
|
+
files:
|
74
|
+
- ".gitignore"
|
75
|
+
- ".rspec"
|
76
|
+
- Gemfile
|
77
|
+
- chase.gemspec
|
78
|
+
- lib/chase.rb
|
79
|
+
- lib/chase/events.rb
|
80
|
+
- lib/chase/http_parser.rb
|
81
|
+
- lib/chase/request.rb
|
82
|
+
- lib/chase/response.rb
|
83
|
+
- lib/chase/server.rb
|
84
|
+
- lib/chase/version.rb
|
85
|
+
- spec/chase/events_spec.rb
|
86
|
+
- spec/chase/response_spec.rb
|
87
|
+
- spec/chase/server_spec.rb
|
88
|
+
- spec/examples.txt
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
homepage: https://github.com/joeosburn/chase
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.6.8
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Chase is an event machine http server
|
114
|
+
test_files:
|
115
|
+
- spec/chase/events_spec.rb
|
116
|
+
- spec/chase/response_spec.rb
|
117
|
+
- spec/chase/server_spec.rb
|
118
|
+
- spec/examples.txt
|
119
|
+
- spec/spec_helper.rb
|