functions_framework 1.4.2 → 1.5.1

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: 72dfd786bcd5b46663c5bb00f78fd6eed556f8cb9419f7aebeb1fc16421d61b4
4
- data.tar.gz: 16ef142b7cc6c98b0eb42c5e6df6fb9d8deceee28d582b2bc0a859b20ef0b97b
3
+ metadata.gz: fb9c48937022efcc8517a3ac10290bee36771a969ded09e06099b42e8c862ef9
4
+ data.tar.gz: 853431e6e9cc3db2ef2554bfb95981206925ad1b8a4456760ade90d4a5241ec6
5
5
  SHA512:
6
- metadata.gz: 1f1eeb41025962565b9e6920848d0eb117467a60ccea937c415a963281014c35762d6c66966bd281d2e3e2c9937e9d5d2772884ed79d43ce1da690428c3380da
7
- data.tar.gz: be1032875299ba2e18a189d142b4a654bb338ec0d9455757c11088baf0c6d5b71d189a166552c9243f14b562fe1d649ca4839bcb24a3a3ac75eca84df3006c2d
6
+ metadata.gz: d2d84aeed4bfb4d7dcf23727349b7110dbab6f1760758d5b98ff9512e420408fee66c42adeb5a8bfd4c816fc35756af7e8fe9d867848bac8373cd08464c4264b
7
+ data.tar.gz: 200331fccda7c1a7ea0e31b3144958fb9479051e014d96962b41ac220133789c20c0521110bf5f929fafa111651dec752aad035dc46c76285c261d2548417103
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ### 1.5.1 (2025-02-06)
4
+
5
+ ### Miscellaneous Chores
6
+
7
+ * release 1.5.1 ([#211](https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues/211))
8
+
9
+ ### 1.5.0 (2025-01-03)
10
+
11
+ #### Features
12
+
13
+ * Support pidfile in CLI & Server (defaults to puma.pid) ([#178](https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues/178))
14
+
3
15
  ### 1.4.2 (2024-09-18)
4
16
 
5
17
  #### Bug Fixes
data/README.md CHANGED
@@ -4,8 +4,7 @@ An open source framework for writing lightweight, portable Ruby functions that
4
4
  run in a serverless environment. Functions written to this Framework will run
5
5
  in many different environments, including:
6
6
 
7
- * [Google Cloud Functions](https://cloud.google.com/functions)
8
- * [Google Cloud Run](https://cloud.google.com/run)
7
+ * [Google Cloud Run functions](https://cloud.google.com/functions)
9
8
  * Any other [Knative](https://github.com/knative)-based environment
10
9
  * Your local development machine
11
10
 
@@ -113,8 +112,7 @@ These guides provide additional getting-started information.
113
112
  functions server.
114
113
  * **[Deploying Functions](https://googlecloudplatform.github.io/functions-framework-ruby/latest/file.deploying-functions.html)**
115
114
  : How to deploy functions to
116
- [Google Cloud Functions](https://cloud.google.com/functions) or
117
- [Google Cloud Run](https://cloud.google.com/run).
115
+ [Google Cloud Run functions](https://cloud.google.com/functions)
118
116
 
119
117
  The library reference documentation can be found at:
120
118
  https://googlecloudplatform.github.io/functions-framework-ruby
@@ -36,6 +36,7 @@ module FunctionsFramework
36
36
  @source = ::ENV["FUNCTION_SOURCE"] || ::FunctionsFramework::DEFAULT_SOURCE
37
37
  @env = nil
38
38
  @port = nil
39
+ @pidfile = nil
39
40
  @bind = nil
40
41
  @min_threads = nil
41
42
  @max_threads = nil
@@ -67,6 +68,12 @@ module FunctionsFramework
67
68
  #
68
69
  attr_reader :error_message
69
70
 
71
+ ##
72
+ # @return [String] The pidfile.
73
+ # @return [nil] if not running.
74
+ #
75
+ attr_reader :pidfile
76
+
70
77
  ##
71
78
  # Parse the given command line arguments.
72
79
  # Exits if argument parsing failed.
@@ -89,6 +96,9 @@ module FunctionsFramework
89
96
  "Supported values are 'http' and 'cloudevent'." do |val|
90
97
  @signature_type = val
91
98
  end
99
+ op.on "-P", "--pidfile PIDFILE", "Set the pidfile for the server (defaults to puma.pid)" do |val|
100
+ @pidfile = val
101
+ end
92
102
  op.on "-p", "--port PORT", "Set the port to listen to (defaults to 8080)" do |val|
93
103
  @port = val.to_i
94
104
  end
@@ -218,6 +228,7 @@ module FunctionsFramework
218
228
  ::FunctionsFramework.start function do |config|
219
229
  config.rack_env = @env
220
230
  config.port = @port
231
+ config.pidfile = @pidfile
221
232
  config.bind_addr = @bind
222
233
  config.show_error_details = @detailed_errors
223
234
  config.min_threads = @min_threads
@@ -152,6 +152,24 @@ module FunctionsFramework
152
152
  @server&.thread&.alive?
153
153
  end
154
154
 
155
+ ##
156
+ # Returns pidfile if server is currently running
157
+ #
158
+ # @return [String, nil]
159
+ #
160
+ def pidfile
161
+ @config.pidfile if running?
162
+ end
163
+
164
+ ##
165
+ # Returns whether pidfile is present.
166
+ #
167
+ # @return [Boolean]
168
+ #
169
+ def pidfile?
170
+ !!@config.pidfile && running?
171
+ end
172
+
155
173
  ##
156
174
  # Cause this server to respond to SIGTERM, SIGINT, and SIGHUP by shutting
157
175
  # down gracefully.
@@ -214,6 +232,7 @@ module FunctionsFramework
214
232
  self.rack_env = nil
215
233
  self.bind_addr = nil
216
234
  self.port = nil
235
+ self.pidfile = nil
217
236
  self.min_threads = nil
218
237
  self.max_threads = nil
219
238
  self.show_error_details = nil
@@ -245,6 +264,14 @@ module FunctionsFramework
245
264
  @port = (port || ::ENV["PORT"] || 8080).to_i
246
265
  end
247
266
 
267
+ ##
268
+ # Set the pidfile string, or `nil` to use the default.
269
+ # @param path [String,nil]
270
+ #
271
+ def pidfile= path
272
+ @pidfile = (path || ::ENV["PIDFILE"] || "puma.pid").to_s
273
+ end
274
+
248
275
  ##
249
276
  # Set the minimum number of worker threads, or `nil` to use the default.
250
277
  # @param min_threads [Integer,nil]
@@ -306,6 +333,14 @@ module FunctionsFramework
306
333
  @port
307
334
  end
308
335
 
336
+ ##
337
+ # Returns the current pidfile string.
338
+ # @return [String]
339
+ #
340
+ def pidfile
341
+ @pidfile
342
+ end
343
+
309
344
  ##
310
345
  # Returns the minimum number of worker threads in the thread pool.
311
346
  # @return [Integer]
@@ -17,5 +17,5 @@ module FunctionsFramework
17
17
  # Version of the Ruby Functions Framework
18
18
  # @return [String]
19
19
  #
20
- VERSION = "1.4.2".freeze
20
+ VERSION = "1.5.1".freeze
21
21
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: functions_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-01 00:00:00.000000000 Z
10
+ date: 2025-02-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: cloud_events
@@ -106,11 +105,10 @@ homepage: https://github.com/GoogleCloudPlatform/functions-framework-ruby
106
105
  licenses:
107
106
  - Apache-2.0
108
107
  metadata:
109
- changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.4.2/file.CHANGELOG.html
108
+ changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.5.1/file.CHANGELOG.html
110
109
  source_code_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby
111
110
  bug_tracker_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues
112
- documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.4.2
113
- post_install_message:
111
+ documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.5.1
114
112
  rdoc_options: []
115
113
  require_paths:
116
114
  - lib
@@ -125,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
123
  - !ruby/object:Gem::Version
126
124
  version: '0'
127
125
  requirements: []
128
- rubygems_version: 3.5.6
129
- signing_key:
126
+ rubygems_version: 3.6.3
130
127
  specification_version: 4
131
128
  summary: Functions Framework for Ruby
132
129
  test_files: []