Sha256: 288df8484c4864c9859f4c0ee7afcb98f27df3b59c64072931fdc48e96ef0e77

Contents?: true

Size: 1.8 KB

Versions: 7

Compression:

Stored size: 1.8 KB

Contents

unless defined? Bj 
  class Bj 
  #
  # constants and associated attrs
  #
    Bj::VERSION = "1.0.1" #unless defined? Bj::VERSION
    def self.version() Bj::VERSION end

    Bj::LIBDIR = File.expand_path(File::join(File.dirname(__FILE__), "bj")) + File::SEPARATOR unless
      defined? Bj::LIBDIR
    def self.libdir(*value) 
      unless value.empty?
        File.join libdir, *value
      else
        Bj::LIBDIR 
      end
    end

    module EXIT 
      SUCCESS = 0
      FAILURE = 1
      WARNING = 42
    end
  #
  # built-in
  #
    require "socket"
    require "yaml"
    require "thread"
    require "rbconfig"
    require "set"
    require "erb"
    require "tempfile"
  #
  # bootstrap rubygems 
  #
    begin
      require "rubygems"
    rescue LoadError
      42
    end
  #
  # rubyforge/remote
  #
    require "active_record"
  #
  # rubyforge/remote or local/lib 
  #
    #%w[ attributes systemu orderedhash ].each do |lib|
    %w[ systemu orderedhash ].each do |lib|
      begin
        require lib
      rescue
        require libdir(lib)
      end
    end
  #
  # local 
  #
    load libdir("attributes.rb")
    load libdir("stdext.rb")
    load libdir("util.rb")
    load libdir("errors.rb")
    load libdir("logger.rb")
    load libdir("bj.rb")
    load libdir("joblist.rb")
    load libdir("table.rb")
    load libdir("runner.rb")
    load libdir("api.rb")
  #
  # an imperfect reloading hook - because neither rails' plugins nor gems provide one, sigh...
  #
    def self.reload!
      background = nil
      ::Object.module_eval do
        background = Bj.runner.background
        remove_const :Bj rescue nil
        remove_const :BackgroundJob rescue nil
      end
      returned = load __FILE__ rescue nil
      Bj.runner.background = background if background
      returned
    end
  end

  BackgroundJob = Bj
end

Version data entries

7 entries across 7 versions & 5 rubygems

Version Path
ThiagoLelis-backgroundjob-1.0.3 lib/bj.rb
ThiagoLelis-bj-utc-1.0.1 lib/bj.rb
ThiagoLelis-bj-utc-1.0.2 lib/bj.rb
blackhoundjob-1.0.2 lib/bj.rb
vibes-bj-1.2.2 spec/rails_root/vendor/plugins/bj/lib/bj.rb
vibes-bj-1.2.1 spec/rails_root/vendor/plugins/bj/lib/bj.rb
bj-1.0.1 lib/bj.rb