specwrk 0.4.8 → 0.4.11

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
  SHA256:
3
- metadata.gz: b54fec1f526b07cda2e86d7dd5c26c134e33023e50ad3122f637736234d2fbfd
4
- data.tar.gz: d56dbf0ad829e9c554d6caca40ff28c74db66a45ce888593a8d1e6dbf0552c99
3
+ metadata.gz: e85bdff31c7f1312b12a9a823200a5da5b36653433496556cc1bce274a3dc90a
4
+ data.tar.gz: fa73aebb69753d7b528d333f2fca589e0e5525bd12b71e4c5b7815df0932b9a1
5
5
  SHA512:
6
- metadata.gz: 767fe8a6e6316a3c942699925667dced8fb35c37df94d38a21d6211330492de47633d1ec4b283f9106ad81893f2b6fe19a27775177e93305e77da57fd1bc5ce3
7
- data.tar.gz: 4fac68daee472d09bf1503afa44160162cf26a20ba715a09bf417597fbd44b71f88637694d8896f3e2b8621c4d8aa101da7e23c675e225404fa16bfeda1acda2
6
+ metadata.gz: 9467744c0cd676bdeb312b3f1deb4190113601cb01bb9ce939acdfa1c6170897904f3125b43c90dde536459ed56b2623be132bfeed84725c1f6b098ea65ae6a9
7
+ data.tar.gz: f8cd7800b9f117567c1aa53404f2ca7f9a99a907c4b46c1c05da34d7534a2743c68960c50ffd9555de82430f582cb6a042a70579e4a8a44f53dea136f72cd8ae
data/config.ru CHANGED
@@ -2,4 +2,5 @@ require "specwrk"
2
2
  require "specwrk/web"
3
3
  require "specwrk/web/app"
4
4
 
5
+ Specwrk::Web::App.setup!
5
6
  run Specwrk::Web::App.rackup
@@ -19,7 +19,7 @@ COPY $GEMFILE ./
19
19
  RUN gem install ./$GEMFILE --no-document
20
20
  RUN rm ./$GEMFILE
21
21
 
22
- RUN gem install puma
22
+ RUN gem install puma thruster
23
23
  COPY config.ru ./
24
24
 
25
25
  COPY docker/entrypoint.server.sh /usr/local/bin/entrypoint
@@ -1,5 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
- export SPECWRK_SRV_SINGLE_RUN=1
3
+ export THRUSTER_HTTP_PORT=${PORT:-5138}
4
+ export THRUSTER_TARGET_PORT=3000
5
+ export THRUSTER_HTTP_IDLE_TIMEOUT=${IDLE_TIMEOUT:-305}
4
6
 
5
- exec puma --port ${PORT:-$SPECWRK_SRV_PORT} --bind tcp://0.0.0.0 --threads 1 --workers 0 --silent
7
+ exec thrust puma --workers 0 --bind tcp://127.0.0.1:3000 --threads ${PUMA_THREADS:-1}
data/lib/specwrk/cli.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "pathname"
4
- require "fileutils"
5
4
 
6
5
  require "dry/cli"
7
6
 
@@ -45,7 +44,6 @@ module Specwrk
45
44
  ENV["SPECWRK_COUNT"] = count.to_s
46
45
  ENV["SPECWRK_SEED_WAITS"] = seed_waits.to_s
47
46
  ENV["SPECWRK_OUT"] = Pathname.new(output).expand_path(Dir.pwd).to_s
48
- FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
49
47
  end
50
48
 
51
49
  def start_workers
@@ -80,16 +78,13 @@ module Specwrk
80
78
  base.unique_option :verbose, type: :boolean, default: false, desc: "Run in verbose mode. Default false."
81
79
  end
82
80
 
83
- on_setup do |port:, bind:, output:, key:, single_seed_per_run:, group_by:, verbose:, **|
81
+ on_setup do |port:, bind:, output:, key:, group_by:, verbose:, **|
84
82
  ENV["SPECWRK_OUT"] = Pathname.new(output).expand_path(Dir.pwd).to_s
85
- FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
83
+ ENV["SPECWRK_SRV_VERBOSE"] = "1" if verbose
86
84
 
87
- ENV["SPECWRK_SRV_LOG"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "server.log")).to_s if output && !verbose
88
- ENV["SPECWRK_SRV_OUTPUT"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "report.json")).expand_path(Dir.pwd).to_s if output
89
85
  ENV["SPECWRK_SRV_PORT"] = port
90
86
  ENV["SPECWRK_SRV_BIND"] = bind
91
87
  ENV["SPECWRK_SRV_KEY"] = key
92
- ENV["SPECWRK_SRV_SINGLE_SEED_PER_RUN"] = "1" if single_seed_per_run
93
88
  ENV["SPECWRK_SRV_GROUP_BY"] = group_by
94
89
  end
95
90
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Specwrk
4
- VERSION = "0.4.8"
4
+ VERSION = "0.4.11"
5
5
  end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "pathname"
4
+ require "fileutils"
5
+
3
6
  require "webrick"
4
7
  require "rack"
5
8
 
@@ -21,9 +24,7 @@ module Specwrk
21
24
  def run!
22
25
  Process.setproctitle "specwrk-server"
23
26
 
24
- if ENV["SPECWRK_SRV_LOG"]
25
- $stdout.reopen(ENV["SPECWRK_SRV_LOG"], "w")
26
- end
27
+ setup!
27
28
 
28
29
  server_opts = {
29
30
  Port: ENV.fetch("SPECWRK_SRV_PORT", "5138").to_i,
@@ -46,10 +47,26 @@ module Specwrk
46
47
  end
47
48
  end
48
49
 
50
+ def setup!
51
+ if ENV["SPECWRK_OUT"]
52
+
53
+ FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
54
+ ENV["SPECWRK_SRV_LOG"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "server.log")).to_s unless ENV["SPECWRK_SRV_VERBOSE"]
55
+ ENV["SPECWRK_SRV_OUTPUT"] ||= Pathname.new(File.join(ENV["SPECWRK_OUT"], "report.json")).expand_path(Dir.pwd).to_s
56
+ end
57
+
58
+ if ENV["SPECWRK_SRV_LOG"]
59
+ $stdout.reopen(ENV["SPECWRK_SRV_LOG"], "w")
60
+ end
61
+ end
62
+
49
63
  def rackup
50
64
  Rack::Builder.new do
51
- use Rack::Runtime
52
- use Specwrk::Web::Logger, $stdout, %w[/health]
65
+ if ENV["SPECWRK_SRV_VERBOSE"]
66
+ use Rack::Runtime
67
+ use Specwrk::Web::Logger, $stdout, %w[/health]
68
+ end
69
+
53
70
  use Specwrk::Web::Auth, %w[/health] # global auth check
54
71
  run Specwrk::Web::App.new # your router
55
72
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "stringio"
4
+ require "fileutils"
4
5
 
5
6
  require "specwrk/client"
6
7
  require "specwrk/worker/executor"
@@ -13,6 +14,7 @@ module Specwrk
13
14
 
14
15
  def initialize
15
16
  Process.setproctitle ENV.fetch("SPECWRK_ID", "specwrk-worker")
17
+ FileUtils.mkdir_p(ENV["SPECWRK_OUT"]) if ENV["SPECWRK_OUT"]
16
18
 
17
19
  @running = true
18
20
  @client = Client.new
@@ -85,13 +87,13 @@ module Specwrk
85
87
 
86
88
  def thump
87
89
  while running && !Specwrk.force_quit
90
+ sleep 10
91
+
88
92
  begin
89
- client.heartbeat if client.last_request_at.nil? || client.last_request_at < Time.now - 10
93
+ client.heartbeat if client.last_request_at.nil? || client.last_request_at < Time.now - 30
90
94
  rescue
91
95
  warn "Heartbeat failed!"
92
96
  end
93
-
94
- sleep 1
95
97
  end
96
98
  end
97
99
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specwrk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Westendorf