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/storage_adapter.rb,
lib/bumbleworks/process_definition.rb,
lib/bumbleworks/participant_registration.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
"0.0.11"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.envObject

Returns the value of attribute env.



19
20
21
# File 'lib/bumbleworks.rb', line 19

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.



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/bumbleworks.rb', line 33

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:



56
57
58
59
60
61
# File 'lib/bumbleworks.rb', line 56

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:



68
69
70
71
# File 'lib/bumbleworks.rb', line 68

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).



121
122
123
124
# File 'lib/bumbleworks.rb', line 121

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.



100
101
102
# File 'lib/bumbleworks.rb', line 100

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


84
85
86
87
# File 'lib/bumbleworks.rb', line 84

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.



92
93
94
# File 'lib/bumbleworks.rb', line 92

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

.reset!Object

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



108
109
110
111
112
# File 'lib/bumbleworks.rb', line 108

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