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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2866f09b90fbd1283a2720b908ef50aa9e026ef2
4
- data.tar.gz: 748166f06723673e6fa78bb7ba365838261a5dc4
3
+ metadata.gz: 99ea2f8a431565aaf84bda2ea1e0bdfa014c24ad
4
+ data.tar.gz: b9174eef1f1e9a68ad18e77582451b74dc702e6a
5
5
  SHA512:
6
- metadata.gz: 0c17159bd2216ccf74fabe1efe391cfc5cb31c0257a89421ba56d26653c537006fc593cc5cd6e9a78d68d9002441327f6abe0020976fb6d586f2f5a45a9a9f2e
7
- data.tar.gz: 80ae4f7fd6edadccf95045477e67c8d1cead1ff83acf7ec7b5e37beba55e47616936fa76d2d979c670b569580b80839d3ace78028183550ceace2a6833902c0b
6
+ metadata.gz: 805c1abc822286d9632d71de331cff116362270cd93f0670e504d39f89ac7c4b8c10a13e3df70fd3a42f1d59be109db98e9552d118e9f16aa83fa13bac88fc43
7
+ data.tar.gz: 6cff71ed16a85220f3f615d85af66e65ce28957ef2c0e9ee6e9655fe25981060b3128bfda4905e4abaf33ed9760b1a483b687b3661bf06ec5d198f39346c9eeb
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ mkmf.log
15
15
  .idea
16
16
  *.iml
17
17
  *.gem
18
+ *.log
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.4'
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
- Class.new(Sinatra::Base) {
69
- set :port, port
70
-
71
- include HttpSimulator
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_sim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean de Klerk