sidekiq-reset_statistics 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5619fdb46cfb1820c15c0b524ba349c883514324
4
+ data.tar.gz: eaf5bab3bcf0e681183e0a713972938ee5d73f47
5
+ SHA512:
6
+ metadata.gz: f3cd75d7f2d6e71d48a8a563597c4b5bbecaca8e7e8e1c23535e4f2d7ad471da9707a48273590e75b7b86555e5d53de49dbdf2c85d4a92a2a50bad856595a725
7
+ data.tar.gz: fc5e09b8f32f1cda49e224d2adef152b67cb4295095dad2959bf8050235a2aaa1cc2e2b6b7593c3331f7d80ddc9f22f75f4920b3622c8402ed9c52d80448b21d
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ coverage
2
+ rdoc
3
+ doc
4
+ .vagrant
5
+ .yardoc
6
+ .bundle
7
+ pkg
8
+ Gemfile.lock
9
+ *.rdb
10
+ .ruby-version
11
+ .ruby-gemset
12
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format nested
3
+ --order random
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ ## 1.0.0 (2013-09-12)
4
+
5
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 David Czarnecki
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # sidekiq-reset_statistics
2
+
3
+ Adds a tab to your Sidekiq dashboard to allow you to reset Sidekiq statistics.
4
+
5
+ ## Installation
6
+
7
+ Add the following in your application's `Gemfile`
8
+
9
+ ```ruby
10
+ gem 'sidekiq-reset_statistics'
11
+ ```
12
+
13
+ ## Contributing to sidekiq-reset_statistics
14
+
15
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
16
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
17
+ * Fork the project
18
+ * Start a feature/bugfix branch
19
+ * Commit and push until you are happy with your contribution
20
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
22
+
23
+ ## Copyright
24
+
25
+ Copyright (c) 2013 David Czarnecki. See LICENSE.txt for further details.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = 'spec/**/*_spec.rb'
7
+ spec.rspec_opts = ['--backtrace']
8
+ # spec.ruby_opts = ['-w']
9
+ end
10
+
11
+ task :default => :spec
@@ -0,0 +1,11 @@
1
+ require 'sidekiq/web'
2
+ require 'sidekiq-reset_statistics/version'
3
+ require 'sidekiq-reset_statistics/web'
4
+
5
+ Sidekiq::Web.register Sidekiq::ResetStatistics::Web
6
+ Sidekiq::Web.tabs["Reset Statistics"] = "reset-statistics"
7
+
8
+ module Sidekiq
9
+ module ResetStatistics
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Sidekiq
2
+ module ResetStatistics
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ module Sidekiq
2
+ module ResetStatistics
3
+ module Web
4
+ def self.registered(app)
5
+ app.get "/reset-statistics" do
6
+ web_dir = File.expand_path("../../../web", __FILE__)
7
+ view_path = File.join(web_dir, "views", "reset_statistics.erb")
8
+ template = File.read(view_path)
9
+ render :erb, template
10
+ end
11
+
12
+ app.post "/reset-statistics" do
13
+ Sidekiq::Stats.new.reset
14
+ redirect root_path
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,27 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ require 'sidekiq-reset_statistics/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sidekiq-reset_statistics"
7
+ s.version = Sidekiq::ResetStatistics::VERSION
8
+ s.authors = ["David Czarnecki"]
9
+ s.email = ["me@davidczarnecki.com"]
10
+ s.homepage = "https://github.com/czarneckid/sidekiq-reset_statistics"
11
+ s.summary = %q{Adds a tab to your Sidekiq dashboard to allow you to reset Sidekiq statistics}
12
+ s.description = %q{Adds a tab to your Sidekiq dashboard to allow you to reset Sidekiq statistics}
13
+ s.license = 'MIT'
14
+
15
+ s.rubyforge_project = "sidekiq-reset_statistics"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_development_dependency('sidekiq')
23
+ s.add_development_dependency('sinatra')
24
+ s.add_development_dependency('rake')
25
+ s.add_development_dependency('rspec')
26
+ s.add_development_dependency('rack-test')
27
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Sidekiq::ResetStatistics::VERSION' do
4
+ it 'should be the correct version' do
5
+ Sidekiq::ResetStatistics::VERSION.should == '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sidekiq::ResetStatistics::Web do
4
+ include Rack::Test::Methods
5
+
6
+ before do
7
+ Sidekiq.redis { |conn| conn.flushdb }
8
+ end
9
+
10
+ def app
11
+ @app ||= Sidekiq::Web
12
+ end
13
+
14
+ it 'should display the index page' do
15
+ get '/reset-statistics'
16
+ last_response.status.should == 200
17
+ end
18
+
19
+ it 'should reset statistics in Sidekiq' do
20
+ Sidekiq.redis do |conn|
21
+ conn.set('stat:processed', 5)
22
+ conn.set('stat:failed', 10)
23
+ post '/reset-statistics'
24
+ last_response.status.should == 302
25
+ conn.get('stat:processed').should == '0'
26
+ conn.get('stat:failed').should == '0'
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,11 @@
1
+ require 'rspec'
2
+ require 'sidekiq-reset_statistics'
3
+ require 'rack/test'
4
+
5
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
6
+
7
+ RSpec.configure do |config|
8
+ end
9
+
10
+ require 'sidekiq'
11
+ Sidekiq.logger.level = Logger::ERROR
@@ -0,0 +1,3 @@
1
+ <form action="<%= root_path %>reset-statistics" method="post">
2
+ <input class="btn btn-danger pull-left" type="submit" name="reset_statistics" value="Reset Sidekiq Statistics" data-confirm="<%= t('AreYouSure') %>"/>
3
+ </form>
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sidekiq-reset_statistics
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Czarnecki
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sidekiq
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Adds a tab to your Sidekiq dashboard to allow you to reset Sidekiq statistics
84
+ email:
85
+ - me@davidczarnecki.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - .gitignore
91
+ - .rspec
92
+ - CHANGELOG.md
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - lib/sidekiq-reset_statistics.rb
98
+ - lib/sidekiq-reset_statistics/version.rb
99
+ - lib/sidekiq-reset_statistics/web.rb
100
+ - sidekiq-reset_statistics.gemspec
101
+ - spec/sidekiq-reset_statistics/version_spec.rb
102
+ - spec/sidekiq-reset_statistics/web_spec.rb
103
+ - spec/spec_helper.rb
104
+ - web/views/reset_statistics.erb
105
+ homepage: https://github.com/czarneckid/sidekiq-reset_statistics
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - '>='
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project: sidekiq-reset_statistics
125
+ rubygems_version: 2.0.3
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Adds a tab to your Sidekiq dashboard to allow you to reset Sidekiq statistics
129
+ test_files:
130
+ - spec/sidekiq-reset_statistics/version_spec.rb
131
+ - spec/sidekiq-reset_statistics/web_spec.rb
132
+ - spec/spec_helper.rb