Giter VIP home page Giter VIP logo

rails_workflow's Introduction

Rails Workflow Engine

Build Status Code Climate Join the chat at https://gitter.im/madzhuga/rails_workflow

Overview

Rails Workflow allows you to organize your application business logic by joining user- and auto- operations in processes. You can configure, create and manage processes to easily build project management systems, sales / product provisioning systems, ERP, CMS, etc.

Rails Workflow is mountable Rails engine and can be mounted to any Rails application.

All processes, configurations, operations and their data is persisted for processing and supporting purposes. Engine has UI to configure process templates and manage existing processes.

Rails Workflow Engine

Main features:

  • It is mountable rails engine.
  • Allows to configure process and operation templates.
  • Allows to configure syncronous and asyncronous operations.
  • Allows to run operations in background
  • Provides operations exceptions/errors monitoring and management.
  • Allows to build hierarchical synchronous and asynchronous processes.
  • Allows to split process implementation to operations isolating logic.
  • Allows to reuse operations in different processes.
  • Every operation runs in it's own transaction and has separate context.
  • Process may be canceled, manually changed, rolled back, reset to any specific operation.
  • Allow to track operations flow and their context, errors, user activities etc.

User Interface

  • It has UI for processes configuration and management.
  • UI is bootstrapped and can be easily changed to fit main rails application design.

Documentation

You can find tutorials and documentation here

Help and support

Please contact me if you have any questions or need any customization

Installation

Add to your application's Gemfile:

gem 'rails_workflow'

And then execute:

$ bundle install

and mount it to /workflow routes:

Rails.application.routes.draw do
  ...
  mount RailsWorkflow::Engine => '/workflow', as: 'workflow'
  ...
end

Generate all models:

$ rails generate rails_workflow:install
$ bundle exec rake db:migrate

I am developing this engine using PostgreSQL database. In case if you using MySQL, add following to your config/initializers/workflow.rb file:

RailsWorkflow.setup do |config|
  config.sql_dialect= 'mysql'
end

rails_workflow's People

Contributors

deathweaselx86 avatar gitter-badger avatar madzhuga avatar naofumi-fujii avatar pib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rails_workflow's Issues

ActiveRecord::Migration is not supported

When running migration it throws the following exception:

$ rails db:migrate
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

class CreateWorkflowProcesses < ActiveRecord::Migration[4.2]

Is it not supported for these versions?

$ ruby --version
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
$ rails --version
Rails 5.1.4

Missing template rails_workflow/operations/index

Following these instructions, I get an error at localhost:3000/workflows/

ActionView::MissingTemplate - Missing template rails_workflow/operations/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
  * "/path/app/views"
  * "/path/.rvm/gems/ruby-2.1.2/gems/rails_workflow-0.3.2/app/views"
  * "/path/.rvm/gems/ruby-2.1.2/gems/bootstrap-sass-extras-0.0.6/app/views"
  * "/path/.rvm/gems/ruby-2.1.2/bundler/gems/devise-aa49dd53b557/app/views"

There is a file /path/.rvm/gems/ruby-2.1.2/gems/bootstrap-sass-extras-0.0.6/app/views/rails_workflow/operations/index.html.slim. I'm unfamiliar with .slim templates, but I think rails_workflow must have an undocumented template handler dependency?

db:migrate error json

Hi

I'm getting the following error when trying to migrate the database. Any ideas on how to solve this. All dependencies seem to be installed correctly.

