right_support 2.8.34 → 2.8.35

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.8.34
1
+ 2.8.35
@@ -21,6 +21,7 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
 
23
23
  require 'logger'
24
+ require 'rack'
24
25
 
25
26
  module RightSupport::Rack
26
27
 
@@ -72,7 +73,7 @@ module RightSupport::Rack
72
73
  if env['sinatra.error'] && !env['sinatra.error.handled']
73
74
  log_exception(logger, env['sinatra.error'])
74
75
  end
75
- log_request_end(logger, status, header, began_at) if enabled
76
+ log_request_end(logger, status, header, body, began_at) if enabled
76
77
 
77
78
  return [status, header, body]
78
79
  rescue Exception => e
@@ -147,22 +148,29 @@ module RightSupport::Rack
147
148
  # @param [Time] began_at time of the Rack request beginning
148
149
  #
149
150
  # @return [TrueClass] always true
150
- def log_request_end(logger, status, headers, began_at)
151
+ def log_request_end(logger, status, headers, body, began_at)
151
152
  duration = (Time.now - began_at) * 1000
152
153
 
153
- content_length = if headers['Content-Length']
154
- headers['Content-Length'].to_s
154
+ # Downcase keys in the headers Hash for case-insensitive comparisons
155
+ safe_headers = Hash[*headers.map {|k,v| [k.downcase, v]}.flatten]
156
+
157
+ content_length = if safe_headers['content-length']
158
+ safe_headers['content-length']
155
159
  else
156
- '-'
160
+ if body.is_a?(Array)
161
+ body.reduce(0) {|accum, e| accum += e.bytesize}
162
+ else
163
+ body.bytesize
164
+ end
157
165
  end
158
166
 
159
167
  params = [
160
168
  duration,
161
- status,
162
- content_length,
169
+ "#{status} #{Rack::Utils::HTTP_STATUS_CODES[status]}",
170
+ content_length.to_s,
163
171
  ]
164
172
 
165
- logger.info %Q{Completed in %dms | %d | %s bytes} % params
173
+ logger.info %Q{Completed in %dms | %s | %s bytes} % params
166
174
  end
167
175
 
168
176
  # Log exception
@@ -2,16 +2,14 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: right_support 2.8.34 ruby lib
6
5
 
7
6
  Gem::Specification.new do |s|
8
7
  s.name = "right_support"
9
- s.version = "2.8.34"
8
+ s.version = "2.8.35"
10
9
 
11
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
11
  s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
14
- s.date = "2014-11-04"
12
+ s.date = "2014-11-12"
15
13
  s.description = "A toolkit of useful, reusable foundation code created by RightScale."
16
14
  s.email = "support@rightscale.com"
17
15
  s.extra_rdoc_files = [
@@ -148,11 +146,12 @@ Gem::Specification.new do |s|
148
146
  ]
149
147
  s.homepage = "https://github.com/rightscale/right_support"
150
148
  s.licenses = ["MIT"]
151
- s.rubygems_version = "2.2.0"
149
+ s.require_paths = ["lib"]
150
+ s.rubygems_version = "1.8.23"
152
151
  s.summary = "Reusable foundation code."
153
152
 
154
153
  if s.respond_to? :specification_version then
155
- s.specification_version = 4
154
+ s.specification_version = 3
156
155
 
157
156
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
158
157
  s.add_development_dependency(%q<rake>, ["~> 10.0"])
@@ -276,7 +276,7 @@ describe RightSupport::Net::RequestBalancer do
276
276
  end
277
277
 
278
278
  it 'performs an initial resolution' do
279
- @balancer.instance_variable_get("@resolved_at").to_f.should be_close(Time.now.to_f, 1.0)
279
+ @balancer.instance_variable_get("@resolved_at").to_f.should be_within(1.0).of(Time.now.to_f)
280
280
  @balancer.instance_variable_get("@ips").should include('1.1.1.1')
281
281
  @balancer.instance_variable_get("@ips").should include('2.2.2.2')
282
282
  @balancer.instance_variable_get("@ips").should include('3.3.3.3')
@@ -29,10 +29,12 @@ describe RightSupport::Stats do
29
29
  before(:all) do
30
30
  @helpers = RightSupport::Stats
31
31
  @original_recent_size = RightSupport::Stats::Activity::RECENT_SIZE
32
+ RightSupport::Stats::Activity.send(:remove_const, :RECENT_SIZE) # Silence warning
32
33
  RightSupport::Stats::Activity.const_set(:RECENT_SIZE, 10)
33
34
  end
34
35
 
35
36
  after(:all) do
37
+ RightSupport::Stats::Activity.send(:remove_const, :RECENT_SIZE) # Silence warning
36
38
  RightSupport::Stats::Activity.const_set(:RECENT_SIZE, @original_recent_size)
37
39
  end
38
40
 
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RightSupport::Validation::OpenSSL do
4
- GOOD_PEM_PUB_RSA = read_fixture('good_pub_rsa.pem')
5
- GOOD_PEM_PRIV_RSA = read_fixture('good_priv_rsa.pem')
6
- GOOD_ENCRYPTED_PEM_PRIV_RSA = read_fixture('encrypted_priv_rsa.pem')
7
- GOOD_SSH_PUB_RSA = read_fixture('good_pub_rsa.ssh')
8
- GOOD_SSH_PUB_DSA = read_fixture('good_pub_dsa.ssh')
9
- GOOD_PEM_PRIV_DSA = read_fixture('good_priv_dsa.pem')
4
+ GOOD_PEM_PUB_RSA = read_fixture('good_pub_rsa.pem') unless const_defined?('GOOD_PEM_PUB_RSA')
5
+ GOOD_PEM_PRIV_RSA = read_fixture('good_priv_rsa.pem') unless const_defined?('GOOD_PEM_PRIV_RSA')
6
+ GOOD_ENCRYPTED_PEM_PRIV_RSA = read_fixture('encrypted_priv_rsa.pem') unless const_defined?('GOOD_ENCRYPTED_PEM_PRIV_RSA')
7
+ GOOD_SSH_PUB_RSA = read_fixture('good_pub_rsa.ssh') unless const_defined?('GOOD_SSH_PUB_RSA')
8
+ GOOD_SSH_PUB_DSA = read_fixture('good_pub_dsa.ssh') unless const_defined?('GOOD_SSH_PUB_DSA')
9
+ GOOD_PEM_PRIV_DSA = read_fixture('good_priv_dsa.pem') unless const_defined?('GOOD_PEM_PRIV_DSA')
10
10
 
11
11
  context :pem_public_key? do
12
12
  it 'recognizes valid keys' do
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe RightSupport::Validation::SSH do
4
- GOOD_PEM_PRIV_RSA = read_fixture('good_priv_rsa.pem')
5
- GOOD_ENCRYPTED_PEM_PRIV_RSA = read_fixture('encrypted_priv_rsa.pem')
6
- GOOD_SSH_PUB_RSA = read_fixture('good_pub_rsa.ssh')
7
- GOOD_SSH_PUB_DSA = read_fixture('good_pub_dsa.ssh')
8
- GOOD_PEM_PRIV_DSA = read_fixture('good_priv_dsa.pem')
4
+ GOOD_PEM_PRIV_RSA = read_fixture('good_priv_rsa.pem') unless const_defined?('GOOD_PEM_PUB_RSA')
5
+ GOOD_ENCRYPTED_PEM_PRIV_RSA = read_fixture('encrypted_priv_rsa.pem') unless const_defined?('GOOD_ENCRYPTED_PEM_PRIV_RSA')
6
+ GOOD_SSH_PUB_RSA = read_fixture('good_pub_rsa.ssh') unless const_defined?('GOOD_SSH_PUB_RSA')
7
+ GOOD_SSH_PUB_DSA = read_fixture('good_pub_dsa.ssh') unless const_defined?('GOOD_SSH_PUB_DSA')
8
+ GOOD_PEM_PRIV_DSA = read_fixture('good_priv_dsa.pem') unless const_defined?('GOOD_PEM_PRIV_DSA')
9
9
 
10
10
  context :ssh_private_key? do
11
11
  it 'recognizes valid keys' do
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.34
4
+ version: 2.8.35
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Tony Spataro
@@ -13,76 +14,86 @@ authors:
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
- date: 2014-11-04 00:00:00.000000000 Z
17
+ date: 2014-11-12 00:00:00.000000000 Z
17
18
  dependencies:
18
19
  - !ruby/object:Gem::Dependency
19
20
  name: rake
20
21
  requirement: !ruby/object:Gem::Requirement
22
+ none: false
21
23
  requirements:
22
- - - "~>"
24
+ - - ~>
23
25
  - !ruby/object:Gem::Version
24
26
  version: '10.0'
25
27
  type: :development
26
28
  prerelease: false
27
29
  version_requirements: !ruby/object:Gem::Requirement
30
+ none: false
28
31
  requirements:
29
- - - "~>"
32
+ - - ~>
30
33
  - !ruby/object:Gem::Version
31
34
  version: '10.0'
32
35
  - !ruby/object:Gem::Dependency
33
36
  name: jeweler
34
37
  requirement: !ruby/object:Gem::Requirement
38
+ none: false
35
39
  requirements:
36
- - - "~>"
40
+ - - ~>
37
41
  - !ruby/object:Gem::Version
38
42
  version: '2.0'
39
43
  type: :development
40
44
  prerelease: false
41
45
  version_requirements: !ruby/object:Gem::Requirement
46
+ none: false
42
47
  requirements:
43
- - - "~>"
48
+ - - ~>
44
49
  - !ruby/object:Gem::Version
45
50
  version: '2.0'
46
51
  - !ruby/object:Gem::Dependency
47
52
  name: ruby-debug
48
53
  requirement: !ruby/object:Gem::Requirement
54
+ none: false
49
55
  requirements:
50
- - - ">="
56
+ - - ! '>='
51
57
  - !ruby/object:Gem::Version
52
58
  version: '0'
53
59
  type: :development
54
60
  prerelease: false
55
61
  version_requirements: !ruby/object:Gem::Requirement
62
+ none: false
56
63
  requirements:
57
- - - ">="
64
+ - - ! '>='
58
65
  - !ruby/object:Gem::Version
59
66
  version: '0'
60
67
  - !ruby/object:Gem::Dependency
61
68
  name: pry
62
69
  requirement: !ruby/object:Gem::Requirement
70
+ none: false
63
71
  requirements:
64
- - - ">="
72
+ - - ! '>='
65
73
  - !ruby/object:Gem::Version
66
74
  version: '0'
67
75
  type: :development
68
76
  prerelease: false
69
77
  version_requirements: !ruby/object:Gem::Requirement
78
+ none: false
70
79
  requirements:
71
- - - ">="
80
+ - - ! '>='
72
81
  - !ruby/object:Gem::Version
73
82
  version: '0'
74
83
  - !ruby/object:Gem::Dependency
75
84
  name: pry-byebug
76
85
  requirement: !ruby/object:Gem::Requirement
86
+ none: false
77
87
  requirements:
78
- - - ">="
88
+ - - ! '>='
79
89
  - !ruby/object:Gem::Version
80
90
  version: '0'
81
91
  type: :development
82
92
  prerelease: false
83
93
  version_requirements: !ruby/object:Gem::Requirement
94
+ none: false
84
95
  requirements:
85
- - - ">="
96
+ - - ! '>='
86
97
  - !ruby/object:Gem::Version
87
98
  version: '0'
88
99
  description: A toolkit of useful, reusable foundation code created by RightScale.
@@ -93,10 +104,10 @@ extra_rdoc_files:
93
104
  - LICENSE
94
105
  - README.md
95
106
  files:
96
- - ".coveralls.yml"
97
- - ".rspec"
98
- - ".simplecov"
99
- - ".travis.yml"
107
+ - .coveralls.yml
108
+ - .rspec
109
+ - .simplecov
110
+ - .travis.yml
100
111
  - CHANGELOG.rdoc
101
112
  - Gemfile
102
113
  - Gemfile.lock
@@ -222,25 +233,29 @@ files:
222
233
  homepage: https://github.com/rightscale/right_support
223
234
  licenses:
224
235
  - MIT
225
- metadata: {}
226
236
  post_install_message:
227
237
  rdoc_options: []
228
238
  require_paths:
229
239
  - lib
230
240
  required_ruby_version: !ruby/object:Gem::Requirement
241
+ none: false
231
242
  requirements:
232
- - - ">="
243
+ - - ! '>='
233
244
  - !ruby/object:Gem::Version
234
245
  version: '0'
246
+ segments:
247
+ - 0
248
+ hash: -578187549211322829
235
249
  required_rubygems_version: !ruby/object:Gem::Requirement
250
+ none: false
236
251
  requirements:
237
- - - ">="
252
+ - - ! '>='
238
253
  - !ruby/object:Gem::Version
239
254
  version: '0'
240
255
  requirements: []
241
256
  rubyforge_project:
242
- rubygems_version: 2.2.0
257
+ rubygems_version: 1.8.23
243
258
  signing_key:
244
- specification_version: 4
259
+ specification_version: 3
245
260
  summary: Reusable foundation code.
246
261
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 2b33df20f4893e7f64ab22c00fd808086fc89095
4
- data.tar.gz: 122a7c34399879bd12fcc742849516be36273e5a
5
- SHA512:
6
- metadata.gz: 584cc527971f1c292a2e2e6b7a52dcd1c1012c1ce28bced75664d7e1ee92428e1e9655ad013930a14416380354b75aa30df9ee21e8efd48a6180eb54a60eacc7
7
- data.tar.gz: f27150448cc7b88daf33f25739137ec158c55a14c98393ca056d5c8ab8aa5ed8bd3b24a7f75687ac4cef52e191c8a09ba837a1f8f37664904baa411a5252b8b0