Skip to content
This repository

RU-8 Upgrade delayed_job to rails3/ruby1.9 #62

Closed
wants to merge 14 commits into from
This page is out of date. Refresh to see the latest.
3  Gemfile
... ...
@@ -0,0 +1,3 @@
  1
+source "https://deploy:AKu742Fone@gems.secondrotation.com"
  2
+
  3
+gemspec
41  Gemfile.lock
... ...
@@ -0,0 +1,41 @@
  1
+PATH
  2
+  remote: .
  3
+  specs:
  4
+    secondrotation-delayed_job (2.0.0)
  5
+
  6
+GEM
  7
+  remote: https://deploy:AKu742Fone@gems.secondrotation.com/
  8
+  remote: http://rubygems.org/
  9
+  specs:
  10
+    activemodel (3.0.20)
  11
+      activesupport (= 3.0.20)
  12
+      builder (~> 2.1.2)
  13
+      i18n (~> 0.5.0)
  14
+    activerecord (3.0.20)
  15
+      activemodel (= 3.0.20)
  16
+      activesupport (= 3.0.20)
  17
+      arel (~> 2.0.10)
  18
+      tzinfo (~> 0.3.23)
  19
+    activesupport (3.0.20)
  20
+    arel (2.0.10)
  21
+    builder (2.1.2)
  22
+    i18n (0.5.0)
  23
+    rack (1.5.2)
  24
+    rake (10.1.0)
  25
+    rspec (1.3.2)
  26
+    rspec-rails (1.3.4)
  27
+      rack (>= 1.0.0)
  28
+      rspec (~> 1.3.1)
  29
+    sqlite3 (1.3.7)
  30
+    tzinfo (0.3.37)
  31
+
  32
+PLATFORMS
  33
+  ruby
  34
+
  35
+DEPENDENCIES
  36
+  activerecord (~> 3.0.8)
  37
+  activesupport (~> 3.0.8)
  38
+  rake (~> 10.1.0)
  39
+  rspec-rails (~> 1.3.4)
  40
+  secondrotation-delayed_job!
  41
+  sqlite3
26  Rakefile
... ...
@@ -0,0 +1,26 @@
  1
+#!/bin/env ruby
  2
+# encoding: utf-8
  3
+require 'rubygems'
  4
+require 'bundler'
  5
+
  6
+begin
  7
+  Bundler.setup(:default, :development)
  8
+rescue Bundler::BundlerError => e
  9
+  $stderr.puts e.message
  10
+  $stderr.puts "Run `bundle install` to install missing gems"
  11
+  exit e.status_code
  12
+end
  13
+require 'rake'
  14
+
  15
+Bundler::GemHelper.install_tasks
  16
+
  17
+require 'spec'
  18
+require 'spec/rake/spectask'
  19
+
  20
+Spec::Rake::SpecTask.new(:spec) do |t|
  21
+  opts = File.join(File.dirname(__FILE__), "spec", 'spec.opts')
  22
+  t.spec_opts << '--options' << opts if File.exists?(opts)
  23
+  t.spec_files = Dir.glob('spec/**/*_spec.rb')
  24
+end
  25
+
  26
+task :default => :spec
1  VERSION
... ...
@@ -0,0 +1 @@
  1
+2.0.0
39  delayed_job.gemspec
... ...
@@ -1,21 +1,13 @@
1  
-# encoding: utf-8
2  
-
3  
-#version = File.read('README.textile').scan(/^\*\s+([\d\.]+)/).flatten
4  
-
  1
+# -*- encoding: utf-8 -*-
5 2
 Gem::Specification.new do |s|
6  
-  s.name     = "delayed_job"
7  
-  s.version  = "1.7.0"
8  
-  s.date     = "2008-11-28"
  3
+  s.name = "secondrotation-delayed_job" 
  4
+  s.version = File.read(File.expand_path('../VERSION', __FILE__)).strip
9 5
   s.summary  = "Database-backed asynchronous priority queue system -- Extracted from Shopify"
10 6
   s.email    = "tobi@leetsoft.com"
11 7
   s.homepage = "http://github.com/tobi/delayed_job/tree/master"
12  
-  s.description = "Delated_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core tasks."
  8
+  s.description = "Delated_job (or DJ) encapsulates the common pattern of asynchronously executing longer tasks in the background. It is a direct extraction from Shopify where the job table is responsible for a multitude of core taskgem."
13 9
   s.authors  = ["Tobias Lütke"]
14 10
 
15  
-  # s.bindir = "bin"
16  
-  # s.executables = ["delayed_job"]
17  
-  # s.default_executable = "delayed_job"
18  
-
19 11
   s.has_rdoc = false
20 12
   s.rdoc_options = ["--main", "README.textile"]
21 13
   s.extra_rdoc_files = ["README.textile"]
@@ -26,13 +18,13 @@ Gem::Specification.new do |s|
26 18
     README.textile
27 19
     delayed_job.gemspec
28 20
     init.rb
29  
-    lib/delayed/job.rb
30  
-    lib/delayed/message_sending.rb
31  
-    lib/delayed/performable_method.rb
32  
-    lib/delayed/worker.rb
  21
