google-cloud-env 1.3.3 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cc1587d2fad1a7c47c154488e76f4441d4dbb2a4c9a56826f0a18d2027d3e5d
4
- data.tar.gz: '0998d2e1d9568e680b87f6da44e892c3c2d800ee6e6f17e562f6855c9f5813b8'
3
+ metadata.gz: c1d6be34c567d4881e2f9e841727cbde968ae37bfd41b5d27bcd3c7b21840d8c
4
+ data.tar.gz: 7aa6c6c1805fb4f51e1b76685740c47a8017629447ab0d7f91f602761e0b7c89
5
5
  SHA512:
6
- metadata.gz: f1d417ccdc7fc15e61cdc13a1493f406b0f2437738b5afd51eb00cc8b48e331a1e1145d9debb2246945a3dab38b808f478ad9499da313a901ab7358bc9c404f5
7
- data.tar.gz: 40a8fb198fc780aa6057e4e56d420b12021f7c401a52765a591f7b761019f1f52ddcea9411659def21c9f704748f8cf69a8dadbded7d22e86cbddbf74d182cb2
6
+ metadata.gz: 85b70ad063ca34727e9838b78933231c7181b8d82cd3c12fd69a199da4af7d24655700147277a9dea7cab575f5d90b1007337a2bfbde24f087e573f8bd77c57b
7
+ data.tar.gz: dc25667e37ffd201c6000542e2f4fcba4f2f1466bd7f6167932322cb0fd40a9fbbfbb42033ed836f1db98f836b6cdd4e1ce345b362cf746b0ba86019e43d2631
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Release History
2
2
 
3
+ ## [1.6.0](https://www.github.com/googleapis/ruby-cloud-env/compare/google-cloud-env/v1.5.0...google-cloud-env/v1.6.0) (2022-03-21)
4
+
5
+
6
+ ### Features
7
+
8
+ * **deps:** update actions/setup-node action to v3 ([#27](https://www.github.com/googleapis/ruby-cloud-env/issues/27)) ([ffb9430](https://www.github.com/googleapis/ruby-cloud-env/commit/ffb9430e67bc4504d8c4f69203a0f911a90bff5a))
9
+
10
+ ### 1.5.0 (2021-03-08)
11
+
12
+ #### Features
13
+
14
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
15
+
16
+ ### 1.4.0 / 2020-10-12
17
+
18
+ #### Features
19
+
20
+ * Honor GCE_METADATA_HOST environment variable
21
+
3
22
  ### 1.3.3 / 2020-07-10
4
23
 
5
24
  #### Bug Fixes
data/CONTRIBUTING.md CHANGED
@@ -1,4 +1,4 @@
1
- # Contributing to Google Cloud hosting environment
1
+ # Contributing to Google Cloud Ruby Client
2
2
 
3
3
  1. **Sign one of the contributor license agreements below.**
4
4
  2. Fork the repo, develop and test your code changes.
@@ -6,105 +6,66 @@
6
6
 
7
7
  ## Contributor License Agreements
8
8
 
9
- Before we can accept your pull requests you'll need to sign a Contributor
10
- License Agreement (CLA):
9
+ Before we can accept your pull requests you'll need to sign a Contributor License Agreement (CLA):
11
10
 
12
- - **If you are an individual writing original source code** and **you own the
13
- intellectual property**, then you'll need to sign an [individual
14
- CLA](https://developers.google.com/open-source/cla/individual).
15
- - **If you work for a company that wants to allow you to contribute your work**,
16
- then you'll need to sign a [corporate
17
- CLA](https://developers.google.com/open-source/cla/corporate).
11
+ - **If you are an individual writing original source code** and **you own the intellectual property**, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual).
12
+ - **If you work for a company that wants to allow you to contribute your work**, then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate).
18
13
 
19
- You can sign these electronically (just scroll to the bottom). After that, we'll
20
- be able to accept your pull requests.
14
+ You can sign these electronically (just scroll to the bottom). After that, we'll be able to accept your pull requests.
21
15
 
22
16
  ## Setup
23
17
 
24
- In order to use the google-cloud-env console and run the project's tests,
25
- there is a small amount of setup:
18
+ In order to use the google-cloud-ruby console and run the project's tests, there is a
19
+ small amount of setup:
26
20
 
