mongo-resque 1.18.2 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## 1.19.0 (2011-09-06)
2
+
3
+ * Changed Hoptoad failure backend into Airbrake (not backwards compatible!)
4
+ * Web UI: Added retry all button to failed jobs page
5
+ * Web UI: Show focus outline
6
+
7
+ ## 1.18.6 (2011-08-30)
8
+
9
+ * Bugfix: Use Rails 3 eager loading for resque:preload
10
+
11
+ ## 1.18.5 (2011-08-24)
12
+
13
+ * Added support for Travis CI
14
+ * Bugfix: preload only happens in production Rails environment
15
+
16
+ ## 1.18.4 (2011-08-23)
17
+
18
+ * Bugfix: preload task depends on setup
19
+
20
+ ## 1.18.3 (2011-08-23)
21
+
22
+ * Bugfix: Fix preloading on Rails 3.x.
23
+
1
24
  ## 1.18.2 (2011-08-19)
2
25
 
3
26
  * Fix RAILS_ROOT deprecation warning
data/README.markdown CHANGED
@@ -23,8 +23,9 @@ to use the same database for your application as Resque (this might
23
23
  still not be the best idea though - behold the stern warnings below).
24
24
 
25
25
  Original resque is currently using hoptoad_notifier in its Hoptoad Failure
26
- Backend. This fork has not implemented this change as I'm undecided wether
27
- the change was for the better or not (we avoid dependency troubles this way).
26
+ Backend and the airbrake gem for its Airbrake Faiure Backend. This fork has
27
+ chosen not to add these dependencies but rather have its own clean support
28
+ for Airbrake (the Hoptoad backend has been deprecated).
28
29
 
29
30
  Delayed Jobs
30
31
  ------------
@@ -22,8 +22,8 @@ module Resque
22
22
  # `Resque::Failure::Base`.
23
23
  #
24
24
  # Example use:
25
- # require 'resque/failure/hoptoad'
26
- # Resque::Failure.backend = Resque::Failure::Hoptoad
25
+ # require 'resque/failure/airbrake'
26
+ # Resque::Failure.backend = Resque::Failure::Airbrake
27
27
  def self.backend=(backend)
28
28
  @backend = backend
29
29
  end
@@ -4,13 +4,13 @@ require 'uri'
4
4
 
5
5
  module Resque
6
6
  module Failure
7
- # A Failure backend that sends exceptions raised by jobs to Hoptoad.
7
+ # A Failure backend that sends exceptions raised by jobs to Airbrake.
8
8
  #
9
9
  # To use it, put this code in an initializer, Rake task, or wherever:
10
10
  #
11
- # require 'resque/failure/hoptoad'
11
+ # require 'resque/failure/airbrake'
12
12
  #
13
- # Resque::Failure::Hoptoad.configure do |config|
13
+ # Resque::Failure::Airbrake.configure do |config|
14
14
  # config.api_key = 'blah'
15
15
  # config.secure = true
16
16
  #
@@ -21,8 +21,8 @@ module Resque
21
21
  # # server env support, defaults to RAILS_ENV or RACK_ENV
22
22
  # config.server_environment = "test"
23
23
  # end
24
- class Hoptoad < Base
25
- # From the hoptoad plugin
24
+ class Airbrake < Base
25
+ # From the airbrake plugin
26
26
  INPUT_FORMAT = /^([^:]+):(\d+)(?::in `([^']+)')?$/
27
27
 
28
28
  class << self
@@ -31,7 +31,7 @@ module Resque
31
31
  end
32
32
 
33
33
  def self.count
34
- # We can't get the total # of errors from Hoptoad so we fake it
34
+ # We can't get the total # of errors from Airbrake so we fake it
35
35
  # by asking Resque how many errors it has seen.
36
36
  Stat[:failed]
37
37
  end
@@ -43,7 +43,7 @@ module Resque
43
43
 
44
44
  def save
45
45
  http = use_ssl? ? :https : :http
46
- url = URI.parse("#{http}://hoptoadapp.com/notifier_api/v2/notices")
46
+ url = URI.parse("#{http}://airbrakeapp.com/notifier_api/v2/notices")
47
47
 
48
48
  request = Net::HTTP::Proxy(self.class.proxy_host, self.class.proxy_port)
49
49
  http = request.new(url.host, url.port)
@@ -60,15 +60,15 @@ module Resque
60
60
  begin
61
61
  response = http.post(url.path, xml, headers)
62
62
  rescue TimeoutError => e
63
- log "Timeout while contacting the Hoptoad server."
63
+ log "Timeout while contacting the Airbrake server."
64
64
  end
65
65
 
66
66
  case response
67
67
  when Net::HTTPSuccess then
68
- log "Hoptoad Success: #{response.class}"
68
+ log "Airbrake Success: #{response.class}"
69
69
  else
70
70
  body = response.body if response.respond_to? :body
71
- log "Hoptoad Failure: #{response.class}\n#{body}"
71
+ log "Airbrake Failure: #{response.class}\n#{body}"
72
72
  end
73
73
  end
74
74
 
@@ -78,7 +78,7 @@ module Resque
78
78
  x.notice :version=>"2.0" do
79
79
  x.tag! "api-key", api_key
80
80
  x.notifier do
81
- x.name "Resqueue"
81
+ x.name "Resque"
82
82
  x.version "0.1"
83
83
  x.url "http://github.com/defunkt/resque"
84
84
  end
data/lib/resque/server.rb CHANGED
@@ -214,6 +214,13 @@ module Resque
214
214
  redirect u('failed')
215
215
  end
216
216
 
217
+ post "/failed/requeue/all" do
218
+ Resque::Failure.count.times do |num|
219
+ Resque::Failure.requeue(num)
220
+ end
221
+ redirect u('failed')
222
+ end
223
+
217
224
  get "/failed/requeue/:index" do
218
225
  Resque::Failure.requeue(params[:index])
219
226
  if request.xhr?
@@ -16,10 +16,6 @@ table, caption, tbody, tfoot, thead, tr, th, td {
16
16
  font-family: inherit;
17
17
  }
18
18
 
19
- :focus {
20
- outline: 0;
21
- }
22
-
23
19
  body {
24
20
  line-height: 1;
25
21
  }
@@ -87,6 +87,6 @@ body { padding:0; margin:0; }
87
87
  #main p.pagination a.less { float:left;}
88
88
  #main p.pagination a.more { float:right;}
89
89
 
90
- #main form {float:right; margin-top:-10px;}
90
+ #main form {float:right; margin-top:-10px;margin-left:10px;}
91
91
 
92
92
  #main .time a.toggle_format {text-decoration:none;}
@@ -5,9 +5,12 @@
5
5
 
6
6
  <h1>Failed Jobs</h1>
7
7
  <%unless failed.empty?%>
8
- <form method="POST" action="<%=u 'failed/clear'%>" class='clear-failed'>
8
+ <form method="POST" action="<%=u 'failed/clear'%>">
9
9
  <input type='submit' name='' value='Clear Failed Jobs' />
10
10
  </form>
11
+ <form method="POST" action="<%=u 'failed/requeue/all'%>">
12
+ <input type='submit' name='' value='Retry Failed Jobs' />
13
+ </form>
11
14
  <%end%>
12
15
 
13
16
  <p class='sub'>Showing <%=start%> to <%= start + 20 %> of <b><%= size = Resque::Failure.count %></b> jobs</p>
data/lib/resque/tasks.rb CHANGED
@@ -41,11 +41,14 @@ namespace :resque do
41
41
  end
42
42
 
43
43
  # Preload app files if this is Rails
44
- task :preload do
45
- if defined? Rails
46
- Dir["#{Rails.root}/app/**/*.rb"].each do |file|
47
- require file
48
- end
44
+ task :preload => :setup do
45
+ if defined?(Rails) && Rails.respond_to?(:application)
46
+ # Rails 3
47
+ Rails.application.eager_load!
48
+ elsif defined?(Rails::Initializer)
49
+ # Rails 2.3
50
+ $rails_rake_task = false
51
+ Rails::Initializer.run :load_application_classes
49
52
  end
50
53
  end
51
54
  end
@@ -1,3 +1,3 @@
1
1
  module Resque
2
- Version = VERSION = '1.18.2'
2
+ Version = VERSION = '1.19.0'
3
3
  end
@@ -1,2 +1,2 @@
1
- $LOAD_PATH.unshift File.expand_path("../..", __FILE__)
1
+ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
2
  require 'resque/tasks'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-resque
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.2
4
+ version: 1.19.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-22 00:00:00.000000000Z
12
+ date: 2011-09-06 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongo
16
- requirement: &2157276880 !ruby/object:Gem::Requirement
16
+ requirement: &2153563380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2157276880
24
+ version_requirements: *2153563380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: vegas
27
- requirement: &2157276380 !ruby/object:Gem::Requirement
27
+ requirement: &2153562880 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.1.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2157276380
35
+ version_requirements: *2153562880
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sinatra
38
- requirement: &2157275680 !ruby/object:Gem::Requirement
38
+ requirement: &2153562420 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.9.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2157275680
46
+ version_requirements: *2153562420
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: multi_json
49
- requirement: &2157275100 !ruby/object:Gem::Requirement
49
+ requirement: &2153591640 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '1.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2157275100
57
+ version_requirements: *2153591640
58
58
  description: ! " Resque is a Redis-backed Ruby library for creating background
59
59
  jobs,\n placing those jobs on multiple queues, and processing them later.\n\n
60
60
  \ Mongo-Resque is the same thing, but for mongo. It would not exist\n without
@@ -71,8 +71,8 @@ extra_rdoc_files:
71
71
  files:
72
72
  - lib/resque/delayed.rb
73
73
  - lib/resque/errors.rb
74
+ - lib/resque/failure/airbrake.rb
74
75
  - lib/resque/failure/base.rb
75
- - lib/resque/failure/hoptoad.rb
76
76
  - lib/resque/failure/mongo.rb
77
77
  - lib/resque/failure/multiple.rb
78
78
  - lib/resque/failure/redis.rb