nonnative 1.27.0 → 1.28.0

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: '0384f1153315ed00bbf2c15405150a102b5fa7c7fac9548eac6ee2c03e6e821e'
4
- data.tar.gz: d09d8785d1f1a0a81806f3b6740e1b835125884bc1e7b2f192ae8bb8586d8acd
3
+ metadata.gz: bbb604e3c902b73acba698a4c291a0ed9a269fddabbd6e354add54fd751422b9
4
+ data.tar.gz: 7629e83827772b5e9770fe06b45e8d1014f957b8308d044029121fb75ef07f58
5
5
  SHA512:
6
- metadata.gz: b6cf1fad64114a39e7c00090a1dedd00d5c7c4f80344668ef5234e68836c6055a9b5aa839dd6639882effc16d03e142a5ba0db6f18154d05617906ae4492f877
7
- data.tar.gz: 8050865795030f35bb222314905bb4ae981efce1ee21bcad13a9ead4a6d992163439e8b3900aea566d1244cc2438e3a42f711a909a41b55b849e1379af423cb1
6
+ metadata.gz: 7ab05385158fe857b2aadfe587ac1b76e429957a50d91a67e9e62c54c0f9deb3f2fda00a3269883b000adee18ab6d9bf565f3e8a09d8f0e957c67accf55be500
7
+ data.tar.gz: fd18a1d40215a7f520b6f30e72be9dde4ddb5473efa3357b79f9d304e0f81141168492caeb3fd112536b3ad586526db4a3dea4acc93baf272608f62242cc18c7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (1.27.0)
4
+ nonnative (1.28.0)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.5)
6
6
  cucumber (>= 4, < 5)
7
7
  grpc (>= 1, < 2)
@@ -47,12 +47,12 @@ GEM
47
47
  cucumber-create-meta (1.0.0)
48
48
  cucumber-messages (~> 12.2, >= 12.2.0)
49
49
  sys-uname (~> 1.2, >= 1.2.1)
50
- cucumber-cucumber-expressions (10.2.1)
51
- cucumber-gherkin (14.0.1)
52
- cucumber-messages (~> 12.2, >= 12.2.0)
53
- cucumber-html-formatter (7.0.0)
54
- cucumber-messages (~> 12.2, >= 12.2.0)
55
- cucumber-messages (12.2.0)
50
+ cucumber-cucumber-expressions (10.2.2)
51
+ cucumber-gherkin (14.2.0)
52
+ cucumber-messages (~> 12.4, >= 12.4.0)
53
+ cucumber-html-formatter (7.2.0)
54
+ cucumber-messages (~> 12.4, >= 12.4.0)
55
+ cucumber-messages (12.4.0)
56
56
  protobuf-cucumber (~> 3.10, >= 3.10.8)
57
57
  cucumber-tag-expressions (2.0.4)
58
58
  cucumber-wire (3.1.0)
@@ -65,17 +65,17 @@ GEM
65
65
  unf (>= 0.0.5, < 1.0.0)
66
66
  e2mmap (0.1.0)
67
67
  ffi (1.13.1)
68
- google-protobuf (3.12.2)
68
+ google-protobuf (3.12.4)
69
69
  googleapis-common-protos-types (1.0.5)
70
70
  google-protobuf (~> 3.11)
71
- grpc (1.30.1)
71
+ grpc (1.30.2)
72
72
  google-protobuf (~> 3.12)
73
73
  googleapis-common-protos-types (~> 1.0)
74
- grpc-tools (1.30.1)
74
+ grpc-tools (1.30.2)
75
75
  http-accept (1.7.0)
76
76
  http-cookie (1.0.3)
77
77
  domain_name (~> 0.5)
78
- i18n (1.8.4)
78
+ i18n (1.8.5)
79
79
  concurrent-ruby (~> 1.0)
80
80
  jaro_winkler (1.5.4)
81
81
  json (2.3.0)
