nonnative 0.2.0 → 0.2.1
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/Gemfile.lock +5 -1
- data/README.md +0 -8
- data/lib/nonnative/logger.rb +16 -0
- data/lib/nonnative/process.rb +7 -4
- data/lib/nonnative/version.rb +1 -1
- data/lib/nonnative.rb +6 -1
- data/nonnative.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc55917fc160807c8f3c3044f387fa57e77e02f2c00a49c51c0b553486498937
|
4
|
+
data.tar.gz: 164d765442febb35f9e3e8980c90e7124cc45defe163b46a73714a0cf65344a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3c9eacd0190c8aec9bfbdfdf731fcc8bd231e452f1267b14433eb9a9a85e18733a23fd3c45f0f2192945f394d710254e7cd8d2fffb5d4285b2491fc3e3d6202
|
7
|
+
data.tar.gz: f207d345eaf75c70cf6b8839f55f6d9038305b0a33367d401dcb113b89eba38f3423cf6eaed91fd56511a802c437b4db131a1748302d5d05ed712b83dcf16124
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nonnative (0.2.
|
4
|
+
nonnative (0.2.1)
|
5
5
|
cucumber
|
6
6
|
rspec-expectations
|
7
|
+
semantic_logger
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
@@ -12,6 +13,7 @@ GEM
|
|
12
13
|
backport (1.1.1)
|
13
14
|
backports (3.15.0)
|
14
15
|
builder (3.2.3)
|
16
|
+
concurrent-ruby (1.1.5)
|
15
17
|
cucumber (3.1.2)
|
16
18
|
builder (>= 2.1.2)
|
17
19
|
cucumber-core (~> 3.2.0)
|
@@ -57,6 +59,8 @@ GEM
|
|
57
59
|
ruby-progressbar (~> 1.7)
|
58
60
|
unicode-display_width (>= 1.4.0, < 1.7)
|
59
61
|
ruby-progressbar (1.10.1)
|
62
|
+
semantic_logger (4.5.0)
|
63
|
+
concurrent-ruby (~> 1.0)
|
60
64
|
solargraph (0.35.1)
|
61
65
|
backport (~> 1.1)
|
62
66
|
bundler (>= 1.17.2)
|
data/README.md
CHANGED
@@ -41,11 +41,3 @@ Nonnative.configure do |config|
|
|
41
41
|
config.port = 12_321
|
42
42
|
end
|
43
43
|
```
|
44
|
-
|
45
|
-
Tag your cucumber scenarios with @nonnative
|
46
|
-
|
47
|
-
```cucumber
|
48
|
-
Scenario: Successful Response
|
49
|
-
When we send "test" with the echo client
|
50
|
-
Then we should receive a "test" response
|
51
|
-
```
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'semantic_logger'
|
4
|
+
|
5
|
+
SemanticLogger.default_level = :info
|
6
|
+
SemanticLogger.add_appender(io: STDOUT, formatter: :color)
|
7
|
+
|
8
|
+
module Nonnative
|
9
|
+
class Logger
|
10
|
+
class << self
|
11
|
+
def create
|
12
|
+
SemanticLogger['nonnative']
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/nonnative/process.rb
CHANGED
@@ -2,25 +2,28 @@
|
|
2
2
|
|
3
3
|
module Nonnative
|
4
4
|
class Process
|
5
|
-
def initialize(configuration)
|
5
|
+
def initialize(configuration, logger)
|
6
6
|
@configuration = configuration
|
7
|
+
@logger = logger
|
7
8
|
end
|
8
9
|
|
9
10
|
def start
|
10
11
|
@child_pid = spawn(configuration.process)
|
11
12
|
return if port_open?
|
12
13
|
|
13
|
-
|
14
|
-
raise Nonnative::Error, 'Could not start the process'
|
14
|
+
logger.error('Process has started though did respond in time', pid: child_pid)
|
15
15
|
end
|
16
16
|
|
17
17
|
def stop
|
18
18
|
::Process.kill('SIGHUP', child_pid)
|
19
|
+
return unless port_open?
|
20
|
+
|
21
|
+
logger.error('Process has stopped though did respond in time', pid: child_pid)
|
19
22
|
end
|
20
23
|
|
21
24
|
private
|
22
25
|
|
23
|
-
attr_reader :configuration, :child_pid
|
26
|
+
attr_reader :configuration, :logger, :child_pid
|
24
27
|
|
25
28
|
def port_open?
|
26
29
|
Timeout.timeout(configuration.timeout) do
|
data/lib/nonnative/version.rb
CHANGED
data/lib/nonnative.rb
CHANGED
@@ -10,9 +10,14 @@ require 'nonnative/error'
|
|
10
10
|
require 'nonnative/configuration'
|
11
11
|
require 'nonnative/cucumber'
|
12
12
|
require 'nonnative/process'
|
13
|
+
require 'nonnative/logger'
|
13
14
|
|
14
15
|
module Nonnative
|
15
16
|
class << self
|
17
|
+
def logger
|
18
|
+
@logger ||= Nonnative::Logger.create
|
19
|
+
end
|
20
|
+
|
16
21
|
def configuration
|
17
22
|
@configuration ||= Nonnative::Configuration.new
|
18
23
|
end
|
@@ -22,7 +27,7 @@ module Nonnative
|
|
22
27
|
end
|
23
28
|
|
24
29
|
def start
|
25
|
-
@process ||= Nonnative::Process.new(configuration)
|
30
|
+
@process ||= Nonnative::Process.new(configuration, logger)
|
26
31
|
@process.start
|
27
32
|
end
|
28
33
|
|
data/nonnative.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nonnative
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Falkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: semantic_logger
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -118,6 +132,7 @@ files:
|
|
118
132
|
- lib/nonnative/configuration.rb
|
119
133
|
- lib/nonnative/cucumber.rb
|
120
134
|
- lib/nonnative/error.rb
|
135
|
+
- lib/nonnative/logger.rb
|
121
136
|
- lib/nonnative/process.rb
|
122
137
|
- lib/nonnative/version.rb
|
123
138
|
- nonnative.gemspec
|