D:\Workspace\sad>bundle exec rake db:migrate
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
== 20150123172243 CreateWorkflowWfProcesses: migrating ========================
-- create_table(:workflow_processes)
-> 0.0110s
-- create_table(:workflow_operations)
-> 0.0050s
-- create_table(:workflow_process_templates)
-> 0.0050s
-- create_table(:workflow_operation_templates)
-> 0.0040s
-- add_column(:workflow_processes, :template_id, :integer)
-> 0.0150s
-- add_column(:workflow_processes, :type, :string)
-> 0.0150s
-- add_column(:workflow_operations, :process_id, :integer)
-> 0.0180s
-- add_column(:workflow_operations, :template_id, :integer)
-> 0.0140s
-- add_column(:workflow_operation_templates, :async, :boolean)
-> 0.0140s
-- add_column(:workflow_operations, :dependencies, :text)
-> 0.0130s
-- add_column(:workflow_operation_templates, :child_process_id, :integer)
-> 0.0130s
-- add_column(:workflow_operations, :child_process_id, :integer)
-> 0.0120s
-- add_column(:workflow_operation_templates, :assignment_id, :integer)
-> 0.0130s
-- add_column(:workflow_operation_templates, :assignment_type, :string)
-> 0.0110s
-- add_column(:workflow_operations, :assignment_id, :integer)
-> 0.0120s
-- add_column(:workflow_operations, :assignment_type, :string)
-> 0.0110s
-- add_column(:workflow_operations, :assigned_at, :datetime)
-> 0.0100s
-- add_column(:workflow_operation_templates, :kind, :string)
-> 0.0100s
-- add_column(:workflow_operation_templates, :role, :string)
-> 0.0120s
-- add_column(:workflow_operation_templates, :group, :string)
-> 0.0130s
-- add_column(:workflow_operations, :type, :string)
-> 0.0120s
-- add_column(:workflow_operations, :is_active, :boolean)
-> 0.0130s
-- add_column(:workflow_operation_templates, :instruction, :text)
-> 0.0110s
-- create_table(:workflow_contexts)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

undefined method json' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x5edc6a0>D:inmigrate'
NoMethodError: undefined method json' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x5edc6a0> D:inmigrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
'

Issue in rake db:migrate

Issue with Json type column with PostgreSQL,

Stacktrace.......

singh@singh-Latitude-E5450:~/project/jen_etl/db/migrate$ bundle exec rake db:migrate --trace
(in /home/singh/project/jen_etl)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20150123172243 CreateWorkflowWfProcesses: migrating ========================
-- create_table(:workflow_processes)
-> 0.0008s
-- create_table(:workflow_operations)
-> 0.0005s
-- create_table(:workflow_process_templates)
-> 0.0005s
-- create_table(:workflow_operation_templates)
-> 0.0005s
-- add_column(:workflow_processes, :template_id, :integer)
-> 0.0003s
-- add_column(:workflow_processes, :type, :string)
-> 0.0002s
-- add_column(:workflow_operations, :process_id, :integer)
-> 0.0003s
-- add_column(:workflow_operations, :template_id, :integer)
-> 0.0002s
-- add_column(:workflow_operation_templates, :async, :boolean)
-> 0.0003s
-- add_column(:workflow_operations, :dependencies, :text)
-> 0.0002s
-- add_column(:workflow_operation_templates, :child_process_id, :integer)
-> 0.0003s
-- add_column(:workflow_operations, :child_process_id, :integer)
-> 0.0002s
-- add_column(:workflow_operation_templates, :assignment_id, :integer)
-> 0.0002s
-- add_column(:workflow_operation_templates, :assignment_type, :string)
-> 0.0002s
-- add_column(:workflow_operations, :assignment_id, :integer)
-> 0.0002s
-- add_column(:workflow_operations, :assignment_type, :string)
-> 0.0003s
-- add_column(:workflow_operations, :assigned_at, :datetime)
-> 0.0002s
-- add_column(:workflow_operation_templates, :kind, :string)
-> 0.0002s
-- add_column(:workflow_operation_templates, :role, :string)
-> 0.0002s
-- add_column(:workflow_operation_templates, :group, :string)
-> 0.0002s
-- add_column(:workflow_operations, :type, :string)
-> 0.0002s
-- add_column(:workflow_operations, :is_active, :boolean)
-> 0.0002s
-- add_column(:workflow_operation_templates, :instruction, :text)
-> 0.0002s
-- create_table(:workflow_contexts)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method json' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x000000054940a8>/var/lib/gems/1.9.1/gems/rails_workflow-0.2.2/db/migrate/20150123172243_create_workflow_wf_processes.rb:66:inblock in change'
/var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:202:in create_table' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:inblock in method_missing'
/var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in block in say_with_time' /usr/lib/ruby/1.9.1/benchmark.rb:280:inmeasure'

