Module: Bumbleworks

Extended by:
Forwardable
Defined in:
lib/bumbleworks.rb,
lib/bumbleworks/task.rb,
lib/bumbleworks/ruote.rb,
lib/bumbleworks/support.rb,
lib/bumbleworks/version.rb,
lib/bumbleworks/tasks/base.rb,
lib/bumbleworks/hash_storage.rb,
lib/bumbleworks/tree_builder.rb,
lib/bumbleworks/configuration.rb,
lib/bumbleworks/simple_logger.rb,
lib/bumbleworks/storage_adapter.rb,
lib/bumbleworks/local_participant.rb,
lib/bumbleworks/process_definition.rb,
lib/bumbleworks/storage_participant.rb,
lib/bumbleworks/workitem_entity_storage.rb,
lib/bumbleworks/participant_registration.rb

Defined Under Namespace

Modules: LocalParticipant, Support, Tasks, WorkitemEntityStorage Classes: Configuration, HashStorage, InvalidEntity, InvalidSetting, ParticipantRegistration, ProcessDefinition, Ruote, SimpleLogger, StorageAdapter, StorageParticipant, Task, TreeBuilder, UndefinedSetting, UnsupportedMode

Constant Summary collapse

VERSION =
"0.0.25"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.envObject

Returns the value of attribute env.



22
23
24
# File 'lib/bumbleworks.rb', line 22

def env
  @env
end

Class Method Details

.configurationObject

Returns the global configuration, or initializes a new configuration object if it doesn’t exist yet. If initializing new config, also adds default storage adapters.



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/bumbleworks.rb', line 36

def configuration
  @configuration ||= begin
    configuration = Bumbleworks::Configuration.new
    configuration.add_storage_adapter(Bumbleworks::HashStorage)
    if defined?(Bumbleworks::Redis::Adapter) && Bumbleworks::Redis::Adapter.auto_register?
      configuration.add_storage_adapter(Bumbleworks::Redis::Adapter)
    end
    if defined?(Bumbleworks::Sequel::Adapter) && Bumbleworks::Sequel::Adapter.auto_register?
      configuration.add_storage_adapter(Bumbleworks::Sequel::Adapter)
    end
    configuration
  end
end

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

Yields the global configuration to a block.

Examples:

Bumbleworks.configure do |c|
  c.root = 'path/to/ruote/assets'
end

Yields:

See Also:



59
60
61
62
63
64
# File 'lib/bumbleworks.rb', line 59

def configure(&block)
  unless block
    raise ArgumentError.new("You tried to .configure without a block!")
  end
  yield configuration
end

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

Same as .configure, but clears all existing configuration settings first.

Yields:

See Also:



71
72
73
74
# File 'lib/bumbleworks.rb', line 71

def configure!(&block)
  @configuration = nil
  configure(&block)
end

.launch!(process_definition_name, options = {}) ⇒ Object

Launches the process definition with the given process name, as long as that definition name is already registered with Bumbleworks. If options has an :entity key, attempts to extract the id and class name before sending it, so it can be properly stored in workitem fields (and re-instantiated later).



124
125
126
127
# File 'lib/bumbleworks.rb', line 124

def launch!(process_definition_name, options = {})
  extract_entity_from_options!(options)
  Bumbleworks::Ruote.launch(process_definition_name, options)
end

.load_definitions!(options = {}) ⇒ Object

Registers all process_definitions in the configured definitions_directory with the Ruote engine.



103
104
105
# File 'lib/bumbleworks.rb', line 103

def load_definitions!(options = {})
  Bumbleworks::ProcessDefinition.create_all_from_directory!(definitions_directory, options)
end

.register_participants(&block) ⇒ Object

Accepts a block for registering participants. Note that a ‘catchall Ruote::StorageParticipant’ is always added to the end of the list (unless it is defined in the block).

Examples:

Bumbleworks.register_participants do
  painter PainterClass
  builder BuilderClass
  plumber PlumberClass
end


87
88
89
90
# File 'lib/bumbleworks.rb', line 87

def register_participants(&block)
  Bumbleworks::ParticipantRegistration.autoload_all
  Bumbleworks::Ruote.register_participants(&block)
end

.register_tasks(&block) ⇒ Object

Autoloads all files in the configured tasks_directory.



95
96
97
# File 'lib/bumbleworks.rb', line 95

def register_tasks(&block)
  Bumbleworks::Task.autoload_all
end

.reset!Object

Resets Bumbleworks - clears configuration and setup variables, and also resets the dashboard.



111
112
113
114
115
# File 'lib/bumbleworks.rb', line 111

def reset!
  @configuration = nil
  @participant_block = nil
  Bumbleworks::Ruote.reset!
end