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/task/finder.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.35"
Class Attribute Summary collapse
-
.env ⇒ Object
Returns the value of attribute env.
Class Method Summary collapse
-
.configuration ⇒ Object
Returns the global configuration, or initializes a new configuration object if it doesn’t exist yet.
-
.configure {|configuration| ... } ⇒ Object
Yields the global configuration to a block.
-
.configure! {|configuration| ... } ⇒ Object
Same as .configure, but clears all existing configuration settings first.
-
.launch!(process_definition_name, *args) ⇒ Object
Launches the process definition with the given process name, as long as that definition name is already registered with Bumbleworks.
-
.load_definitions!(options = {}) ⇒ Object
Registers all process_definitions in the configured definitions_directory with the Ruote engine.
-
.register_participants(&block) ⇒ Object
Accepts a block for registering participants.
-
.register_tasks(&block) ⇒ Object
Autoloads all files in the configured tasks_directory.
-
.reset! ⇒ Object
Resets Bumbleworks - clears configuration and setup variables, and also resets the dashboard.
Class Attribute Details
.env ⇒ Object
Returns the value of attribute env.
22 23 24 |
# File 'lib/bumbleworks.rb', line 22 def env @env end |
Class Method Details
.configuration ⇒ Object
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.
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/bumbleworks.rb', line 39 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.
62 63 64 65 66 67 |
# File 'lib/bumbleworks.rb', line 62 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.
74 75 76 77 |
# File 'lib/bumbleworks.rb', line 74 def configure!(&block) @configuration = nil configure(&block) end |
.launch!(process_definition_name, *args) ⇒ 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).
127 128 129 130 |
# File 'lib/bumbleworks.rb', line 127 def launch!(process_definition_name, *args) extract_entity_from_fields!(args.first || {}) Bumbleworks::Ruote.launch(process_definition_name, *args) end |
.load_definitions!(options = {}) ⇒ Object
Registers all process_definitions in the configured definitions_directory with the Ruote engine.
106 107 108 |
# File 'lib/bumbleworks.rb', line 106 def load_definitions!( = {}) Bumbleworks::ProcessDefinition.create_all_from_directory!(definitions_directory, ) 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).
90 91 92 93 |
# File 'lib/bumbleworks.rb', line 90 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.
98 99 100 |
# File 'lib/bumbleworks.rb', line 98 def register_tasks(&block) Bumbleworks::Task.autoload_all end |
.reset! ⇒ Object
Resets Bumbleworks - clears configuration and setup variables, and also resets the dashboard.
114 115 116 117 118 |
# File 'lib/bumbleworks.rb', line 114 def reset! @configuration = nil @participant_block = nil Bumbleworks::Ruote.reset! end |