warning already initialized constant on production console

Hi,
When launching the console on production i see many warnings. In development mode all looks ok.

$ bundle exec rails c production
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:31: warning: already initialized constant RailsWorkflow::Status::NOT_STARTED
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:31: warning: previous definition of NOT_STARTED was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:32: warning: already initialized constant RailsWorkflow::Status::IN_PROGRESS
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:32: warning: previous definition of IN_PROGRESS was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:33: warning: already initialized constant RailsWorkflow::Status::DONE
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:33: warning: previous definition of DONE was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:34: warning: already initialized constant RailsWorkflow::Status::WAITING
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:34: warning: previous definition of WAITING was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:35: warning: already initialized constant RailsWorkflow::Status::ERROR
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:35: warning: previous definition of ERROR was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:36: warning: already initialized constant RailsWorkflow::Status::CANCELED
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:36: warning: previous definition of CANCELED was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:37: warning: already initialized constant RailsWorkflow::Status::SKIPPED
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:37: warning: previous definition of SKIPPED was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:38: warning: already initialized constant RailsWorkflow::Status::ROLLBACK
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:38: warning: previous definition of ROLLBACK was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:31: warning: already initialized constant RailsWorkflow::Status::NOT_STARTED
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:31: warning: previous definition of NOT_STARTED was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:32: warning: already initialized constant RailsWorkflow::Status::IN_PROGRESS
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:32: warning: previous definition of IN_PROGRESS was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:33: warning: already initialized constant RailsWorkflow::Status::DONE
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:33: warning: previous definition of DONE was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:34: warning: already initialized constant RailsWorkflow::Status::WAITING
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:34: warning: previous definition of WAITING was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:35: warning: already initialized constant RailsWorkflow::Status::ERROR
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:35: warning: previous definition of ERROR was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:36: warning: already initialized constant RailsWorkflow::Status::CANCELED
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:36: warning: previous definition of CANCELED was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:37: warning: already initialized constant RailsWorkflow::Status::SKIPPED
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:37: warning: previous definition of SKIPPED was here
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:38: warning: already initialized constant RailsWorkflow::Status::ROLLBACK
/xxx/xxx/xxxx/shared/bundle/ruby/2.3.0/gems/rails_workflow-0.3.5/app/concerns/rails_workflow/status.rb:38: warning: previous definition of ROLLBACK was here

Error on Rake db:migration

rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Index name 'index_rails_workflow_operation_templates_on_process_template_id' on table 'rails_workflow_operation_templates' is too long; the limit is 62 characters/home/jmunyi/rails_play_ground/pinboard/db/migrate/20151117091953_create_workflow_processes.rb:38:in `block in create_indexes'

Not able to achieve parallel processing

Details below:

  1. Create a new Process Template
  2. Click on Add Operation and create a role based operation (eg. Approval by Team Lead)
  3. Click on Add Operation and create another role based operation (eg. Approval by Manager) and do not select dependency check box
  4. Click on Add Operation and create a third role based operation (eg. Approval by Delivery Manager) and select dependencies as:
  • Approval by Team Lead - Done
  • Approval by Manager - Done
  1. Modify application by mapping above created process template id
  2. Login with user who has Team lead role
  3. Click on User Operations link.
  4. Under Available operations section, operation is listed with start button
  5. Click on start and complete operation
  6. Now login with user who has Delivery manager role and click on User Operations

Notice that user is able to see the operation. It should not be seen as Manager has not yet performed any action.

User (with Delivery Manager role) should be able to see operation only when both (Team lead and Manager) have completed their action.

rails generate rails_workflow:install shows error

/Users/fangqi/.rvm/gems/ruby-2.2.4/gems/rails_workflow-0.7.2/lib/rails_workflow/config.rb:17:in `require_relative': /Users/fangqi/.rvm/gems/ruby-2.2.4/gems/rails_workflow-0.7.2/lib/rails_workflow/operation_runner.rb:65: syntax error, unexpected '.' (SyntaxError)
context&.save
please take a look