27
- 1. Install Ruby. google-cloud-env requires Ruby 2.4+. You may choose to
28
- manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
- [rbenv](https://github.com/rbenv/rbenv), or
30
- [chruby](https://github.com/postmodern/chruby).
21
+ 1. Install Ruby.
22
+ google-cloud-env requires Ruby 2.4+. You may choose to manage your Ruby and gem installations with [RVM](https://rvm.io/), [rbenv](https://github.com/rbenv/rbenv), or [chruby](https://github.com/postmodern/chruby).
31
23
 
32
- 2. Install [Bundler](http://bundler.io/).
24
+ 2. Install [Bundler](http://bundler.io/).
33
25
 
34
- ```sh
35
- $ gem install bundler
36
- ```
26
+ ```sh
27
+ $ gem install bundler
28
+ ```
37
29
 
38
- 3. Install the top-level project dependencies.
30
+ 3. Install the project dependencies.
39
31
 
40
- ```sh
41
- $ bundle install
42
- ```
32
+ ```sh
33
+ $ bundle install
34
+ ```
43
35
 
44
- 4. Install the hosting environment dependencies.
36
+ ## Tests
45
37
 
46
- ```sh
47
- $ cd google-cloud-env/
48
- $ bundle exec rake bundleupdate
49
- ```
38
+ All contributions should include tests that ensure the contributed code behaves as expected.
50
39
 
51
- ## hosting environment Tests
52
-
53
- Tests are very important part of google-cloud-env. All contributions
54
- should include tests that ensure the contributed code behaves as expected.
55
-
56
- To run the unit tests, documentation tests, and code style checks together for a
57
- package:
40
+ To run the tests and code style checks together:
58
41
 
59
42
  ``` sh
60
- $ cd google-cloud-env/
61
43
  $ bundle exec rake ci
62
44
  ```
63
45
 
64
- To run the command above, plus all acceptance tests, use `rake ci:acceptance` or
65
- its handy alias, `rake ci:a`.
66
-
67
- ### hosting environment Unit Tests
46
+ ### Unit Tests
68
47
 
48
+ The project uses the [minitest](https://github.com/seattlerb/minitest) library, including [specs](https://github.com/seattlerb/minitest#specs), [mocks](https://github.com/seattlerb/minitest#mocks) and [minitest-autotest](https://github.com/seattlerb/minitest-autotest).
69
49
 
70
- The project uses the [minitest](https://github.com/seattlerb/minitest) library,
71
- including [specs](https://github.com/seattlerb/minitest#specs),
72
- [mocks](https://github.com/seattlerb/minitest#mocks) and
73
- [minitest-autotest](https://github.com/seattlerb/minitest-autotest).
74
-
75
- To run the hosting environment unit tests:
50
+ To run the unit tests for a package:
76
51
 
77
52
  ``` sh
78
- $ cd google-cloud-env/
79
53
  $ bundle exec rake test
80
54
  ```
81
55
 
82
- ### hosting environment Documentation Tests
56
+ ### Coding Style
83
57
 
84
- The project tests the code examples in the gem's
85
- [YARD](https://github.com/lsegal/yard)-based documentation.
58
+ Please follow the established coding style in the library. The style is is largely based on [The Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide) with a few exceptions based on seattle-style:
86
59
 
87
- The example testing functions in a way that is very similar to unit testing, and
88
- in fact the library providing it,
89
- [yard-doctest](https://github.com/p0deje/yard-doctest), is based on the
90
- project's unit test library, [minitest](https://github.com/seattlerb/minitest).
60
+ * Avoid parenthesis when possible, including in method definitions.
61
+ * Always use double quotes strings. ([Option B](https://github.com/bbatsov/ruby-style-guide#strings))
91
62
 
92
- To run the hosting environment documentation tests:
63
+ You can check your code against these rules by running Rubocop like so:
93
64
 
94
- ``` sh
95
- $ cd google-cloud-env/
96
- $ bundle exec rake doctest
65
+ ```sh
66
+ $ bundle exec rake rubocop
97
67
  ```
98
68
 
99
- If you add, remove or modify documentation examples when working on a pull
100
- request, you may need to update the setup for the tests. The stubs and mocks
101
- required to run the tests are located in `support/doctest_helper.rb`. Please
102
- note that much of the setup is matched by the title of the
103
- [`@example`](http://www.rubydoc.info/gems/yard/file/docs/Tags.md#example) tag.
104
- If you alter an example's title, you may encounter breaking tests.
105
-
106
69
  ## Code of Conduct
107
70
 
108
- Please note that this project is released with a Contributor Code of Conduct. By
109
- participating in this project you agree to abide by its terms. See
110
- {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
71
+ Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See {file:CODE_OF_CONDUCT.md Code of Conduct} for more information.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  Apache License
2
2
  Version 2.0, January 2004
3
- https://www.apache.org/licenses/
3
+ http://www.apache.org/licenses/
4
4
 
5
5
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
6
 
@@ -192,7 +192,7 @@
192
192
  you may not use this file except in compliance with the License.
193
193
  You may obtain a copy of the License at
194
194
 
195
- https://www.apache.org/licenses/LICENSE-2.0
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
196
 
197
197
  Unless required by applicable law or agreed to in writing, software
198
198
  distributed under the License is distributed on an "AS IS" BASIS,
data/README.md CHANGED
@@ -7,11 +7,11 @@ apps running on Google Cloud Platform.
7
7
 
8
8
  ## Supported Ruby Versions
9
9
 
10
- This library is supported on Ruby 2.4+.
10
+ This library is supported on Ruby 2.5+.
11
11
 
12
12
  Google provides official support for Ruby versions that are actively supported
13
13
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or in
14
- security maintenance, and not end of life. Currently, this means Ruby 2.4 and
14
+ security maintenance, and not end of life. Currently, this means Ruby 2.5 and
15
15
  later. Older versions of Ruby _may_ still work, but are unsupported and not
16
16
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
17
17
  about the Ruby support schedule.
data/SECURITY.md ADDED
@@ -0,0 +1,7 @@
1
+ # Security Policy
2
+
3
+ To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4
+
5
+ The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6
+
7
+ We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  class Env
19
- VERSION = "1.3.3".freeze
19
+ VERSION = "1.6.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -82,6 +82,9 @@ module Google
82
82
  # well as mocking for testing.
83
83
  #
84
84
  # @param [Hash] env Mock environment variables.
85
+ # @param [String] host The hostname or IP address of the metadata server.
86
+ # Optional. If not specified, uses the `GCE_METADATA_HOST`,
87
+ # environment variable or falls back to `169.254.167.254`.
85
88
  # @param [Hash,false] metadata_cache The metadata cache. You may pass
86
89
  # a prepopuated cache, an empty cache (the default) or `false` to
87
90
  # disable the cache completely.
@@ -102,7 +105,7 @@ module Google
102
105
  # If specified, overrides the `request_timeout` and `open_timeout`
103
106
  # settings.
104
107
  #
105
- def initialize env: nil, connection: nil, metadata_cache: nil,
108
+ def initialize env: nil, host: nil, connection: nil, metadata_cache: nil,
106
109
  open_timeout: 0.1, request_timeout: 1.0,
107
110
  retry_count: 2, retry_interval: 0.1,
108
111
  retry_backoff_factor: 1.5, retry_max_interval: 0.5
@@ -114,7 +117,9 @@ module Google
114
117
  @retry_backoff_factor = retry_backoff_factor
115
118
  @retry_max_interval = retry_max_interval
116
119
  request_opts = { timeout: request_timeout, open_timeout: open_timeout }
117
- @connection = connection || ::Faraday.new(url: METADATA_HOST, request: request_opts)
120
+ host ||= @env["GCE_METADATA_HOST"] || METADATA_HOST
121
+ host = "http://#{host}" unless host.start_with? "http://"
122
+ @connection = connection || ::Faraday.new(url: host, request: request_opts)
118
123
  end
119
124
 
120
125
  ##
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.6.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: 2020-07-13 00:00:00.000000000 Z
11
+ date: 2022-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 0.17.3
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.0'
22
+ version: '3.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 0.17.3
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
32
+ version: '3.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: autotest-suffix
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 1.24.0
53
+ version: 1.25.1
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 1.24.0
60
+ version: 1.25.1
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: minitest
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -186,13 +186,18 @@ files:
186
186
  - CONTRIBUTING.md
187
187
  - LICENSE
188
188
  - README.md
189
+ - SECURITY.md
189
190
  - lib/google-cloud-env.rb
190
191
  - lib/google/cloud/env.rb
191
192
  - lib/google/cloud/env/version.rb
192
- homepage: https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-env
193
+ homepage: https://github.com/googleapis/ruby-cloud-env
193
194
  licenses:
194
195
  - Apache-2.0
195
- metadata: {}
196
+ metadata:
197
+ changelog_uri: https://googleapis.dev/ruby/google-cloud-env/v1.6.0/file.CHANGELOG.html
198
+ source_code_uri: https://github.com/googleapis/ruby-cloud-env
199
+ bug_tracker_uri: https://github.com/googleapis/ruby-cloud-env/issues
200
+ documentation_uri: https://googleapis.dev/ruby/google-cloud-env/v1.6.0
196
201
  post_install_message:
197
202
  rdoc_options: []
198
203
  require_paths:
@@ -201,14 +206,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
201
206
  requirements:
202
207
  - - ">="
203
208
  - !ruby/object:Gem::Version
204
- version: '2.4'
209
+ version: '2.5'
205
210
  required_rubygems_version: !ruby/object:Gem::Requirement
206
211
  requirements:
207
212
  - - ">="
208
213
  - !ruby/object:Gem::Version
209
214
  version: '0'
210
215
  requirements: []
211
- rubygems_version: 3.1.3
216
+ rubygems_version: 3.3.5
212
217
  signing_key:
213
218
  specification_version: 4
214
219
  summary: Google Cloud Platform hosting environment information.