Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Mar 01, 2010

  1. bonus features are included again

    authored
  2. moved job files into lib directory

    This breaks support for installing background-fu directly into vendor plugins. It should always be installed as a gem and then add it to your Gemfile. 
    
    Worker's now must be contained in files ending in _worker.rb. Since Rails expects this for autoloading this should not cause any issues.
    authored

Feb 28, 2010

  1. put basic logging back into background script. this commit breaks sup…

    …port for some previous versions of rails
    
    use 1-0-stable branch for versions of Rails prior to Rails 2.3.
    authored

Feb 27, 2010

  1. no longer using daemons gem.

    instead of using the old: 
      
        ./script/daemons start
    
    use:
    
        ruby script/background
    
    If you refer the ./script method just make script/background executable.
    
    Currently, script/background is missing some of its original features. For examle it logs to the console when run as opposed to the Rails logs. The original functionality will be restored. The script now recognizes the file config/background.yml as its config file.
    authored
  2. Background-Fu config file is now config/background.rb instead of conf…

    …ig/daemons.rb. No longer use the rails initialization process load workers.
    
    The workers are just required if included in lib/workers. There is no reason to add the the load path when lib dir is already in it. Also, this will automatically require workers in the background script.  
    
    The Railtie at this point is empty and could be done away with but since we will be using Rails::Engine soon I have just left the file.
    authored

Feb 26, 2010

  1. copy over daemons script and config in Rails 3 generator

    authored
  2. rails generate background [--skip-migration] [--skip-examples]

    conversion of original background-fu generator to Rails 3 style generator. Does everything the same as original one with exception of copying the Jobs Admin scaffold.
    authored

Feb 25, 2010

  1. added necessary requires to Railtie

    Rails 3 requires developers to explicitly require any pieces of Rails they use as well as including the lib itselft. This is why b-fu and rails are required in the Railtie. rails/engine is required because the Railtie hooks into set_load_path which is an initializer defined in rails/engine.
    authored
  2. RAILS_ROOT is deprecated so use Rails.root if its available

    authored
  3. added version file necessary for jeweler

    authored
  4. oops forgot to add MAJOR in version check when loading Railite

    authored
  5. only load railtie if Rails 3

    authored
  6. BackgroundFu::Railtie basics

    only run rails/init.rb if Rails version <= 2. If not BackgroundFu::Railtie is loaded and should perform same actions as original rails/init.rb
    authored
  7. convert to jeweler

    authored

Feb 23, 2010

  1. Job run chain callbacks complete

    added before_ensure and after_ensure. these work in similar fashion to before_invoke and other callbacks. Methods registered with before_ensure or after_ensure are guarunteed to be called if the worker errors. If you opened a file for some reason in before_invoke then you should close the file in a before_ensure or after_ensure based on your needs.
    authored

Feb 22, 2010

  1. before_rescue and after_rescue callbacks

    before_rescue and after_rescue let you hook into your Job when something goes wrong. Background-Fu stores the error caused by your Job in its result and sets the state to failing. before_rescue lets you hook into the Job process before these two actions are taken. If you store any data in the result or state of the Job using a before_rescue callback it will be overriden. However, if you would like to override the result and state stored by B-Fu you  can use after_rescue :).
    authored
  2. simple magic (worker) callbacks

    this is the beginning of work on magic callbacks or worker callbacks. In the first use case (working as of this commit) you simply want to call one method before and after the method your worker runs when called by a Job. Say you have a worker, ExampleWorker with a method add and you enqueue a job with, Job.enqueue!(ExampleWorker, :add, 1, 2). When the Job is run if the instance methods before_add or after_add are defined in Example worker they will be called in the logical places. Use these magic callbacks to perform tasks such as logging or modifying the state of an object prior to using it in a long running Job. This first use case is really a simplification of the second.
    
    The second use case (not currently implemented) is wanting to call multiple methods before the worker method. This will be possible in similar fashion to Job callbacks. Extending the example above it will be possible to use the class macros before_add/after_add passing them a list of method names to call at the appropriate times.  
    
    Also looking into adding hooks like rescue_add and ensure_add.
    authored
  3. were are describing after_init not after_initialize

    authored
  4. after_init callback executes given methods after initializing Job

    seeing as there are many callbacks to add should probably dynamically call alias_method_chain and define methods like invoke_worker_with_callbacks using cb_points hash. This wont be as simple as the dynamic class method and callers/checkers generation however
    
    Added a "stub" ExampleWorker class to the top of the callbacks_spec. This way background-fu files need not be generated to run specs. Had to make some changes in places where the use of ExampleWorker#add was not stubbed.
    authored
  5. finished writing specs for invocation of job

    still need to add specs for:
    	* predicates (finished?, pending?,etc...)
    	* rescuing run
    	* ensuring run
    	* #get_done!
    	* bonus features
    	* logging
    
    above is incomplete list.
    authored

Feb 21, 2010

  1. implemented specs for Job#enqueue! and initialization

    Still need to implement the invocation specs and write many others
    authored
  2. all parts of callbacks (class macros, checkers, and callers) are dyna…

    …mically gernated when including Job::Callbacks
    
    to add a callback point add the befores and afters arrays at the top of self.included in Job::Callbacks.
    authored
  3. added after_invoke callback

    switched callback macros to be dynamically generated as opposed to explicitly defined. Make it easier to add more callback points in the future
    authored
  4. shared examples for any callback point

    Any callback point needs to conform to a certain spec of behaviors. To make this process painless use it_should_behave_like "Any CB Point" when describing a callback point. This shared example group assumes that a let block defining :callback_point precedes it. See before_invoke in spec/lib/job/callbacks.rb for an example.
    authored
  5. the basics of callbacks (before_invoke)

    before_invoke callback allows methods in the Job class to be called right before it is run. Use the macro before_invoke(*do_methods) to specify which methods to call. The callback chain does not interrupt the running of the job. It is arrogant of the results returned by each before_invoke method. Methods are called in the order they are added so
    	
    	before_invoke :method1, :method2, :method3
    
    is the same as
    
    	before_invoke :method1
    	before_invoke :method2
    	before_invoke :method3
    authored

Feb 20, 2010

  1. no longer using Test::Unit and using RSpec

    all existing tests have been converted to specs. 
    
    A little note on the TODO in spec/job_spec.rb for some reason in describe block I cannot get the shoulda macros "should_validate_presence_of" and "should_require_readonly_attributes" to work. Spent a bit of time trying to figure this out but havent gotten it working. Since this part of the spec really isn't as important as the behavior of the Job API I'm going to go back and adress it later.
    authored
  2. starting callbacks

    to keep callbacks an extension similar to job bonus features the Job::Callbacks module allows callback functionality to be easily switched off (see rails/init.rb).
    authored
  3. getting ready to spec

    copied spec_helper pretty much verbatim from its generated counterpart (see note at top of file). This way all the rspec-rails functionality is available when writing
    authored

May 18, 2009

  1. patched bonus include depending on rails version

    Signed-off-by: Jacek Becela <jacek.becela@gmail.com>
    authored ncr committed

Apr 29, 2009

  1. Brandt Kurowski

    Fix for non-existent config file

    Signed-off-by: Jacek Becela <jacek.becela@gmail.com>
    authored ncr committed

Mar 25, 2009

  1. Modified Job.find to use Time.zone.now instead of Time.now for compat…

    …ibility with Rails 2.1+ (which stores dates and times in UTC).
    
    Signed-off-by: Jacek Becela <jacek.becela@gmail.com>
    authored ncr committed
  2. Modified Job.find to use DateTime.zone instead of Time.now for compat…

    …ibility with Rails 2.1+ (which stores dates and times in UTC).
    
    Signed-off-by: Jacek Becela <jacek.becela@gmail.com>
    authored ncr committed

Mar 05, 2009

  1. Added ability to configure job check and job cleanup intervals throug…

    …h settings in config/daemons.yml. Updated README.txt includes instructions for overriding these defaults. Judicious use of these settings allows for reduction in number of ongoing database calls.
    
    Signed-off-by: Jacek Becela <jacek.becela@gmail.com>
    authored ncr committed

Feb 07, 2009

  1. Jacek Becela

    Merged some changes from beloved contributors :), bumped version to 1…

    ….0.10 and added TODO if you ever wonder what to do with your free evening
    authored
  2. Keith Morrison

    Start test suite

    Signed-off-by: Jacek Becela <jacek.becela@gmail.com>
    authored ncr committed
Something went wrong with that request. Please try again.