nonnative 1.34.0 → 1.40.0

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
  SHA256:
3
- metadata.gz: 796ba4a8f59903f33fd52ecc0657c9dd741ecb79002d9d0397a8b6b578de3323
4
- data.tar.gz: f0a7a0ae04ad4afb063e630ba6a79573105cd2ac4b2bf73e9126e461bf1a71d6
3
+ metadata.gz: 870143059910a181598b40406aebc0e8d7882133aa01b82091da14436dee664a
4
+ data.tar.gz: 6a1e9449a4eb21b1c58c6c5b3a8256546956f84db8cd5c09c7a939ea09f33cbc
5
5
  SHA512:
6
- metadata.gz: d56caea50dbc0451c2708626b48b444781f2b79ff290b1d64b42a6401d384179c4ad62641706d213615feda86e780d410bd069914c437343b9c39803db2f2d39
7
- data.tar.gz: 4f0ad200212c58805e3e4d74900773520ad99156772344578ec3daa80aeb690808f682d240433dfc521502235e3984c84d893a875444f0a5ea6eefb5dcf710f2
6
+ metadata.gz: 38f4f40a6460548a9470f707c66e1b5067c3a336a97f49de4415ffdcbb85f07c7f626b61f5948485c630ddcb9d8235b0a6ed069cbd1c6844bfd25b4e9109879c
7
+ data.tar.gz: a19898c50a83a2f7d3d330eec829d7420236f87f0f00919256ebe1ab34c4bffd175124cd5ed832b09275942707b9a15fc3f84a7b14e82d85a5d9437e89bcbadf
data/.circleci/config.yml CHANGED
@@ -1,6 +1,4 @@
1
1
  version: 2.1
2
- orbs:
3
- sonarcloud: sonarsource/sonarcloud@1.0.1
4
2
 
5
3
  jobs:
6
4
  build:
@@ -12,7 +10,7 @@ jobs:
12
10
  keys:
13
11
  - nonnative-gem-cache-{{ checksum "Gemfile.lock" }}
14
12
  - nonnative-gem-cache-
15
- - run: make dependencies
13
+ - run: make dep
16
14
  - save_cache:
17
15
  key: nonnative-gem-cache-{{ checksum "Gemfile.lock" }}
18
16
  paths:
@@ -20,15 +18,14 @@ jobs:
20
18
  - run: make features
21
19
  - store_test_results:
22
20
  path: reports
23
- - run: make analysis
21
+ - run: make lint
24
22
  - store_artifacts:
25
23
  path: coverage
26
24
  - store_artifacts:
27
25
  path: features/logs
28
- - sonarcloud/scan
29
26
  release:
30
27
  docker:
31
- - image: alexfalkowski/release:1.0
28
+ - image: alexfalkowski/release:2.0
32
29
  steps:
33
30
  - checkout
34
31
  - run: release.sh
@@ -36,9 +33,9 @@ jobs:
36
33
  workflows:
37
34
  nonnative:
38
35
  jobs:
39
- - build:
40
- context: SonarCloud
36
+ - build
41
37
  - release:
38
+ context: gh
42
39
  requires:
43
40
  - build
44
41
  filters:
data/.rubocop.yml CHANGED
@@ -4,7 +4,7 @@ AllCops:
4
4
  NewCops: enable
5
5
 
6
6
  Layout/LineLength:
7
- Max: 120
7
+ Max: 160
8
8
 
9
9
  Metrics/MethodLength:
