freshli-commons 0.6.4 → 0.6.7

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: d95cfbbcfd1f22a42fd6d51c485eba7d06fe0a92a813df113de230a53983c9b8
4
- data.tar.gz: 87fd47d927a2c0a9eadd6d9a2f1fea52ddeca1e825fad10c7f5237b0b7da5472
3
+ metadata.gz: d240b4214d3146f9ac2a850f8bbec234cc081e730ccf2e404c1d230e4c7d31b2
4
+ data.tar.gz: 2307b0714f44f51a154e9d74ae73f0b88cac082e0f2e25b9898b8c9a763991e2
5
5
  SHA512:
6
- metadata.gz: 999ee8589980e249c8c6f7eb8f0abd35979dc6c9b5401de2276542f8dade867f140bf608f4c55b10ca16799abe69f66b81ee3e19ab426af70e947005069fa66f
7
- data.tar.gz: fe6e596e37061fae93c278aff9b7d2974e365f65cd15751a9261f18618d7ddde8a584b3d92547d4af3661679ec268fe0dac5c87fcbb5c08e7296fed1a5118529
6
+ metadata.gz: 6db1d2dc787cc06685ab40d62cc2bee3ebd97f419778f020761c049218e2cf5e7aa9732d91c809f1719063d2f256b90bd823f797fdd5a769e1946868168a0cae
7
+ data.tar.gz: da480f259e5248d35807e37cc52a9044ee6f0218d69a53e5083a0d42b640fcdf9c94bda1ad1c163dfbdce827e46c0118ab102bfd73562fcc17be762b81dc5d99
data/Rakefile CHANGED
@@ -3,6 +3,8 @@
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
+ require 'git-version-bump'
7
+
6
8
  require 'fileutils'
7
9
 
8
10
  # TODO: Copy the `freshli_agent.proto` from the `corgibytes/freshli` repository
@@ -70,7 +72,57 @@ require 'rubocop/rake_task'
70
72
 
71
73
  RuboCop::RakeTask.new
72
74
 
75
+ namespace :version do
76
+ desc "Persist the the current version number as #{GVB.version}"
77
+ task :persist do
78
+ version_file = File.expand_path(File.join(File.dirname(__FILE__), 'lib', 'corgibytes', 'freshli', 'commons', 'version.rb'))
79
+ version_file_contents = <<~VERSION_FILE
80
+ module Corgibytes
81
+ module Freshli
82
+ module Commons
83
+ VERSION = '#{GVB.version}'
84
+ end
85
+ end
86
+ end
87
+ VERSION_FILE
88
+ File.write(version_file, version_file_contents)
89
+ end
90
+ end
91
+
73
92
  # Ensure that the grpc files are generated before the build runs
74
- Rake::Task['build'].enhance(['grpc'])
93
+ Rake::Task['build'].enhance(['grpc', 'version:bump:patch', 'version:persist'])
75
94
 
76
95
  task default: %i[grpc spec rubocop]
96
+
97
+ # Copied from https://github.com/mpalmer/git-version-bump/blob/c1af65cd82c131cb541fa717b3d24a9247973049/lib/git-version-bump/rake-tasks.rb
98
+ # to avoid an issue that was causing the version number of the `git-version-bump` gem to be used instead
99
+ # of this gem's version. That's because of how the `GVB.version` method determines the calling file.
100
+ namespace :version do
101
+ namespace :bump do
102
+ desc "bump major version (x.y.z -> x+1.0.0)"
103
+ task :major do
104
+ GVB.tag_version "#{GVB.major_version + 1}.0.0"
105
+
106
+ puts "Version is now #{GVB.version}"
107
+ end
108
+
109
+ desc "bump minor version (x.y.z -> x.y+1.0)"
110
+ task :minor do
111
+ GVB.tag_version "#{GVB.major_version}.#{GVB.minor_version+1}.0"
112
+
113
+ puts "Version is now #{GVB.version}"
114
+ end
115
+
116
+ desc "bump patch version (x.y.z -> x.y.z+1)"
117
+ task :patch do
118
+ GVB.tag_version "#{GVB.major_version}.#{GVB.minor_version}.#{GVB.patch_version+1}"
119
+
120
+ puts "Version is now #{GVB.version}"
121
+ end
122
+
123
+ desc "Print current version"
124
+ task :show do
125
+ puts GVB.version
126
+ end
127
+ end
128
+ end
@@ -8,7 +8,6 @@ module Corgibytes
8
8
  module Commons
9
9
  # Contains utility methods for executing commands and working with their output.
10
10
  module Execute
11
-
12
11
  def msbuild_dll_path
13
12
  dotnet_exe_path = File.realpath(find_executable('dotnet'))
14
13
  dotnet_dir = File.dirname(dotnet_exe_path)
@@ -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
@@ -106,6 +111,10 @@ Then('the ProcessManifest response contains the following file paths expanded be
106
111
  expect([@process_manifest_result]).to eq(expected_paths)
107
112
  end
108
113
 
114
+ Then('the ProcessManifest response is empty') do
115
+ expect(@process_manifest_result).to be_empty
116
+ end
117
+
109
118
  When('I call RetrieveReleaseHistory with {string} on port {int}') do |package_url, port|
110
119
  @retrieve_release_history_results = GrpcClient.new(port).retrieve_release_history(package_url)
111
120
  end
@@ -0,0 +1,7 @@
1
+ module Corgibytes
2
+ module Freshli
3
+ module Commons
4
+ VERSION = '0.6.7'
5
+ end
6
+ end
7
+ end
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.4
4
+ version: 0.6.7
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-30 00:00:00.000000000 Z
11
+ date: 2023-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba
@@ -91,7 +91,6 @@ files:
91
91
  - ".editorconfig"
92
92
  - ".rspec"
93
93
  - ".rubocop.yml"
94
- - ".semver"
95
94
  - CODE_OF_CONDUCT.md
96
95
  - LICENSE
97
96
  - README.md
@@ -113,6 +112,7 @@ files:
113
112
  - lib/corgibytes/freshli/commons/step_definitions/grpc/health_pb.rb
114
113
  - lib/corgibytes/freshli/commons/step_definitions/grpc/health_services_pb.rb
115
114
  - lib/corgibytes/freshli/commons/test_services.rb
115
+ - lib/corgibytes/freshli/commons/version.rb
116
116
  - protos/corgibytes/freshli/agent/grpc/freshli_agent.proto
117
117
  - sig/corgibytes/freshli/commons.rbs
118
118
  homepage: https://github.com/corgibytes/freshli-commons
data/.semver DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- :major: 0
3
- :minor: 6
4
- :patch: 4
5
- :special: ''
6
- :metadata: ''