Skip to content

Commit

Permalink
Document and check for unsupported Ruby versions (googleapis#1988)
Browse files Browse the repository at this point in the history
  • Loading branch information
dazuma authored Mar 5, 2018
1 parent 0eb3766 commit 6fbad2e
Show file tree
Hide file tree
Showing 31 changed files with 318 additions and 18 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,14 @@ $ gem install google-cloud-video_intelligence

## Supported Ruby Versions

google-cloud-ruby is supported on Ruby 2.0+.
These libraries are currently supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

Expand Down
7 changes: 7 additions & 0 deletions gcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ end

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-bigquery/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ end

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-bigtable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ steps:
$ gem install google-cloud-bigtable
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Cloud Bigtable API
to see other available methods on the client.
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ zone = "us-central1-a"
response = cluster_manager_client.list_clusters(project_id_2, zone)
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Google Container Engine API
to see other available methods on the client.
Expand Down
9 changes: 8 additions & 1 deletion google-cloud-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ This library contains shared types, such as error classes, for the google-cloud

## Supported Ruby Versions

This library is supported on Ruby 2.0+.
This library is currently supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

Expand Down
85 changes: 70 additions & 15 deletions google-cloud-core/lib/google/cloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,26 +96,81 @@ def self.configure

@config
end

##
# Initialize toplevel configuration
# @private
#
def self.init_configuration
configure do |config|
default_project = Google::Cloud::Config.deferred do
ENV["GOOGLE_CLOUD_PROJECT"] || ENV["GCLOUD_PROJECT"]
end
default_creds = Google::Cloud::Config.deferred do
Google::Cloud::Config.credentials_from_env \
"GOOGLE_CLOUD_CREDENTIALS", "GOOGLE_CLOUD_CREDENTIALS_JSON",
"GOOGLE_CLOUD_KEYFILE", "GOOGLE_CLOUD_KEYFILE_JSON",
"GCLOUD_KEYFILE", "GCLOUD_KEYFILE_JSON"
end

config.add_field! :project_id, default_project,
match: String, allow_nil: true
config.add_alias! :project, :project_id
config.add_field! :credentials, default_creds, match: Object
config.add_alias! :keyfile, :credentials
end
end

# In June, 2018, set supported version to 2.3 and recommended to 2.4.
# Thereafter, follow the MRI support schedule: supported means non-EOL,
# and recommended means in normal (rather than security) maintenance.
# See https://www.ruby-lang.org/en/downloads/branches/

##
# Minimum "supported" Ruby version (non-EOL)
# @private
#
SUPPORTED_VERSION_THRESHOLD = "2.0".freeze

##
# Minimum "recommended" Ruby version (normal maintenance)
# @private
#
RECOMMENDED_VERSION_THRESHOLD = "2.3".freeze

##
# Check Ruby version and emit a warning if it is old
# @private
#
def self.warn_on_old_ruby_version \
supported_version: SUPPORTED_VERSION_THRESHOLD,
recommended_version: RECOMMENDED_VERSION_THRESHOLD
cur_version = Gem::Version.new RUBY_VERSION
if cur_version < Gem::Version.new(supported_version)
warn "WARNING: You are running Ruby #{cur_version}, which has reached" \
" end-of-life and is no longer supported by Ruby Core."
warn "It is strongly recommended that you upgrade to Ruby" \
" #{recommended_version} or later."
warn "See https://www.ruby-lang.org/en/downloads/branches/ for more" \
" info on the Ruby maintenance schedule."
elsif cur_version < Gem::Version.new(recommended_version)
warn "WARNING: You are running Ruby #{cur_version}, which is nearing" \
" end-of-life."
warn "Consider upgrading to Ruby #{recommended_version} or later."
warn "See https://www.ruby-lang.org/en/downloads/branches/ for more" \
" info on the Ruby maintenance schedule."
end
rescue ArgumentError
warn "Unable to determine current Ruby version."
end
end
end

# Set the default top-level configuration
Google::Cloud.configure do |config|
default_project = Google::Cloud::Config.deferred do
ENV["GOOGLE_CLOUD_PROJECT"] || ENV["GCLOUD_PROJECT"]
end
default_creds = Google::Cloud::Config.deferred do
Google::Cloud::Config.credentials_from_env \
"GOOGLE_CLOUD_CREDENTIALS", "GOOGLE_CLOUD_CREDENTIALS_JSON",
"GOOGLE_CLOUD_KEYFILE", "GOOGLE_CLOUD_KEYFILE_JSON",
"GCLOUD_KEYFILE", "GCLOUD_KEYFILE_JSON"
end
Google::Cloud.init_configuration

config.add_field! :project_id, default_project, match: String, allow_nil: true
config.add_alias! :project, :project_id
config.add_field! :credentials, default_creds, match: Object
config.add_alias! :keyfile, :credentials
end
# Emit a warning if current Ruby is at or nearing end-of-life
Google::Cloud.warn_on_old_ruby_version

# Auto-load all Google Cloud service gems.
Gem.find_files("google-cloud-*.rb").each do |google_cloud_service|
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-dataproc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ cluster_controller_client.list_clusters(project_id_2, region).each_page do |page
end
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Google Cloud Dataproc API
to see other available methods on the client.
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-datastore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ tasks = datastore.run query

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-debugger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ for a list of possible configuration options.

This library is supported on Ruby 2.2 or later.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

This library follows [Semantic Versioning](http://semver.org/). It is currently
in major version zero (0.y.z), which means that anything may change at any time
and the public API should not be considered stable.
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-dlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ steps:
$ gem install google-cloud-dlp
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Preview
#### DlpServiceClient
```rb
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-dns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ end

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ This library provides information on the application hosting environment for app

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-error_reporting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ in the [Authentication Guide](https://googlecloudplatform.github.io/google-cloud

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-firestore/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ steps:
$ gem install google-cloud-firestore
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Google Cloud Firestore API
to see other available methods on the client.
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-language/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ document = { content: content, type: type }
response = language_service_client.analyze_sentiment(document)
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Google Cloud Natural Language API
to see other available methods on the client.
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-logging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ for more ways to authenticate the client library.

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ metric_service_client.list_monitored_resource_descriptors(formatted_name).each_p
end
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Stackdriver Monitoring API
to see other available methods on the client.
Expand Down
11 changes: 11 additions & 0 deletions google-cloud-os_login/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ steps:
$ gem install google-cloud-os_login
```

### Supported Ruby Versions

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

### Next Steps
- Read the [Client Library Documentation][] for Google Cloud OS Login API
to see other available methods on the client.
Expand Down
7 changes: 7 additions & 0 deletions google-cloud-pubsub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ subscriber.stop.wait!

This library is supported on Ruby 2.0+.

However, Ruby 2.3 or later is strongly recommended, as earlier releases have
reached or are nearing end-of-life. After June 1, 2018, Google will provide
official support only for Ruby versions that are considered current and
supported by Ruby Core (that is, Ruby versions that are either in normal
maintenance or in security maintenance).
See https://www.ruby-lang.org/en/downloads/branches/ for further details.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).
Expand Down
Loading

0 comments on commit 6fbad2e

Please sign in to comment.