freno-client 0.3.0 → 0.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad998991ce9e268582944b14bcad1f95b3f256ae
4
- data.tar.gz: 858a1e5eab82112e90e44559cc64f14a57eef065
3
+ metadata.gz: fe5c746dd4f13a74f1d005ef02525980186175a2
4
+ data.tar.gz: b77184aa9a5e0a98116e6444d61405cf2f0a5cc2
5
5
  SHA512:
6
- metadata.gz: d550f31be8158f7ec916d3b76475c8ec15e04e6039cc34473049ad276097397df72c1139bfd421175b1792eba997763fffadcd9023d4860eef6096f23040d024
7
- data.tar.gz: c6c3826a47449958d2030fc8f8904eeba9cee2aeb72890fa6803d0c287542c13814df6934b0b47d03cb418544cef7a856623591700b4d149ca5ba4df0edd261b
6
+ metadata.gz: e969f338ff696426546ea5c1906f8665b77ba8088aa1ed7146b8e9e4d701e42b779b8834ca92060e0c4bd322e9c7ccbaf4405bea7cde6abe0a7177a91c12fd24
7
+ data.tar.gz: 7a2f7982b3027e94a4bf02b340a8cf538f7f26cfd8cbd1916591de9083afec49ccd4a7752634ca85bdf29805ddb7855da01eade6d3cd254c8a21e0182eec77a8
@@ -0,0 +1,317 @@
1
+ AllCops:
2
+ DisabledByDefault: true
3
+
4
+ Bundler/DuplicatedGem:
5
+ Enabled: true
6
+
7
+ Bundler/OrderedGems:
8
+ Enabled: true
9
+
10
+ Lint/BlockAlignment:
11
+ Enabled: true
12
+
13
+ Lint/CircularArgumentReference:
14
+ Enabled: true
15
+
16
+ Lint/ConditionPosition:
17
+ Enabled: true
18
+
19
+ Lint/Debugger:
20
+ Enabled: true
21
+
22
+ Lint/DefEndAlignment:
23
+ Enabled: true
24
+
25
+ Lint/DeprecatedClassMethods:
26
+ Enabled: true
27
+
28
+ Lint/DuplicateMethods:
29
+ Enabled: true
30
+
31
+ Lint/DuplicatedKey:
32
+ Enabled: true
33
+
34
+ Lint/EachWithObjectArgument:
35
+ Enabled: true
36
+
37
+ Lint/ElseLayout:
38
+ Enabled: true
39
+
40
+ Lint/EmptyEnsure:
41
+ Enabled: true
42
+
43
+ Lint/EndInMethod:
44
+ Enabled: true
45
+
46
+ Lint/EmptyInterpolation:
47
+ Enabled: true
48
+
49
+ Lint/EndAlignment:
50
+ Enabled: false
51
+
52
+ Lint/EnsureReturn:
53
+ Enabled: true
54
+
55
+ Lint/FloatOutOfRange:
56
+ Enabled: true
57
+
58
+ Lint/FormatParameterMismatch:
59
+ Enabled: true
60
+
61
+ Style/HashSyntax:
62
+ Enabled: true
63
+ EnforcedStyle: ruby19
64
+
65
+ Lint/InvalidCharacterLiteral:
66
+ Enabled: true
67
+
68
+ Lint/LiteralInCondition:
69
+ Enabled: true
70
+
71
+ Lint/LiteralInInterpolation:
72
+ Enabled: true
73
+
74
+ Lint/Loop:
75
+ Enabled: true
76
+
77
+ Lint/NextWithoutAccumulator:
78
+ Enabled: true
79
+
80
+ Lint/RandOne:
81
+ Enabled: true
82
+
83
+ Lint/RequireParentheses:
84
+ Enabled: true
85
+
86
+ Lint/RescueException:
87
+ Enabled: true
88
+
89
+ Lint/StringConversionInInterpolation:
90
+ Enabled: true
91
+
92
+ Lint/UnderscorePrefixedVariableName:
93
+ Enabled: true
94
+
95
+ Lint/UnneededDisable:
96
+ Enabled: true
97
+
98
+ Lint/UnneededSplatExpansion:
99
+ Enabled: true
100
+
101
+ Lint/UnreachableCode:
102
+ Enabled: true
103
+
104
+ Lint/UselessComparison:
105
+ Enabled: true
106
+
107
+ Lint/UselessSetterCall:
108
+ Enabled: true
109
+
110
+ Lint/Void:
111
+ Enabled: true
112
+
113
+ Metrics/AbcSize:
114
+ Enabled: false
115
+
116
+ Metrics/BlockLength:
117
+ Enabled: false
118
+
119
+ Metrics/BlockNesting:
120
+ Enabled: false
121
+
122
+ Metrics/ClassLength:
123
+ Enabled: false
124
+
125
+ Metrics/CyclomaticComplexity:
126
+ Enabled: false
127
+
128
+ Metrics/LineLength:
129
+ Enabled: false
130
+
131
+ Metrics/MethodLength:
132
+ Enabled: false
133
+
134
+ Metrics/ModuleLength:
135
+ Enabled: false
136
+
137
+ Metrics/ParameterLists:
138
+ Enabled: false
139
+
140
+ Metrics/PerceivedComplexity:
141
+ Enabled: false
142
+
143
+ Performance/CaseWhenSplat:
144
+ Enabled: false
145
+
146
+ Performance/Count:
147
+ Enabled: true
148
+
149
+ Performance/Detect:
150
+ Enabled: true
151
+
152
+ Performance/DoubleStartEndWith:
153
+ Enabled: true
154
+
155
+ Performance/EndWith:
156
+ Enabled: true
157
+
158
+ Performance/FlatMap:
159
+ Enabled: true
160
+
161
+ Performance/HashEachMethods:
162
+ Enabled: true
163
+
164
+ Performance/LstripRstrip:
165
+ Enabled: true
166
+
167
+ Performance/RangeInclude:
168
+ Enabled: false
169
+
170
+ Performance/RedundantMatch:
171
+ Enabled: false
172
+
173
+ Performance/RedundantMerge:
174
+ Enabled: true
175
+ MaxKeyValuePairs: 1
176
+
177
+ Performance/RedundantSortBy:
178
+ Enabled: true
179
+
180
+ Performance/ReverseEach:
181
+ Enabled: true
182
+
183
+ Performance/Sample:
184
+ Enabled: true
185
+
186
+ Performance/Size:
187
+ Enabled: true
188
+
189
+ Performance/StartWith:
190
+ Enabled: true
191
+
192
+ Security/Eval:
193
+ Enabled: true
194
+
195
+ Style/ArrayJoin:
196
+ Enabled: true
197
+
198
+ Style/AsciiIdentifiers:
199
+ Enabled: true
200
+
201
+ Style/BeginBlock:
202
+ Enabled: true
203
+
204
+ Style/BlockComments:
205
+ Enabled: true
206
+
207
+ Layout/BlockEndNewline:
208
+ Enabled: true
209
+
210
+ Style/CaseEquality:
211
+ Enabled: true
212
+
213
+ Style/CharacterLiteral:
214
+ Enabled: true
215
+
216
+ Style/ClassAndModuleCamelCase:
217
+ Enabled: true
218
+
219
+ Style/ClassMethods:
220
+ Enabled: true
221
+
222
+ Style/Copyright:
223
+ Enabled: false
224
+
225
+ Style/DefWithParentheses:
226
+ Enabled: true
227
+
228
+ Style/EndBlock:
229
+ Enabled: true
230
+
231
+ Layout/EndOfLine:
232
+ Enabled: true
233
+
234
+ Style/FileName:
235
+ Enabled: true
236
+
237
+ Style/FlipFlop:
238
+ Enabled: true
239
+
240
+ Style/For:
241
+ Enabled: true
242
+
243
+ Layout/InitialIndentation:
244
+ Enabled: true
245
+
246
+ Style/LambdaCall:
247
+ Enabled: true
248
+
249
+ Style/MethodCallWithoutArgsParentheses:
250
+ Enabled: true
251
+
252
+ Style/MethodDefParentheses:
253
+ Enabled: true
254
+
255
+ Style/MethodName:
256
+ Enabled: true
257
+
258
+ Style/MultilineIfThen:
259
+ Enabled: true
260
+
261
+ Style/NilComparison:
262
+ Enabled: true
263
+
264
+ Style/Not:
265
+ Enabled: true
266
+
267
+ Style/OneLineConditional:
268
+ Enabled: true
269
+
270
+ Layout/SpaceAfterMethodName:
271
+ Enabled: true
272
+
273
+ Layout/SpaceAfterColon:
274
+ Enabled: true
275
+
276
+ Layout/SpaceAfterComma:
277
+ Enabled: true
278
+
279
+ Layout/SpaceAfterNot:
280
+ Enabled: true
281
+
282
+ Layout/SpaceAfterSemicolon:
283
+ Enabled: true
284
+
285
+ Layout/SpaceAroundBlockParameters:
286
+ Enabled: true
287
+
288
+ Layout/SpaceAroundEqualsInParameterDefault:
289
+ Enabled: true
290
+
291
+ Layout/SpaceInsideArrayPercentLiteral:
292
+ Enabled: true
293
+
294
+ Layout/SpaceInsideBrackets:
295
+ Enabled: true
296
+
297
+ Layout/SpaceInsideParens:
298
+ Enabled: true
299
+
300
+ Layout/SpaceInsideRangeLiteral:
301
+ Enabled: true
302
+
303
+ Style/StabbyLambdaParentheses:
304
+ Enabled: true
305
+
306
+ Style/StringLiterals:
307
+ Enabled: true
308
+ EnforcedStyle: double_quotes
309
+
310
+ Layout/Tab:
311
+ Enabled: true
312
+
313
+ Layout/TrailingBlankLines:
314
+ Enabled: true
315
+
316
+ Layout/TrailingWhitespace:
317
+ Enabled: true
@@ -1,5 +1,16 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.1
4
+ - 2.1
5
+ - 2.2
6
+ - 2.3
7
+ - 2.4
8
+ - ruby-head
9
+ matrix:
10
+ allow_failures:
11
+ - rvm: ruby-head
12
+ fast_finish: true
5
13
  before_install: gem install bundler -v 1.14.6
