heartcheck-resque 0.0.1 → 0.0.2

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: f848101f29129c14dae99377b88eb1d1f3724aef
4
- data.tar.gz: 7bbd327a7f40c41474e83f715b4baa2f7f41b72a
3
+ metadata.gz: 0453bb7009f774195c59c9527a2139569f9cd8f7
4
+ data.tar.gz: 39141561116747a4faecb580cbecce5d750ebb4f
5
5
  SHA512:
6
- metadata.gz: 2b34d45593638cd19b3f03eca26701e9c31734386a6e7599e2529a2f74410b882e8fc2712dfc9916e0669747d5be3a6fd0f4f2b494471baa315523d5d0195a4d
7
- data.tar.gz: eb06e4031524c4040edf227c659a8e214af6cfce922162ae58c0b0c6004c98a87fd719953d49c4a16745fb9892288c6a1f2f6994290b8ea55016a5d18c6904ef
6
+ metadata.gz: d069dd5c57a53ed234f8ad0182de9e63e61e1101f9832fc2a5a33b9bffdf3cfa6681915a80bcaf8c5712c055824781c7e02335105b0d8d7e5ba6d5e9fe76c5af
7
+ data.tar.gz: 7d5545c840c74c5602c873cd516b08bd40b329fe031418ed4cb92edeb48c8088cda153388b2a178da7e11a436c516f544343a5c97eeb128e837ea1682138d765
data/.gitignore CHANGED
@@ -13,3 +13,4 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  /vendor/bundle
16
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
File without changes
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ services:
3
+ - redis-server
4
+ before_install: gem install bundler -v 1.10.6
5
+ install: bundle install -j 4 --retry 3
6
+ script:
7
+ - bin/rspec
8
+
9
+ matrix:
10
+ include:
11
+ - rvm: "1.9.3"
12
+ gemfile: Gemfile-old-ruby
13
+ - rvm: "2.0.0"
14
+ - rvm: "2.1.7"
15
+ - rvm: "2.2.4"
16
+ - rvm: "2.3.0"
17
+ - rvm: "2.4.0"
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://geminabox.locaweb.com.br'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in heartcheck-resque.gemspec
4
4
  gemspec
data/Gemfile-old-ruby ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rack', '~> 1.6.8'
4
+
5
+ # Specify your gem's dependencies in heartcheck-resque.gemspec
6
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Rafael Lima
1
+ Copyright (c) 2015 Locaweb
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # Heartcheck::Resque
2
2
 
