resque-enqueue-logger 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +53 -0
- data/VERSION +1 -1
- data/lib/resque/plugins/enqueue-logger.rb +21 -0
- data/lib/resque-enqueue-logger.rb +2 -1
- data/resque-enqueue-logger.gemspec +4 -4
- metadata +6 -6
- data/README.rdoc +0 -19
- data/lib/resque-enqueue-logger/resque/plugins/enqueue-logger.rb +0 -9
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
|
2
|
+
resque-enqueue-logger
|
3
|
+
===============
|
4
|
+
|
5
|
+
Resque plugin that adds simple logging before enqueueing a job.
|
6
|
+
|
7
|
+
Installation
|
8
|
+
---------
|
9
|
+
|
10
|
+
To install:
|
11
|
+
|
12
|
+
gem install resque-enqueue-logger
|
13
|
+
|
14
|
+
Or if you use Bundler, add this to your `Gemfile`
|
15
|
+
|
16
|
+
gem 'resque-enqueue-logger'
|
17
|
+
|
18
|
+
Usage
|
19
|
+
-----
|
20
|
+
|
21
|
+
Set your logger, e.g. in an initializer:
|
22
|
+
|
23
|
+
# config/initializers/resque.rb
|
24
|
+
require 'resque'
|
25
|
+
Resque.redis = 'localhost:6379'
|
26
|
+
Resque::Plugins::EnqueueLogger.logger = Rails.logger
|
27
|
+
|
28
|
+
Then extend the plugin in your job class:
|
29
|
+
|
30
|
+
class ExampleJob
|
31
|
+
extend Resque::Plugins::EnqueueLogger
|
32
|
+
@queue = :example_queue
|
33
|
+
|
34
|
+
def self.perform(*args)
|
35
|
+
# your job
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
Contributing to resque-enqueue-logger
|
40
|
+
----------------------------------
|
41
|
+
|
42
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
43
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
44
|
+
* Fork the project.
|
45
|
+
* Start a feature/bugfix branch.
|
46
|
+
* Commit and push until you are happy with your contribution.
|
47
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
48
|
+
* 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.
|
49
|
+
|
50
|
+
Copyright
|
51
|
+
--------
|
52
|
+
|
53
|
+
Copyright (c) 2012 Brian Ray. See LICENSE.txt for further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Resque
|
2
|
+
module Plugins
|
3
|
+
module EnqueueLogger
|
4
|
+
|
5
|
+
def self.logger=(logger)
|
6
|
+
@@logger = logger
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.logger
|
10
|
+
@@logger
|
11
|
+
end
|
12
|
+
|
13
|
+
def before_enqueue_logger(*args)
|
14
|
+
@@logger.info "Resqueue enqueue: #{self} #{args} at #{Time.now}" unless @@logger.nil?
|
15
|
+
ensure
|
16
|
+
true # ensure logging doesn't prevent the job from getting enqueued
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1 +1,2 @@
|
|
1
|
-
require 'resque'
|
1
|
+
require 'resque'
|
2
|
+
require 'resque/plugins/enqueue-logger'
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{resque-enqueue-logger}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["bray"]
|
@@ -14,18 +14,18 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.email = %q{brian.ray1@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
|
-
"README.
|
17
|
+
"README.md"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
21
|
"Gemfile",
|
22
22
|
"Gemfile.lock",
|
23
23
|
"LICENSE.txt",
|
24
|
-
"README.
|
24
|
+
"README.md",
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
27
|
"lib/resque-enqueue-logger.rb",
|
28
|
-
"lib/resque
|
28
|
+
"lib/resque/plugins/enqueue-logger.rb",
|
29
29
|
"resque-enqueue-logger.gemspec",
|
30
30
|
"test/helper.rb",
|
31
31
|
"test/test_resque-enqueue-logger.rb"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- bray
|
@@ -95,17 +95,17 @@ extensions: []
|
|
95
95
|
|
96
96
|
extra_rdoc_files:
|
97
97
|
- LICENSE.txt
|
98
|
-
- README.
|
98
|
+
- README.md
|
99
99
|
files:
|
100
100
|
- .document
|
101
101
|
- Gemfile
|
102
102
|
- Gemfile.lock
|
103
103
|
- LICENSE.txt
|
104
|
-
- README.
|
104
|
+
- README.md
|
105
105
|
- Rakefile
|
106
106
|
- VERSION
|
107
107
|
- lib/resque-enqueue-logger.rb
|
108
|
-
- lib/resque
|
108
|
+
- lib/resque/plugins/enqueue-logger.rb
|
109
109
|
- resque-enqueue-logger.gemspec
|
110
110
|
- test/helper.rb
|
111
111
|
- test/test_resque-enqueue-logger.rb
|
@@ -123,7 +123,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
123
|
requirements:
|
124
124
|
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
hash: -
|
126
|
+
hash: -330419311
|
127
127
|
segments:
|
128
128
|
- 0
|
129
129
|
version: "0"
|
data/README.rdoc
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
= resque-enqueue-logger
|
2
|
-
|
3
|
-
Description goes here.
|
4
|
-
|
5
|
-
== Contributing to resque-enqueue-logger
|
6
|
-
|
7
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
-
* Fork the project.
|
10
|
-
* Start a feature/bugfix branch.
|
11
|
-
* Commit and push until you are happy with your contribution.
|
12
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
-
* 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.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2012 Brian Ray. See LICENSE.txt for
|
18
|
-
further details.
|
19
|
-
|