rack_check 0.2.0 → 0.2.2

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: 4aa32f99238054589b506204575a854191839f76
4
- data.tar.gz: 7054ecea565a3f0d90c366c52a93b5e03cfa87a8
3
+ metadata.gz: 51a5f8038bf2d6a1eec85fc2541bb28a79a5f4b5
4
+ data.tar.gz: 9fddcb754b84d4be178967f2cf3c36e58bd929b2
5
5
  SHA512:
6
- metadata.gz: 7d1007233623eca042e83c1b6be51cd577b1571491b010fcf0d57c611b267bc00a249a6b226875ac863cc300e5a426d608ad7a2f70eb4f7ac4f4afd3533f838a
7
- data.tar.gz: 762e6e53caddf58c63d641ba24c21ba141f2cb9e6e7ef3ccf88cc82f50b60203cb8daab7a1185e2ddf8117d1925d9b2510a97b85d070406f67014acc6d00c880
6
+ metadata.gz: f296542b7adcdf240c6eba71f994a538fe119494fb15f0683bd8e54de88dfb484a3b3ca3425bfa635d97ac8ea6ca0146c49ffbf19ee49b2a05a352ebca9b471e
7
+ data.tar.gz: b1f8e490981615f260a13e9380034969b167edeb06be6de530a8243aa8604e417f0655ac6de9f2ccd27e0565f0141fe0dafd36de1a9be4e845058d7e2585acca
@@ -1,4 +1,5 @@
1
1
  require 'socket'
2
+ require 'open4'
2
3
 
3
4
  module RackCheck
4
5
 
@@ -17,15 +18,13 @@ class ServerManager
17
18
  Thread.new do
18
19
  begin
19
20
  with_environment(ru_file) do |dir|
20
- @pid = Process.spawn context.app_server_command,
21
- in: '/dev/null',
22
- out: '/dev/null',
23
- err: '/dev/null',
24
- chdir: dir
25
- @stop_var.take
26
- Process.kill 'TERM', @pid
27
- Process.wait @pid
28
- @pid = nil
21
+ Dir.chdir(dir) do
22
+ @pid, @in, @out, @err = Open4.popen4 context.app_server_command
23
+ @stop_var.take
24
+ Process.kill 'TERM', @pid
25
+ Process.wait @pid
26
+ @pid = nil
27
+ end
29
28
  end
30
29
  rescue => e
31
30
  $stderr.puts "App server thread exited: #{e.message}\n#{e.backtrace.join("\n")}"
@@ -44,6 +43,14 @@ class ServerManager
44
43
  end
45
44
  end
46
45
 
46
+ def errors
47
+ @err&.read.strip
48
+ end
49
+
50
+ def output
51
+ @out&.read.strip
52
+ end
53
+
47
54
  private
48
55
 
49
56
  def wait_for_port
@@ -9,6 +9,9 @@ module RackCheck::Spec
9
9
 
10
10
  def with_server(ru_file)
11
11
  yield start_server(ru_file)
12
+ rescue HTTP::ConnectionError => e
13
+ e.message << "\n\nServer error:\n#{@server&.errors}"
14
+ raise e
12
15
  ensure
13
16
  stop_server
14
17
  end
@@ -14,6 +14,7 @@ module RackCheck::Spec
14
14
  STARTUP_TIMEOUT = 10
15
15
 
16
16
  def self.run(app_server_command, app_server_port)
17
+ load_tests
17
18
  @@context = Context.new(app_server_command, app_server_port, STARTUP_TIMEOUT)
18
19
 
19
20
  # TODO there must be a better way to pass context to a rspec suite
@@ -23,7 +24,9 @@ module RackCheck::Spec
23
24
  def self.server_context
24
25
  @@context
25
26
  end
26
- end
27
27
 
28
- require 'rack_check/spec/rackup'
29
- require 'rack_check/spec/env'
28
+ def self.load_tests
29
+ require 'rack_check/spec/rackup'
30
+ require 'rack_check/spec/env'
31
+ end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module RackCheck
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.2"
3
3
  end
data/rack_check.gemspec CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency "rspec", "~> 3.0"
26
26
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
27
27
  spec.add_runtime_dependency "http", "~> 2.2"
28
+ spec.add_runtime_dependency "open4", "~> 1.3"
28
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tinco Andringa
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-04 00:00:00.000000000 Z
11
+ date: 2017-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: open4
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.3'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.3'
83
97
  description:
84
98
  email:
85
99
  - tinco@phusion.nl
@@ -127,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
141
  version: '0'
128
142
  requirements: []
129
143
  rubyforge_project:
130
- rubygems_version: 2.6.10
144
+ rubygems_version: 2.5.1
131
145
  signing_key:
132
146
  specification_version: 4
133
147
  summary: Tool that checks a Ruby application server for Rack compliancy