Module: JFlow

Defined in:
lib/jflow.rb,
lib/jflow/cli.rb,
lib/jflow/stats.rb,
lib/jflow/domain.rb,
lib/jflow/version.rb,
lib/jflow/activity/map.rb,
lib/jflow/activity/task.rb,
lib/jflow/configuration.rb,
lib/jflow/worker_thread.rb,
lib/jflow/activity/mixin.rb,
lib/jflow/activity/worker.rb,
lib/jflow/activity/definition.rb,
lib/jflow/termination_protector.rb

Defined Under Namespace

Modules: Activity Classes: Cli, Configuration, Domain, Stats, TerminationProtector, WorkerThread

Constant Summary collapse

VERSION =
"0.5.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject



25
26
27
# File 'lib/jflow.rb', line 25

def self.configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



29
30
31
# File 'lib/jflow.rb', line 29

def self.configure
  yield(configuration)
end

.handle_exception(exception) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/jflow.rb', line 43

def self.handle_exception(exception)
  JFlow.configuration.error_handlers.each do |error_handler|
    begin
      error_handler.call(exception)
    rescue => e
      log_error("Error handler failed!")
      log_error(e.backtrace.join("\n")) unless e.backtrace.nil?
    end
  end
end

.load_activitiesObject



33
34
35
36
37
38
39
40
41
# File 'lib/jflow.rb', line 33

def self.load_activities
  configuration.load_paths.each do |path|
    path = File.join(ENV['APP_ROOT'], path) if ENV['APP_ROOT']
    Dir["#{path}/*.rb"].each do |file|
      configuration.logger.debug "found #{file}"
      require file
    end
  end
end

.log_error(str) ⇒ Object



54
55
56
# File 'lib/jflow.rb', line 54

def self.log_error(str)
  JFlow.configuration.logger.error "[#{Thread.current.object_id}] #{str}"
end