Use Active Job API

Instead of relying solely on Sidekiq regarding the background processing, I think it would be much more flexible regarding the selection of background processing system if Active Job was used (Rails 4.2+).

postgres

Hi..thanks for your work.
I cant bundle install because it requires an installed postgres db which I don't want to install.
gem 'rails', '4.2.6'
gem 'rails_workflow', '0.3.1'

checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***

Would be great to have a choice.
Greetings
Werner

rails generate rails_workflow:install fails

Hi, I cant get the rails_workflow gem to install, can you please advise? I tried with both rails 5.1.4 & 5.2.3

Many thanks in advance!
G

error message:

/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:90: warning: already initialized constant FileUtils::VERSION
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils/version.rb:4: warning: previous definition of VERSION was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1188: warning: already initialized constant FileUtils::Entry_::S_IF_DOOR
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils.rb:1267: warning: previous definition of S_IF_DOOR was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1446: warning: already initialized constant FileUtils::Entry_::DIRECTORY_TERM
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils.rb:1547: warning: previous definition of DIRECTORY_TERM was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1448: warning: already initialized constant FileUtils::Entry_::SYSCASE
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils.rb:1549: warning: previous definition of SYSCASE was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1501: warning: already initialized constant FileUtils::OPT_TABLE
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils.rb:1602: warning: previous definition of OPT_TABLE was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1555: warning: already initialized constant FileUtils::LOW_METHODS
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils.rb:1656: warning: previous definition of LOW_METHODS was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/fileutils.rb:1562: warning: already initialized constant FileUtils::METHODS
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/fileutils-1.2.0/lib/fileutils.rb:1663: warning: previous definition of METHODS was here
/Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/railtie/configuration.rb:97:in method_missing': undefined method assets' for #Rails::Application::Configuration:0x00007fe198a14560
Did you mean? asset_host (NoMethodError)
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/rails_workflow-0.7.3/lib/rails_workflow/engine.rb:22:in block in <class:Engine>' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in instance_exec'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in run' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in block in run_initializers'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:228:in block in tsort_each' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:350:in block (2 levels) in each_strongly_connected_component'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:431:in each_strongly_connected_component_from' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:349:in block in each_strongly_connected_component'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:347:in each' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:347:in call'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:347:in each_strongly_connected_component' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:226:in tsort_each'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/2.5.0/tsort.rb:205:in tsort_each' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in run_initializers'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in initialize!' from /Users/guest/workspace/workflowapp/config/environment.rb:5:in <top (required)>'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in require' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in block in require_with_bootsnap_lfi'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in register' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in require_with_bootsnap_lfi'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in require' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in block in require'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in load_dependency' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in require'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:102:in preload' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:153:in serve'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:141:in block in run' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in loop'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application.rb:135:in run' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/spring-2.0.2/lib/spring/application/boot.rb:19:in <top (required)>'
from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in require' from /Users/guest/.rbenv/versions/2.5.3/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in require'
from -e:1:in `

'

Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
#gem 'rails', '5.1.4'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

#rails workflow
gem 'rails_workflow'
gem 'active_model_serializers'
gem 'activejob'
gem 'bootstrap-rails-engine'
gem 'draper'
gem 'guid'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'slim-rails'
gem 'will_paginate'


group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
  #workflow
  gem 'devise'
  gem 'rails-controller-testing'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Rails 5.1 Incompatibility

Processing fails on Rails 5.1 due to this error:

wrong number of arguments (given 1, expected 0)
/Users/dpitman/.rvm/gems/ruby-2.3.5/gems/activerecord-5.1.4/lib/active_record/associations/collection_association.rb:28:in `reader'
/Users/dpitman/.rvm/gems/ruby-2.3.5/gems/activerecord-5.1.4/lib/active_record/associations/builder/association.rb:111:in `operations'
/Users/dpitman/others-repositories/rails_workflow/app/models/rails_workflow/process.rb:50:in `uncompleted_operations'
/Users/dpitman/others-repositories/rails_workflow/app/models/rails_workflow/process.rb:44:in `uncompleted?'

This is fixed by not passing in true to the operations association in RailsWorkflow::Process:
converge-co@630a4c8

[FAQ] Production ready

Hi @madzhuga and rails_workflow community,

Is it production ready to use ?

Could you please share those who deployed in production, regarding any issue faced and so on ... ?

Thanks.

why aren't there more workflow gems?

Hi @madzhuga just wondering if you have any idea why there aren't any good workflow gems? I'm sure that's why you started this project. But any ideas why gems like Stonepath and Ruote never took off?

It seems really odd to me since most project I work on always have some business process and I've never found a good way of managing them.

Is it because people are just using state machines to manage workflows? Or maybe a combination of service objects and state machines or something?

Anyway, curious to hear your thoughts!

Also, good luck on this project!

Remove pg dependency

Even though it is mentioned we can switch to mysql in the README, the pg dependency still be listed in the gemspec so we still must install PostgreSQL and pg gem. Could you consider remove pg dependency?

undefined method `get_role_values'

