google-cloud-core 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -1
- data/lib/google/cloud.rb +100 -16
- data/lib/google/cloud/core/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0b557c72656343a1c1931542cd9cd3a3bd1fd5a82fb786c8c6468071cfefe41
|
4
|
+
data.tar.gz: 620d60ecc70baba4ed88cbea048764ae4a47307b8d87f3e184aa3f0999970b60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fcf42cc101c71d111ad06b9f50af49715cff12264a42353edb64304dc4b54c8bec2d9f5069937eff73c21dc0f31ad03181ac42606a32266f1c7c5fb6bac2fe3
|
7
|
+
data.tar.gz: 9f52bf6b7aa21cf5b14d03e5097eb389296943cdab0619f9596f1ba819ea10fadea3e940dabb82b0c3897010a0e7c54b7d0e4b53fa100ab5ed0558f75424ffd0
|
data/README.md
CHANGED
@@ -6,7 +6,14 @@ This library contains shared types, such as error classes, for the google-cloud
|
|
6
6
|
|
7
7
|
## Supported Ruby Versions
|
8
8
|
|
9
|
-
This library is supported on Ruby 2.0+.
|
9
|
+
This library is currently supported on Ruby 2.0+.
|
10
|
+
|
11
|
+
However, Ruby 2.3 or later is strongly recommended, as earlier releases have
|
12
|
+
reached or are nearing end-of-life. After June 1, 2018, Google will provide
|
13
|
+
official support only for Ruby versions that are considered current and
|
14
|
+
supported by Ruby Core (that is, Ruby versions that are either in normal
|
15
|
+
maintenance or in security maintenance).
|
16
|
+
See https://www.ruby-lang.org/en/downloads/branches/ for further details.
|
10
17
|
|
11
18
|
## Versioning
|
12
19
|
|
data/lib/google/cloud.rb
CHANGED
@@ -96,28 +96,112 @@ module Google
|
|
96
96
|
|
97
97
|
@config
|
98
98
|
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Initialize toplevel configuration
|
102
|
+
# @private
|
103
|
+
#
|
104
|
+
def self.init_configuration
|
105
|
+
configure do |config|
|
106
|
+
default_project = Google::Cloud::Config.deferred do
|
107
|
+
ENV["GOOGLE_CLOUD_PROJECT"] || ENV["GCLOUD_PROJECT"]
|
108
|
+
end
|
109
|
+
default_creds = Google::Cloud::Config.deferred do
|
110
|
+
Google::Cloud::Config.credentials_from_env \
|
111
|
+
"GOOGLE_CLOUD_CREDENTIALS", "GOOGLE_CLOUD_CREDENTIALS_JSON",
|
112
|
+
"GOOGLE_CLOUD_KEYFILE", "GOOGLE_CLOUD_KEYFILE_JSON",
|
113
|
+
"GCLOUD_KEYFILE", "GCLOUD_KEYFILE_JSON"
|
114
|
+
end
|
115
|
+
|
116
|
+
config.add_field! :project_id, default_project,
|
117
|
+
match: String, allow_nil: true
|
118
|
+
config.add_alias! :project, :project_id
|
119
|
+
config.add_field! :credentials, default_creds, match: Object
|
120
|
+
config.add_alias! :keyfile, :credentials
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# In June, 2018, set supported version to 2.3 and recommended to 2.4.
|
125
|
+
# Thereafter, follow the MRI support schedule: supported means non-EOL,
|
126
|
+
# and recommended means in normal (rather than security) maintenance.
|
127
|
+
# See https://www.ruby-lang.org/en/downloads/branches/
|
128
|
+
|
129
|
+
##
|
130
|
+
# Minimum "supported" Ruby version (non-EOL)
|
131
|
+
# @private
|
132
|
+
#
|
133
|
+
SUPPORTED_VERSION_THRESHOLD = "2.0".freeze
|
134
|
+
|
135
|
+
##
|
136
|
+
# Minimum "recommended" Ruby version (normal maintenance)
|
137
|
+
# @private
|
138
|
+
#
|
139
|
+
RECOMMENDED_VERSION_THRESHOLD = "2.3".freeze
|
140
|
+
|
141
|
+
##
|
142
|
+
# Check Ruby version and emit a warning if it is old
|
143
|
+
# @private
|
144
|
+
#
|
145
|
+
def self.warn_on_old_ruby_version \
|
146
|
+
supported_version: SUPPORTED_VERSION_THRESHOLD,
|
147
|
+
recommended_version: RECOMMENDED_VERSION_THRESHOLD
|
148
|
+
return if ENV["GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS"]
|
149
|
+
cur_version = Gem::Version.new RUBY_VERSION
|
150
|
+
if cur_version < Gem::Version.new(supported_version)
|
151
|
+
warn_unsupported_ruby cur_version, recommended_version
|
152
|
+
elsif cur_version < Gem::Version.new(recommended_version)
|
153
|
+
warn_nonrecommended_ruby cur_version, recommended_version
|
154
|
+
end
|
155
|
+
rescue ArgumentError
|
156
|
+
warn "Unable to determine current Ruby version."
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
# Print a warning for an EOL version of Ruby
|
161
|
+
# @private
|
162
|
+
#
|
163
|
+
def self.warn_unsupported_ruby cur_version, recommended_version
|
164
|
+
warn "WARNING: You are running Ruby #{cur_version}, which has reached" \
|
165
|
+
" end-of-life and is no longer supported by Ruby Core."
|
166
|
+
warn "The Google Cloud API clients work best on supported versions of" \
|
167
|
+
" Ruby. It is strongly recommended that you upgrade to Ruby" \
|
168
|
+
" #{recommended_version} or later."
|
169
|
+
warn "See https://www.ruby-lang.org/en/downloads/branches/ for more" \
|
170
|
+
" info on the Ruby maintenance schedule."
|
171
|
+
warn "To suppress this message, set the" \
|
172
|
+
" GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable."
|
173
|
+
end
|
174
|
+
|
175
|
+
##
|
176
|
+
# Print a warning for a supported but nearing EOL version of Ruby
|
177
|
+
# @private
|
178
|
+
#
|
179
|
+
def self.warn_nonrecommended_ruby cur_version, recommended_version
|
180
|
+
warn "WARNING: You are running Ruby #{cur_version}, which is nearing" \
|
181
|
+
" end-of-life."
|
182
|
+
warn "The Google Cloud API clients work best on supported versions of" \
|
183
|
+
" Ruby. Consider upgrading to Ruby #{recommended_version} or later."
|
184
|
+
warn "See https://www.ruby-lang.org/en/downloads/branches/ for more" \
|
185
|
+
" info on the Ruby maintenance schedule."
|
186
|
+
warn "To suppress this message, set the" \
|
187
|
+
" GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable."
|
188
|
+
end
|
99
189
|
end
|
100
190
|
end
|
101
191
|
|
102
192
|
# Set the default top-level configuration
|
103
|
-
Google::Cloud.
|
104
|
-
default_project = Google::Cloud::Config.deferred do
|
105
|
-
ENV["GOOGLE_CLOUD_PROJECT"] || ENV["GCLOUD_PROJECT"]
|
106
|
-
end
|
107
|
-
default_creds = Google::Cloud::Config.deferred do
|
108
|
-
Google::Cloud::Config.credentials_from_env \
|
109
|
-
"GOOGLE_CLOUD_CREDENTIALS", "GOOGLE_CLOUD_CREDENTIALS_JSON",
|
110
|
-
"GOOGLE_CLOUD_KEYFILE", "GOOGLE_CLOUD_KEYFILE_JSON",
|
111
|
-
"GCLOUD_KEYFILE", "GCLOUD_KEYFILE_JSON"
|
112
|
-
end
|
193
|
+
Google::Cloud.init_configuration
|
113
194
|
|
114
|
-
|
115
|
-
|
116
|
-
config.add_field! :credentials, default_creds, match: Object
|
117
|
-
config.add_alias! :keyfile, :credentials
|
118
|
-
end
|
195
|
+
# Emit a warning if current Ruby is at or nearing end-of-life
|
196
|
+
Google::Cloud.warn_on_old_ruby_version
|
119
197
|
|
120
198
|
# Auto-load all Google Cloud service gems.
|
121
|
-
Gem.
|
199
|
+
auto_load_files = if Gem.respond_to? :find_latest_files
|
200
|
+
Gem.find_latest_files "google-cloud-*.rb"
|
201
|
+
else
|
202
|
+
# Ruby 2.0 does not have Gem.find_latest_files
|
203
|
+
Gem.find_files "google-cloud-*.rb"
|
204
|
+
end
|
205
|
+
auto_load_files.each do |google_cloud_service|
|
122
206
|
require google_cloud_service
|
123
207
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-env
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
requirements: []
|
189
189
|
rubyforge_project:
|
190
|
-
rubygems_version: 2.7.
|
190
|
+
rubygems_version: 2.7.7
|
191
191
|
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: Internal shared library for google-cloud-ruby
|