http-double 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/http-double.rb +1 -1
- data/lib/http_double/base.rb +15 -11
- data/lib/http_double/version.rb +1 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb89445f8247604e9ecec1820a8745079d0a566c
|
4
|
+
data.tar.gz: 79f37dd1e89778680590e15234f18e8c0e87707e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ed4d5c31b4cd7befba7fedda9914208b6018528d8d8e4e3264db6602656b5c324946a1a3eb6bf8f4246eb571b5532435ee80686c2592bc2ff679a5052c799a0
|
7
|
+
data.tar.gz: 5c6d2b77584c6a93f4f35c1710dc33068e03ede57b097b11069293f1e0d9598efefe4dead04dad3900e86dbae4191fb41841c4a6a55f84f0e3eace93e9f01742
|
data/lib/http-double.rb
CHANGED
data/lib/http_double/base.rb
CHANGED
@@ -1,25 +1,29 @@
|
|
1
1
|
require 'sinatra/base'
|
2
|
+
require 'sinatra/namespace'
|
2
3
|
|
3
4
|
module HttpDouble
|
4
5
|
class Base < Sinatra::Base
|
6
|
+
register Sinatra::Namespace
|
5
7
|
|
6
8
|
class << self
|
7
9
|
|
8
|
-
def
|
10
|
+
def foreground(addr, port, log_path: '/dev/null', logger: nil)
|
9
11
|
server_class = self
|
10
|
-
thread = Thread.new do
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Thin::Server.start(addr, port) do
|
18
|
-
use RequestLogger, server_class.log
|
19
|
-
run server_class
|
20
|
-
end
|
13
|
+
# Even if we use /dev/null, we need a logger to suppress warnings
|
14
|
+
# generated by Thin::Logging#trace_logger being undefined
|
15
|
+
log_stream = File.open(log_path, 'a')
|
16
|
+
Thin::Logging.trace_logger = logger || Logger.new(log_stream)
|
21
17
|
|
18
|
+
Thin::Server.start(addr, port) do
|
19
|
+
use RequestLogger, server_class.log
|
20
|
+
run server_class
|
22
21
|
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
def background(*args)
|
26
|
+
thread = Thread.new{ foreground *args }
|
23
27
|
thread.abort_on_exception = true
|
24
28
|
thread
|
25
29
|
end
|
data/lib/http_double/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-double
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neil E. Pearson
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra-contrib
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rack
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|