screenshot from 2017-02-28 17-42-57

How is the roles for the template being taken? Iam using devise and cancancan gem in rails 5 and have got workflow running but it pops an error when i try to add person by role. Please help.

Please support MySQL via mysql2 gem [feature request]

$ rails generate rails_workflow:install
$ bundle exec rake db:migrate
== 20150630090558 CreateWorkflowProcesses: migrating ==========================
-- table_exists?(:workflow_processes)
   -> 0.0007s
-- table_exists?(:rails_workflow_processes)
   -> 0.0003s
-- table_exists?(:workflow_operations)
   -> 0.0005s
-- table_exists?(:rails_workflow_operations)
   -> 0.0003s
-- table_exists?(:workflow_process_templates)
   -> 0.0005s
-- table_exists?(:rails_workflow_process_templates)
   -> 0.0003s
-- table_exists?(:workflow_operation_templates)
   -> 0.0005s
-- table_exists?(:rails_workflow_operation_templates)
   -> 0.0003s
-- table_exists?(:workflow_contexts)
   -> 0.0005s
-- table_exists?(:rails_workflow_contexts)
   -> 0.0003s
-- table_exists?(:workflow_errors)
   -> 0.0005s
-- table_exists?(:rails_workflow_errors)
   -> 0.0003s
-- column_exists?(:rails_workflow_contexts, :parent_id)
   -> 0.0014s
-- column_exists?(:rails_workflow_contexts, :parent_type)
   -> 0.0009s
-- column_exists?(:rails_workflow_contexts, :body)
   -> 0.0010s
-- column_exists?(:rails_workflow_contexts, :created_at)
   -> 0.0009s
-- column_exists?(:rails_workflow_contexts, :updated_at)
   -> 0.0010s
-- column_exists?(:rails_workflow_errors, :message)
   -> 0.0011s
-- column_exists?(:rails_workflow_errors, :stack_trace)
   -> 0.0010s
-- column_exists?(:rails_workflow_errors, :parent_id)
   -> 0.0009s
-- column_exists?(:rails_workflow_errors, :parent_type)
   -> 0.0010s
-- column_exists?(:rails_workflow_errors, :created_at)
   -> 0.0010s
-- column_exists?(:rails_workflow_errors, :updated_at)
   -> 0.0010s
-- column_exists?(:rails_workflow_errors, :resolved)
   -> 0.0010s
-- column_exists?(:rails_workflow_operation_templates, :title)
   -> 0.0010s
-- column_exists?(:rails_workflow_operation_templates, :version)
   -> 0.0010s
-- column_exists?(:rails_workflow_operation_templates, :uuid)
   -> 0.0009s
