http-double 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c1c07596cec503a5d2db0421d0a8630dbdb50f8
4
- data.tar.gz: 074467290034146de3d24cbf31060456119fc853
3
+ metadata.gz: 1a721d997225c62ba548ee917eae40eefdb4d8e3
4
+ data.tar.gz: 5fe372379cdeec4b1256e51a8b649afb9d59ef61
5
5
  SHA512:
6
- metadata.gz: 3f644198cd3e11f439c0d06c7910540eff86673faf3b3aa1e5da204631daf37f87f47d999e6d748d29c1e83045df8f34d99886e1585bedd833805facfb843e16
7
- data.tar.gz: cc642c0fc8869f31a6c2a018c4562f52653d042ddeb71cb52d2c83c555a1fbec906a2436e727b3cf60df12546e8e46350cab00c6f349af874ecf2dd5882cbc78
6
+ metadata.gz: 51c09d187246bf27b45ddb38222652ffd42d0a4269a3ebc461ffff4da8c4cada55c02b2cf5ff763acee724a2e9c686411b0742d95b4e8d24e72be0744a2b98e1
7
+ data.tar.gz: a4205a95567b1862a7133496aaa7b385022b8281bda15e75646924c1c157224dc578d0fddb9b8f4d793c06ea172d9c2cee80e17d7238ebe2816b38b25e104115
@@ -7,8 +7,9 @@ module HttpDouble
7
7
 
8
8
  class << self
9
9
 
10
- def use_app(klass)
10
+ def use_app(klass, &block)
11
11
  @app_class = klass
12
+ @initializer = block
12
13
  end
13
14
 
14
15
  def foreground(addr, port, log_path: '/dev/null', logger: nil)
@@ -20,9 +21,12 @@ module HttpDouble
20
21
  log_stream = File.open(log_path, 'a')
21
22
  Base.loggers[port] = logger || Logger.new(log_stream)
22
23
 
24
+ initializer = @initializer
25
+
23
26
  Thin::Server.start(addr, port) do
27
+ initializer.call if initializer
24
28
  use RequestLogger, server_class.log
25
- run app_class
29
+ run Class === app_class ? app_class.new : app_class
26
30
  end
27
31
 
28
32
  end
@@ -1,3 +1,3 @@
1
1
  module HttpDouble
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
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.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil E. Pearson