kiqstand 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1 @@
1
+ # Overview
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009-2012 Durran Jordan
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,65 @@
1
+ Kiqstand [![Build Status](https://secure.travis-ci.org/mongoid/kiqstand.png?branch=master&.png)](http://travis-ci.org/mongoid/kiqstand)
2
+ ========
3
+
4
+ Kiqstand is a middleware for Sidekiq for use with Mongoid 3.
5
+
6
+ Compatibility
7
+ -------------
8
+
9
+ Kiqstand is tested against MRI 1.9.3, 2.0.0.
10
+
11
+ Kiqstand requires at least Mongoid 3.0.3, and Moped 1.2.0.
12
+
13
+ Documentation
14
+ -------------
15
+
16
+ Include Kiqstand in your `Gemfile`.
17
+
18
+ ```ruby
19
+ gem "kiqstand"
20
+ ```
21
+
22
+ If you're not using Rails, ensure you require it.
23
+
24
+ ```ruby
25
+ require "kiqstand"
26
+ ```
27
+
28
+ Add the middleware to the Sidekiq server middleware.
29
+
30
+ ```ruby
31
+ Sidekiq.configure_server do |config|
32
+ config.server_middleware do |chain|
33
+ chain.add Kiqstand::Middleware
34
+ end
35
+ end
36
+ ```
37
+
38
+ License
39
+ -------
40
+
41
+ Copyright (c) 2012 Durran Jordan
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining
44
+ a copy of this software and associated documentation files (the
45
+ "Software"), to deal in the Software without restriction, including
46
+ without limitation the rights to use, copy, modify, merge, publish,
47
+ distribute, sublicense, and/or sell copies of the Software, and to
48
+ permit persons to whom the Software is furnished to do so, subject to
49
+ the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be
52
+ included in all copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
55
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
57
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
58
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
59
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
60
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
61
+
62
+ Credits
63
+ -------
64
+
65
+ Durran Jordan: durran at gmail dot com
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ require "bundler"
2
+ Bundler.setup
3
+
4
+ require "rake"
5
+ require "rspec/core/rake_task"
6
+
7
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
8
+ require "kiqstand/version"
9
+
10
+ task :gem => :build
11
+ task :build do
12
+ system "gem build kiqstand.gemspec"
13
+ end
14
+
15
+ task :install => :build do
16
+ system "sudo gem install kiqstand-#{Kiqstand::VERSION}.gem"
17
+ end
18
+
19
+ task :release => :build do
20
+ system "git tag -a v#{Kiqstand::VERSION} -m 'Tagging #{Kiqstand::VERSION}'"
21
+ system "git push --tags"
22
+ system "gem push kiqstand-#{Kiqstand::VERSION}.gem"
23
+ system "rm kiqstand-#{Kiqstand::VERSION}.gem"
24
+ end
25
+
26
+ RSpec::Core::RakeTask.new("spec") do |spec|
27
+ spec.pattern = "spec/**/*_spec.rb"
28
+ end
29
+
30
+ RSpec::Core::RakeTask.new('spec:progress') do |spec|
31
+ spec.rspec_opts = %w(--format progress)
32
+ spec.pattern = "spec/**/*_spec.rb"
33
+ end
34
+
35
+ task :default => :spec
data/lib/kiqstand.rb ADDED
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+ require "kiqstand/middleware"
3
+ require "kiqstand/version"
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ module Kiqstand
3
+
4
+ # This is the middleware for ensuring Moped sessions are diconnected after
5
+ # a worker runs.
6
+ class Middleware
7
+
8
+ # Ensures that after each worker runs, the identity map is cleared in case
9
+ # it was accidentally enabled in this environment, and each session
10
+ # disconnects it's nodes.
11
+ def call(*args)
12
+ yield
13
+ ensure
14
+ if defined?(::Mongoid)
15
+ ::Mongoid::IdentityMap.clear
16
+ disconnect_sessions
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def disconnect_sessions
23
+ ::Mongoid::Threaded.sessions.each_pair do |_, session|
24
+ session.disconnect
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,4 @@
1
+ # encoding: utf-8
2
+ module Kiqstand
3
+ VERSION = "1.0.0"
4
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kiqstand
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Durran Jordan
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mongoid
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: moped
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.2'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.2'
46
+ description: Mongoid 3 Middleware for Sidekiq
47
+ email:
48
+ - durran@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/kiqstand/middleware.rb
54
+ - lib/kiqstand/version.rb
55
+ - lib/kiqstand.rb
56
+ - CHANGELOG.md
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ homepage: http://mongoid.org
61
+ licenses: []
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ segments:
73
+ - 0
74
+ hash: 2502054094086232256
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: 1.3.6
81
+ requirements: []
82
+ rubyforge_project: kiqstand
83
+ rubygems_version: 1.8.24
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Mongoid 3 Middleware for Sidekiq
87
+ test_files: []