resque-cleaner 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.2 (2011-04-07)
2
+
3
+ * Changed a way to load yajl/json\_gem.
4
+
1
5
  ## 0.2.1 (2011-04-06)
2
6
 
3
7
  * BUGFIX: Bulk action didn't work properly when you select all jobs.
@@ -3,12 +3,6 @@
3
3
  module ResqueCleaner
4
4
  module Server
5
5
 
6
- begin
7
- require 'yajl/json_gem'
8
- rescue Exception
9
- require 'json'
10
- end
11
-
12
6
  def self.erb_path(filename)
13
7
  File.join(File.dirname(__FILE__), 'server', 'views', filename)
14
8
  end
@@ -67,7 +61,7 @@ module ResqueCleaner
67
61
  end
68
62
 
69
63
  def self.included(base)
70
- require 'digest/sha1'
64
+
71
65
  base.class_eval do
72
66
  helpers do
73
67
  def time_filter(id, name, value)
@@ -96,6 +90,7 @@ module ResqueCleaner
96
90
  end
97
91
 
98
92
  get "/cleaner" do
93
+ load_library
99
94
  load_cleaner_filter
100
95
 
101
96
  @jobs = cleaner.select
@@ -119,6 +114,7 @@ module ResqueCleaner
119
114
  end
120
115
 
121
116
  get "/cleaner_list" do
117
+ load_library
122
118
  load_cleaner_filter
123
119
 
124
120
  block = filter_block
@@ -135,6 +131,7 @@ module ResqueCleaner
135
131
  end
136
132
 
137
133
  post "/cleaner_exec" do
134
+ load_library
138
135
  load_cleaner_filter
139
136
 
140
137
  if params[:select_all_pages]!="1"
@@ -156,6 +153,7 @@ module ResqueCleaner
156
153
  end
157
154
 
158
155
  post "/cleaner_stale" do
156
+ load_library
159
157
  cleaner.clear_stale
160
158
  redirect "/cleaner"
161
159
  end
@@ -173,6 +171,15 @@ module ResqueCleaner
173
171
  @cleaner
174
172
  end
175
173
 
174
+ def load_library
175
+ require 'digest/sha1'
176
+ begin
177
+ require 'yajl/json_gem' unless [].respond_to?(:to_json)
178
+ rescue Exception
179
+ require 'json'
180
+ end
181
+ end
182
+
176
183
  def load_cleaner_filter
177
184
  @from = params[:f]=="" ? nil : params[:f]
178
185
  @to = params[:t]=="" ? nil : params[:t]
@@ -2,6 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/test_helper')
2
2
 
3
3
  # Pull in the server test_helper from resque
4
4
  require 'resque/server/test_helper.rb'
5
+ require 'digest/sha1'
6
+ require 'json'
5
7
 
6
8
  def setup_some_failed_jobs
7
9
  Resque.redis.flushall
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tatsuya Ono
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-06 00:00:00 +01:00
18
+ date: 2011-04-07 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency