dapr 0.1.24 → 0.1.26

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: 3f9f12b47b2ab348b8b9f5095344b65bb4da63c278cfb4dcf56ca8b12f7cd67a
4
- data.tar.gz: 7908909ca89827446908d97dc90c067893e1d8ddaf2d713cb5d12ea659b28ea4
3
+ metadata.gz: ede293d0cbb90960527f0c91f4009679a2db765f355b8a9d17094f209c11b900
4
+ data.tar.gz: a6ca7bc7a6ad7f8a775b395a6c5eb1da9164f820af88efd8768827436beabc75
5
5
  SHA512:
6
- metadata.gz: c9f2864759062b40a8d69f964e827c58de2044dfdcb10d17e055ac9c1ab1b8f52f1a762ae1e3d60c3de9bd3949acfdd717c3f3b404e649a13b5fe1db7f8287ce
7
- data.tar.gz: e3aa1f63899f004c65985f3169f0ea70aae72b541df1d9977d6da234244e3db21054920cb8b1efcbd5fe9cb8efb9d98a66ef81f5fbffb746b48699f40a8dce3d
6
+ metadata.gz: 4f0d9506ea6006ddd9a117bb330767b86c208d56ef668b418e46b0f3cc231788a8c28dee64a2b412b32cda25bbe104f1b7d27a26b063773e4173c8e127a149d5
7
+ data.tar.gz: 5b3612f1175a25544aa284514391d4b0c27f9ddaca60eafafe589e7cfc5942b4c2d73c616e7d6743e1596558216302ed7371f8d2f322100e116bd218f4040e07
data/.overcommit.yml ADDED
@@ -0,0 +1,337 @@
1
+ ---
2
+ PreCommit:
3
+ AuthorEmail:
4
+ enabled: true
5
+ AuthorName:
6
+ enabled: true
7
+ BerksfileCheck:
8
+ enabled: false
9
+ BrokenSymlinks:
10
+ enabled: true
11
+ BundleAudit:
12
+ enabled: true
13
+ BundleCheck:
14
+ enabled: true
15
+ BundleOutdated:
16
+ enabled: true
17
+ CaseConflicts:
18
+ enabled: true
19
+ ChamberCompare:
20
+ enabled: false
21
+ ChamberSecurity:
22
+ enabled: false
23
+ ChamberVerification:
24
+ enabled: false
25
+ CodeSpellCheck:
26
+ enabled: false
27
+ CoffeeLint:
28
+ enabled: false
29
+ CookStyle:
30
+ enabled: false
31
+ Credo:
32
+ enabled: false
33
+ CssLint:
34
+ enabled: false
35
+ DartAnalyzer:
36
+ enabled: false
37
+ Dogma:
38
+ enabled: false
39
+ ErbLint:
40
+ enabled: false
41
+ EsLint:
42
+ enabled: false
43
+ ExecutePermissions:
44
+ enabled: false
45
+ Fasterer:
46
+ enabled: false
47
+ FixMe:
48
+ enabled: true
49
+ FileSize:
50
+ enabled: false
51
+ Flay:
52
+ enabled: false
53
+ Foodcritic:
54
+ enabled: false
55
+ ForbiddenBranches:
56
+ enabled: true
57
+ branch_patterns: [ 'main', 'master' ]
58
+ GinkgoFocus:
59
+ enabled: false
60
+ GoFmt:
61
+ enabled: false
62
+ GolangciLint:
63
+ enabled: false
64
+ GoLint:
65
+ enabled: false
66
+ GoVet:
67
+ enabled: false
68
+ Hadolint:
69
+ enabled: false
70
+ HamlLint:
71
+ enabled: false
72
+ HardTabs:
73
+ enabled: false
74
+ Hlint:
75
+ enabled: false
76
+ HtmlHint:
77
+ enabled: false
78
+ HtmlTidy:
79
+ enabled: false
80
+ ImageOptim:
81
+ enabled: false
82
+ JavaCheckstyle:
83
+ enabled: false
84
+ Jscs:
85
+ enabled: false
86
+ JsHint:
87
+ enabled: false
88
+ JsLint:
89
+ enabled: false
90
+ Jsl:
91
+ enabled: false
92
+ JsonSyntax:
93
+ enabled: false
94
+ KtLint:
95
+ enabled: false
96
+ LicenseFinder:
97
+ enabled: false
98
+ LicenseHeader:
99
+ enabled: false
100
+ LocalPathsInGemfile:
101
+ enabled: false
102
+ Mdl:
103
+ enabled: false
104
+ MergeConflicts:
105
+ enabled: true
106
+ MixFormat:
107
+ enabled: false
108
+ PuppetMetadataJsonLint:
109
+ enabled: false
110
+ NginxTest:
111
+ enabled: false
112
+ Pep257:
113
+ enabled: false
114
+ Pep8:
115
+ enabled: false
116
+ PhpLint:
117
+ enabled: false
118
+ PhpCs:
119
+ enabled: false
120
+ PhpCsFixer:
121
+ enabled: false
122
+ PhpStan:
123
+ enabled: false
124
+ Pronto:
125
+ enabled: false
126
+ PuppetLint:
127
+ enabled: false
128
+ Pycodestyle:
129
+ enabled: false
130
+ Pydocstyle:
131
+ enabled: false
132
+ Pyflakes:
133
+ enabled: false
134
+ Pylint:
135
+ enabled: false
136
+ PythonFlake8:
137
+ enabled: false
138
+ RakeTarget:
139
+ enabled: false
140
+ RailsBestPractices:
141
+ enabled: false
142
+ RailsSchemaUpToDate:
143
+ enabled: false
144
+ Reek:
145
+ enabled: false
146
+ RstLint:
147
+ enabled: false
148
+ RSpec:
149
+ enabled: false
150
+ RuboCop:
151
+ enabled: true
152
+ RubyLint:
153
+ enabled: false
154
+ RubySyntax:
155
+ enabled: false
156
+ Scalariform:
157
+ enabled: false
158
+ Scalastyle:
159
+ enabled: false
160
+ ScssLint:
161
+ enabled: false
162
+ SemiStandard:
163
+ enabled: false
164
+ ShellCheck:
165
+ enabled: true
166
+ SlimLint:
167
+ enabled: false
168
+ Sorbet:
169
+ enabled: false
170
+ Sqlint:
171
+ enabled: false
172
+ Standard:
173
+ enabled: false
174
+ Stylelint:
175
+ enabled: false
176
+ SwiftLint:
177
+ enabled: false
178
+ TerraformFormat:
179
+ enabled: false
180
+ TsLint:
181
+ enabled: false
182
+ TrailingWhitespace:
183
+ enabled: true
184
+ TravisLint:
185
+ enabled: false
186
+ Vint:
187
+ enabled: false
188
+ W3cCss:
189
+ enabled: false
190
+ W3cHtml:
191
+ enabled: false
192
+ LineEndings:
193
+ enabled: false
194
+ XmlLint:
195
+ enabled: false
196
+ XmlSyntax:
197
+ enabled: false
198
+ YamlLint:
199
+ enabled: false
200
+ YamlSyntax:
201
+ enabled: true
202
+ YardCoverage:
203
+ enabled: false
204
+ YarnCheck:
205
+ enabled: false
206
+ CommitMsg:
207
+ CapitalizedSubject:
208
+ enabled: true
209
+ EmptyMessage:
210
+ enabled: true
211
+ GerritChangeId:
212
+ enabled: false
213
+ HardTabs:
214
+ enabled: false
215
+ MessageFormat:
216
+ enabled: false
217
+ RussianNovel:
218
+ enabled: false
219
+ SingleLineSubject:
220
+ enabled: true
221
+ SpellCheck:
222
+ enabled: false
223
+ TextWidth:
224
+ enabled: true
225
+ TrailingPeriod:
226
+ enabled: true
227
+ PostCheckout:
228
+ BowerInstall:
229
+ enabled: false
230
+ BundleInstall:
231
+ enabled: false
232
+ ComposerInstall:
233
+ enabled: false
234
+ GitLfs:
235
+ enabled: false
236
+ IndexTags:
237
+ enabled: false
238
+ NpmInstall:
239
+ enabled: false
240
+ SubmoduleStatus:
241
+ enabled: false
242
+ YarnInstall:
243
+ enabled: false
244
+ PostCommit:
245
+ BowerInstall:
246
+ enabled: false
247
+ BundleInstall:
248
+ enabled: false
249
+ Commitplease:
250
+ enabled: false
251
+ ComposerInstall:
252
+ enabled: false
253
+ GitGuilt:
254
+ enabled: false
255
+ GitLfs:
256
+ enabled: false
257
+ IndexTags:
258
+ enabled: false
259
+ NpmInstall:
260
+ enabled: false
261
+ SubmoduleStatus:
262
+ enabled: false
263
+ YarnInstall:
264
+ enabled: false
265
+ PostMerge:
266
+ BowerInstall:
267
+ enabled: false
268
+ BundleInstall:
269
+ enabled: false
270
+ ComposerInstall:
271
+ enabled: false
272
+ GitLfs:
273
+ enabled: false
274
+ IndexTags:
275
+ enabled: false
276
+ NpmInstall:
277
+ enabled: false
278
+ SubmoduleStatus:
279
+ enabled: false
280
+ YarnInstall:
281
+ enabled: false
282
+ PostRewrite:
283
+ BowerInstall:
284
+ enabled: false
285
+ BundleInstall:
286
+ enabled: false
287
+ ComposerInstall:
288
+ enabled: false
289
+ IndexTags:
290
+ enabled: false
291
+ NpmInstall:
292
+ enabled: false
293
+ SubmoduleStatus:
294
+ enabled: false
295
+ YarnInstall:
296
+ enabled: false
297
+ PrePush:
298
+ Brakeman:
299
+ enabled: false
300
+ CargoTest:
301
+ enabled: false
302
+ FlutterTest:
303
+ enabled: false
304
+ GitLfs:
305
+ enabled: false
306
+ GolangciLint:
307
+ enabled: false
308
+ GoTest:
309
+ enabled: false
310
+ Minitest:
311
+ enabled: false
312
+ MixTest:
313
+ enabled: false
314
+ PhpUnit:
315
+ enabled: false
316
+ Pronto:
317
+ enabled: false
318
+ ProtectedBranches:
319
+ enabled: true
320
+ PubTest:
321
+ enabled: false
322
+ Pytest:
323
+ enabled: false
324
+ PythonNose:
325
+ enabled: false
326
+ RSpec:
327
+ enabled: false
328
+ RakeTarget:
329
+ enabled: false
330
+ TestUnit:
331
+ enabled: false
332
+ PreRebase:
333
+ MergedCommits:
334
+ enabled: false
335
+ PrepareCommitMsg:
336
+ ReplaceBranch:
337
+ enabled: false
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  require:
3
3
  - rubocop-rake
4
- - rubocop-rspec
4
+ - rubocop-minitest
5
5
 
6
6
  AllCops:
7
7
  TargetRubyVersion: 3.2.0
data/Rakefile CHANGED
@@ -1,12 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
4
+ require 'minitest/test_task'
5
5
 
6
- RSpec::Core::RakeTask.new(:spec)
6
+ Minitest::TestTask.create
7
7
 
8
8
  require 'rubocop/rake_task'
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
12
- task default: %i[spec rubocop]
12
+ require 'pathname'
13
+ Pathname.glob('tasks/*.rake').each { |r| load r }
14
+
15
+ # Coverage and wipelock both come from tasks/
16
+ task default: %i[coverage rubocop wipelock]
data/Readme.adoc CHANGED
@@ -20,9 +20,11 @@ endif::[]
20
20
 
21
21
  == Overview
22
22
 
23
- This library provides a Ruby client for the Dapr runtime. It is a work in progress and is not yet ready for production use.
23
+ This library provides an interface to the {dapr-building-block}s.
24
24
 
25
- Documentation will be added as the library matures.
25
+ CAUTION: This is a work in progress and is not yet ready for production use.
26
+
27
+ NOTE: Documentation will be added as this library matures.
26
28
 
27
29
  == Installation
28
30
 
@@ -34,9 +36,17 @@ If bundler is not being used to manage dependencies, install the gem by executin
34
36
 
35
37
  $ gem install dapr
36
38
 
39
+ .Example from Gemfile
40
+ [source,ruby]
41
+ ----
42
+ gem 'dapr', '~> 0.1.9', require: 'dapr/client'
43
+ gem 'datadog_api_client'
44
+ gem 'grpc', force_ruby_platform: true
45
+ ----
46
+
37
47
  == Usage
38
48
 
39
- Dapr being such a kitchen sink, this library exposes each {dapr-building-block} as either a
49
+ Dapr being such a Smörgåsbord, this library exposes each {dapr-building-block} as either a
40
50
  Client or a Service, depending on whether it uses the AppCallback runtime (Service) or
41
51
  the Dapr API (Client). The clients are thin wrappers around the Dapr API, while the service
42
52
  implementations will be more opinionated, higher-level abstractions. See the specific section on
@@ -80,7 +90,7 @@ focus on the business logic of your service, rather than the plumbing of message
80
90
  ----
81
91
  require 'dapr/service/subscriber'
82
92
  handler = ->(event) { puts "Got event: #{event}" } <1>
83
- pubsub_name = 'pubsub' <2>
93
+ pubsub_name = 'pubsub-name' <2>
84
94
  topics = 'TOPIC-A' <3>
85
95
  sub = Rubyists::Dapr::Service::Subscriber.new(pubsub_name:, topics:, handler:) <4>
86
96
  sub.start! <5>
@@ -89,12 +99,12 @@ sub.start! <5>
89
99
  +
90
100
  NOTE: The handler can be anything that responds to `#call`, such as a lambda, proc, or instance. Sky's the limit! (Dependency injection, anyone?)
91
101
  +
92
- <2> The name of the Dapr pubsub component this subscriber will utilize.
102
+ <2> The name of the Dapr pubsub component this subscriber will utilize.
93
103
  <3> The name of the topic(s) to subscribe to.
94
104
  +
95
105
  TIP: Multiple topics can be subscribed to simultaneously by passing an array of topic names to the `topics` argument.
96
106
  +
97
- <4> Create a new subscriber for the `pubsub` pubsub component, subscribing to the `TOPIC-A` topic.
107
+ <4> Create a new subscriber for the `pubsub-name` pubsub component, subscribing to the `TOPIC-A` topic.
98
108
  <5> Start the subscriber. This will block the current thread and call the handler for each message received.
99
109
 
100
110
  === State Management
@@ -0,0 +1 @@
1
+ {"timestamp":1715471428,"command_name":"Unit Tests","files":[{"filename":"/home/bougyman/rubyists/dapr/lib/dapr.rb","covered_percent":100.0,"coverage":{"lines":[null,null,1,1,null,null,1,1,3,null,null,null,1,1,1,1,1,null,null]},"covered_strength":1.2,"covered_lines":10,"lines_of_code":10},{"filename":"/home/bougyman/rubyists/dapr/lib/dapr/client.rb","covered_percent":100.0,"coverage":{"lines":[null,null,1,1,1,1,1,null,1,1,null,1,1,1,1,1,null,1,4,null,1,1,null,null,1,8,null,null,1,1,null,null,1,11,null,null,null,1,1,null,1,5,null,null,1,1,1,1,null,1,null,null,1,2,null,null,null,null,null]},"covered_strength":1.7575757575757576,"covered_lines":33,"lines_of_code":33},{"filename":"/home/bougyman/rubyists/dapr/lib/dapr/client/lock.rb","covered_percent":100.0,"coverage":{"lines":[null,null,1,1,null,1,1,1,null,1,null,1,1,null,null,1,null,null,1,null,1,1,null,1,6,6,null,null,null,null,null,null,1,6,6,null,null,null,1,6,6,5,5,null,null,1,null,null,null,1,4,4,4,null,3,3,null,null,1,null,null,1,18,null,null,null,null,null]},"covered_strength":3.0606060606060606,"covered_lines":33,"lines_of_code":33}],"metrics":{"covered_percent":100.0,"covered_strength":2.25,"covered_lines":76,"total_lines":76}}
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'securerandom'
4
+ require_relative '../client'
5
+
6
+ module Rubyists
7
+ module Dapr
8
+ module Client
9
+ # Handles publishing messages to Dapr pub/sub topics
10
+ class Lock
11
+ # Include the client module
12
+ include Client
13
+ include SemanticLogger::Loggable
14
+
15
+ # The name of the pubsub component, the client, and the serialization to use
16
+ attr_reader :store_name, :resource_id, :lock
17
+
18
+ # The proto class for the TryLock request message
19
+ LockRequest = ::Dapr::Proto::Runtime::V1::TryLockRequest
20
+ # The proto class for the Unlock request message
21
+ UnlockRequest = ::Dapr::Proto::Runtime::V1::UnlockRequest
22
+ DEFAULT_STORE_NAME = 'locker'
23
+
24
+ def self.acquire(resource_id, store_name: DEFAULT_STORE_NAME, ttl: 10)
25
+ lock = new(store_name, resource_id)
26
+ lock.lock!(ttl:)
27
+ end
28
+
29
+ # Initialize the Lock
30
+ #
31
+ # @param store_name [String] The name of the Dapr lock store component to use
32
+ # @param resource_id [String] The unique ID of the resource to lock
33
+ def initialize(store_name, resource_id)
34
+ @store_name = store_name
35
+ @resource_id = resource_id
36
+ end
37
+
38
+ # @param ttl [Integer] The time-to-live for the lock in seconds
39
+ def lock!(ttl: 10)
40
+ response = singleton.try_lock(LockRequest.new(store_name:, resource_id:, lock_owner:, expiry_in_seconds: ttl))
41
+ if response.success
42
+ logger.info('Acquired lock', store_name:, resource_id:, ttl:, lock_owner:)
43
+ return self
44
+ end
45
+
46
+ logger.warn "Failed to acquire lock for #{resource_id}"
47
+ nil
48
+ end
49
+
50
+ def unlock!
51
+ response = singleton.unlock(UnlockRequest.new(store_name:, resource_id:, lock_owner:))
52
+ status = response.status
53
+ return true if status == :SUCCESS
54
+
55
+ logger.warn('Unlock Failed!', status:, store_name:, resource_id:, lock_owner:)
56
+ false
57
+ end
58
+
59
+ private
60
+
61
+ # @return [String] The unique ID of the lock owner
62
+ def lock_owner
63
+ @lock_owner ||= SecureRandom.uuid
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
data/lib/dapr/client.rb CHANGED
@@ -11,13 +11,15 @@ module Rubyists
11
11
  # The namespace for the Dapr client
12
12
  module Client
13
13
  include SemanticLogger::Loggable
14
- DAPR_PORT = ENV.fetch('DAPR_GRPC_PORT', '5001')
14
+ DAPR_PORT = ENV.fetch('DAPR_GRPC_PORT', nil)
15
15
  DAPR_URI = ENV.fetch('DAPR_GRPC_HOST', 'localhost')
16
16
  DAPR_STUB = ::Dapr::Proto::Runtime::V1::Dapr::Stub
17
17
 
18
- def self.client
19
- logger.info "Creating Dapr client for #{DAPR_URI}:#{DAPR_PORT}"
20
- DAPR_STUB.new("#{DAPR_URI}:#{DAPR_PORT}", :this_channel_is_insecure)
18
+ def self.client(dapr_port: DAPR_PORT, dapr_uri: DAPR_URI)
19
+ return DummyClient.new if dapr_port.nil?
20
+
21
+ logger.info "Creating Dapr client for #{dapr_uri}:#{dapr_port}"
22
+ DAPR_STUB.new("#{dapr_uri}:#{dapr_port}", :this_channel_is_insecure)
21
23
  end
22
24
 
23
25
  def self.singleton
@@ -31,6 +33,27 @@ module Rubyists
31
33
  def singleton
32
34
  @singleton ||= Rubyists::Dapr::Client.singleton
33
35
  end
36
+
37
+ # Make a dummy client that responds to every method with a warning and the called method signature
38
+ class DummyClient
39
+ include SemanticLogger::Loggable
40
+
41
+ def initialize(*_)
42
+ logger.warn 'Dapr is not available (no DAPR_GRPC_PORT), using dummy client'
43
+ end
44
+
45
+ def method_missing(method_name, *, &)
46
+ self.class.define_method(method_name) do |*args, &block|
47
+ logger.warn 'Dapr is not available (no DAPR_GRPC_PORT), using dummy client'
48
+ { method_name:, args:, block: }
49
+ end
50
+ send(method_name, *, &)
51
+ end
52
+
53
+ def respond_to_missing?(_method_name, _include_private = false)
54
+ true
55
+ end
56
+ end
34
57
  end
35
58
  end
36
59
  end
data/lib/dapr/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rubyists
4
4
  module Dapr
5
- VERSION = '0.1.24'
5
+ VERSION = '0.1.26'
6
6
  end
7
7
  end
data/lib/dapr.rb CHANGED
@@ -1,9 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'pathname'
3
4
  require_relative 'dapr/version'
4
5
 
6
+ # Add a method to Pathname to join paths on /
7
+ class Pathname
8
+ def /(other)
9
+ join(other.to_s)
10
+ end
11
+ end
12
+
5
13
  module Rubyists
6
14
  module Dapr
7
15
  class Error < StandardError; end
16
+ ROOT = Pathname.new(__dir__).join('..').expand_path
17
+ LIBROOT = ROOT.join('lib/dapr')
8
18
  end
9
19
  end
