functions_framework 1.1.0 → 1.3.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 +32 -21
- data/README.md +5 -5
- data/docs/deploying-functions.md +2 -2
- data/docs/overview.md +5 -5
- data/lib/functions_framework/cli.rb +4 -4
- data/lib/functions_framework/server.rb +20 -9
- data/lib/functions_framework/testing.rb +1 -1
- data/lib/functions_framework/version.rb +1 -1
- metadata +16 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1c6958234b00d6168c6756c7188b698d84984628d1ff6a1fcd3bbd46fbb6a876
|
|
4
|
+
data.tar.gz: 5ec49e5ea07c8416ac04a336a8581cf71d26c4b2fd1048d4dc35db3e7c497bbc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66f952df1cc33a829a48454a49508d56c8b5026e4b145cb0931c04801b85b5f5b6109d8564c54bbf2fa34bc3882d0adc6f944e22af07547de1743b5ac3a824b3
|
|
7
|
+
data.tar.gz: 81406729506f55f2ca5da840245f4323ca705022f877a31e28af22c41e679d5ea92f40dfca523b3e8c2a869225f5f5abe5a29aa5ff12e5e6ff0a6e9e7e0d9bea
|
data/CHANGELOG.md
CHANGED
|
@@ -1,48 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
### 1.3.0 (2023-04-05)
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* Support for Puma 6 and Rack 3
|
|
8
|
+
|
|
9
|
+
### 1.2.0 (2022-08-25)
|
|
10
|
+
|
|
11
|
+
* Update minimum Ruby version to 2.6
|
|
12
|
+
* Increase default max thread pool size to 16
|
|
13
|
+
|
|
14
|
+
### 1.1.0 (2022-01-18)
|
|
4
15
|
|
|
5
16
|
* Increase default max thread pool size to 8.
|
|
6
17
|
* Return 204 when a GET request is sent to an event function, to support health checks.
|
|
7
18
|
* Flush stdout and stderr streams at the end of each request.
|
|
8
19
|
* Format the error backtrace.
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
### 1.0.1 (2021-09-10)
|
|
11
22
|
|
|
12
23
|
* FIXED: Update legacy event conversion to set the correct types for firebase database events
|
|
13
24
|
|
|
14
|
-
|
|
25
|
+
### 1.0.0 (2021-07-07)
|
|
15
26
|
|
|
16
27
|
* Bumped the version to 1.0.
|
|
17
28
|
* Removed the "preview" notices for Google Cloud Functions since the Ruby runtime is now GA.
|
|
18
29
|
|
|
19
|
-
|
|
30
|
+
### v0.11.0 / 2021-06-28
|
|
20
31
|
|
|
21
32
|
* UPDATED: Update CloudEvents dependency to 0.5 to get fixes for JSON formatting cases
|
|
22
33
|
* FIXED: Updated Pub/Sub and Firebase event conversion logic to better align to Eventarc
|
|
23
34
|
|
|
24
|
-
|
|
35
|
+
### v0.10.0 / 2021-06-01
|
|
25
36
|
|
|
26
37
|
* ADDED: Support raw pubsub events sent by the pubsub emulator
|
|
27
38
|
* FIXED: Set proper response content-type charset when a function returns a string (plain text) or hash (JSON)
|
|
28
39
|
* FIXED: Properly handle conversion of non-ascii characters in legacy event strings
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
### v0.9.0 / 2021-03-18
|
|
31
42
|
|
|
32
43
|
* BREAKING CHANGE: Servers are configured as single-threaded in production by default, matching the current behavior of Google Cloud Functions.
|
|
33
44
|
* FIXED: Fixed conversion of Firebase events to CloudEvents to conform to the specs used by Cloud Functions and Cloud Run.
|
|
34
45
|
* FIXED: Fixed an error when reading a global set to a Minitest::Mock. This will make it easier to write tests that use mocks for global resources.
|
|
35
46
|
|
|
36
|
-
|
|
47
|
+
### v0.8.0 / 2021-03-02
|
|
37
48
|
|
|
38
49
|
* ADDED: Support for lazily-initialized globals
|
|
39
50
|
|
|
40
|
-
|
|
51
|
+
### v0.7.1 / 2021-01-26
|
|
41
52
|
|
|
42
53
|
* DOCS: Fixed several errors in the writing-functions doc samples
|
|
43
54
|
* DOCS: Updated documentation to note public release of GCF support
|
|
44
55
|
|
|
45
|
-
|
|
56
|
+
### v0.7.0 / 2020-09-25
|
|
46
57
|
|
|
47
58
|
* Now requires Ruby 2.5 or later.
|
|
48
59
|
* BREAKING CHANGE: Renamed "context" hash to "globals" and made it read-only for normal functions.
|
|
@@ -56,33 +67,33 @@
|
|
|
56
67
|
* DOCS: Expanded documentation on initialization, execution context, and shared resources.
|
|
57
68
|
* DEPRECATED: The functions-framework executable is deprecated. Use functions-framework-ruby instead.
|
|
58
69
|
|
|
59
|
-
|
|
70
|
+
### v0.6.0 / 2020-09-17
|
|
60
71
|
|
|
61
72
|
* ADDED: You can use the --version flag to print the framework version
|
|
62
73
|
* ADDED: You can use the --verify flag to verify that a given function is defined
|
|
63
74
|
* ADDED: You can now define blocks that are executed at server startup
|
|
64
75
|
|
|
65
|
-
|
|
76
|
+
### v0.5.2 / 2020-09-06
|
|
66
77
|
|
|
67
78
|
* FIXED: Use global $stderr rather than STDERR for logger
|
|
68
79
|
* DOCS: Fix instructions for deployment to Google Cloud Functions
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
### v0.5.1 / 2020-07-20
|
|
71
82
|
|
|
72
83
|
* Updated some documentation links. No functional changes.
|
|
73
84
|
|
|
74
|
-
|
|
85
|
+
### v0.5.0 / 2020-07-09
|
|
75
86
|
|
|
76
87
|
* Removed embedded CloudEvents classes and added the official CloudEvents SDK as a dependency. A `FunctionsFramework::CloudEvents` alias provides backward compatibility.
|
|
77
88
|
|
|
78
|
-
|
|
89
|
+
### v0.4.1 / 2020-07-08
|
|
79
90
|
|
|
80
91
|
* Fixed unsupported signal error on Windows.
|
|
81
92
|
* Fixed several edge case errors in legacy event conversion.
|
|
82
93
|
* Generated Content-Type headers now properly quote param values if needed.
|
|
83
94
|
* Minor documentation updates.
|
|
84
95
|
|
|
85
|
-
|
|
96
|
+
### v0.4.0 / 2020-06-29
|
|
86
97
|
|
|
87
98
|
* Dropped the legacy and largely unsupported `:event` function type. All event functions should be of type `:cloud_event`.
|
|
88
99
|
* Define the object context for function execution, and include an extensible context helper.
|
|
@@ -93,21 +104,21 @@
|
|
|
93
104
|
* Removed redundant `_string` accessors from event classes since raw forms are already available via `[]`.
|
|
94
105
|
* A variety of corrections to event-related class documentation.
|
|
95
106
|
|
|
96
|
-
|
|
107
|
+
### v0.3.1 / 2020-06-27
|
|
97
108
|
|
|
98
109
|
* Fixed crash when using "return" directly in a function block.
|
|
99
110
|
* Added a more flexible request generation helper in the testing module.
|
|
100
111
|
* Fixed several typos in the documentation.
|
|
101
112
|
|
|
102
|
-
|
|
113
|
+
### v0.3.0 / 2020-06-26
|
|
103
114
|
|
|
104
115
|
* Updated the CloudEvent data format for converted pubsub events to conform to Cloud Run's conversion.
|
|
105
116
|
|
|
106
|
-
|
|
117
|
+
### v0.2.1 / 2020-06-25
|
|
107
118
|
|
|
108
119
|
* The `--signature-type` check recognizes the legacy `event` type for `:cloud_event` functions.
|
|
109
120
|
|
|
110
|
-
|
|
121
|
+
### v0.2.0 / 2020-06-24
|
|
111
122
|
|
|
112
123
|
Significant changes:
|
|
113
124
|
|
|
@@ -126,11 +137,11 @@ Minor changes:
|
|
|
126
137
|
* Renamed a few undocumented environment variables, and added support for a logging level environment variable. All CLI flags now have associated environment variables.
|
|
127
138
|
* Several fixes to the example code, and added a new Sinatra example.
|
|
128
139
|
|
|
129
|
-
|
|
140
|
+
### v0.1.1 / 2020-02-27
|
|
130
141
|
|
|
131
142
|
* Server returns 404 when receiving a /favicon.ico or /robots.txt request.
|
|
132
143
|
* Correct a rack constant name in Testing#make_post_request
|
|
133
144
|
|
|
134
|
-
|
|
145
|
+
### v0.1.0 / 2020-01-30
|
|
135
146
|
|
|
136
147
|
* Initial release
|
data/README.md
CHANGED
|
@@ -42,14 +42,14 @@ requiring an HTTP server or complicated request handling logic.
|
|
|
42
42
|
|
|
43
43
|
## Supported Ruby versions
|
|
44
44
|
|
|
45
|
-
This library is supported on Ruby 2.
|
|
45
|
+
This library is supported on Ruby 2.6+.
|
|
46
46
|
|
|
47
47
|
Google provides official support for Ruby versions that are actively supported
|
|
48
48
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
49
|
-
in security maintenance, and not end of life.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
|
50
|
+
still work, but are unsupported and not recommended. See
|
|
51
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
|
52
|
+
support schedule.
|
|
53
53
|
|
|
54
54
|
## Quickstart
|
|
55
55
|
|
data/docs/deploying-functions.md
CHANGED
|
@@ -147,8 +147,8 @@ command may ask you for permission to enable the Cloud Build API for the project
|
|
|
147
147
|
if it isn't already enabled.
|
|
148
148
|
|
|
149
149
|
Because you provide your own Docker image when deploying to Cloud Run, you can
|
|
150
|
-
use any version of Ruby supported by the Functions Framework, from 2.
|
|
151
|
-
3.
|
|
150
|
+
use any version of Ruby supported by the Functions Framework, from 2.6 through
|
|
151
|
+
3.1.
|
|
152
152
|
|
|
153
153
|
### Deploying an image to Cloud Run
|
|
154
154
|
|
data/docs/overview.md
CHANGED
|
@@ -46,14 +46,14 @@ requiring an HTTP server or complicated request handling logic.
|
|
|
46
46
|
|
|
47
47
|
## Supported Ruby versions
|
|
48
48
|
|
|
49
|
-
This library is supported on Ruby 2.
|
|
49
|
+
This library is supported on Ruby 2.6+.
|
|
50
50
|
|
|
51
51
|
Google provides official support for Ruby versions that are actively supported
|
|
52
52
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
53
|
-
in security maintenance, and not end of life.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
|
54
|
+
still work, but are unsupported and not recommended. See
|
|
55
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
|
56
|
+
support schedule.
|
|
57
57
|
|
|
58
58
|
## Quickstart
|
|
59
59
|
|
|
@@ -85,8 +85,8 @@ module FunctionsFramework
|
|
|
85
85
|
@source = val
|
|
86
86
|
end
|
|
87
87
|
op.on "--signature-type TYPE",
|
|
88
|
-
"Asserts that the function has the given signature type." \
|
|
89
|
-
"
|
|
88
|
+
"Asserts that the function has the given signature type. " \
|
|
89
|
+
"Supported values are 'http' and 'cloudevent'." do |val|
|
|
90
90
|
@signature_type = val
|
|
91
91
|
end
|
|
92
92
|
op.on "-p", "--port PORT", "Set the port to listen to (defaults to 8080)" do |val|
|
|
@@ -196,8 +196,8 @@ module FunctionsFramework
|
|
|
196
196
|
function = ::FunctionsFramework.global_registry[@target]
|
|
197
197
|
raise "Undefined function: #{@target.inspect}" if function.nil?
|
|
198
198
|
unless @signature_type.nil? ||
|
|
199
|
-
@signature_type == "http" && function.type == :http ||
|
|
200
|
-
["cloudevent", "event"].include?(@signature_type) && function.type == :cloud_event
|
|
199
|
+
(@signature_type == "http" && function.type == :http) ||
|
|
200
|
+
(["cloudevent", "event"].include?(@signature_type) && function.type == :cloud_event)
|
|
201
201
|
raise "Function #{@target.inspect} does not match type #{@signature_type}"
|
|
202
202
|
end
|
|
203
203
|
function
|
|
@@ -82,13 +82,24 @@ module FunctionsFramework
|
|
|
82
82
|
def start
|
|
83
83
|
synchronize do
|
|
84
84
|
unless running?
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
# Puma >= 6.0 interprets these settings from options
|
|
86
|
+
options = {
|
|
87
|
+
min_threads: @config.min_threads,
|
|
88
|
+
max_threads: @config.max_threads,
|
|
89
|
+
environment: @config.show_error_details? ? "development" : "production"
|
|
90
|
+
}
|
|
91
|
+
# Puma::Events.stdio for Puma < 6.0; otherwise nil for Puma >= 6.0
|
|
92
|
+
events = ::Puma::Events.stdio if ::Puma::Events.respond_to? :stdio
|
|
93
|
+
@server = ::Puma::Server.new @app, events, options
|
|
94
|
+
if @server.respond_to? :min_threads=
|
|
95
|
+
# Puma < 6.0 sets server attributes for these settings
|
|
96
|
+
@server.min_threads = @config.min_threads
|
|
97
|
+
@server.max_threads = @config.max_threads
|
|
98
|
+
@server.leak_stack_on_error = @config.show_error_details?
|
|
99
|
+
end
|
|
89
100
|
@server.binder.add_tcp_listener @config.bind_addr, @config.port
|
|
90
|
-
@config.logger.info "FunctionsFramework: Serving function #{@function.name.inspect}" \
|
|
91
|
-
"
|
|
101
|
+
@config.logger.info "FunctionsFramework: Serving function #{@function.name.inspect} " \
|
|
102
|
+
"on port #{@config.port}..."
|
|
92
103
|
@server.run true
|
|
93
104
|
end
|
|
94
105
|
end
|
|
@@ -306,7 +317,7 @@ module FunctionsFramework
|
|
|
306
317
|
# @return [Integer]
|
|
307
318
|
#
|
|
308
319
|
def max_threads
|
|
309
|
-
@max_threads ||
|
|
320
|
+
@max_threads || 16
|
|
310
321
|
end
|
|
311
322
|
|
|
312
323
|
##
|
|
@@ -377,8 +388,8 @@ module FunctionsFramework
|
|
|
377
388
|
content_type = "#{content_type}; charset=#{string.encoding.name.downcase}"
|
|
378
389
|
end
|
|
379
390
|
headers = {
|
|
380
|
-
"
|
|
381
|
-
"
|
|
391
|
+
"content-type" => content_type,
|
|
392
|
+
"content-length" => string.bytesize
|
|
382
393
|
}
|
|
383
394
|
[status, headers, [string]]
|
|
384
395
|
end
|
|
@@ -367,8 +367,8 @@ module FunctionsFramework
|
|
|
367
367
|
::Rack::QUERY_STRING => url.query,
|
|
368
368
|
::Rack::SERVER_NAME => url.host,
|
|
369
369
|
::Rack::SERVER_PORT => url.port,
|
|
370
|
+
::Rack::SERVER_PROTOCOL => "HTTP/1.1",
|
|
370
371
|
::Rack::RACK_URL_SCHEME => url.scheme,
|
|
371
|
-
::Rack::RACK_VERSION => ::Rack::VERSION,
|
|
372
372
|
::Rack::RACK_LOGGER => ::FunctionsFramework.logger,
|
|
373
373
|
::Rack::RACK_INPUT => ::StringIO.new,
|
|
374
374
|
::Rack::RACK_ERRORS => ::StringIO.new
|
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.3.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: 2023-04-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cloud_events
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
version: 4.3.0
|
|
40
40
|
- - "<"
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version:
|
|
42
|
+
version: 7.a
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,21 +49,27 @@ dependencies:
|
|
|
49
49
|
version: 4.3.0
|
|
50
50
|
- - "<"
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
52
|
+
version: 7.a
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: rack
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
|
-
- - "
|
|
57
|
+
- - ">="
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
59
|
version: '2.1'
|
|
60
|
+
- - "<"
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 4.a
|
|
60
63
|
type: :runtime
|
|
61
64
|
prerelease: false
|
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
63
66
|
requirements:
|
|
64
|
-
- - "
|
|
67
|
+
- - ">="
|
|
65
68
|
- !ruby/object:Gem::Version
|
|
66
69
|
version: '2.1'
|
|
70
|
+
- - "<"
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: 4.a
|
|
67
73
|
description: The Functions Framework is an open source framework for writing lightweight,
|
|
68
74
|
portable Ruby functions that run in a serverless environment. Functions written
|
|
69
75
|
to this Framework will run on Google Cloud Functions, Google Cloud Run, or any other
|
|
@@ -100,10 +106,10 @@ homepage: https://github.com/GoogleCloudPlatform/functions-framework-ruby
|
|
|
100
106
|
licenses:
|
|
101
107
|
- Apache-2.0
|
|
102
108
|
metadata:
|
|
103
|
-
changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.
|
|
109
|
+
changelog_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.3.0/file.CHANGELOG.html
|
|
104
110
|
source_code_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby
|
|
105
111
|
bug_tracker_uri: https://github.com/GoogleCloudPlatform/functions-framework-ruby/issues
|
|
106
|
-
documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.
|
|
112
|
+
documentation_uri: https://googlecloudplatform.github.io/functions-framework-ruby/v1.3.0
|
|
107
113
|
post_install_message:
|
|
108
114
|
rdoc_options: []
|
|
109
115
|
require_paths:
|
|
@@ -112,14 +118,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
112
118
|
requirements:
|
|
113
119
|
- - ">="
|
|
114
120
|
- !ruby/object:Gem::Version
|
|
115
|
-
version: 2.
|
|
121
|
+
version: 2.6.0
|
|
116
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
123
|
requirements:
|
|
118
124
|
- - ">="
|
|
119
125
|
- !ruby/object:Gem::Version
|
|
120
126
|
version: '0'
|
|
121
127
|
requirements: []
|
|
122
|
-
rubygems_version: 3.
|
|
128
|
+
rubygems_version: 3.4.2
|
|
123
129
|
signing_key:
|
|
124
130
|
specification_version: 4
|
|
125
131
|
summary: Functions Framework for Ruby
|