macmillan-utils 1.0.23 → 1.0.27

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: 42d0f124530989afb7adc2d6f009fc4a0c597e35
4
- data.tar.gz: 3ea996731cb2a41a629a776027eb32c9f6184d3d
3
+ metadata.gz: b703afeccf56e22b3f681671bb722878c25d376f
4
+ data.tar.gz: d39c938dc927bfc8d5a00b80245b9943e68d7806
5
5
  SHA512:
6
- metadata.gz: 2d6b78bd871148f5373b17fa53887abcd9045e41d5ab9de1784d0d1c9dbe55056650a8ae57bb0981dcd7caddd2e2be7cf6bef8d54e11d448839ac4e190d28a28
7
- data.tar.gz: 4bdbe4cd33a6a30308bcca4750c3f594136f80f28956f665fe840f800a477f1a2f28e5d2f32ca9d738638b8c093fe3e2390a2f3ad37325273b3424f79d563fb9
6
+ metadata.gz: 80725cfc5166a1324e513fa5b075fb91571f9531703a2c528c594fcd3f46e6993e410017eaece527c98d9fc88a40bc562df6fbed252ebbb6e18116b1f1dc648e
7
+ data.tar.gz: 388e50726a9d51363978d391a4162bfd58d631589f6dbef3a6c8116fb57644e96ea2b7190cacdc17693739e37966d40fa3b02d986d7fe41ee6b17e2b11c4c508
data/.hound.yml CHANGED
@@ -5,7 +5,7 @@ Metrics/LineLength:
5
5
  Style/Documentation:
6
6
  Enabled: false
7
7
 
8
- Style/SingleSpaceBeforeFirstArg:
8
+ Style/SpaceBeforeFirstArg:
9
9
  Enabled: false
10
10
 
11
11
  Style/BracesAroundHashParameters:
data/.rubocop.yml CHANGED
@@ -5,7 +5,7 @@ Metrics/LineLength:
5
5
  Style/Documentation:
6
6
  Enabled: false
7
7
 
8
- Style/SingleSpaceBeforeFirstArg:
8
+ Style/SpaceBeforeFirstArg:
9
9
  Enabled: false
10
10
 
11
11
  Style/BracesAroundHashParameters:
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
- - CODECLIMATE_REPO_TOKEN=2175628fb41494d45b50b6938600a53c130e1f7ac3b81b072bb71e91073a5e4a
14
- addons:
15
- code_climate:
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/nature/macmillan-utils.svg?branch=log-formatter" alt="Build Status" />}[https://travis-ci.org/nature/macmillan-utils]
6
- {<img src="https://codeclimate.com/github/nature/macmillan-utils.png" alt="CodeClimate Rating" />}[https://codeclimate.com/github/nature/macmillan-utils]
7
- {<img src="https://codeclimate.com/github/nature/macmillan-utils/coverage.png" alt="Test Coverage" />}[https://codeclimate.com/github/nature/macmillan-utils]
8
- {<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT Licensed" />}[https://github.com/nature/macmillan-utils/blob/master/LICENSE]
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/nature/macmillan-utils/fork )
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])/){ $1.upcase }
23
+ string = string.gsub(/(?:#{s}+)([a-z])/) { Regexp.last_match(1).upcase }
24
24
  end
25
25
 
26
- string.gsub(/(\A|\s)([a-z])/){ $1 + $2.upcase }
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)
@@ -37,7 +37,7 @@ module Macmillan
37
37
  when ::String
38
38
  msg
39
39
  when ::Exception
40
- "#{ msg.message } (#{ msg.class })\n" << (msg.backtrace || []).join("\n")
40
+ "#{msg.message} (#{msg.class})\n" << (msg.backtrace || []).join("\n")
41
41
  else
42
42
  msg.inspect
43
43
  end
@@ -15,7 +15,7 @@ module Macmillan
15
15
  'user.uuid'
16
16
  end
17
17
 
18
- def initialize(app, opts={})
18
+ def initialize(app, opts = {})
19
19
  @app = app
20
20
  @user_env_key = opts[:user_env_key] || 'current_user'
21
21
  @user_id_method = opts[:user_id_method] || 'user_id'
@@ -28,7 +28,7 @@ def check_rubocop_and_hound
28
28
  file.print latest_rubocop_conf
29
29
  end
30
30
 
31
- fail RuntimeError, '...'
31
+ raise '...'
32
32
  end
33
33
  end
34
34
 
@@ -31,7 +31,7 @@ module Macmillan
31
31
  found_path = search_file if File.exist?(search_file)
32
32
  end
33
33
 
34
- fail 'cannot find application.yml' if found_path.nil?
34
+ raise 'cannot find application.yml' if found_path.nil?
35
35
 
36
36
  found_path
37
37
  end
@@ -12,12 +12,12 @@ module Macmillan
12
12
  return result.value unless result.is_a?(KeyNotFound)
13
13
  end
14
14
 
15
- fail KeyNotFoundError.new("Cannot find a settings value for #{key}")
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
- alias_method :[], :lookup
20
- alias_method :fetch, :lookup
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
- fail ArgumentError, 'You must supply a StatsD client' unless opts[:client]
40
+ raise ArgumentError, 'You must supply a StatsD client' unless opts[:client]
41
41
 
42
42
  @app = app
43
43
  @client = opts[:client]
@@ -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 = ['Macmillan Science and Education (New Publsihing Platforms)']
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 (Macmillan Science and Education) use in our Ruby applications.'
10
- spec.homepage = 'https://github.com/nature/macmillan-utils'
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)
@@ -47,7 +47,7 @@ describe Macmillan::Utils::Logger::Formatter do
47
47
 
48
48
  context 'when the log message is NOT a string or exception' do
49
49
  it 'retuns object.inspect' do
50
- ex = Array.new
50
+ ex = []
51
51
  expect(ex).to receive(:inspect).once
52
52
 
53
53
  logger.info ex
@@ -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
- ->(env) do
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) { ->(env) { raise } }
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.23
4
+ version: 1.0.27
5
5
  platform: ruby
6
6
  authors:
7
- - Macmillan Science and Education (New Publsihing Platforms)
7
+ - Springer Nature
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-14 00:00:00.000000000 Z
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/nature/macmillan-utils
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 (Macmillan Science and Education) use
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