3
3
  [![Build Status](https://travis-ci.org/locaweb/heartcheck-resque.svg)](https://travis-ci.org/locaweb/heartcheck-resque)
4
+ [![Code Climate](https://codeclimate.com/github/locaweb/heartcheck-resque/badges/gpa.svg)](https://codeclimate.com/github/locaweb/heartcheck-resque)
4
5
 
5
- A plugin to check resque connection with heartcheck
6
+ ##A plugin to check resque connection and error amount with [heartcheck](https://github.com/locaweb/heartcheck).
6
7
 
7
8
  ## Installation
8
9
 
9
10
  Add this line to your application's Gemfile:
10
11
 
11
12
  ```ruby
12
- gem 'heartcheck-resque'
13
+ gem 'heartcheck/resque'
13
14
  ```
14
15
 
15
16
  And then execute:
@@ -22,16 +23,21 @@ Or install it yourself as:
22
23
 
23
24
  ## Usage
24
25
 
25
- You can add a check to resque when configure the heartcheck
26
+ You can check any resque connection that there's in your app.
26
27
 
27
28
  ```ruby
28
29
  Heartcheck.setup do |config|
29
30
  config.add :resque do |c|
30
- c.name = 'redis'
31
+ c.add_service(failures_limit: 10)
31
32
  end
32
33
  end
33
34
  ```
34
35
 
36
+ ### Check Heartcheck example [here](https://github.com/locaweb/heartcheck/blob/master/lib/heartcheck/generators/templates/config.rb)
37
+
38
+ ## License
39
+ * [MIT License](https://github.com/locaweb/heartcheck-resque/blob/master/LICENSE.txt)
40
+
35
41
  ## Contributing
36
42
 
37
43
  1. Fork it ( https://github.com/locaweb/heartcheck-resque/fork )
data/Rakefile CHANGED
@@ -1,2 +1 @@
1
- require "bundler/gem_tasks"
2
-
1
+ require 'bundler/gem_tasks'
data/bin/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'heartcheck/resque'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require 'pry'
10
+ Pry.start
data/bin/rspec ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
11
+ '../../Gemfile',
12
+ Pathname.new(__FILE__).realpath
13
+ )
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rubocop' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path(
11
+ '../../Gemfile',
12
+ Pathname.new(__FILE__).realpath
13
+ )
14
+
15
+ require 'rubygems'
16
+ require 'bundler/setup'
17
+
18
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ set -euo pipefail
4
+ IFS=$'\n\t'
5
+
6
+ gem install bundler -v 1.10.6 --conservative
7
+ bundle install -j 4 --retry 3
@@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'heartcheck/resque/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "heartcheck-resque"
7
+ spec.name = 'heartcheck-resque'
8
8
  spec.version = Heartcheck::Resque::VERSION
9
- spec.authors = ["Locaweb"]
10
- spec.email = ["desenvolvedores@locaweb.com.br"]
9
+ spec.authors = ['Locaweb']
10
+ spec.email = ['desenvolvedores@locaweb.com.br']
11
11
  spec.summary = 'A resque failures checker'
12
12
  spec.description = 'Plugin to check resque failures'
13
- spec.homepage = "http://developer.locaweb.com.br"
14
- spec.license = "MIT"
13
+ spec.homepage = 'http://developer.locaweb.com.br'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(/^exe/) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(/^(test|spec|features)/)
20
+ spec.require_paths = ['lib']
20
21
 
21
- spec.add_development_dependency "bundler", "~> 1.7"
22
- spec.add_development_dependency 'rspec', '~> 3.1.0', '>= 3.1.0'
22
+ spec.add_development_dependency 'rspec', '~> 3.4.0'
23
23
  spec.add_development_dependency 'rubocop', '~> 0.27.0', '>= 0.27.1'
24
24
  spec.add_development_dependency 'pry-nav', '~> 0.2.0', '>= 0.2.4'
25
25
 
26
- spec.add_dependency 'heartcheck', '~> 1.0.0', '>= 1.0.0'
26
+ spec.add_dependency 'heartcheck', '~> 1.0', '>= 1.0.0'
27
27
  spec.add_dependency 'resque', '~> 1.0'
28
28
  end
@@ -1,5 +1,5 @@
1
1
  module Heartcheck
2
2
  module Resque
3
- VERSION = "0.0.1"
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
@@ -1,16 +1,20 @@
1
- require 'spec_helper'
2
-
3
1
  describe Heartcheck::Checks::Resque do
2
+ subject(:check) { described_class.new.tap { |c| c.add_service(opts) } }
3
+
4
4
  let(:opts) { { failures_limit: 0 } }
5
- subject { described_class.new.tap { |c| c.add_service(opts) } }
6
5
 
7
6
  describe '#validate' do
8
- context 'with errors' do
7
+ subject(:validate!) { check.validate }
8
+
9
+ let(:errors) { -> { check.instance_variable_get(:@errors) } }
10
+
11
+ context 'with any error on Resque\'s failed jobs' do
9
12
  before { allow(Resque::Failure).to receive(:count).and_return(2) }
10
13
 
11
14
  it 'sets @error' do
12
- subject.validate
13
- expect(subject.instance_variable_get(:@errors)).to eq(['Resque failed! 2 failures'])
15
+ expect { validate! }.to change(&errors)
16
+ .from([])
17
+ .to(['Resque failed! 2 failures'])
14
18
  end
15
19
  end
16
20
 
@@ -18,8 +22,20 @@ describe Heartcheck::Checks::Resque do
18
22
  before { expect(Resque::Failure).to receive(:count).and_return(0) }
19
23
 
20
24
  it 'has no errors' do
21
- subject.validate
22
- expect(subject.instance_variable_get(:@errors)).to be_empty
25
+ expect { validate! }.to_not change(&errors).from([])
26
+ end
27
+ end
28
+
29
+
30
+ context 'with an unexpected error' do
31
+ before do
32
+ allow(Resque::Failure).to receive(:count).and_raise('AnError')
33
+ end
34
+
35
+ it do
36
+ expect { validate! }.to change(&errors)
37
+ .from([])
38
+ .to(['Resque failed! AnError'])
23
39
  end
24
40
  end
25
41
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
1
2
  require 'heartcheck/resque'
2
3
  require 'pry-nav'
3
4
 
metadata CHANGED
@@ -1,49 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heartcheck-resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Locaweb
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2017-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.7'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.7'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rspec
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: 3.1.0
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 3.1.0
19
+ version: 3.4.0
37
20
  type: :development
38
21
  prerelease: false
39
22
  version_requirements: !ruby/object:Gem::Requirement
40
23
  requirements:
41
24
  - - "~>"
42
25
  - !ruby/object:Gem::Version
43
- version: 3.1.0
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 3.1.0
26
+ version: 3.4.0
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: rubocop
49
29
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +70,7 @@ dependencies:
90
70
  requirements:
91
71
  - - "~>"
92
72
  - !ruby/object:Gem::Version
93
- version: 1.0.0
73
+ version: '1.0'
94
74
  - - ">="
95
75
  - !ruby/object:Gem::Version
96
76
  version: 1.0.0
@@ -100,7 +80,7 @@ dependencies:
100
80
  requirements:
101
81
  - - "~>"
102
82
  - !ruby/object:Gem::Version
103
- version: 1.0.0
83
+ version: '1.0'
104
84
  - - ">="
105
85
  - !ruby/object:Gem::Version
106
86
  version: 1.0.0
@@ -126,11 +106,18 @@ extensions: []
126
106
  extra_rdoc_files: []
127
107
  files:
128
108
  - ".gitignore"
129
- - ".ruby-version"
109
+ - ".rspec"
110
+ - ".ruby-version.sample"
111
+ - ".travis.yml"
130
112
  - Gemfile
113
+ - Gemfile-old-ruby
131
114
  - LICENSE.txt
132
115
  - README.md
133
116
  - Rakefile
117
+ - bin/console
118
+ - bin/rspec
119
+ - bin/rubocop
120
+ - bin/setup
134
121
  - heartcheck-resque.gemspec
135
122
  - lib/heartcheck/checks/resque.rb
136
123
  - lib/heartcheck/resque.rb
@@ -157,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
144
  version: '0'
158
145
  requirements: []
159
146
  rubyforge_project:
160
- rubygems_version: 2.2.0
147
+ rubygems_version: 2.5.2
161
148
  signing_key:
162
149
  specification_version: 4
163
150
  summary: A resque failures checker