-- add_column(:rails_workflow_operation_templates, :uuid, :uuid)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'uuid' at line 1: ALTER TABLE `rails_workflow_operation_templates` ADD `uuid` uuid
# ...
/app/db/migrate/20150630090558_create_workflow_processes.rb:136:in `block (2 levels) in create_columns'
/app/db/migrate/20150630090558_create_workflow_processes.rb:134:in `map'
/app/db/migrate/20150630090558_create_workflow_processes.rb:134:in `block in create_columns'
/app/db/migrate/20150630090558_create_workflow_processes.rb:133:in `each'
/app/db/migrate/20150630090558_create_workflow_processes.rb:133:in `create_columns'
/app/db/migrate/20150630090558_create_workflow_processes.rb:4:in `change'
# ...
ActiveRecord::StatementInvalid: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'uuid' at line 1: ALTER TABLE `rails_workflow_operation_templates` ADD `uuid` uuid
# ...
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'uuid' at line 1
# ...

Index name too long on rake db:migrate

index name 'index_rails_workflow_operation_templates_on_process_template_id' on table 'rails_workflow_operation_templates' is too long; the limit is 62 characters/Users/dougf/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:936:in `add_index_options'

Broken in new Rails 5 project

$  rails generate rails_workflow:install
/home/me/.rvm/gems/ruby-2.3.1/gems/draper-2.1.0/lib/draper.rb:5:in `require': cannot load such file -- active_model/serializers/xml (LoadError)
    from /home/me/.rvm/gems/ruby-2.3.1/gems/draper-2.1.0/lib/draper.rb:5:in `<top (required)>'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/rails_workflow-0.3.6/lib/rails_workflow.rb:7:in `require'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/rails_workflow-0.3.6/lib/rails_workflow.rb:7:in `<top (required)>'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
    from /home/me/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
    from /home/me/Downloads/rails_workflow_test/config/application.rb:7:in `<top (required)>'

Installation (rails generate) leads to error

I created a new project with rails 4.1.9 (ruby 2.1.5).
Gemfile is standard. Added the line "gem 'rails_workflow', '0.2.1'".
After bundle install I added the line
mount RailsWorkflow::Engine => '/workflow', as: 'workflow'
in routes.rb.
After executing "rails generate rails_workflow:install" the first error was

/.rvm/gems/ruby-2.1.5@railsworkflow/gems/activesupport-4.1.9/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- devise (LoadError)

I added devise in the gemfile (gem 'devise'). After the next bundle install the following error appeared:

/.rvm/gems/ruby-2.1.5@railsworkflow/gems/rails_workflow-0.2.1/config/initializers/will_paginate.rb:8:in `module:ActionView': uninitialized constant WillPaginate::ActionView::LinkRenderer (NameError)

What do background and asynchronous really mean?

I've been experimenting with this gem (very cool!) and can't wrap my head around what background and asynchronous are meant to be used for on Operations.

Background
When background is true, ActiveJob performs the task with a background job. Otherwise it is performed "now", synchronously.

Asynchronous
I don't understand what this does and I can't tell the difference from a workflow perspective.

What I'm looking for
What I was hoping for is a way to configure a workflow, so that if a user attempts to perform an Operation in a way that will not succeed because of dependencies and conditions, that the attempt to complete the operation (say the gem's complete method) would fail. At this point I'd just return the user an error message recommending next steps.

I'd like to avoid having to duplicate these checks both in validations (activerecord) and in the workflow process. Also, the complexity of the dependency relationships is a big reason why I'm looking at rails_workflow.

Could you enlighten us?

Demo?

Hi! I am working on a Rails application that has a large workflow component: https://github.com/18F/C2

Right now, we are using the workflow gem (https://github.com/geekq/workflow) to manage it but we are quickly realizing its limits. eg: when we want to add a few step or have custom workflows, it is a big pain to refactor.

Most importantly, we'd like to develop our app into a platform where we can have easily configurable workflows for different user types.

I am very interested in the engine approach you have developed here. I took a peek at the tutorial but would love to see a live demo. Do you have one floating around that I could check out?

Thank you!

Assign operation on run time after completion a operation

Hello I really like your gem but i need to know following points:

  • How we can assign a operation to multiple roles ?
  • Can I assign an Operation dynamically to an user after completing an operation? For Ex. 'a' operation completed after flow should go to the 'b' operation but 'b' should assigned at that time to whom it should assigned ?
  • Can I re-assign the operation to previous step if current operation is failed ?

I am also looking deep into your gem your answer can save some of my time.

Thanks For your reply in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.