functions_framework 1.4.1 → 1.5.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 +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +2 -4
- data/lib/functions_framework/cli.rb +13 -2
- data/lib/functions_framework/server.rb +35 -0
- data/lib/functions_framework/version.rb +1 -1
- data/lib/functions_framework.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc90045c947a92ef29d14a88cccc1a31c82969912b7eca410ff7423bea52cc1
|
4
|
+
data.tar.gz: f678ef25e7883451be774b9dffacb8538971cd6d2211dfeac6a9f7886803ca5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c148723f894e7b341780fd43f32938e96fa8de48fca7e8e60f25def589de0fcd05433508e25c756617bcf7bcd58a98793cd0a8112974fd4d4c9cc65aceaa728f
|
7
|
+
data.tar.gz: b0913575ae419000ca0ea74b9f70cea6ecd96126955b27ffb27887b55d90f3abf5f84e5bfafd87c419f960cb683a92118c62252394c79be631cd407057ae43d9
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
### 1.5.0 (2025-01-03)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Support pidfile in CLI & Server (defaults to puma.pid) ([#178](https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues/178))
|
8
|
+
|
9
|
+
### 1.4.2 (2024-09-18)
|
10
|
+
|
11
|
+
#### Bug Fixes
|
12
|
+
|
13
|
+
* typo in cli help ([#196](https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues/196))
|
14
|
+
#### Documentation
|
15
|
+
|
16
|
+
* fix a broken link to the rack SPEC
|
17
|
+
|
3
18
|
### 1.4.1 (2023-06-27)
|
4
19
|
|
5
20
|
#### 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
|
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
|
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
|
@@ -98,10 +108,10 @@ module FunctionsFramework
|
|
98
108
|
op.on "-e", "--environment ENV", "Set the Rack environment" do |val|
|
99
109
|
@env = val
|
100
110
|
end
|
101
|
-
op.on "--min-threads NUM", "Set the minimum
|
111
|
+
op.on "--min-threads NUM", "Set the minimum thread pool size" do |val|
|
102
112
|
@min_threads = val
|
103
113
|
end
|
104
|
-
op.on "--max-threads NUM", "Set the maximum
|
114
|
+
op.on "--max-threads NUM", "Set the maximum thread pool size" do |val|
|
105
115
|
@max_threads = val
|
106
116
|
end
|
107
117
|
op.on "--[no-]detailed-errors", "Set whether to show error details" do |val|
|
@@ -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]
|
data/lib/functions_framework.rb
CHANGED
@@ -121,7 +121,7 @@ module FunctionsFramework
|
|
121
121
|
# function. The block should take a single `Rack::Request` argument. It
|
122
122
|
# should return one of the following:
|
123
123
|
# * A standard 3-element Rack response array. See
|
124
|
-
# https://github.com/rack/rack/blob/
|
124
|
+
# https://github.com/rack/rack/blob/main/SPEC.rdoc
|
125
125
|
# * A `Rack::Response` object.
|
126
126
|
# * A simple String that will be sent as the response body.
|
127
127
|
# * A Hash object that will be encoded as JSON and sent as the response
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: functions_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cloud_events
|
@@ -106,10 +106,10 @@ homepage: https://github.com/GoogleCloudPlatform/functions-framework-ruby
|
|
106
106
|
licenses:
|
107
107
|
- Apache-2.0
|
108
108
|
metadata:
|
109
|
-
changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.
|
109
|
+
changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.5.0/file.CHANGELOG.html
|
110
110
|
source_code_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby
|
111
111
|
bug_tracker_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues
|
112
|
-
documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.
|
112
|
+
documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.5.0
|
113
113
|
post_install_message:
|
114
114
|
rdoc_options: []
|
115
115
|
require_paths:
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.5.23
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: Functions Framework for Ruby
|