Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update minimum Ruby version to 2.6 #145

Merged
merged 1 commit into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the one above, the

### Useful tools

The Functions Framework runs on Ruby 2.5 or later. We recommend having a recent
The Functions Framework runs on Ruby 2.6 or later. We recommend having a recent
version of Ruby for development and testing. The CI will test against all
supported versions of Ruby.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1"]
ruby-version: ["2.6", "2.7", "3.0", "3.1"]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
ruby: "2.5"
flags: "--only --test-unit"
- os: ubuntu-latest
ruby: "2.6"
flags: "--only --test-unit"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ source "https://rubygems.org"

gemspec

gem "google-style", "~> 1.25.1"
gem "minitest", "~> 5.14"
gem "google-style", "~> 1.26.1"
gem "minitest", "~> 5.16"
gem "minitest-focus", "~> 1.2"
gem "minitest-rg", "~> 5.2"
gem "redcarpet", "~> 3.5" unless ::RUBY_PLATFORM == "java"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ requiring an HTTP server or complicated request handling logic.

## Supported Ruby versions

This library is supported on Ruby 2.5+.
This library is supported on Ruby 2.6+.

Google provides official support for Ruby versions that are actively supported
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
in security maintenance, and not end of life. Currently, this means Ruby 2.5
and later. Older versions of Ruby _may_ still work, but are unsupported and not
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
about the Ruby support schedule.
in security maintenance, and not end of life. Older versions of Ruby _may_
still work, but are unsupported and not recommended. See
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
support schedule.

## Quickstart

Expand Down
4 changes: 2 additions & 2 deletions docs/deploying-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ command may ask you for permission to enable the Cloud Build API for the project
if it isn't already enabled.

Because you provide your own Docker image when deploying to Cloud Run, you can
use any version of Ruby supported by the Functions Framework, from 2.5 through
3.0.
use any version of Ruby supported by the Functions Framework, from 2.6 through
3.1.

### Deploying an image to Cloud Run

Expand Down
10 changes: 5 additions & 5 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ requiring an HTTP server or complicated request handling logic.

## Supported Ruby versions

This library is supported on Ruby 2.5+.
This library is supported on Ruby 2.6+.

Google provides official support for Ruby versions that are actively supported
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
in security maintenance, and not end of life. Currently, this means Ruby 2.5
and later. Older versions of Ruby _may_ still work, but are unsupported and not
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
about the Ruby support schedule.
in security maintenance, and not end of life. Older versions of Ruby _may_
still work, but are unsupported and not recommended. See
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
support schedule.

## Quickstart

Expand Down
12 changes: 6 additions & 6 deletions functions_framework.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ version = ::FunctionsFramework::VERSION

spec.summary = "Functions Framework for Ruby"
spec.description =
"The Functions Framework is an open source framework for writing" \
" lightweight, portable Ruby functions that run in a serverless" \
" environment. Functions written to this Framework will run on Google" \
" Cloud Functions, Google Cloud Run, or any other Knative-based" \
" environment."
"The Functions Framework is an open source framework for writing " \
"lightweight, portable Ruby functions that run in a serverless " \
"environment. Functions written to this Framework will run on Google " \
"Cloud Functions, Google Cloud Run, or any other Knative-based " \
"environment."
spec.license = "Apache-2.0"
spec.homepage = "https://github.com/GoogleCloudPlatform/functions-framework-ruby"

Expand All @@ -44,7 +44,7 @@ version = ::FunctionsFramework::VERSION
spec.bindir = "bin"
spec.executables = ["functions-framework", "functions-framework-ruby"]

spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 2.6.0"
spec.add_dependency "cloud_events", ">= 0.7.0", "< 2.a"
spec.add_dependency "puma", ">= 4.3.0", "< 6.a"
spec.add_dependency "rack", "~> 2.1"
Expand Down
8 changes: 4 additions & 4 deletions lib/functions_framework/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def parse_args argv # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
@source = val
end
op.on "--signature-type TYPE",
"Asserts that the function has the given signature type." \
" Supported values are 'http' and 'cloudevent'." do |val|
"Asserts that the function has the given signature type. " \
"Supported values are 'http' and 'cloudevent'." do |val|
@signature_type = val
end
op.on "-p", "--port PORT", "Set the port to listen to (defaults to 8080)" do |val|
Expand Down Expand Up @@ -196,8 +196,8 @@ def load_function
function = ::FunctionsFramework.global_registry[@target]
raise "Undefined function: #{@target.inspect}" if function.nil?
unless @signature_type.nil? ||
@signature_type == "http" && function.type == :http ||
["cloudevent", "event"].include?(@signature_type) && function.type == :cloud_event
(@signature_type == "http" && function.type == :http) ||
(["cloudevent", "event"].include?(@signature_type) && function.type == :cloud_event)
raise "Function #{@target.inspect} does not match type #{@signature_type}"
end
function
Expand Down
4 changes: 2 additions & 2 deletions lib/functions_framework/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def start
@server.max_threads = @config.max_threads
@server.leak_stack_on_error = @config.show_error_details?
@server.binder.add_tcp_listener @config.bind_addr, @config.port
@config.logger.info "FunctionsFramework: Serving function #{@function.name.inspect}" \
" on port #{@config.port}..."
@config.logger.info "FunctionsFramework: Serving function #{@function.name.inspect} " \
"on port #{@config.port}..."
@server.run true
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def query_server_with_retry server
_out, err = capture_subprocess_io do
response = query_server_with_retry event_server do
file_path = File.join __dir__, "legacy_events_data", "legacy_pubsub.json"
event_json = IO.read file_path
event_json = File.read file_path
::Net::HTTP.post URI("#{server_url}/"), event_json, "Content-Type" => "application/json"
end
end
Expand All @@ -224,7 +224,7 @@ def query_server_with_retry server
_out, err = capture_subprocess_io do
response = query_server_with_retry event_server do
file_path = File.join __dir__, "legacy_events_data", "pubsub_utf8.json"
event_json = IO.read file_path
event_json = File.read file_path
::Net::HTTP.post URI("#{server_url}/"), event_json, "Content-Type" => "application/json; charset=utf-8"
end
end
Expand Down