gurney_client 2.0.0 → 2.0.1
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 +7 -0
- data/README.md +2 -2
- data/lib/gurney_client/api.rb +5 -1
- data/lib/gurney_client/cli.rb +5 -5
- data/lib/gurney_client/report.rb +1 -1
- data/lib/gurney_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ebd82677f2031c2ec6a369aa5937d94dfefd84564565cc99e7361b7d0f350395
|
|
4
|
+
data.tar.gz: 800a1f7c34353d1a9be0f78e08905abd56ec59403a9f95682d8ddeb07611ae7c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b102002c62bafd97f7ec84f423c7894b0d91852c3ff388bf2fbf9587702c971e53569579ef05a6703b9f488f9011e72f24063e6eeb5bb5edaa5a95decbca3037
|
|
7
|
+
data.tar.gz: dce37bfdebaa7d90644caf0b2bb232c300f250d1de342527ded2712cc8690dfbae8909d9c61021c7f548772f7fa895859c6bc4a9397708593d964e1cc4fd3955
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
+
## 2.0.1 (2026-12-01)
|
|
7
|
+
|
|
8
|
+
### Compatible changes
|
|
9
|
+
* Supports Ruby 3.0 again (2.0.0 needed 3.2).
|
|
10
|
+
* Credentials in `api_host` (`https://user:password@host`) are sent as basic auth, as gurney 1 did with `api_url`.
|
|
11
|
+
|
|
12
|
+
|
|
6
13
|
## 2.0.0 (2026-12-01)
|
|
7
14
|
|
|
8
15
|
### Breaking changes
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Gurney
|
|
2
2
|
|
|
3
|
-
Gurney reports the dependency files of a project to Ambulance, which parses them and tracks the dependencies' security advisories. It is published to RubyGems as `gurney_client` and has no dependencies besides Ruby (3.
|
|
3
|
+
Gurney reports the dependency files of a project to Ambulance, which parses them and tracks the dependencies' security advisories. It is published to RubyGems as `gurney_client` and has no dependencies besides Ruby (3.0 or later) and `git`.
|
|
4
4
|
|
|
5
5
|
## Configuration
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ Command line options take precedence over the file:
|
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
Usage: gurney [options]
|
|
26
|
-
--api-host HOST Address of Ambulance, like https://ambulance.example.com
|
|
26
|
+
--api-host HOST Address of Ambulance, like https://ambulance.example.com (credentials as https://user:password@host are sent as basic auth)
|
|
27
27
|
--api-token TOKEN The project's ingest token, sent in the X-AuthToken header
|
|
28
28
|
-c, --config FILE Config file to use (default: gurney.yml)
|
|
29
29
|
-h, --hook Run as a Git post-receive hook
|
data/lib/gurney_client/api.rb
CHANGED
|
@@ -39,9 +39,13 @@ module GurneyClient
|
|
|
39
39
|
nil
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
# Credentials in api_host ("https://user:password@host") are sent as basic auth, as gurney 1 did.
|
|
42
43
|
def post_http(uri, body, headers)
|
|
44
|
+
request = Net::HTTP::Post.new(uri.request_uri, headers)
|
|
45
|
+
request.basic_auth(URI::DEFAULT_PARSER.unescape(uri.user), URI::DEFAULT_PARSER.unescape(uri.password.to_s)) if uri.user
|
|
46
|
+
request.body = body
|
|
43
47
|
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https', open_timeout: 10, read_timeout: 60) do |http|
|
|
44
|
-
http.
|
|
48
|
+
http.request(request)
|
|
45
49
|
end
|
|
46
50
|
[response.code.to_i, response.body]
|
|
47
51
|
rescue SocketError, SystemCallError, Timeout::Error, OpenSSL::SSL::SSLError => e
|
data/lib/gurney_client/cli.rb
CHANGED
|
@@ -21,7 +21,7 @@ module GurneyClient
|
|
|
21
21
|
|
|
22
22
|
# Returns the exit status. A hook always exits with 0: the push has happened anyway.
|
|
23
23
|
def run
|
|
24
|
-
hook = @argv.
|
|
24
|
+
hook = @argv.include?('-h') || @argv.include?('--hook')
|
|
25
25
|
@options = parse_options
|
|
26
26
|
return 0 if @options[:help]
|
|
27
27
|
|
|
@@ -45,7 +45,7 @@ module GurneyClient
|
|
|
45
45
|
branch = repository.current_branch
|
|
46
46
|
raise Error, "The current branch (#{branch}) is not listed in the config." unless config.branches.include?(branch)
|
|
47
47
|
|
|
48
|
-
report(repository, config, branch
|
|
48
|
+
report(repository, config, branch: branch, revision: repository.revision, source: 'cli')
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def run_hook
|
|
@@ -58,7 +58,7 @@ module GurneyClient
|
|
|
58
58
|
next unless config.branches.include?(branch)
|
|
59
59
|
|
|
60
60
|
begin
|
|
61
|
-
report(repository, config, branch
|
|
61
|
+
report(repository, config, branch: branch, revision: revision, source: 'hook')
|
|
62
62
|
rescue ApiError => e
|
|
63
63
|
@stderr.puts "Gurney API error for #{branch}: #{e.message}"
|
|
64
64
|
end
|
|
@@ -77,7 +77,7 @@ module GurneyClient
|
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def report(repository, config, branch:, revision:, source:)
|
|
80
|
-
payload = Report.new(repository
|
|
80
|
+
payload = Report.new(repository: repository, config: config, environment: branch, revision: revision, source: source)
|
|
81
81
|
api = Api.new(host: config.api_host, token: config.api_token, transport: @transport)
|
|
82
82
|
message = api.post_report(project_id: config.project_id, report: payload.to_h)
|
|
83
83
|
@stdout.puts "Gurney: #{message || "reported #{payload.files.size} files for #{branch}"}"
|
|
@@ -87,7 +87,7 @@ module GurneyClient
|
|
|
87
87
|
options = { config_file: 'gurney.yml', hook: false }
|
|
88
88
|
parser = OptionParser.new do |opts|
|
|
89
89
|
opts.banner = 'Usage: gurney [options]'
|
|
90
|
-
opts.on('--api-host HOST', 'Address of Ambulance, like https://ambulance.example.com') { |value| options[:api_host] = value }
|
|
90
|
+
opts.on('--api-host HOST', 'Address of Ambulance, like https://ambulance.example.com (https://user:password@host for basic auth)') { |value| options[:api_host] = value }
|
|
91
91
|
opts.on('--api-token TOKEN', "The project's ingest token, sent in the X-AuthToken header") { |value| options[:api_token] = value }
|
|
92
92
|
opts.on('-c', '--config FILE', 'Config file to use (default: gurney.yml)') { |value| options[:config_file] = value }
|
|
93
93
|
opts.on('-h', '--hook', 'Run as a Git post-receive hook') { options[:hook] = true }
|
data/lib/gurney_client/report.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gurney_client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Schaflitzl
|
|
@@ -41,7 +41,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
41
41
|
requirements:
|
|
42
42
|
- - ">="
|
|
43
43
|
- !ruby/object:Gem::Version
|
|
44
|
-
version: '3.
|
|
44
|
+
version: '3.0'
|
|
45
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
47
|
- - ">="
|