freshli-commons 0.6.3 → 0.6.5

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: a751675263a73d44064334d8b59efd3bd01dfdbc85fc1866d1718d8e05c48796
4
- data.tar.gz: bac3dad72d4a7f7d9a2470d49ed1e0e8b3076f1d984098530fc5fba7a14d35f4
3
+ metadata.gz: 21e474e889630431e22ad889a33194b4f2a0ae21f720563080416f2ef71c0037
4
+ data.tar.gz: 4f6de194f062b50efbfbb2629d23ca19ab7c1b2d3f5d0d467a4ed1ef6c4975fe
5
5
  SHA512:
6
- metadata.gz: 2abc8d7d2529f33f770f25983a522bc0d7c994702934a680f429a3ffea6b26b696076bd2b927b6a74ef641e177be77a3632329eca447dfdd01b5f0f8f611cb3a
7
- data.tar.gz: acfcebc15394b2fd5e3978d4fa99b5104406548749a5627e8271e80a2f54b1e6c08f4fcd7d62c3bdd10b2665aaaae0d57c0edcf70d849af68a461f051a0e767e
6
+ metadata.gz: 413ae77a6c3b4b50a8217074a4ba61cf58df1f6d0c571c0012120569a813d74f7428a93787f93bf1cb74311bfc48c86c0eb7421da1865d788a3557c84ef740fc
7
+ data.tar.gz: 18e590e2ffa3d9fbb5ab47ce5e0ef8355d8f66e993fea3b1f9cc6dc40a8dca2434c85262476f327b6e9122b66b1080a447ecd49aafc00ac7d7733c12deb4a724
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 6
4
- :patch: 3
4
+ :patch: 5
5
5
  :special: ''
6
6
  :metadata: ''
@@ -1,12 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'open3'
4
+ require 'mkmf'
4
5
 
5
6
  module Corgibytes
6
7
  module Freshli
7
8
  module Commons
8
9
  # Contains utility methods for executing commands and working with their output.
9
10
  module Execute
11
+
12
+ def msbuild_dll_path
13
+ dotnet_exe_path = File.realpath(find_executable('dotnet'))
14
+ dotnet_dir = File.dirname(dotnet_exe_path)
15
+ sdk_dir = File.join(dotnet_dir, 'sdk', Dir.children(File.join(dotnet_dir, 'sdk')).max)
16
+ result = File.join(sdk_dir, 'MSBuild.dll')
17
+ result = result.gsub('/', '\\') if Gem.win_platform?
18
+ result
19
+ end
20
+
21
+ def null_output_target
22
+ Gem.win_platform? ? '\\\\.\\nul' : '/dev/null'
23
+ end
24
+
10
25
  def enable_dotnet_command_colors
11
26
  ENV['DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION'] = 'true'
12
27
  end
@@ -31,7 +46,7 @@ module Corgibytes
31
46
  end
32
47
  end
33
48
 
34
- BUFFER_LEN = 128
49
+ BUFFER_LEN = 8
35
50
 
36
51
  def fill_buffer_from_stream(stream, buffer)
37
52
  # loop through reading data until there is an EOF (value is nil)
@@ -89,10 +104,6 @@ module Corgibytes
89
104
  end
90
105
  exit_status
91
106
  end
92
-
93
- def null_output_target
94
- Gem.win_platform? ? 'NUL:' : '/dev/null'
95
- end
96
107
  end
97
108
  end
98
109
  end
@@ -104,11 +104,15 @@ module Corgibytes
104
104
  # rubocop:disable Metrics/MethodLength
105
105
  def wait_until_running!
106
106
  Timeout.timeout(5) do
107
+ attempts = 0
107
108
  loop do
109
+ attempts += 1
110
+ yield(attempts) if block_given?
111
+
108
112
  status = nil
109
113
  begin
110
114
  status = health_check
111
- rescue GRPC::Unavailable
115
+ rescue GRPC::Unavailable, GRPC::NotFound
112
116
  status = nil
113
117
  end
114
118
 
@@ -15,7 +15,9 @@ Then('the freshli_agent.proto gRPC service is running on port {int}') do |port|
15
15
  end
16
16
 
17
17
  When('I wait for the freshli_agent.proto gRPC service to be running on port {int}') do |port|
18
- GrpcClient.new(port).wait_until_running!
18
+ GrpcClient.new(port).wait_until_running! do |attempts|
19
+ log("Checking gRPC service health. Attempt ##{attempts}.")
20
+ end
19
21
  end
20
22
 
21
23
  When('the gRPC service on port {int} is sent the shutdown command') do |port|
@@ -23,7 +25,10 @@ When('the gRPC service on port {int} is sent the shutdown command') do |port|
23
25
  end
24
26
 
25
27
  Then('there are no services running on port {int}') do |port|
26
- expect(Ports.available?(port) { |attempts| log(attempts) }).to be_truthy
28
+ is_port_available = Ports.available?(port) do |attempts|
29
+ log("Checking port availability. Attempt ##{attempts}.")
30
+ end
31
+ expect(is_port_available).to be_truthy
27
32
  end
28
33
 
29
34
  test_services = TestServices.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freshli-commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - M. Scott Ford
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-25 00:00:00.000000000 Z
11
+ date: 2023-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba