Sha256: 70840ccd908a9aaa616e9261eb52c61d55eadb45ae744157bf5f6d4e4b5299b0

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.2" #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
averell23-bj-1.0.2 lib/bj.rb
bricooke-bj-1.0.2 lib/bj.rb
jcnetdev-bj-1.0.33 lib/bj.rb
jcnetdev-bj-1.0.38 lib/bj.rb
sevenwire-bj-1.0.1 lib/bj.rb
sevenwire-bj-1.0.2 lib/bj.rb
bjj-1.0.3 lib/bj.rb