http_sim 0.0.4 → 0.0.5
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/.gitignore +1 -0
- data/CHANGELOG.txt +1 -0
- data/http_sim.gemspec +1 -1
- data/lib/http_sim.rb +6 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99ea2f8a431565aaf84bda2ea1e0bdfa014c24ad
|
4
|
+
data.tar.gz: b9174eef1f1e9a68ad18e77582451b74dc702e6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805c1abc822286d9632d71de331cff116362270cd93f0670e504d39f89ac7c4b8c10a13e3df70fd3a42f1d59be109db98e9552d118e9f16aa83fa13bac88fc43
|
7
|
+
data.tar.gz: 6cff71ed16a85220f3f615d85af66e65ce28957ef2c0e9ee6e9655fe25981060b3128bfda4905e4abaf33ed9760b1a483b687b3661bf06ec5d198f39346c9eeb
|
data/.gitignore
CHANGED
data/CHANGELOG.txt
CHANGED
@@ -2,3 +2,4 @@ Version 0.0.1 http_sim is released
|
|
2
2
|
Version 0.0.2 Allow changing port
|
3
3
|
Version 0.0.3 Requests to endpoints are recorded and listed at endpoint's /request endpoint
|
4
4
|
Version 0.0.4 Added run_daemon!, stop_daemon!, and wait_for_start methods
|
5
|
+
Version 0.0.5 run_daemon! now writes to a (configurable) log file
|
data/http_sim.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'http_sim'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.5'
|
8
8
|
spec.authors = ['Jean de Klerk']
|
9
9
|
spec.email = ['jadekler@gmail.com']
|
10
10
|
spec.summary = 'Simulate your external HTTP integrations.'
|
data/lib/http_sim.rb
CHANGED
@@ -52,24 +52,18 @@ module HttpSimulator
|
|
52
52
|
|
53
53
|
Class.new(Sinatra::Base) {
|
54
54
|
set :port, port
|
55
|
+
set :logging, false
|
55
56
|
|
56
57
|
include HttpSimulator
|
57
58
|
}.run!
|
58
59
|
end
|
59
60
|
|
60
|
-
def self.run_daemon!(port: 4567, max_wait_seconds: 5)
|
61
|
-
check_if_port_in_use(port)
|
62
|
-
|
63
|
-
Sinatra::Base.get '/' do
|
64
|
-
ERB.new(@@erb_files[:index]).result binding
|
65
|
-
end
|
66
|
-
|
61
|
+
def self.run_daemon!(port: 4567, max_wait_seconds: 5, log_file: 'http_sim_log.log')
|
67
62
|
@@pid = Process.fork do
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}.run!
|
63
|
+
$stdout.reopen(log_file, 'w')
|
64
|
+
$stdout.sync = true
|
65
|
+
$stderr.reopen($stdout)
|
66
|
+
run!(port: port)
|
73
67
|
end
|
74
68
|
|
75
69
|
wait_for_start(port, max_wait_seconds)
|