data/README.md CHANGED
@@ -37,10 +37,19 @@ Configure nonnative with the following:
37
37
  - A timeout value.
38
38
  - Port to verify.
39
39
  - The class for servers.
40
- - The file you want STDOUT to be logged to for processes.
40
+ - The log for servers/processes
41
41
  - The strategy for processes/servers.
42
- * Startup will start the process once.
43
- * Before will hook into cucumbers Before and After.
42
+
43
+ ### Strategy
44
+
45
+ The strategy can be one of the following values:
46
+ - startup - will start the process once.
47
+ - before - will hook into cucumbers Before and After.
48
+ - manual - do this manually
49
+
50
+ This can be overridden by the following environment variables:
51
+ - NONNATIVE_STRATEGY - Set this to override what is set in the config.
52
+ - NONNATIVE_TIMEOUT - Set this (in seconds, e.g 5) to override what is set in the config.
44
53
 
45
54
  ### Processes
46
55
 
@@ -50,12 +59,12 @@ Setup it up programmatically:
50
59
  require 'nonnative'
51
60
 
52
61
  Nonnative.configure do |config|
53
- config.strategy = :startup or :before or :manual
62
+ config.strategy = :startup
54
63
 
55
64
  config.process do |d|
56
65
  d.name = 'start_1'
57
66
  d.command = 'features/support/bin/start 12_321'
58
- d.timeout = 0.5
67
+ d.timeout = config.strategy.timeout
59
68
  d.port = 12_321
60
69
  d.log = 'features/logs/12_321.log'
61
70
  d.signal = 'INT' # Possible values are described in Signal.list.keys
@@ -39,6 +39,7 @@ require 'nonnative/close_all_socket_pair'
39
39
  require 'nonnative/delay_socket_pair'
40
40
  require 'nonnative/invalid_data_socket_pair'
41
41
  require 'nonnative/socket_pair_factory'
42
+ require 'nonnative/strategy'
42
43
 
43
44
  module Nonnative
44
45
  class << self
@@ -56,12 +56,17 @@ module Nonnative
56
56
  end
57
57
 
58
58
  def initialize
59
- self.strategy = :before
60
- self.processes = []
61
- self.servers = []
59
+ @strategy = Strategy.new
60
+ @processes = []
61
+ @servers = []
62
62
  end
63
63
 
64
- attr_accessor :strategy, :processes, :servers
64
+ attr_accessor :processes, :servers
65
+ attr_reader :strategy
66
+
67
+ def strategy=(value)
68
+ @strategy = Strategy.new(value)
69
+ end
65
70
 
66
71
  def process
67
72
  process = Nonnative::ConfigurationProcess.new
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nonnative
4
+ class Strategy
5
+ def initialize(strategy = 'before', timeout = 5)
6
+ @strategy = strategy
7
+ @timeout = timeout
8
+ end
9
+
10
+ def timeout
11
+ (env_timeout || @timeout).to_i
12
+ end
13
+
14
+ def to_s
15
+ (env_strategy || @strategy).to_s
16
+ end
17
+
18
+ private
19
+
20
+ def env_strategy
21
+ @env_strategy ||= ENV['NONNATIVE_STRATEGY']
22
+ end
23
+
24
+ def env_timeout
25
+ @env_timeout ||= ENV['NONNATIVE_TIMEOUT']
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nonnative
4
- VERSION = '1.27.0'
4
+ VERSION = '1.28.0'
5
5
  end
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: 1.27.0
4
+ version: 1.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Falkowski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-21 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -310,6 +310,7 @@ files:
310
310
  - lib/nonnative/start_error.rb
311
311
  - lib/nonnative/startup.rb
312
312
  - lib/nonnative/stop_error.rb
313
+ - lib/nonnative/strategy.rb
313
314
  - lib/nonnative/timeout.rb
314
315
  - lib/nonnative/version.rb
315
316
  - nonnative.gemspec