14
+ script:
15
+ - bundle exec script/cibuild
16
+ - bundle exec script/cibuild-lint
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ group :test do
6
+ gem "rubocop", require: false
7
+ end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Freno::Client
1
+ # Freno Client [![Build Status](https://travis-ci.org/github/freno-client.svg)](https://travis-ci.org/github/freno-client)
2
2
 
3
3
  A ruby client for [Freno](https://github.com/github/freno): the cooperative, highly available throttler service.
4
4
 
@@ -29,7 +29,7 @@ Or install it yourself as:
29
29
  To start using the client, give it a faraday instance pointing to Freno's base URL.
30
30
 
31
31
  ```ruby
32
- require 'freno/client'
32
+ require "freno/client"
33
33
 
34
34
  FRENO_URL = "http://freno.domain.com:8111"
35
35
  faraday = Faraday.new(FRENO_URL)
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require "rake/testtask"
4
4
  Rake::TestTask.new(:test) do |t|
5
5
  t.libs << "test"
6
6
  t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
@@ -1,6 +1,6 @@
1
1
  # -- encoding: utf-8 --
2
- $:.unshift File.expand_path('../lib', __FILE__)
3
- require_relative 'lib/freno/client/version'
2
+ $:.unshift File.expand_path("../lib", __FILE__)
3
+ require_relative "lib/freno/client/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "freno-client"
@@ -16,10 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.license = "MIT"
17
17
  spec.required_ruby_version = ">= 2.0.0"
18
18
 
19
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
19
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
20
20
  # to allow pushing to a single host or delete this section to allow pushing to any host.
21
21
  if spec.respond_to?(:metadata)
22
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
22
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
23
23
  else
24
24
  raise "RubyGems 2.0 or newer is required to protect against " \
25
25
  "public gem pushes."
@@ -40,7 +40,7 @@ module Freno
40
40
  yield self if block_given?
41
41
  end
42
42
 
43
- # Provides an interface to Freno's check request
43
+ # Provides an interface to Freno"s check request
44
44
  #
45
45
  # See https://github.com/github/freno/blob/master/doc/http.md#check-request
46
46
  #
@@ -50,7 +50,7 @@ module Freno
50
50
  perform :check, app: app, store_type: store_type, store_name: store_name, options: options
51
51
  end
52
52
 
53
- # Provides an interface to Freno's check-read request
53
+ # Provides an interface to Freno"s check-read request
54
54
  #
55
55
  # See https://github.com/github/freno/blob/master/doc/http.md#specialized-requests
56
56
  #
@@ -72,7 +72,7 @@ module Freno
72
72
  end
73
73
 
74
74
 
75
- # Determines whether Freno considers it's OK to write to masters
75
+ # Determines whether Freno considers it"s OK to write to masters
76
76
  #
77
77
  # Returns true or false.
78
78
  #
@@ -80,7 +80,7 @@ module Freno
80
80
  check(app: app, store_type: store_type, store_name: store_name, options: options).ok?
81
81
  end
82
82
 
83
- # Determines whether it's OK to read from replicas as replication delay is below
83
+ # Determines whether it"s OK to read from replicas as replication delay is below
84
84
  # the given threshold.
85
85
  #
86
86
  # Returns true or false.
@@ -0,0 +1,3 @@
1
+ module Freno
2
+ Error = Class.new(StandardError)
3
+ end
@@ -1,5 +1,6 @@
1
- require_relative 'preconditions'
2
- require_relative 'result'
1
+ require_relative "preconditions"
2
+ require_relative "result"
3
+ require_relative "errors"
3
4
 
4
5
  module Freno
5
6
  class Client
@@ -24,14 +25,13 @@ module Freno
24
25
  end
25
26
 
26
27
  def perform
27
- begin
28
- response = request(verb, path)
29
- rescue Faraday::TimeoutError => ex
30
- raise ex if raise_on_timeout
31
- Result.from_meaning(:request_timeout)
32
- else
33
- process_response(response)
34
- end
28
+ response = request(verb, path)
29
+ process_response(response)
30
+ rescue Faraday::TimeoutError => ex
31
+ raise Freno::Error.new(ex) if raise_on_timeout
32
+ Result.from_meaning(:request_timeout)
33
+ rescue => ex
34
+ raise Freno::Error.new(ex)
35
35
  end
36
36
 
37
37
  protected
@@ -1,4 +1,4 @@
1
- require_relative '../request'
1
+ require_relative "../request"
2
2
 
3
3
  module Freno
4
4
  class Client
@@ -1,4 +1,4 @@
1
- require_relative '../request'
1
+ require_relative "../request"
2
2
 
3
3
  module Freno
4
4
  class Client
@@ -1,4 +1,4 @@
1
- require_relative '../request'
1
+ require_relative "../request"
2
2
 
3
3
  module Freno
4
4
  class Client
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  module Freno
4
4
  class Client
@@ -1,5 +1,5 @@
1
1
  module Freno
2
2
  class Client
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ set -eu
4
+
5
+ test -d "/usr/share/rbenv/shims" && {
6
+ export PATH="/usr/share/rbenv/shims:$PATH"
7
+ export RBENV_VERSION="2.4.1"
8
+ }
9
+
10
+ set -x
11
+ git log -n 1 HEAD | cat
12
+ ruby -v
13
+ bundle -v
14
+ set +x
15
+
16
+ git clean -fd
17
+
18
+ script/bootstrap
19
+ bundle exec rubocop
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freno-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Fernández
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,6 +77,7 @@ extensions: []
77
77
  extra_rdoc_files: []
78
78
  files:
79
79
  - ".gitignore"
80
+ - ".rubocop.yml"
80
81
  - ".travis.yml"
81
82
  - CODE_OF_CONDUCT.md
82
83
  - CONTRIBUTING.md
@@ -88,6 +89,7 @@ files:
88
89
  - bin/setup
89
90
  - freno-client.gemspec
90
91
  - lib/freno/client.rb
92
+ - lib/freno/client/errors.rb
91
93
  - lib/freno/client/preconditions.rb
92
94
  - lib/freno/client/request.rb
93
95
  - lib/freno/client/requests/check.rb
@@ -97,6 +99,7 @@ files:
97
99
  - lib/freno/client/version.rb
98
100
  - script/bootstrap
99
101
  - script/cibuild
102
+ - script/cibuild-lint
100
103
  - script/console
101
104
  homepage: https://github.com/github/freno-client
102
105
  licenses: