Skip to content

Commit af8900e

Browse files
authored
Merge pull request #22 from zhulik/master
Update dependencies, drop unsupported ruby versions, create rubocop todo
2 parents b7a909e + 25af938 commit af8900e

File tree

6 files changed

+130
-30
lines changed

6 files changed

+130
-30
lines changed

.rubocop.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
inherit_from: .rubocop_todo.yml
2+
13
AllCops:
4+
TargetRubyVersion: 3.0
25
Exclude:
36
- lib/prometheus/api_client/version.rb
7+
NewCops: disable
8+
SuggestExtensions: false
49

5-
AlignHash:
10+
Layout/HashAlignment:
611
EnforcedHashRocketStyle: table
712

813
Style/TrailingCommaInArguments:
914
EnforcedStyleForMultiline: comma
1015

11-
Style/TrailingCommaInLiteral:
16+
Style/TrailingCommaInArrayLiteral:
17+
EnforcedStyleForMultiline: comma
18+
19+
Style/TrailingCommaInHashLiteral:
1220
EnforcedStyleForMultiline: comma
1321

1422
Metrics/AbcSize:
@@ -21,6 +29,6 @@ Metrics/BlockLength:
2129
Exclude:
2230
- 'spec/**/*.rb'
2331

24-
Metrics/LineLength:
32+
Layout/LineLength:
2533
Exclude:
2634
- 'spec/**/*.rb'

.rubocop_todo.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2023-02-20 17:39:35 UTC using RuboCop version 1.45.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 1
10+
# This cop supports safe autocorrection (--autocorrect).
11+
Layout/EmptyLineAfterMagicComment:
12+
Exclude:
13+
- 'prometheus-api-client.gemspec'
14+
15+
# Offense count: 8
16+
# This cop supports safe autocorrection (--autocorrect).
17+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
18+
# SupportedHashRocketStyles: key, separator, table
19+
# SupportedColonStyles: key, separator, table
20+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
21+
Layout/HashAlignment:
22+
Exclude:
23+
- 'examples/get_metrics.rb'
24+
- 'examples/low_level.rb'
25+
- 'spec/prometheus/api_client/client_spec.rb'
26+
27+
# Offense count: 1
28+
# This cop supports safe autocorrection (--autocorrect).
29+
# Configuration parameters: PreferredName.
30+
Naming/RescuedExceptionsVariableName:
31+
Exclude:
32+
- 'lib/prometheus/api_client/client.rb'
33+
34+
# Offense count: 8
35+
# This cop supports safe autocorrection (--autocorrect).
36+
Style/Encoding:
37+
Exclude:
38+
- 'Rakefile'
39+
- 'lib/prometheus.rb'
40+
- 'lib/prometheus/api_client.rb'
41+
- 'lib/prometheus/api_client/client.rb'
42+
- 'prometheus-api-client.gemspec'
43+
- 'spec/prometheus/api_client/client_spec.rb'
44+
- 'spec/prometheus/api_client_spec.rb'
45+
- 'spec/spec_helper.rb'
46+
47+
# Offense count: 1
48+
# This cop supports safe autocorrection (--autocorrect).
49+
Style/ExpandPathArguments:
50+
Exclude:
51+
- 'prometheus-api-client.gemspec'
52+
53+
# Offense count: 13
54+
# This cop supports unsafe autocorrection (--autocorrect-all).
55+
# Configuration parameters: EnforcedStyle.
56+
# SupportedStyles: always, always_true, never
57+
Style/FrozenStringLiteralComment:
58+
Exclude:
59+
- 'Gemfile'
60+
- 'Rakefile'
61+
- 'examples/authentication_proxy.rb'
62+
- 'examples/get_labels.rb'
63+
- 'examples/get_metrics.rb'
64+
- 'examples/low_level.rb'
65+
- 'lib/prometheus.rb'
66+
- 'lib/prometheus/api_client.rb'
67+
- 'lib/prometheus/api_client/client.rb'
68+
- 'prometheus-api-client.gemspec'
69+
- 'spec/prometheus/api_client/client_spec.rb'
70+
- 'spec/prometheus/api_client_spec.rb'
71+
- 'spec/spec_helper.rb'
72+
73+
# Offense count: 1
74+
# This cop supports safe autocorrection (--autocorrect).
75+
# Configuration parameters: PreferredDelimiters.
76+
Style/PercentLiteralDelimiters:
77+
Exclude:
78+
- 'prometheus-api-client.gemspec'
79+
80+
# Offense count: 1
81+
# This cop supports safe autocorrection (--autocorrect).
82+
Style/RedundantCondition:
83+
Exclude:
84+
- 'lib/prometheus/api_client/client.rb'
85+
86+
# Offense count: 1
87+
# This cop supports unsafe autocorrection (--autocorrect-all).
88+
# Configuration parameters: Mode.
89+
Style/StringConcatenation:
90+
Exclude:
91+
- 'lib/prometheus/api_client/client.rb'
92+
93+
# Offense count: 1
94+
# This cop supports safe autocorrection (--autocorrect).
95+
# Configuration parameters: MinSize.
96+
# SupportedStyles: percent, brackets
97+
Style/SymbolArray:
98+
EnforcedStyle: brackets

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ before_install:
55
- |
66
if [[ "$(ruby -e 'puts RUBY_VERSION')" != 1.* ]]; then gem update --system; fi
77
rvm:
8-
- 2.3.3
9-
- 2.4.0
10-
- 2.5.3
11-
- 2.6.0
12-
- jruby-9.1.9.0
8+
- 3.0.5
9+
- 3.1.3
10+
- 3.2.1
11+
- jruby-9.4.1.0

Gemfile

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,13 @@ source 'https://rubygems.org'
22

33
gemspec
44

5-
def ruby_version?(constraint)
6-
Gem::Dependency.new('', constraint).match?('', RUBY_VERSION)
7-
end
8-
95
gem 'faraday'
106

117
group :test do
128
gem 'coveralls'
13-
gem 'json', '< 2.0' if ruby_version?('< 2.0')
14-
gem 'rack', '< 2.0' if ruby_version?('< 2.2.2')
15-
gem 'rack-test'
169
gem 'rake'
1710
gem 'rspec'
18-
gem 'rubocop', '< 0.42'
19-
gem 'term-ansicolor', '< 1.4' if ruby_version?('< 2.0')
20-
gem 'tins', '< 1.7' if ruby_version?('< 2.0')
11+
gem 'rubocop'
2112
gem 'vcr'
2213
gem 'webmock'
2314
end

lib/prometheus/api_client/client.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require 'json'
44
require 'faraday'
5+
require 'faraday/net_http'
56

67
module Prometheus
78
# Client is a ruby implementation for a Prometheus compatible api_client.
@@ -38,7 +39,9 @@ def initialize(options = {})
3839

3940
@client = Faraday.new(
4041
faraday_options(options),
41-
)
42+
) do |f|
43+
f.adapter :net_http
44+
end
4245
end
4346

4447
# Evaluates an instant query at a single point in time:

prometheus-api-client.gemspec

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
33
require 'prometheus/api_client/version'
44

55
Gem::Specification.new do |s|
6-
s.name = 'prometheus-api-client'
7-
s.version = Prometheus::ApiClient::VERSION
8-
s.summary = 'A suite of reading metrics stored on ' \
9-
'a Prometheus server.'
10-
s.authors = ['Yaacov Zamir']
11-
s.email = ['kobi.zamir@gmail.com']
12-
s.homepage = 'https://github.com/yaacov/prometheus_api_client_ruby'
13-
s.license = 'Apache-2.0'
6+
s.name = 'prometheus-api-client'
7+
s.version = Prometheus::ApiClient::VERSION
8+
s.summary = 'A suite of reading metrics stored on ' \
9+
'a Prometheus server.'
10+
s.authors = ['Yaacov Zamir']
11+
s.email = ['kobi.zamir@gmail.com']
12+
s.homepage = 'https://github.com/yaacov/prometheus_api_client_ruby'
13+
s.license = 'Apache-2.0'
14+
s.required_ruby_version = '>= 3.0.0'
1415

15-
s.files = %w(README.md) + Dir.glob('{lib/**/*}')
16-
s.require_paths = ['lib']
16+
s.files = %w(README.md) + Dir.glob('{lib/**/*}')
17+
s.require_paths = ['lib']
1718

18-
s.add_dependency 'faraday', '>= 0.9', '< 2.0.0'
19+
s.add_dependency 'faraday', '>= 2.0.0', '< 3.0.0'
1920
end

0 commit comments

Comments
 (0)