10
10
  Max: 20
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.7.1
1
+ ruby-2.7.2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,65 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.40.0](https://github.com/alexfalkowski/nonnative/compare/v1.39.0...v1.40.0) (2021-04-25)
6
+
7
+
8
+ ### Features
9
+
10
+ * update deps ([#76](https://github.com/alexfalkowski/nonnative/issues/76)) ([83c9e16](https://github.com/alexfalkowski/nonnative/commit/83c9e16b5e5f9f14ed2cc5fd2eb29b83147c1e53))
11
+
12
+ ## [1.39.0](https://github.com/alexfalkowski/nonnative/compare/v1.38.0...v1.39.0) (2021-04-23)
13
+
14
+
15
+ ### Features
16
+
17
+ * log interruptions ([#75](https://github.com/alexfalkowski/nonnative/issues/75)) ([bde3e05](https://github.com/alexfalkowski/nonnative/commit/bde3e052b422a0ca659cfb54fcf3ca9d8a1fb20c))
18
+
19
+ ## [1.38.0](https://github.com/alexfalkowski/nonnative/compare/v1.37.0...v1.38.0) (2021-04-22)
20
+
21
+
22
+ ### Features
23
+
24
+ * terminate connections on change ([#74](https://github.com/alexfalkowski/nonnative/issues/74)) ([6c1cc8e](https://github.com/alexfalkowski/nonnative/commit/6c1cc8e1c3f15d11848889852897b523f5848794))
25
+
26
+ ## [1.37.0](https://github.com/alexfalkowski/nonnative/compare/v1.36.0...v1.37.0) (2021-04-22)
27
+
28
+
29
+ ### Features
30
+
31
+ * simplify go exeutable ([#73](https://github.com/alexfalkowski/nonnative/issues/73)) ([95e4cf4](https://github.com/alexfalkowski/nonnative/commit/95e4cf44180ee84d32cc42ee058d6742732b57b9))
32
+
33
+ ## [1.36.0](https://github.com/alexfalkowski/nonnative/compare/v1.35.2...v1.36.0) (2021-04-21)
34
+
35
+
36
+ ### Features
37
+
38
+ * remove badge from docs ([#72](https://github.com/alexfalkowski/nonnative/issues/72)) ([2cd384c](https://github.com/alexfalkowski/nonnative/commit/2cd384cb9f73da1f131829f1eaf9b0c9e1ae3cdf))
39
+
40
+ ### [1.35.2](https://github.com/alexfalkowski/nonnative/compare/v1.35.1...v1.35.2) (2021-04-21)
41
+
42
+
43
+ ### Bug Fixes
44
+
45
+ * go command ([#71](https://github.com/alexfalkowski/nonnative/issues/71)) ([fe28cf3](https://github.com/alexfalkowski/nonnative/commit/fe28cf345be108780b47ac4c96d212b215d721a8))
46
+
47
+ ### [1.35.1](https://github.com/alexfalkowski/nonnative/compare/v1.35.0...v1.35.1) (2021-04-04)
48
+
49
+ ## [1.35.0](https://github.com/alexfalkowski/nonnative/compare/v1.34.0...v1.35.0) (2021-04-03)
50
+
51
+
52
+ ### Features
53
+
54
+ * **deps:** udate to latest ([#69](https://github.com/alexfalkowski/nonnative/issues/69)) ([8989b5d](https://github.com/alexfalkowski/nonnative/commit/8989b5dd960cc7064ed196545625c9ef8b9ee280))
55
+ * update ruby to version 2.7.2 [ci skip] ([90d3cb7](https://github.com/alexfalkowski/nonnative/commit/90d3cb7b24d2c4a70dd8e4fad809f008c849b34b))
56
+
57
+ ## [1.34.0](https://github.com/alexfalkowski/nonnative/compare/v1.33.0...v1.34.0) (2020-10-30)
58
+
59
+
60
+ ### Features
61
+
62
+ * bump to version 1.34.0 ([882f3db](https://github.com/alexfalkowski/nonnative/commit/882f3db513a8ffae7661dd000d50a380c2c004d0))
63
+
5
64
  ## [1.33.0](https://github.com/alexfalkowski/nonnative/compare/v1.32.0...v1.33.0) (2020-10-30)
6
65
 
7
66
 
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nonnative (1.34.0)
4
+ nonnative (1.40.0)
5
5
  concurrent-ruby (~> 1.0, >= 1.0.5)
6
- cucumber (>= 5, < 6)
6
+ cucumber (>= 6, < 7)
7
7
  grpc (>= 1, < 2)
8
+ grpc-tools (>= 1, < 2)
8
9
  puma (~> 5.0)
9
10
  rest-client (~> 2.1)
10
11
  rspec-benchmark (~> 0.6.0)
@@ -14,99 +15,113 @@ PATH
14
15
  GEM
15
16
  remote: https://rubygems.org/
16
17
  specs:
17
- activesupport (6.0.3.4)
18
+ activesupport (6.1.3.1)
18
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
- i18n (>= 0.7, < 2)
20
- minitest (~> 5.1)
21
- tzinfo (~> 1.1)
22
- zeitwerk (~> 2.2, >= 2.2.2)
23
- ast (2.4.1)
20
+ i18n (>= 1.6, < 2)
21
+ minitest (>= 5.1)
22
+ tzinfo (~> 2.0)
23
+ zeitwerk (~> 2.3)
24
+ ast (2.4.2)
25
+ backport (1.1.2)
26
+ benchmark (0.1.1)
24
27
  benchmark-malloc (0.2.0)
25
28
  benchmark-perf (0.6.0)
26
29
  benchmark-trend (0.4.0)
27
30
  builder (3.2.4)
28
- concurrent-ruby (1.1.7)
29
- cucumber (5.2.0)
31
+ concurrent-ruby (1.1.8)
32
+ cucumber (6.0.0)
30
33
  builder (~> 3.2, >= 3.2.4)
31
- cucumber-core (~> 8.0, >= 8.0.1)
32
- cucumber-create-meta (~> 2.0, >= 2.0.2)
33
- cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
34
- cucumber-gherkin (~> 15.0, >= 15.0.2)
35
- cucumber-html-formatter (~> 9.0, >= 9.0.0)
36
- cucumber-messages (~> 13.1, >= 13.1.0)
37
- cucumber-wire (~> 4.0, >= 4.0.1)
34
+ cucumber-core (~> 9.0, >= 9.0.0)
35
+ cucumber-create-meta (~> 4.0, >= 4.0.0)
36
+ cucumber-cucumber-expressions (~> 12.1, >= 12.1.1)
37
+ cucumber-gherkin (~> 18.1, >= 18.1.0)
38
+ cucumber-html-formatter (~> 13.0, >= 13.0.0)
39
+ cucumber-messages (~> 15.0, >= 15.0.0)
40
+ cucumber-wire (~> 5.0, >= 5.0.0)
38
41
  diff-lcs (~> 1.4, >= 1.4.4)
42
+ mime-types (~> 3.3, >= 3.3.1)
39
43
  multi_test (~> 0.1, >= 0.1.2)
40
- sys-uname (~> 1.2, >= 1.2.1)
41
- cucumber-core (8.0.1)
42
- cucumber-gherkin (~> 15.0, >= 15.0.2)
43
- cucumber-messages (~> 13.0, >= 13.0.1)
44
- cucumber-tag-expressions (~> 2.0, >= 2.0.4)
45
- cucumber-create-meta (2.0.4)
46
- cucumber-messages (~> 13.1, >= 13.1.0)
47
- sys-uname (~> 1.2, >= 1.2.1)
48
- cucumber-cucumber-expressions (10.3.0)
49
- cucumber-gherkin (15.0.2)
50
- cucumber-messages (~> 13.0, >= 13.0.1)
51
- cucumber-html-formatter (9.0.0)
52
- cucumber-messages (~> 13.0, >= 13.0.1)
53
- cucumber-messages (13.1.0)
44
+ sys-uname (~> 1.2, >= 1.2.2)
45
+ cucumber-core (9.0.0)
46
+ cucumber-gherkin (~> 18.1, >= 18.1.0)
47
+ cucumber-messages (~> 15.0, >= 15.0.0)
48
+ cucumber-tag-expressions (~> 3.0, >= 3.0.1)
49
+ cucumber-create-meta (4.0.0)
50
+ cucumber-messages (~> 15.0, >= 15.0.0)
51
+ sys-uname (~> 1.2, >= 1.2.2)
52
+ cucumber-cucumber-expressions (12.1.1)
53
+ cucumber-gherkin (18.1.1)
54
+ cucumber-messages (~> 15.0, >= 15.0.0)
55
+ cucumber-html-formatter (13.0.0)
56
+ cucumber-messages (~> 15.0, >= 15.0.0)
57
+ cucumber-messages (15.0.0)
54
58
  protobuf-cucumber (~> 3.10, >= 3.10.8)
55
- cucumber-tag-expressions (2.0.4)
56
- cucumber-wire (4.0.1)
57
- cucumber-core (~> 8.0, >= 8.0.1)
58
- cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
59
- cucumber-messages (~> 13.0, >= 13.0.1)
59
+ cucumber-tag-expressions (3.0.1)
60
+ cucumber-wire (5.0.0)
61
+ cucumber-core (~> 9.0, >= 9.0.0)
62
+ cucumber-cucumber-expressions (~> 12.1, >= 12.1.1)
63
+ cucumber-messages (~> 15.0, >= 15.0.0)
60
64
  diff-lcs (1.4.4)
61
- docile (1.3.2)
65
+ docile (1.3.5)
62
66
  domain_name (0.5.20190701)
63
67
  unf (>= 0.0.5, < 1.0.0)
64
- ffi (1.13.1)
65
- google-protobuf (3.13.0)
66
- googleapis-common-protos-types (1.0.5)
67
- google-protobuf (~> 3.11)
68
- grpc (1.32.0)
69
- google-protobuf (~> 3.13)
68
+ e2mmap (0.1.0)
69
+ ffi (1.15.0)
70
+ google-protobuf (3.15.8)
71
+ googleapis-common-protos-types (1.0.6)
72
+ google-protobuf (~> 3.14)
73
+ grpc (1.37.0)
74
+ google-protobuf (~> 3.15)
70
75
  googleapis-common-protos-types (~> 1.0)
71
- grpc-tools (1.32.0)
76
+ grpc-tools (1.37.0)
72
77
  http-accept (1.7.0)
73
78
  http-cookie (1.0.3)
74
79
  domain_name (~> 0.5)
75
- i18n (1.8.5)
80
+ i18n (1.8.10)
76
81
  concurrent-ruby (~> 1.0)
77
- json (2.3.1)
82
+ jaro_winkler (1.5.4)
83
+ kramdown (2.3.1)
84
+ rexml
85
+ kramdown-parser-gfm (1.1.0)
86
+ kramdown (~> 2.0)
78
87
  middleware (0.1.0)
79
88
  mime-types (3.3.1)
80
89
  mime-types-data (~> 3.2015)
81
- mime-types-data (3.2020.0512)
82
- minitest (5.14.2)
90
+ mime-types-data (3.2021.0225)
91
+ mini_portile2 (2.5.0)
92
+ minitest (5.14.4)
83
93
  multi_test (0.1.2)
84
94
  mustermann (1.1.1)
85
95
  ruby2_keywords (~> 0.0.1)
86
96
  netrc (0.11.0)
87
- nio4r (2.5.4)
88
- parallel (1.19.2)
89
- parser (2.7.2.0)
97
+ nio4r (2.5.7)
98
+ nokogiri (1.11.3)
99
+ mini_portile2 (~> 2.5.0)
100
+ racc (~> 1.4)
101
+ parallel (1.20.1)
102
+ parser (3.0.1.0)
90
103
  ast (~> 2.4.1)
91
104
  protobuf-cucumber (3.10.8)
92
105
  activesupport (>= 3.2)
93
106
  middleware
94
107
  thor
95
108
  thread_safe
96
- puma (5.0.4)
109
+ puma (5.2.2)
97
110
  nio4r (~> 2.0)
111
+ racc (1.5.2)
98
112
  rack (2.2.3)
99
113
  rack-protection (2.1.0)
100
114
  rack
101
115
  rainbow (3.0.0)
102
- rake (13.0.1)
103
- regexp_parser (1.8.2)
116
+ regexp_parser (2.1.1)
104
117
  rest-client (2.1.0)
105
118
  http-accept (>= 1.7.0, < 2.0)
106
119
  http-cookie (>= 1.0.2, < 2.0)
107
120
  mime-types (>= 1.16, < 4.0)
108
121
  netrc (~> 0.8)
109
- rexml (3.2.4)
122
+ reverse_markdown (2.0.0)
123
+ nokogiri
124
+ rexml (3.2.5)
110
125
  rspec (3.10.0)
111
126
  rspec-core (~> 3.10.0)
112
127
  rspec-expectations (~> 3.10.0)
@@ -116,61 +131,76 @@ GEM
116
131
  benchmark-perf (~> 0.6)
117
132
  benchmark-trend (~> 0.4)
118
133
  rspec (>= 3.0)
119
- rspec-core (3.10.0)
134
+ rspec-core (3.10.1)
120
135
  rspec-support (~> 3.10.0)
121
- rspec-expectations (3.10.0)
136
+ rspec-expectations (3.10.1)
122
137
  diff-lcs (>= 1.2.0, < 2.0)
123
138
  rspec-support (~> 3.10.0)
124
- rspec-mocks (3.10.0)
139
+ rspec-mocks (3.10.2)
125
140
  diff-lcs (>= 1.2.0, < 2.0)
126
141
  rspec-support (~> 3.10.0)
127
- rspec-support (3.10.0)
128
- rubocop (1.0.0)
142
+ rspec-support (3.10.2)
143
+ rubocop (1.13.0)
129
144
  parallel (~> 1.10)
130
- parser (>= 2.7.1.5)
145
+ parser (>= 3.0.0.0)
131
146
  rainbow (>= 2.2.2, < 4.0)
132
- regexp_parser (>= 1.8)
147
+ regexp_parser (>= 1.8, < 3.0)
133
148
  rexml
134
- rubocop-ast (>= 0.6.0)
149
+ rubocop-ast (>= 1.2.0, < 2.0)
135
150
  ruby-progressbar (~> 1.7)
136
- unicode-display_width (>= 1.4.0, < 2.0)
137
- rubocop-ast (1.0.0)
151
+ unicode-display_width (>= 1.4.0, < 3.0)
152
+ rubocop-ast (1.4.1)
138
153
  parser (>= 2.7.1.5)
139
- ruby-progressbar (1.10.1)
140
- ruby2_keywords (0.0.2)
141
- simplecov (0.17.1)
154
+ ruby-progressbar (1.11.0)
155
+ ruby2_keywords (0.0.4)
156
+ simplecov (0.21.2)
142
157
  docile (~> 1.1)
143
- json (>= 1.8, < 3)
144
- simplecov-html (~> 0.10.0)
145
- simplecov-html (0.10.2)
158
+ simplecov-html (~> 0.11)
159
+ simplecov_json_formatter (~> 0.1)
160
+ simplecov-html (0.12.3)
161
+ simplecov_json_formatter (0.1.2)
146
162
  sinatra (2.1.0)
147
163
  mustermann (~> 1.0)
148
164
  rack (~> 2.2)
149
165
  rack-protection (= 2.1.0)
150
166
  tilt (~> 2.0)
167
+ solargraph (0.40.4)
168
+ backport (~> 1.1)
169
+ benchmark
170
+ bundler (>= 1.17.2)
171
+ e2mmap
172
+ jaro_winkler (~> 1.5)
173
+ kramdown (~> 2.3)
174
+ kramdown-parser-gfm (~> 1.1)
175
+ parser (~> 3.0)
176
+ reverse_markdown (>= 1.0.5, < 3)
177
+ rubocop (>= 0.52)
178
+ thor (~> 1.0)
179
+ tilt (~> 2.0)
180
+ yard (~> 0.9, >= 0.9.24)
151
181
  sys-uname (1.2.2)
152
182
  ffi (~> 1.1)
153
183
  thor (1.0.1)
154
184
  thread_safe (0.3.6)
155
185
  tilt (2.0.10)
156
- tzinfo (1.2.7)
157
- thread_safe (~> 0.1)
186
+ tzinfo (2.0.4)
187
+ concurrent-ruby (~> 1.0)
158
188
  unf (0.1.4)
159
189
  unf_ext
160
190
  unf_ext (0.0.7.7)
161
- unicode-display_width (1.7.0)
162
- zeitwerk (2.4.1)
191
+ unicode-display_width (2.0.0)
192
+ yard (0.9.26)
193
+ zeitwerk (2.4.2)
163
194
 
164
195
  PLATFORMS
165
196
  ruby
166
197
 
167
198
  DEPENDENCIES
168
199
  bundler (~> 2.1, >= 2.1.4)
169
- grpc-tools (>= 1, < 2)
170
200
  nonnative!
171
- rake (~> 13.0, >= 13.0.1)
172
- rubocop (~> 1.0)
173
- simplecov (~> 0.17.1)
201
+ rubocop (~> 1.12)
202
+ simplecov (~> 0.21.2)
203
+ solargraph (~> 0.40.4)
174
204
 
175
205
  BUNDLED WITH
176
206
  2.1.4
data/Makefile CHANGED
@@ -1,27 +1,27 @@
1
1
  .PHONY: features
2
2
 
3
- dependencies:
3
+ dep:
4
4
  bin/setup
5
5
 
6
- outdated-dependencies:
6
+ outdated:
7
7
  bundle outdated --only-explicit
8
8
 
9
9
  features: clean
10
10
  bundle exec cucumber --profile report --fail-fast $(feature)
11
11
 
12
- analysis:
12
+ lint:
13
13
  bundle exec rubocop
14
14
 
15
- cleanup-analysis:
15
+ fix-lint:
16
16
  bundle exec rubocop -A
17
17
 
18
- cleanup-logs:
18
+ clean-logs:
19
19
  rm -rf features/logs/*.log
20
20
 
21
- cleanup-reports:
21
+ clean-reports:
22
22
  rm -rf reports
23
23
 
24
- cleanup-coverage:
24
+ clean-coverage:
25
25
  rm -rf coverage
26
26
 
27
- clean: cleanup-logs cleanup-reports cleanup-coverage
27
+ clean: clean-logs clean-reports clean-coverage
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
1
  [![CircleCI](https://circleci.com/gh/alexfalkowski/nonnative.svg?style=svg)](https://circleci.com/gh/alexfalkowski/nonnative)
2
- [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=alexfalkowski_nonnative&metric=alert_status)](https://sonarcloud.io/dashboard?id=alexfalkowski_nonnative)
3
2
 
4
3
  # Nonnative
5
4
 
@@ -374,7 +373,6 @@ server.proxy.close_all # To use close_all.
374
373
  server.proxy.reset # To reset it back to a good state.
375
374
  ```
376
375
 
377
-
378
376
  ### Go
379
377
 
380
378
  As we love using go as a language for services we have added support to start binaries with defined parameters. This expects that you build your services in the format of `command sub_command --params`
@@ -382,8 +380,6 @@ As we love using go as a language for services we have added support to start bi
382
380
  To get this to work you will need to create a `main_test.go` file with these contents:
383
381
 
384
382
  ```go
385
- // +build features
386
-
387
383
  package main
388
384
 
389
385
  import (
@@ -401,11 +397,11 @@ func TestFeatures(t *testing.T) {
401
397
  Then to compile this binary you will need to do the following:
402
398
 
403
399
  ```sh
404
- go test -mod vendor -c -tags features -covermode=count -o your_binary -coverpkg=./... github.com/your_location
400
+ go test -mod vendor -c -covermode=count -o your_binary -coverpkg=./... github.com/your_location
405
401
  ```
406
402
 
407
403
  Then to get an executable you do the following:
408
404
 
409
405
  ```ruby
410
- Nonnative::GoCommand.new('your_binary', 'reports').executable('sub_command', '--config config.yaml')
406
+ Nonnative.go_executable('reports', 'your_binary', 'sub_command', '--config config.yaml')
411
407
  ```
data/lib/nonnative.rb CHANGED
@@ -46,6 +46,10 @@ module Nonnative
46
46
  class << self
47
47
  attr_reader :pool
48
48
 
49
+ def go_executable(output, exec, cmd, *params)
50
+ Nonnative::GoCommand.new(exec, output).executable(cmd, params)
51
+ end
52
+
49
53
  def load_configuration(path)
50
54
  @configuration ||= Nonnative::Configuration.load_file(path) # rubocop:disable Naming/MemoizedInstanceVariableName
51
55
  end
@@ -3,6 +3,7 @@
3
3
  module Nonnative
4
4
  class CloseAllSocketPair < SocketPair
5
5
  def connect(local_socket)
6
+ ensure
6
7
  local_socket.close
7
8
  end
8
9
  end
@@ -48,27 +48,46 @@ module Nonnative
48
48
  def perform_start
49
49
  loop do
50
50
  thread = Thread.start(tcp_server.accept) do |local_socket|
51
- id = Thread.current.object_id
52
-
53
- logger.info "started connection for #{id} with socket #{local_socket.inspect}"
54
-
55
- connect local_socket
56
- connections.delete(id)
57
-
58
- logger.info "finished connection for #{id} with socket #{local_socket.inspect}"
51
+ accept_connection local_socket
59
52
  end
60
53
 
61
- thread.report_on_exception = false
62
54
  connections[thread.object_id] = thread
63
55
  end
64
56
  end
65
57
 
58
+ def accept_connection(local_socket)
59
+ id = Thread.current.object_id
60
+ socket_info = local_socket.inspect
61
+
62
+ error = connect(local_socket)
63
+ if error
64
+ logger.error "could not handle the connection for '#{id}' with socket '#{socket_info}' and error '#{error}'"
65
+ else
66
+ logger.info "handled connection for '#{id}' with socket '#{socket_info}'"
67
+ end
68
+
69
+ connections.delete(id)
70
+ end
71
+
66
72
  def connect(local_socket)
67
- SocketPairFactory.create(read_state, service.proxy, logger).connect(local_socket)
73
+ pair = SocketPairFactory.create(read_state, service.proxy)
74
+ pair.connect(local_socket)
75
+ rescue StandardError => e
76
+ local_socket.close
77
+
78
+ e
79
+ end
80
+
81
+ def close_connections
82
+ connections.each_value(&:terminate)
83
+ connections.clear
68
84
  end
69
85
 
70
86
  def apply_state(state)
71
- mutex.synchronize { @state = state }
87
+ mutex.synchronize do
88
+ @state = state
89
+ close_connections
90
+ end
72
91
  end
73
92
 
74
93
  def read_state
@@ -2,30 +2,25 @@
2
2
 
3
3
  module Nonnative
4
4
  class GoCommand
5
- def initialize(main, output)
6
- @main = main
5
+ def initialize(exec, output)
6
+ @exec = exec
7
7
  @output = output
8
8
  end
9
9
 
10
10
  def executable(cmd, *params)
11
11
  params = params.join(' ')
12
- "#{main} #{flags(cmd, params).join(' ')} #{cmd} #{params}"
13
- end
14
-
15
- def execute(cmd, *params)
16
- Open3.popen3(executable(cmd, params)) do |_stdin, stdout, stderr, wait_thr|
17
- return stdout.read, stderr.read, wait_thr.value
18
- end
12
+ "#{exec} #{flags(cmd, params).join(' ')} #{cmd} #{params}".strip
19
13
  end
20
14
 
21
15
  private
22
16
 
23
- attr_reader :main, :output
17
+ attr_reader :exec, :output
24
18
 
25
19
  def flags(cmd, params)
26
- m = File.basename(main, File.extname(main))
20
+ m = File.basename(exec, File.extname(exec))
27
21
  p = params.gsub(/\W/, '')
28
- path = "#{output}/#{m}-#{cmd}-#{p}"
22
+ name = [m, cmd, p].reject(&:empty?).join('-')
23
+ path = "#{output}/#{name}"
29
24
 
30
25
  [
31
26
  "-test.cpuprofile=#{path}-cpu.prof",
@@ -2,9 +2,8 @@
2
2
 
3
3
  module Nonnative
4
4
  class SocketPair
5
- def initialize(proxy, logger)
5
+ def initialize(proxy)
6
6
  @proxy = proxy
7
- @logger = logger
8
7
  end
9
8
 
10
9
  def connect(local_socket)
@@ -16,8 +15,6 @@ module Nonnative
16
15
  break if pipe(ready, local_socket, remote_socket)
17
16
  break if pipe(ready, remote_socket, local_socket)
18
17
  end
19
- rescue StandardError => e
20
- logger.error e
21
18
  ensure
22
19
  local_socket.close
23
20
  remote_socket&.close
@@ -25,7 +22,7 @@ module Nonnative
25
22
 
26
23
  protected
27
24
 
28
- attr_reader :proxy, :logger
25
+ attr_reader :proxy
29
26
 
30
27
  def create_remote_socket
31
28
  ::TCPSocket.new('0.0.0.0', proxy.port)
@@ -3,7 +3,7 @@
3
3
  module Nonnative
4
4
  class SocketPairFactory
5
5
  class << self
6
- def create(type, proxy, logger)
6
+ def create(type, proxy)
7
7
  pair = case type
8
8
  when :close_all
9
9
  CloseAllSocketPair
@@ -15,7 +15,7 @@ module Nonnative
15
15
  SocketPair
16
16
  end
17
17
 
18
- pair.new(proxy, logger)
18
+ pair.new(proxy)
19
19
  end
20
20
  end
21
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Nonnative
4
- VERSION = '1.34.0'
4
+ VERSION = '1.40.0'
5
5
  end
data/nonnative.gemspec CHANGED
@@ -24,8 +24,9 @@ Gem::Specification.new do |spec|
24
24
  spec.required_ruby_version = ['>= 2.7.0', '< 2.8.0']
25
25
 
26
26
  spec.add_dependency 'concurrent-ruby', '~> 1.0', '>= 1.0.5'
27
- spec.add_dependency 'cucumber', ['>= 5', '< 6']
27
+ spec.add_dependency 'cucumber', ['>= 6', '< 7']
28
28
  spec.add_dependency 'grpc', ['>= 1', '< 2']
29
+ spec.add_dependency 'grpc-tools', ['>= 1', '< 2']
29
30
  spec.add_dependency 'puma', '~> 5.0'
30
31
  spec.add_dependency 'rest-client', '~> 2.1'
31
32
  spec.add_dependency 'rspec-benchmark', '~> 0.6.0'
@@ -33,8 +34,7 @@ Gem::Specification.new do |spec|
33
34
  spec.add_dependency 'sinatra', '~> 2.0', '>= 2.0.8.1'
34
35
 
35
36
  spec.add_development_dependency 'bundler', '~> 2.1', '>= 2.1.4'
36
- spec.add_development_dependency 'grpc-tools', ['>= 1', '< 2']
37
- spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.1'
38
- spec.add_development_dependency 'rubocop', '~> 1.0'
39
- spec.add_development_dependency 'simplecov', '~> 0.17.1'
37
+ spec.add_development_dependency 'rubocop', '~> 1.12'
38
+ spec.add_development_dependency 'simplecov', '~> 0.21.2'
39
+ spec.add_development_dependency 'solargraph', '~> 0.40.4'
40
40
  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.34.0
4
+ version: 1.40.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-10-30 00:00:00.000000000 Z
11
+ date: 2021-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -36,20 +36,20 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '5'
39
+ version: '6'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '6'
42
+ version: '7'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '5'
49
+ version: '6'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '6'
52
+ version: '7'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: grpc
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -70,6 +70,26 @@ dependencies:
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '2'
73
+ - !ruby/object:Gem::Dependency
74
+ name: grpc-tools
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '1'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '1'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '2'
73
93
  - !ruby/object:Gem::Dependency
74
94
  name: puma
75
95
  requirement: !ruby/object:Gem::Requirement
@@ -173,73 +193,47 @@ dependencies:
173
193
  - !ruby/object:Gem::Version
174
194
  version: 2.1.4
175
195
  - !ruby/object:Gem::Dependency
176
- name: grpc-tools
177
- requirement: !ruby/object:Gem::Requirement
178
- requirements:
179
- - - ">="
180
- - !ruby/object:Gem::Version
181
- version: '1'
182
- - - "<"
183
- - !ruby/object:Gem::Version
184
- version: '2'
185
- type: :development
186
- prerelease: false
187
- version_requirements: !ruby/object:Gem::Requirement
188
- requirements:
189
- - - ">="
190
- - !ruby/object:Gem::Version
191
- version: '1'
192
- - - "<"
193
- - !ruby/object:Gem::Version
194
- version: '2'
195
- - !ruby/object:Gem::Dependency
196
- name: rake
196
+ name: rubocop
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: '13.0'
202
- - - ">="
203
- - !ruby/object:Gem::Version
204
- version: 13.0.1
201
+ version: '1.12'
205
202
  type: :development
206
203
  prerelease: false
207
204
  version_requirements: !ruby/object:Gem::Requirement
208
205
  requirements:
209
206
  - - "~>"
210
207
  - !ruby/object:Gem::Version
211
- version: '13.0'
212
- - - ">="
213
- - !ruby/object:Gem::Version
214
- version: 13.0.1
208
+ version: '1.12'
215
209
  - !ruby/object:Gem::Dependency
216
- name: rubocop
210
+ name: simplecov
217
211
  requirement: !ruby/object:Gem::Requirement
218
212
  requirements:
219
213
  - - "~>"
220
214
  - !ruby/object:Gem::Version
221
- version: '1.0'
215
+ version: 0.21.2
222
216
  type: :development
223
217
  prerelease: false
224
218
  version_requirements: !ruby/object:Gem::Requirement
225
219
  requirements:
226
220
  - - "~>"
227
221
  - !ruby/object:Gem::Version
228
- version: '1.0'
222
+ version: 0.21.2
229
223
  - !ruby/object:Gem::Dependency
230
- name: simplecov
224
+ name: solargraph
231
225
  requirement: !ruby/object:Gem::Requirement
232
226
  requirements:
233
227
  - - "~>"
234
228
  - !ruby/object:Gem::Version
235
- version: 0.17.1
229
+ version: 0.40.4
236
230
  type: :development
237
231
  prerelease: false
238
232
  version_requirements: !ruby/object:Gem::Requirement
239
233
  requirements:
240
234
  - - "~>"
241
235
  - !ruby/object:Gem::Version
242
- version: 0.17.1
236
+ version: 0.40.4
243
237
  description: Allows you to keep using the power of ruby to test other systems
244
238
  email:
245
239
  - alexrfalkowski@gmail.com
@@ -295,7 +289,6 @@ files:
295
289
  - lib/nonnative/timeout.rb
296
290
  - lib/nonnative/version.rb
297
291
  - nonnative.gemspec
298
- - sonar-project.properties
299
292
  homepage: https://github.com/alexfalkowski/nonnative
300
293
  licenses:
301
294
  - Unlicense
@@ -318,7 +311,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
318
311
  - !ruby/object:Gem::Version
319
312
  version: '0'
320
313
  requirements: []
321
- rubygems_version: 3.1.2
314
+ rubygems_version: 3.1.4
322
315
  signing_key:
323
316
  specification_version: 4
324
317
  summary: Allows you to keep using the power of ruby to test other systems
@@ -1,4 +0,0 @@
1
- sonar.projectKey=alexfalkowski_nonnative
2
- sonar.organization=alejandrofalkowski
3
- sonar.exclusions=features/**/*
4
- sonar.ruby.coverage.reportPaths=coverage/.resultset.json