simple_worker 1.0.13 → 1.0.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,7 +45,7 @@ module SimpleWorker
45
45
  reqs.each do |r|
46
46
  r2 = "#{gem_info[:path]}/lib/#{r}"
47
47
  begin
48
- puts 'requiring ' + r2
48
+ SimpleWorker.logger.debug 'requiring ' + r2
49
49
  require r2
50
50
  rescue LoadError=>ex
51
51
  raise "Gem #{gem_name} was found, but we could not load the file '#{r2}'. You may need to use :require=>x.........."
@@ -168,6 +168,18 @@ sw_config = job_data['sw_config']
168
168
  f.write("require 'simple_worker'\n")
169
169
 
170
170
 
171
+ File.open(File.join(File.dirname(__FILE__), 'server', 'overrides.rb'), 'r') do |fr|
172
+ while line = fr.gets
173
+ f.write line
174
+ end
175
+ end
176
+
177
+ # Now we must disable queuing while loading up classes. This is from the overrides.rb file
178
+ f.write("
179
+ SimpleWorker.disable_queueing()
180
+ ")
181
+
182
+
171
183
  # add some rails stuff if using Rails
172
184
  if defined?(Rails)
173
185
  f.write "module Rails
@@ -208,18 +220,13 @@ end
208
220
  f.write "init_mailer(sw_config)\n"
209
221
  f.write "ActionMailer::Base.prepend_view_path('templates')\n"
210
222
  end
211
- f.write "init_database_connection(sw_config)"
223
+ f.write "init_database_connection(sw_config)\n"
212
224
  if SimpleWorker.config.extra_requires
213
225
  SimpleWorker.config.extra_requires.each do |r|
214
226
  f.write "require '#{r}'\n"
215
227
  end
216
228
  end
217
229
 
218
- File.open(File.join(File.dirname(__FILE__), 'server', 'overrides.rb'), 'r') do |fr|
219
- while line = fr.gets
220
- f.write line
221
- end
222
- end
223
230
 
224
231
  merged.each_pair do |k, v|
225
232
  if v[:extname] == ".rb"
@@ -231,16 +238,17 @@ end
231
238
  end
232
239
  #end
233
240
  #f.write File.open(filename, 'r') { |mo| mo.read }
234
- f.write("require_relative '#{File.basename(filename)}'")
241
+ f.write("require_relative '#{File.basename(filename)}'\n")
235
242
 
236
243
 
237
244
 
238
245
  f.write("
239
- SimpleWorker.disable_queueing()
240
246
  runner_class = get_class_to_run(job_data['class_name'])
241
247
  SimpleWorker.running_class = runner_class
242
248
  runner = init_runner(runner_class, job_data, dirname)
243
249
  init_worker_service_for_runner(job_data)
250
+
251
+ # lastly, reenable queueing
244
252
  SimpleWorker.enable_queueing()
245
253
 
246
254
  # Let's run it!
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: simple_worker
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.13
5
+ version: 1.0.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Travis Reeder
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-26 00:00:00 Z
13
+ date: 2011-11-03 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: zip