async-service 0.22.0 → 0.24.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: b34c255ee7608b446acf8a57e86b876644f34eb21d5afa6b2a35d8f6235bb718
4
- data.tar.gz: 66b3494d6bdfb347e1ae6b1440261754132a70fa903743f5d50dc19d636ef13e
3
+ metadata.gz: 627b83e2706cf6594c5f66b3c0d5208ce0991e09b7da9ad1db6fc8140ee96a8a
4
+ data.tar.gz: cd6737b1aa7efb1c3f2c83b441994152ade264c3de1861caedc91da7ac25000d
5
5
  SHA512:
6
- metadata.gz: bc3919f55bbf3221098522a47ecc4d744cdabc97f958d4b5d63dc8ed350c4f778b414acda577304a1a2b6493132abf01562f333a67bd84f348feab260d20c9ad
7
- data.tar.gz: 9adf428ca9ddd8eb76aa0adcd67ab60268fa49bfe118d868b5fca6a75aa27749a4576f1f437f2e94855bcb2fd1013dd06ec4e8c4ec801b8c4cd99ddbbd77bf5d
6
+ metadata.gz: 2f51eca9ac8c9a6befbee2d8f8720d1cfe9d834eba0b1ddf0eccf6f5cf5c2df78e3587f1978459db35a6f56c41d3a8065b247f4ecfc8868d8015b5beb06694aa
7
+ data.tar.gz: d9a35eca09c06dc7776c80499231cc0b800e669138f44afc0ec1e3c40514b7e3095639a7a3a486688abd61bd1061e75fd2bfa02fea00891ac026fff8ca3695c4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -2,6 +2,7 @@
2
2
 
3
3
  # Released under the MIT License.
4
4
  # Copyright, 2024-2026, by Samuel Williams.
5
+ # Copyright, 2026, by Udi Feldman.
5
6
 
6
7
  require "async/container/controller"
7
8
  require_relative "policy"
@@ -91,7 +92,7 @@ module Async
91
92
  end
92
93
 
93
94
  # Stop all named services.
94
- def stop(graceful = true)
95
+ def stop(graceful = @graceful_stop)
95
96
  @services.each do |service|
96
97
  begin
97
98
  service.stop
@@ -11,12 +11,19 @@ module Async
11
11
  # Designed to be invoked within an {Async::Controller::Container}.
12
12
  class Generic
13
13
  # Convert the given environment into a service if possible.
14
+ #
15
+ # If the evaluator responds to `make_service`, it is called with the environment and its return value is used as the service. This allows environments to compose child environments and return a concrete service without a dedicated service class.
16
+ #
17
+ # Otherwise, the evaluator's `service_class` is instantiated with the environment and evaluator as arguments.
18
+ #
14
19
  # @parameter environment [Environment] The environment to use to construct the service.
15
- # @returns [Generic | Nil] The constructed service if the environment specifies a service class.
20
+ # @returns [Generic | Nil] The constructed service if the environment specifies a service class or make_service.
16
21
  def self.wrap(environment)
17
22
  evaluator = environment.evaluator
18
23
 
19
- if evaluator.key?(:service_class)
24
+ if evaluator.respond_to?(:make_service)
25
+ return evaluator.make_service(environment)
26
+ elsif evaluator.key?(:service_class)
20
27
  if service_class = evaluator.service_class
21
28
  return service_class.new(environment, evaluator)
22
29
  end
@@ -7,6 +7,6 @@
7
7
  module Async
8
8
  # @namespace
9
9
  module Service
10
- VERSION = "0.22.0"
10
+ VERSION = "0.24.0"
11
11
  end
12
12
  end
data/license.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # MIT License
2
2
 
3
3
  Copyright, 2024-2026, by Samuel Williams.
4
+ Copyright, 2026, by Udi Feldman.
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/readme.md CHANGED
@@ -31,6 +31,10 @@ Please see the [project documentation](https://socketry.github.io/async-service/
31
31
 
32
32
  Please see the [project releases](https://socketry.github.io/async-service/releases/index) for all releases.
33
33
 
34
+ ### v0.23.0
35
+
36
+ - `Async::Service::Generic.wrap` now checks for a `make_service(environment)` method on the evaluator before falling back to `service_class`. This allows environments to compose child environments and return a fully-constructed service without introducing a dedicated service class.
37
+
34
38
  ### v0.22.0
35
39
 
36
40
  - Ensure process title is updated immediately after server starts in `Managed::Service`.
@@ -78,10 +82,6 @@ Please see the [project releases](https://socketry.github.io/async-service/relea
78
82
  - Renamed `Async::Service::Managed::Service` -\> `Async::Service::ManagedService`.
79
83
  - Renamed `Async::Service::Managed::Environment` -\> `Async::Service::ManagedEnvironment`.
80
84
 
81
- ### v0.15.1
82
-
83
- - `Managed::Service` should run within `Async do ... end`.
84
-
85
85
  ## Contributing
86
86
 
87
87
  We welcome contributions to this project.
@@ -92,6 +92,22 @@ We welcome contributions to this project.
92
92
  4. Push to the branch (`git push origin my-new-feature`).
93
93
  5. Create new Pull Request.
94
94
 
95
+ ### Running Tests
96
+
97
+ To run the test suite:
98
+
99
+ ``` shell
100
+ bundle exec sus
101
+ ```
102
+
103
+ ### Making Releases
104
+
105
+ To make a new release:
106
+
107
+ ``` shell
108
+ bundle exec bake gem:release:patch # or minor or major
109
+ ```
110
+
95
111
  ### Developer Certificate of Origin
96
112
 
97
113
  In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.23.0
4
+
5
+ - `Async::Service::Generic.wrap` now checks for a `make_service(environment)` method on the evaluator before falling back to `service_class`. This allows environments to compose child environments and return a fully-constructed service without introducing a dedicated service class.
6
+
3
7
  ## v0.22.0
4
8
 
5
9
  - Ensure process title is updated immediately after server starts in `Managed::Service`.
data.tar.gz.sig CHANGED
@@ -1,4 +1,4 @@
1
- Xd�|�f�>����\��]kB�m]�����%�_�VPY��rL!��v`/�]ѹ�#T+�%w��f����H�xڅ�=K�A�uZٍl�=1�U�^��%�i"궴���̡���L�I��%~��Z�}�H���/�#Lp�+��������*ȓ��P
2
- pE�Z!'W�P�9_/������O��n 4�[G=�w��u
3
- �
4
- ���t���-S__�3g�-�ݗ��D�3��l9<@cg�i]q�E��=��H�m�{UA�&D�.�����
1
+ c���5d�@�,2X���[7
2
+ *�^DI� 2oc�?�.d��P rbAϩJ��үvʢ������$� ~��|[b��������?we��[�O��h皇�`=k1_܈��|���h& Rt΀^���:�qNyz��TO���)y�@���P�β��͗}$Y���
3
+ D�No�آ�3�䣥��\0���(���)�K�<)
4
+ �!�� oo�$�2<�"/�q��M?u(~#G���V��������O�貼��ߡ��֪��K�ˤ�"� ���, ����
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Udi Feldman
8
9
  bindir: bin
9
10
  cert_chain:
10
11
  - |
@@ -133,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
134
  - !ruby/object:Gem::Version
134
135
  version: '0'
135
136
  requirements: []
136
- rubygems_version: 4.0.6
137
+ rubygems_version: 4.0.3
137
138
  specification_version: 4
138
139
  summary: A service layer for Async.
139
140
  test_files: []
metadata.gz.sig CHANGED
Binary file