data/oci/Containerfile ADDED
@@ -0,0 +1,48 @@
1
+ ARG ALPINE_VERSION=3.19
2
+ ARG RUBY_VERSION=3.3.1
3
+ FROM docker.io/ruby:$RUBY_VERSION-alpine$ALPINE_VERSION AS build-env
4
+
5
+ # Setting env up
6
+ ARG APP_ROOT=/app
7
+ ARG JOBS=8
8
+ ENV LANG C.UTF-8
9
+ ENV BUNDLE_SILENCE_ROOT_WARNING=1
10
+
11
+ #Install dependencies needed for compilation
12
+ RUN apk --no-cache add curl ruby-dev build-base git
13
+
14
+ WORKDIR $APP_ROOT
15
+
16
+ RUN mkdir -p lib/dapr
17
+ COPY lib/dapr/version.rb lib/dapr/version.rb
18
+ COPY Gemfile dapr.gemspec .
19
+ RUN bundle config set build.nokogiri --use-system-libraries && \
20
+ bundle config set without 'test development assets' && \
21
+ bundle install --jobs 8 && \
22
+ mkdir -p /src && \
23
+ cd /src && \
24
+ curl -L https://github.com/leahneukirchen/snooze/archive/refs/tags/v0.5.tar.gz > snooze.tar.gz && \
25
+ tar xvf snooze.tar.gz && \
26
+ cd snooze-0.5 && \
27
+ make && \
28
+ install -m 0755 snooze /bin/snooze && \
29
+ cd / && \
30
+ rm -rf /src
31
+
32
+ # Remove folders not needed in resulting image
33
+ RUN rm -rf node_modules tmp/cache app/assets vendor/assets spec
34
+
35
+ ############### Build step done ###############
36
+ FROM docker.io/ruby:3.3.0-alpine3.19
37
+ ARG ALPINE_VERSION=3.19
38
+ ARG RUBY_VERSION=3.3.1
39
+ ARG APP_ROOT=/app
40
+
41
+ WORKDIR $APP_ROOT
42
+
43
+ # install packages
44
+ RUN apk --update --no-cache add coreutils curl bash runit
45
+ COPY --from=build-env /usr/local/bundle/ /usr/local/bundle/
46
+ COPY --from=build-env /bin/snooze /bin/snooze
47
+
48
+ CMD ['bundle', 'exec', 'puma', '-C', 'config/puma.rb']
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ CoverageError = Class.new(StandardError)
4
+ desc 'Run all specs with coverage'
5
+ task :coverage do
6
+ ENV['COVERAGE'] = 'test'
7
+ require 'json'
8
+ require 'bigdecimal'
9
+ coverage_file = Pathname('coverage/coverage.json')
10
+ old_coverage = ''
11
+ old_percent = 0
12
+ if coverage_file.exist?
13
+ old_coverage = coverage_file.read
14
+ old_percent = BigDecimal(JSON.parse(old_coverage)['metrics']['covered_percent'], 4).to_f
15
+ end
16
+
17
+ sh 'ruby test/test_dapr.rb'
18
+
19
+ new_coverage = coverage_file.read
20
+ new_percent = BigDecimal(JSON.parse(new_coverage)['metrics']['covered_percent'], 4).to_f
21
+ if new_percent < old_percent
22
+ coverage_file.write old_coverage
23
+ raise CoverageError, "Coverage dropped from #{old_percent}% to #{new_percent}%"
24
+ elsif new_percent > old_percent
25
+ puts "Coverage increased from #{old_percent}% to #{new_percent}%"
26
+ else
27
+ puts "Coverage stayed the same at #{old_percent}%"
28
+ end
29
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Remove Gemfile.lock'
4
+ task :wipelock do
5
+ system 'rm -f Gemfile.lock'
6
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dapr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tj (bougyman) Vanderpoel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-04-17 00:00:00.000000000 Z
12
+ date: 2024-05-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dapr-ruby
@@ -46,18 +46,24 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
+ - ".overcommit.yml"
49
50
  - ".rspec"
50
51
  - ".rubocop.yml"
51
52
  - CHANGELOG.md
52
53
  - Rakefile
53
54
  - Readme.adoc
55
+ - coverage/coverage.json
54
56
  - lib/dapr.rb
55
57
  - lib/dapr/client.rb
58
+ - lib/dapr/client/lock.rb
56
59
  - lib/dapr/client/publisher.rb
57
60
  - lib/dapr/service.rb
58
61
  - lib/dapr/service/subscriber.rb
59
62
  - lib/dapr/version.rb
63
+ - oci/Containerfile
60
64
  - sig/dapr.rbs
65
+ - tasks/coverage.rake
66
+ - tasks/wipelock.rake
61
67
  homepage: https://github.com/rubyists/dapr
62
68
  licenses: []
63
69
  metadata: