macmillan-utils 1.0.23 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +1 -1
- data/.rubocop.yml +1 -1
- data/.travis.yml +12 -4
- data/README.rdoc +5 -5
- data/lib/macmillan/utils/helper/string_conversion_helper.rb +4 -4
- data/lib/macmillan/utils/logger/formatter.rb +1 -1
- data/lib/macmillan/utils/middleware/uuid.rb +1 -1
- data/lib/macmillan/utils/rspec/rspec_defaults.rb +1 -1
- data/lib/macmillan/utils/settings/app_yaml_backend.rb +1 -1
- data/lib/macmillan/utils/settings/lookup.rb +3 -3
- data/lib/macmillan/utils/statsd_middleware.rb +1 -1
- data/macmillan-utils.gemspec +4 -4
- data/spec/lib/macmillan/utils/helper/string_conversion_helper_spec.rb +3 -3
- data/spec/lib/macmillan/utils/logger/formatter_spec.rb +1 -1
- data/spec/lib/macmillan/utils/statsd_middleware_spec.rb +2 -2
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b703afeccf56e22b3f681671bb722878c25d376f
|
4
|
+
data.tar.gz: d39c938dc927bfc8d5a00b80245b9943e68d7806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80725cfc5166a1324e513fa5b075fb91571f9531703a2c528c594fcd3f46e6993e410017eaece527c98d9fc88a40bc562df6fbed252ebbb6e18116b1f1dc648e
|
7
|
+
data.tar.gz: 388e50726a9d51363978d391a4162bfd58d631589f6dbef3a6c8116fb57644e96ea2b7190cacdc17693739e37966d40fa3b02d986d7fe41ee6b17e2b11c4c508
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
sudo: false
|
2
|
+
|
1
3
|
language: ruby
|
2
4
|
cache: bundler
|
3
5
|
rvm:
|
@@ -5,12 +7,18 @@ rvm:
|
|
5
7
|
- 2.0
|
6
8
|
- 2.1
|
7
9
|
- 2.2
|
10
|
+
- 2.3.0
|
8
11
|
- jruby-19mode
|
9
12
|
- rbx-2
|
13
|
+
|
14
|
+
# Ensure we don't build for *every* commit (doesn't apply to PR builds)
|
15
|
+
branches:
|
16
|
+
only:
|
17
|
+
- master
|
18
|
+
|
10
19
|
env:
|
11
20
|
global:
|
12
21
|
- USE_SIMPLECOV=true
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
repo_token: 2175628fb41494d45b50b6938600a53c130e1f7ac3b81b072bb71e91073a5e4a
|
22
|
+
|
23
|
+
before_install:
|
24
|
+
- gem update bundler
|
data/README.rdoc
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
|
3
3
|
A collection of useful patterns we use in our Ruby applications.
|
4
4
|
|
5
|
-
{<img src="https://travis-ci.org/
|
6
|
-
{<img src="https://codeclimate.com/github/
|
7
|
-
{<img src="https://codeclimate.com/github/
|
8
|
-
{<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT Licensed" />}[https://github.com/
|
5
|
+
{<img src="https://travis-ci.org/springernature/macmillan-utils.svg?branch=log-formatter" alt="Build Status" />}[https://travis-ci.org/springernature/macmillan-utils]
|
6
|
+
{<img src="https://codeclimate.com/github/springernature/macmillan-utils.png" alt="CodeClimate Rating" />}[https://codeclimate.com/github/springernature/macmillan-utils]
|
7
|
+
{<img src="https://codeclimate.com/github/springernature/macmillan-utils/coverage.png" alt="Test Coverage" />}[https://codeclimate.com/github/springernature/macmillan-utils]
|
8
|
+
{<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT Licensed" />}[https://github.com/springernature/macmillan-utils/blob/master/LICENSE]
|
9
9
|
|
10
10
|
== Installation
|
11
11
|
|
@@ -106,7 +106,7 @@ Add the following to the top of your `env.rb`:
|
|
106
106
|
|
107
107
|
== Contributing
|
108
108
|
|
109
|
-
1. Fork it ( https://github.com/
|
109
|
+
1. Fork it ( https://github.com/springernature/macmillan-utils/fork )
|
110
110
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
111
111
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
112
112
|
4. Push to the branch (`git push origin my-new-feature`)
|
@@ -7,8 +7,8 @@ module Macmillan
|
|
7
7
|
# shamelessly ripped out of the 'facets' gem
|
8
8
|
def snakecase_string(string)
|
9
9
|
string
|
10
|
-
.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
11
|
-
.gsub(/([a-z\d])([A-Z])/,'\1_\2')
|
10
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
11
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
12
12
|
.tr('-', '_')
|
13
13
|
.gsub(/\s/, '_')
|
14
14
|
.gsub(/__+/, '_')
|
@@ -20,10 +20,10 @@ module Macmillan
|
|
20
20
|
separators = ['_', '\s']
|
21
21
|
|
22
22
|
separators.each do |s|
|
23
|
-
string = string.gsub(/(?:#{s}+)([a-z])/){
|
23
|
+
string = string.gsub(/(?:#{s}+)([a-z])/) { Regexp.last_match(1).upcase }
|
24
24
|
end
|
25
25
|
|
26
|
-
string.gsub(/(\A|\s)([a-z])/){
|
26
|
+
string.gsub(/(\A|\s)([a-z])/) { Regexp.last_match(1) + Regexp.last_match(2).upcase }
|
27
27
|
end
|
28
28
|
|
29
29
|
def camelcase_to_snakecase_symbol(string)
|
@@ -12,12 +12,12 @@ module Macmillan
|
|
12
12
|
return result.value unless result.is_a?(KeyNotFound)
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
raise KeyNotFoundError.new("Cannot find a settings value for #{key}")
|
16
16
|
end
|
17
17
|
|
18
18
|
# Backwards compatibility: in the past this has been used like a Hash
|
19
|
-
|
20
|
-
|
19
|
+
alias [] lookup
|
20
|
+
alias fetch lookup
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -37,7 +37,7 @@ module Macmillan
|
|
37
37
|
INCREMENTS = 'statsd.increments'.freeze
|
38
38
|
|
39
39
|
def initialize(app, opts = {})
|
40
|
-
|
40
|
+
raise ArgumentError, 'You must supply a StatsD client' unless opts[:client]
|
41
41
|
|
42
42
|
@app = app
|
43
43
|
@client = opts[:client]
|
data/macmillan-utils.gemspec
CHANGED
@@ -3,11 +3,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'macmillan-utils'
|
6
|
-
spec.version = "1.0.#{ENV['BUILD_NUMBER'] || 'dev'}"
|
7
|
-
spec.authors = ['
|
6
|
+
spec.version = "1.0.#{ENV['TRAVIS_BUILD_NUMBER'] || ENV['BUILD_NUMBER'] || 'dev'}"
|
7
|
+
spec.authors = ['Springer Nature']
|
8
8
|
spec.email = ['npp-developers@macmillan.com']
|
9
|
-
spec.summary = 'A collection of useful patterns we (
|
10
|
-
spec.homepage = 'https://github.com/
|
9
|
+
spec.summary = 'A collection of useful patterns we (Springer Nature) use in our Ruby applications.'
|
10
|
+
spec.homepage = 'https://github.com/springernature/macmillan-utils'
|
11
11
|
spec.license = 'MIT'
|
12
12
|
|
13
13
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -18,8 +18,8 @@ describe Macmillan::Utils::Helper::StringConversionHelper do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
describe '#upper_camelcase_string' do
|
21
|
-
let(:spacey_string) {'I feel spaced out'}
|
22
|
-
let(:underscorey_string) {'i_feel_under_scored'}
|
21
|
+
let(:spacey_string) { 'I feel spaced out' }
|
22
|
+
let(:underscorey_string) { 'i_feel_under_scored' }
|
23
23
|
|
24
24
|
it 'converts a string containing spaces to upper camelcase' do
|
25
25
|
expect(upper_camelcase_string(spacey_string)).to eq('IFeelSpacedOut')
|
@@ -31,7 +31,7 @@ describe Macmillan::Utils::Helper::StringConversionHelper do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
describe '#camelcase_to_snakecase_symbol' do
|
34
|
-
let(:camel) {'LookAtThisHumpyOldCamel'}
|
34
|
+
let(:camel) { 'LookAtThisHumpyOldCamel' }
|
35
35
|
|
36
36
|
it 'converts a camelcase string to a snakecase symbol equivalent' do
|
37
37
|
expect(camelcase_to_snakecase_symbol(camel)).to eq(:look_at_this_humpy_old_camel)
|
@@ -24,7 +24,7 @@ describe Macmillan::Utils::StatsdMiddleware do
|
|
24
24
|
|
25
25
|
context 'when extra metrics have been pushed into the env' do
|
26
26
|
let(:app) do
|
27
|
-
|
27
|
+
lambda do |env|
|
28
28
|
env['statsd.timers'] << 'foo.bar'
|
29
29
|
env['statsd.increments'] << 'woo.waa'
|
30
30
|
|
@@ -41,7 +41,7 @@ describe Macmillan::Utils::StatsdMiddleware do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
context 'upon error' do
|
44
|
-
let(:app) { ->(
|
44
|
+
let(:app) { ->(_env) { raise } }
|
45
45
|
|
46
46
|
it 'sends an exception increment to statsd and raises the error' do
|
47
47
|
expect { subject.call(request.env) }.to raise_error(RuntimeError)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macmillan-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Springer Nature
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -251,7 +251,7 @@ files:
|
|
251
251
|
- spec/lib/macmillan/utils/statsd_decorator_spec.rb
|
252
252
|
- spec/lib/macmillan/utils/statsd_middleware_spec.rb
|
253
253
|
- spec/spec_helper.rb
|
254
|
-
homepage: https://github.com/
|
254
|
+
homepage: https://github.com/springernature/macmillan-utils
|
255
255
|
licenses:
|
256
256
|
- MIT
|
257
257
|
metadata: {}
|
@@ -274,8 +274,7 @@ rubyforge_project:
|
|
274
274
|
rubygems_version: 2.4.5
|
275
275
|
signing_key:
|
276
276
|
specification_version: 4
|
277
|
-
summary: A collection of useful patterns we (
|
278
|
-
in our Ruby applications.
|
277
|
+
summary: A collection of useful patterns we (Springer Nature) use in our Ruby applications.
|
279
278
|
test_files:
|
280
279
|
- spec/fixtures/config/application.yml
|
281
280
|
- spec/lib/macmillan/utils/helper/hash_key_helper_spec.rb
|