+    lib/delayed_job/job.rb
  22
+    lib/delayed_job/message_sending.rb
  23
+    lib/delayed_job/performable_method.rb
  24
+    lib/delayed_job/worker.rb
33 25
     lib/delayed_job.rb
34  
-    tasks/jobs.rake
35  
-    tasks/tasks.rb
  26
+    lib/delayed_job/tasks/jobs.rake
  27
+    lib/delayed_job/tasks/tasks.rb
36 28
   ]
37 29
   s.test_files = %w[
38 30
     spec/database.rb
@@ -40,4 +32,13 @@ Gem::Specification.new do |s|
40 32
     spec/job_spec.rb
41 33
     spec/story_spec.rb
42 34
   ]
43  
-end
  35
+  s.require_paths = ["lib"]
  36
+  s.executables   = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
  37
+
  38
+  s.add_development_dependency 'rake', '~> 10.1.0'
  39
+  s.add_development_dependency "activesupport", '~> 3.0.8'
  40
+  s.add_development_dependency "activerecord", '~> 3.0.8'
  41
+  s.add_development_dependency "rspec-rails", '~> 1.3.4'
  42
+  s.add_development_dependency 'sqlite3'
  43
+
  44
+end
10  lib/delayed_job.rb
... ...
@@ -1,9 +1,11 @@
1 1
 autoload :ActiveRecord, 'active_record'
2 2
 
3  
-require File.dirname(__FILE__) + '/delayed/message_sending'
4  
-require File.dirname(__FILE__) + '/delayed/performable_method'
5  
-require File.dirname(__FILE__) + '/delayed/job'
6  
-require File.dirname(__FILE__) + '/delayed/worker'
  3
+require File.dirname(__FILE__) + '/delayed_job/message_sending'
  4
+require File.dirname(__FILE__) + '/delayed_job/performable_method'
  5
+require File.dirname(__FILE__) + '/delayed_job/job'
  6
+require File.dirname(__FILE__) + '/delayed_job/worker'
  7
+require 'yaml'
  8
+YAML::ENGINE.yamler = 'syck'
7 9
 
8 10
 Object.send(:include, Delayed::MessageSending)   
9 11
 Module.send(:include, Delayed::MessageSending::ClassMethods)
6  lib/delayed/job.rb → lib/delayed_job/job.rb
@@ -10,6 +10,8 @@ class Job < ActiveRecord::Base
10 10
     MAX_RUN_TIME = 4.hours
11 11
     set_table_name :delayed_jobs
12 12
 
  13
+    before_save :set_run_at
  14
+
13 15
     # By default failed jobs are destroyed after too many attempts.
14 16
     # If you want to keep them around (perhaps to inspect the reason
15 17
     # for the failure), set this to false.
@@ -249,12 +251,12 @@ def attempt_to_load(klass)
249 251
     # Note: This does not ping the DB to get the time, so all your clients
250 252
     # must have syncronized clocks.
251 253
     def self.db_time_now
252  
-      (ActiveRecord::Base.default_timezone == :utc) ? Time.now.utc : Time.zone.now
  254
+      (ActiveRecord::Base.default_timezone == :utc) ? Time.now.utc : Time.current
253 255
     end
254 256
 
255 257
   protected
256 258
 
257  
-    def before_save
  259
+    def set_run_at
258 260
       self.run_at ||= self.class.db_time_now
259 261
     end
260 262
 
0  lib/delayed/message_sending.rb → lib/delayed_job/message_sending.rb
File renamed without changes
0  lib/delayed/performable_method.rb → lib/delayed_job/performable_method.rb
File renamed without changes
0  lib/tasks/jobs.rake → lib/delayed_job/tasks/jobs.rake
File renamed without changes
0  lib/tasks/tasks.rb → lib/delayed_job/tasks/tasks.rb
File renamed without changes
0  lib/delayed/worker.rb → lib/delayed_job/worker.rb
File renamed without changes
2  spec/database.rb
@@ -3,7 +3,7 @@
3 3
 
4 4
 require 'rubygems'
5 5
 require 'active_record'
6  
-gem 'sqlite3-ruby'
  6
+require 'logger'
7 7
 
8 8
 require File.dirname(__FILE__) + '/../init'
9 9
 require 'spec'
2  spec/delayed_method_spec.rb
... ...
@@ -1,4 +1,4 @@
1  
-require File.dirname(__FILE__) + '/database'
  1
+require 'database'
2 2
 
3 3
 class SimpleJob
4 4
   cattr_accessor :runs; self.runs = 0
2  spec/job_spec.rb
... ...
@@ -1,4 +1,4 @@
1  
-require File.dirname(__FILE__) + '/database'
  1
+require 'database'
2 2
 
3 3
 class SimpleJob
4 4
   cattr_accessor :runs; self.runs = 0
2  spec/story_spec.rb
... ...
@@ -1,4 +1,4 @@
1  
-require File.dirname(__FILE__) + '/database'
  1
+require 'database'
2 2
 
3 3
 describe "A story" do
4 4
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.