taskinator 0.4.3 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1a746ba56e5b6a2f57736990eef9e83eafe8701fcbebaaddea258a010f3ee14
4
- data.tar.gz: 5e17bc8e6a61b93d6df0691dc463fb178aca72957ab79eccaea7b9cd6c1af642
3
+ metadata.gz: 0ea786056f74987f21643d392336032d09896df7ddc01d462a78a257a19088d8
4
+ data.tar.gz: f693f14e2dac9341f1c83c6bf04b12da9d96261498198cc712e71be5b4b51955
5
5
  SHA512:
6
- metadata.gz: 8f8cd10cc4c8f5d45d5cc781b379927bae7c0ed5c280e2470450a818a6a3132af75bc11a4c16eef6312056f984e912f3fa758bd45e493988cee37fd01ad92d87
7
- data.tar.gz: f8b330d3f6e6766f6ddbc33becd3bb6d16826a021dd0ba16c3b2ec8308cdfe31caad40621fcbc542d6662c8aababaa946e369d251c82b24a213f955a942192a3
6
+ metadata.gz: 6151322f48c6215c41ffeeb6fc08d43aa871f9f76d04f628c80d29fa423b22fb0a3ee589803efd1503c3b59491bc4e2ace36879f801638898b9ace0557e4f180
7
+ data.tar.gz: 65ba806d211f62c8ff12ea3c036b037f53567a17f1a848129ba8f737d4fc0267be7435d6e315591afa81527275042bf22cc04066c74684b6cc54b0e3ce8691f8
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+ 1. Go to '...'
16
+ 2. Click on '....'
17
+ 3. Scroll down to '....'
18
+ 4. See error
19
+
20
+ **Expected behavior**
21
+ A clear and concise description of what you expected to happen.
22
+
23
+ **Screenshots**
24
+ If applicable, add screenshots to help explain your problem.
25
+
26
+ **Desktop (please complete the following information):**
27
+ - OS: [e.g. iOS]
28
+ - Browser [e.g. chrome, safari]
29
+ - Version [e.g. 22]
30
+
31
+ **Smartphone (please complete the following information):**
32
+ - Device: [e.g. iPhone6]
33
+ - OS: [e.g. iOS8.1]
34
+ - Browser [e.g. stock browser, safari]
35
+ - Version [e.g. 22]
36
+
37
+ **Additional context**
38
+ Add any other context about the problem here.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Custom issue template
3
+ about: Describe this issue template's purpose here.
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,41 @@
1
+ name: Taskinator
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+
7
+ pull_request:
8
+ branches: [ master ]
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ ruby-version:
16
+ - '2.7'
17
+ - '3.0'
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Set up Ruby
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ bundler-cache: true
25
+ - name: Build Gem
26
+ run: bundle exec rake build
27
+ - name: Run tests
28
+ run: bundle exec rake spec
29
+
30
+ publish:
31
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
32
+ needs: build
33
+ runs-on: ubuntu-latest
34
+ steps:
35
+ - uses: actions/checkout@v2
36
+ - name: Release Gem
37
+ uses: discourse/publish-rubygems-action@v2
38
+ env:
39
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
40
+ GIT_NAME: Chris Stefano
41
+ GIT_EMAIL: virtualstaticvoid@gmail.com
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.7.2
1
+ ruby-3.0.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ v0.4.4 - 17 Jan 2022
2
+ ---
3
+ Add support for `ActiveJob`.
4
+
1
5
  v0.4.3 - 14 Jan 2022
2
6
  ---
3
7
  Add `#find_process` and `#find_task` methods to `Taskinator::Api`.
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ virtualstaticvoid@gmail.com.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,58 @@
1
+ # How to contribute
2
+
3
+ All kinds of contributions are welcome. By participating you agree to follow the [code of conduct].
4
+
5
+ If you find an issue, have an idea for a new feature or any improvement, you can report them
6
+ as issues or submit pull requests. To maintain an organized process, please read the following
7
+ guidelines before submitting.
8
+
9
+ ## Reporting Issues
10
+
11
+ Before reporting new issues, please verify if there are any existing issues for the same problem
12
+ by searching in [issues].
13
+
14
+ Please make sure to give a clear name to the issue and describe it with all relevant information.
15
+ Giving examples can help understand your suggestion or, in case of issues to reproduce the problem.
16
+
17
+ ## Sending Pull Requests
18
+
19
+ Look at existing [issues] to see if there are any related issues that your feature/fix should
20
+ consider. If there are none, please create one describing your implementations intent. You should
21
+ always mention a related issue in the pull request description.
22
+
23
+ While writing code, follow the code conventions that you find in the existing code.
24
+
25
+ Try to write short, clear and objective commit messages too. You can squash your commits and
26
+ improve your commit messages once your done.
27
+
28
+ Also make sure to add good tests to your new code. Only refactoring of tested features and
29
+ documentation do not need new tests. This way your changes will be documented and future
30
+ changes will not break what you added.
31
+
32
+ ### Step-by-step
33
+
34
+ - Fork the repository.
35
+ - Commit and push until your are happy of what you have done.
36
+ - Execute the full test suite to ensure all is passing.
37
+ - Squash commits if necessary.
38
+ - Push to your repository.
39
+ - Open a pull request to the original repository.
40
+ - Give your pull request a good description. Do not forget to mention a related issue.
41
+
42
+ ## Running Tests
43
+
44
+ Once you cloned the gem to your development environment, you should run the following command
45
+ from the root folder to install the project dependencies.
46
+
47
+ ```bash
48
+ ./bin/setup
49
+ ```
50
+
51
+ After that, you can execute the tests suite by running the following command from the root folder.
52
+
53
+ ```bash
54
+ rake spec
55
+ ```
56
+
57
+ [code of conduct]: CODE_OF_CONDUCT.md
58
+ [issues]: https://github.com/virtualstaticvoid/taskinator/issues
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  # queues
7
+ gem 'activejob' , '>= 5.0.0'
7
8
  gem 'sidekiq' , '>= 3.5.0'
8
9
  gem 'rspec-sidekiq' , '>= 2.1.0'
9
10
 
@@ -16,7 +17,10 @@ gem 'resque_spec' , '>= 0.16.0'
16
17
  gem 'bundler' , '>= 1.6.0'
17
18
  gem 'rake' , '>= 10.3.0'
18
19
  gem 'activesupport' , '~> 5.2.0'
20
+
19
21
  gem 'rspec'
22
+ gem 'rspec-rails' , '>= 2.0'
23
+
20
24
  gem 'coveralls' , '>= 0.8.22'
21
25
  gem 'pry' , '>= 0.9.0'
22
26
  gem 'pry-byebug' , '>= 1.3.0'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- taskinator (0.4.3)
4
+ taskinator (0.4.7)
5
5
  builder (>= 3.2.2)
6
6
  connection_pool (>= 2.2.0)
7
7
  globalid (~> 0.3)
@@ -14,7 +14,23 @@ PATH
14
14
  GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
- activesupport (5.2.6)
17
+ actionpack (5.2.6.2)
18
+ actionview (= 5.2.6.2)
19
+ activesupport (= 5.2.6.2)
20
+ rack (~> 2.0, >= 2.0.8)
21
+ rack-test (>= 0.6.3)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (5.2.6.2)
25
+ activesupport (= 5.2.6.2)
26
+ builder (~> 3.1)
27
+ erubi (~> 1.4)
28
+ rails-dom-testing (~> 2.0)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
30
+ activejob (5.2.6.2)
31
+ activesupport (= 5.2.6.2)
32
+ globalid (>= 0.3.6)
33
+ activesupport (5.2.6.2)
18
34
  concurrent-ruby (~> 1.0, >= 1.0.2)
19
35
  i18n (>= 0.7, < 2)
20
36
  minitest (~> 5.1)
@@ -30,35 +46,58 @@ GEM
30
46
  term-ansicolor (~> 1.3)
31
47
  thor (>= 0.19.4, < 2.0)
32
48
  tins (~> 1.6)
33
- delayed_job (4.1.9)
34
- activesupport (>= 3.0, < 6.2)
49
+ crass (1.0.6)
50
+ delayed_job (4.1.10)
51
+ activesupport (>= 3.0, < 8.0)
35
52
  diff-lcs (1.5.0)
36
53
  docile (1.4.0)
37
54
  e2mmap (0.1.0)
55
+ erubi (1.10.0)
38
56
  fakeredis (0.7.0)
39
57
  redis (>= 3.2, < 5.0)
40
58
  globalid (0.6.0)
41
59
  activesupport (>= 5.0)
42
- i18n (1.8.11)
60
+ i18n (1.9.1)
43
61
  concurrent-ruby (~> 1.0)
44
62
  json (2.6.1)
63
+ loofah (2.14.0)
64
+ crass (~> 1.0.2)
65
+ nokogiri (>= 1.5.9)
45
66
  method_source (1.0.0)
67
+ mini_portile2 (2.7.1)
46
68
  minitest (5.15.0)
47
69
  mono_logger (1.1.1)
48
70
  multi_json (1.15.0)
49
71
  mustermann (1.1.1)
50
72
  ruby2_keywords (~> 0.0.1)
51
- pry (0.14.1)
73
+ nokogiri (1.13.1)
74
+ mini_portile2 (~> 2.7.0)
75
+ racc (~> 1.4)
76
+ pry (0.13.1)
52
77
  coderay (~> 1.1)
53
78
  method_source (~> 1.0)
54
- pry-byebug (3.8.0)
79
+ pry-byebug (3.9.0)
55
80
  byebug (~> 11.0)
56
- pry (~> 0.10)
81
+ pry (~> 0.13.0)
82
+ racc (1.6.0)
57
83
  rack (2.2.3)
58
84
  rack-protection (2.1.0)
59
85
  rack
86
+ rack-test (1.1.0)
87
+ rack (>= 1.0, < 3)
88
+ rails-dom-testing (2.0.3)
89
+ activesupport (>= 4.2.0)
90
+ nokogiri (>= 1.6)
91
+ rails-html-sanitizer (1.4.2)
92
+ loofah (~> 2.3)
93
+ railties (5.2.6.2)
94
+ actionpack (= 5.2.6.2)
95
+ activesupport (= 5.2.6.2)
96
+ method_source
97
+ rake (>= 0.8.7)
98
+ thor (>= 0.19.0, < 2.0)
60
99
  rake (13.0.6)
61
- redis (4.5.1)
100
+ redis (4.6.0)
62
101
  redis-namespace (1.8.1)
63
102
  redis (>= 3.0.4)
64
103
  resque (2.2.0)
@@ -72,24 +111,32 @@ GEM
72
111
  rspec-core (>= 3.0.0)
73
112
  rspec-expectations (>= 3.0.0)
74
113
  rspec-mocks (>= 3.0.0)
75
- rspec (3.10.0)
76
- rspec-core (~> 3.10.0)
77
- rspec-expectations (~> 3.10.0)
78
- rspec-mocks (~> 3.10.0)
79
- rspec-core (3.10.1)
80
- rspec-support (~> 3.10.0)
81
- rspec-expectations (3.10.1)
114
+ rspec (3.11.0)
115
+ rspec-core (~> 3.11.0)
116
+ rspec-expectations (~> 3.11.0)
117
+ rspec-mocks (~> 3.11.0)
118
+ rspec-core (3.11.0)
119
+ rspec-support (~> 3.11.0)
120
+ rspec-expectations (3.11.0)
82
121
  diff-lcs (>= 1.2.0, < 2.0)
83
- rspec-support (~> 3.10.0)
84
- rspec-mocks (3.10.2)
122
+ rspec-support (~> 3.11.0)
123
+ rspec-mocks (3.11.0)
85
124
  diff-lcs (>= 1.2.0, < 2.0)
86
- rspec-support (~> 3.10.0)
125
+ rspec-support (~> 3.11.0)
126
+ rspec-rails (5.1.0)
127
+ actionpack (>= 5.2)
128
+ activesupport (>= 5.2)
129
+ railties (>= 5.2)
130
+ rspec-core (~> 3.10)
131
+ rspec-expectations (~> 3.10)
132
+ rspec-mocks (~> 3.10)
133
+ rspec-support (~> 3.10)
87
134
  rspec-sidekiq (3.1.0)
88
135
  rspec-core (~> 3.0, >= 3.0.0)
89
136
  sidekiq (>= 2.4.0)
90
- rspec-support (3.10.3)
137
+ rspec-support (3.11.0)
91
138
  ruby2_keywords (0.0.5)
92
- sidekiq (6.3.1)
139
+ sidekiq (6.4.1)
93
140
  connection_pool (>= 2.2.2)
94
141
  rack (~> 2.0)
95
142
  redis (>= 4.2.0)
@@ -123,6 +170,7 @@ PLATFORMS
123
170
  ruby
124
171
 
125
172
  DEPENDENCIES
173
+ activejob (>= 5.0.0)
126
174
  activesupport (~> 5.2.0)
127
175
  bundler (>= 1.6.0)
128
176
  coveralls (>= 0.8.22)
@@ -134,9 +182,10 @@ DEPENDENCIES
134
182
  resque (>= 1.25.2)
135
183
  resque_spec (>= 0.16.0)
136
184
  rspec
185
+ rspec-rails (>= 2.0)
137
186
  rspec-sidekiq (>= 2.1.0)
138
187
  sidekiq (>= 3.5.0)
139
188
  taskinator!
140
189
 
141
190
  BUNDLED WITH
142
- 2.2.14
191
+ 2.3.5
data/README.md CHANGED
@@ -1,9 +1,8 @@
1
1
  # Taskinator
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/taskinator.svg)](http://badge.fury.io/rb/taskinator)
4
- [![Build Status](https://secure.travis-ci.org/virtualstaticvoid/taskinator.png?branch=master)](http://travis-ci.org/virtualstaticvoid/taskinator)
4
+ [![Build Status](https://img.shields.io/github/workflow/status/virtualstaticvoid/taskinator/Taskinator?style=flat-square)](https://github.com/virtualstaticvoid/taskinator/actions)
5
5
  [![Code Climate](https://codeclimate.com/github/virtualstaticvoid/taskinator.png)](https://codeclimate.com/github/virtualstaticvoid/taskinator)
6
- [![Coverage Status](https://coveralls.io/repos/virtualstaticvoid/taskinator/badge.png)](https://coveralls.io/r/virtualstaticvoid/taskinator)
7
6
 
8
7
  A simple orchestration library for running complex processes or workflows in Ruby.
9
8
  Processes are defined using a simple DSL, where the sequences and tasks are defined.
@@ -13,6 +12,7 @@ and the overall process can be monitored for completion or failure.
13
12
  Processes and tasks are executed by background workers and you can use any one of the
14
13
  following gems:
15
14
 
15
+ * [active_job](https://github.com/rails/rails/tree/main/activejob)
16
16
  * [resque](https://github.com/resque/resque)
17
17
  * [sidekiq](https://github.com/mperham/sidekiq)
18
18
  * [delayed_job](https://github.com/collectiveidea/delayed_job)
@@ -22,8 +22,8 @@ Redis key/values.
22
22
 
23
23
  ## Requirements
24
24
 
25
- The latest MRI (2.1, 2.0) version. Other versions/VMs are untested but might work fine.
26
- MRI 1.9 is not supported.
25
+ The latest MRI 2.x or 3.x version. Other versions/VMs are untested, but might work fine.
26
+ MRI 1.x is not supported.
27
27
 
28
28
  Redis 2.4 or greater is required.
29
29
 
@@ -39,12 +39,34 @@ Add this line to your application's Gemfile:
39
39
 
40
40
  And then execute:
41
41
 
42
- $ bundle
42
+ $ bundle install
43
43
 
44
44
  Or install it yourself as:
45
45
 
46
46
  $ gem install taskinator
47
47
 
48
+ If you are using Taskinator within a Rails application, then add an initializer, such as
49
+ `config/initializers/taskinator.rb`, with the following configuration content:
50
+
51
+ ```ruby
52
+ # config/initializers/taskinator.rb
53
+ Taskinator.configure do |config|
54
+
55
+ # configure the queue adapter to use
56
+ # can be :active_job, :delayed_job, :redis or :sidekiq
57
+ config.queue_adapter = :redis
58
+
59
+ # configure redis
60
+ config.redis = {
61
+ :url => 'redis://redis.example.com:7372/12',
62
+ :namespace => 'mynamespace'
63
+ }
64
+
65
+ end
66
+ ```
67
+
68
+ See the configuration section below for more configuration details.
69
+
48
70
  ## Usage
49
71
 
50
72
  ### Definition
@@ -53,6 +75,7 @@ Start by creating a "process" module and extending `Taskinator::Definition`.
53
75
 
54
76
  ```ruby
55
77
  require 'taskinator'
78
+
56
79
  module MyProcess
57
80
  extend Taskinator::Definition
58
81
 
@@ -148,15 +171,16 @@ module MyProcess
148
171
  end
149
172
  ```
150
173
 
151
- It is likely that you already have worker classes for one of the queueing libraries,
152
- such as resque or delayed_job, and wish to reuse them for executing them in the sequence
153
- defined by the process definition.
174
+ #### Reusing ActiveJob jobs
175
+
176
+ It is likely that you already have one or more [jobs](https://guides.rubyonrails.org/active_job_basics.html)
177
+ and want to reuse them within the process definition.
154
178
 
155
- Define a `job` step, providing the class of the worker, and then taskinator will execute
156
- that worker as part of the process definition.
179
+ Define a `job` step, providing the class of the Active Job to run and then taskinator will
180
+ invoke that job as part of the process.
157
181
 
158
- The `job` step will be queued and executed on same queue as configured by `delayed_job`, or
159
- that of the worker for `resque` and `sidekiq`.
182
+ The `job` step will be queued and executed on same queue as
183
+ [configured by the job](https://guides.rubyonrails.org/active_job_basics.html#queues).
160
184
 
161
185
  ```ruby
162
186
  # E.g. A resque worker
@@ -180,6 +204,8 @@ module MyProcess
180
204
  end
181
205
  ```
182
206
 
207
+ #### Data Driven Process Definitions
208
+
183
209
  You can also define data driven tasks using the `for_each` method, which takes an iterator method
184
210
  name as an argument.
185
211
 
@@ -207,6 +233,8 @@ module MyProcess
207
233
  end
208
234
  ```
209
235
 
236
+ #### Branching
237
+
210
238
  It is possible to branch the process logic based on the options hash passed in when creating
211
239
  a process. The `options?` method takes the options key as an argument and calls the supplied
212
240
  block if the option is present and it's value is _truthy_.
@@ -243,6 +271,8 @@ process2 = MyProcess.create_process
243
271
  process2.tasks.count #=> 1
244
272
  ```
245
273
 
274
+ #### Transformations
275
+
246
276
  In addition, it is possible to transform the arguments used by a task or job, by including
247
277
  a `transform` step in the definition.
248
278
 
@@ -271,6 +301,8 @@ module MyProcess
271
301
  end
272
302
  ```
273
303
 
304
+ #### Subprocesses
305
+
274
306
  Processes can be composed of other processes too:
275
307
 
276
308
  ```ruby
@@ -292,6 +324,8 @@ module MyProcess
292
324
  end
293
325
  ```
294
326
 
327
+ #### Complex Process Definitions
328
+
295
329
  Any combination or nesting of `task`, `sequential`, `concurrent` and `for_each` steps are
296
330
  possible. E.g.
297
331
 
@@ -646,17 +680,20 @@ _NOTE:_ The configuration hash _must_ have symbolized keys.
646
680
 
647
681
  ```ruby
648
682
  Taskinator.configure do |config|
649
- config.redis = {
650
- :url => 'redis://redis.example.com:7372/12',
651
- :namespace => 'mynamespace'
652
- }
683
+
684
+ # redis configuration
685
+ config.redis = {
686
+ :url => 'redis://redis.example.com:7372/12',
687
+ :namespace => 'mynamespace'
688
+ }
689
+
653
690
  end
654
691
  ```
655
692
 
656
693
  Or, alternatively, via an `ENV` variable
657
694
 
658
695
  Set the `REDIS_PROVIDER` environment variable to the Redis server url.
659
- E.g. On Heroku, with RedisGreen: set REDIS_PROVIDER=REDISGREEN_URL and Taskinator will use the
696
+ E.g. On Heroku, with RedisGreen: set `REDIS_PROVIDER=REDISGREEN_URL` and Taskinator will use the
660
697
  value of the `REDISGREEN_URL` environment variable when connecting to Redis.
661
698
 
662
699
  You may also use the generic `REDIS_URL` which may be set to your own private Redis server.
@@ -667,15 +704,37 @@ wiki page for more information.
667
704
 
668
705
  ### Queues
669
706
 
707
+ To configure the queue adapter to use, set `config.queue_adapter` to one of the following values:
708
+
709
+ * `:active_job`
710
+ * `:delayed_job`
711
+ * `:redis`
712
+ * `:sidekiq`
713
+
714
+ As follows:
715
+
716
+ ```ruby
717
+ Taskinator.configure do |config|
718
+
719
+ # configure the queue adapter to use
720
+ # can be :active_job, :delayed_job, :redis or :sidekiq
721
+ config.queue_adapter = :redis
722
+
723
+ end
724
+ ```
725
+
670
726
  By default the queue names for process and task workers is `default`, however, you can specify
671
727
  the queue names as follows:
672
728
 
673
729
  ```ruby
674
730
  Taskinator.configure do |config|
731
+
732
+ # queue configuration
675
733
  config.queue_config = {
676
734
  :process_queue => :default,
677
735
  :task_queue => :default
678
736
  }
737
+
679
738
  end
680
739
  ```
681
740
 
@@ -686,7 +745,10 @@ as `ActiveSupport::Notifications`.
686
745
 
687
746
  ```ruby
688
747
  Taskinator.configure do |config|
748
+
749
+ # configure instrumenter to use
689
750
  config.instrumenter = ActiveSupport::Notifications
751
+
690
752
  end
691
753
  ```
692
754
 
@@ -694,7 +756,10 @@ Alternatively, you can use the built-in instrumenter for logging to the console
694
756
 
695
757
  ```ruby
696
758
  Taskinator.configure do |config|
759
+
760
+ # configure instrumenter to use
697
761
  config.instrumenter = Taskinator::ConsoleInstrumenter.new
762
+
698
763
  end
699
764
  ```
700
765
 
@@ -53,9 +53,9 @@ module Taskinator
53
53
 
54
54
  def save
55
55
  Taskinator.redis do |conn|
56
- conn.pipelined do
57
- visitor = RedisSerializationVisitor.new(conn, self).visit
58
- conn.hmset(
56
+ conn.pipelined do |pipeline|
57
+ visitor = RedisSerializationVisitor.new(pipeline, self).visit
58
+ pipeline.hmset(
59
59
  Taskinator::Process.key_for(uuid),
60
60
  :tasks_count, visitor.task_count,
61
61
  :tasks_failed, 0,
@@ -109,15 +109,15 @@ module Taskinator
109
109
  @updated_at = Time.now.utc
110
110
  Taskinator.redis do |conn|
111
111
  process_key = self.process_key
112
- conn.multi do
113
- conn.hmset(
112
+ conn.multi do |transaction|
113
+ transaction.hmset(
114
114
  self.key,
115
115
  :state, new_state,
116
116
  :updated_at, @updated_at
117
117
  )
118
118
 
119
119
  # also update the "root" process
120
- conn.hset(
120
+ transaction.hset(
121
121
  process_key,
122
122
  :updated_at, @updated_at
123
123
  )
@@ -178,9 +178,9 @@ module Taskinator
178
178
  define_method "incr_#{status}" do
179
179
  Taskinator.redis do |conn|
180
180
  process_key = self.process_key
181
- conn.multi do
182
- conn.hincrby process_key, "tasks_#{status}", 1
183
- conn.hset process_key, :updated_at, Time.now.utc
181
+ conn.multi do |transaction|
182
+ transaction.hincrby process_key, "tasks_#{status}", 1
183
+ transaction.hset process_key, :updated_at, Time.now.utc
184
184
  end
185
185
  end
186
186
  end
@@ -467,9 +467,9 @@ module Taskinator
467
467
 
468
468
  # pre-load all the attributes to reduce redis hits
469
469
  Taskinator.redis do |conn|
470
- keys, values = conn.multi do
471
- conn.hkeys(@key)
472
- conn.hvals(@key)
470
+ keys, values = conn.multi do |transaction|
471
+ transaction.hkeys(@key)
472
+ transaction.hvals(@key)
473
473
  end
474
474
  @attribute_values = Hash[keys.collect(&:to_sym).zip(values)]
475
475
  end
@@ -0,0 +1,53 @@
1
+ module Taskinator
2
+ module Queues
3
+
4
+ # https://guides.rubyonrails.org/active_job_basics.html
5
+
6
+ def self.create_active_job_adapter(config={})
7
+ ActiveJobAdapter.new(config)
8
+ end
9
+
10
+ class ActiveJobAdapter
11
+ def initialize(config={})
12
+ @config = Taskinator::Queues::DefaultConfig.merge(config)
13
+ end
14
+
15
+ def enqueue_create_process(definition, uuid, args)
16
+ queue = definition.queue || @config[:definition_queue]
17
+ CreateProcessWorker.set(:queue => queue)
18
+ .perform_later(definition.name, uuid, Taskinator::Persistence.serialize(args))
19
+ end
20
+
21
+ def enqueue_process(process)
22
+ queue = process.queue || @config[:process_queue]
23
+ ProcessWorker.set(:queue => queue)
24
+ .perform_later(process.uuid)
25
+ end
26
+
27
+ def enqueue_task(task)
28
+ queue = task.queue || @config[:task_queue]
29
+ TaskWorker.set(:queue => queue)
30
+ .perform_later(task.uuid)
31
+ end
32
+
33
+ class CreateProcessWorker < ApplicationJob
34
+ def perform(definition_name, uuid, args)
35
+ Taskinator::CreateProcessWorker.new(definition_name, uuid, args).perform
36
+ end
37
+ end
38
+
39
+ class ProcessWorker < ApplicationJob
40
+ def perform(process_uuid)
41
+ Taskinator::ProcessWorker.new(process_uuid).perform
42
+ end
43
+ end
44
+
45
+ class TaskWorker < ApplicationJob
46
+ def perform(task_uuid)
47
+ Taskinator::TaskWorker.new(task_uuid).perform
48
+ end
49
+ end
50
+
51
+ end
52
+ end
53
+ end
@@ -48,6 +48,7 @@ module Taskinator
48
48
  end
49
49
  end
50
50
 
51
+ require 'taskinator/queues/active_job' if defined?(ApplicationJob)
51
52
  require 'taskinator/queues/delayed_job' if defined?(Delayed)
52
53
  require 'taskinator/queues/resque' if defined?(Resque)
53
54
  require 'taskinator/queues/sidekiq' if defined?(Sidekiq)
@@ -1,3 +1,3 @@
1
1
  module Taskinator
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.7"
3
3
  end
data/lib/taskinator.rb CHANGED
@@ -98,7 +98,7 @@ module Taskinator
98
98
 
99
99
  # the queue adapter to use
100
100
  # supported adapters include
101
- # :delayed_job, :redis and :sidekiq
101
+ # :active_job, :delayed_job, :redis and :sidekiq
102
102
  # NOTE: ensure that the respective gem is included
103
103
  attr_reader :queue_adapter
104
104
 
@@ -118,7 +118,7 @@ module Taskinator
118
118
 
119
119
  def queue
120
120
  @queue ||= begin
121
- adapter = self.queue_adapter || :resque
121
+ adapter = self.queue_adapter || :resque # TODO: change default to :active_job
122
122
  config = queue_config || {}
123
123
  Taskinator::Queues.create_adapter(adapter, config)
124
124
  end
data/spec/spec_helper.rb CHANGED
@@ -27,6 +27,20 @@ require 'resque'
27
27
  require 'resque_spec'
28
28
  ResqueSpec.disable_ext = false
29
29
 
30
+ require 'active_job'
31
+
32
+ ActiveJob::Base.queue_adapter = :test
33
+
34
+ class ApplicationJob < ActiveJob::Base
35
+ queue_as :not_used
36
+ end
37
+
38
+ # minimum rails gems for rspec/rails
39
+ require 'action_view'
40
+ require 'action_dispatch'
41
+ require 'action_controller'
42
+ require 'rspec/rails'
43
+
30
44
  require 'taskinator'
31
45
 
32
46
  Taskinator.configure do |config|
@@ -17,8 +17,8 @@ describe Taskinator::Api, :redis => true do
17
17
  allow_any_instance_of(Process).to receive(:fetch) {}
18
18
 
19
19
  Taskinator.redis do |conn|
20
- conn.multi do
21
- 3.times {|i| conn.sadd(Taskinator::Persistence.processes_list_key, i) }
20
+ conn.multi do |transaction|
21
+ 3.times {|i| transaction.sadd(Taskinator::Persistence.processes_list_key, i) }
22
22
  end
23
23
  end
24
24
 
@@ -34,8 +34,8 @@ describe Taskinator::Api, :redis => true do
34
34
 
35
35
  it "yields the number of processes" do
36
36
  Taskinator.redis do |conn|
37
- conn.multi do
38
- 3.times {|i| conn.sadd(Taskinator::Persistence.processes_list_key, i) }
37
+ conn.multi do |transaction|
38
+ 3.times {|i| transaction.sadd(Taskinator::Persistence.processes_list_key, i) }
39
39
  end
40
40
  end
41
41
 
@@ -0,0 +1,80 @@
1
+ require 'spec_helper'
2
+
3
+ describe Taskinator::Queues::ActiveJobAdapter, :active_job do
4
+
5
+ it_should_behave_like "a queue adapter", :active_job, Taskinator::Queues::ActiveJobAdapter
6
+
7
+ let(:adapter) { Taskinator::Queues::ActiveJobAdapter }
8
+ let(:uuid) { Taskinator.generate_uuid }
9
+
10
+ subject { adapter.new }
11
+
12
+ describe "CreateProcessWorker" do
13
+ let(:args) { Taskinator::Persistence.serialize(:foo => :bar) }
14
+
15
+ it "enqueues" do
16
+ worker = adapter::CreateProcessWorker
17
+ definition = MockDefinition.create
18
+ subject.enqueue_create_process(definition, uuid, :foo => :bar)
19
+
20
+ expect(worker).to have_been_enqueued.with(definition.name, uuid, args)
21
+ end
22
+
23
+ it "enqueues to specified queue" do
24
+ worker = adapter::CreateProcessWorker
25
+ definition = MockDefinition.create(:other)
26
+
27
+ subject.enqueue_create_process(definition, uuid, :foo => :bar)
28
+
29
+ expect(worker).to have_been_enqueued.with(definition.name, uuid, args).on_queue(:other)
30
+ end
31
+
32
+ it "calls worker" do
33
+ expect_any_instance_of(Taskinator::CreateProcessWorker).to receive(:perform)
34
+ adapter::CreateProcessWorker.new.perform(MockDefinition.create.name, uuid, args)
35
+ end
36
+ end
37
+
38
+ describe "ProcessWorker" do
39
+ it "enqueues processes" do
40
+ worker = adapter::ProcessWorker
41
+ subject.enqueue_process(double('process', :uuid => uuid, :queue => nil))
42
+
43
+ expect(worker).to have_been_enqueued.with(uuid)
44
+ end
45
+
46
+ it "enqueues process to specified queue" do
47
+ worker = adapter::ProcessWorker
48
+ subject.enqueue_process(double('process', :uuid => uuid, :queue => :other))
49
+
50
+ expect(worker).to have_been_enqueued.with(uuid).on_queue(:other)
51
+ end
52
+
53
+ it "calls process worker" do
54
+ expect_any_instance_of(Taskinator::ProcessWorker).to receive(:perform)
55
+ adapter::ProcessWorker.new.perform(uuid)
56
+ end
57
+ end
58
+
59
+ describe "TaskWorker" do
60
+ it "enqueues tasks" do
61
+ worker = adapter::TaskWorker
62
+ subject.enqueue_task(double('task', :uuid => uuid, :queue => nil))
63
+
64
+ expect(worker).to have_been_enqueued.with(uuid)
65
+ end
66
+
67
+ it "enqueues task to specified queue" do
68
+ worker = adapter::TaskWorker
69
+ subject.enqueue_task(double('task', :uuid => uuid, :queue => :other))
70
+
71
+ expect(worker).to have_been_enqueued.with(uuid).on_queue(:other)
72
+ end
73
+
74
+ it "calls task worker" do
75
+ expect_any_instance_of(Taskinator::TaskWorker).to receive(:perform)
76
+ adapter::TaskWorker.new.perform(uuid)
77
+ end
78
+ end
79
+
80
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Stefano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-14 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -131,13 +131,17 @@ executables:
131
131
  extensions: []
132
132
  extra_rdoc_files: []
133
133
  files:
134
- - ".coveralls.yml"
134
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
135
+ - ".github/ISSUE_TEMPLATE/custom.md"
136
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
137
+ - ".github/workflows/taskinator.yml"
135
138
  - ".gitignore"
136
139
  - ".rspec"
137
140
  - ".ruby-gemset"
138
141
  - ".ruby-version"
139
- - ".travis.yml"
140
142
  - CHANGELOG.md
143
+ - CODE_OF_CONDUCT.md
144
+ - CONTRIBUTING.md
141
145
  - Gemfile
142
146
  - Gemfile.lock
143
147
  - LICENSE.txt
@@ -159,6 +163,7 @@ files:
159
163
  - lib/taskinator/process.rb
160
164
  - lib/taskinator/process_worker.rb
161
165
  - lib/taskinator/queues.rb
166
+ - lib/taskinator/queues/active_job.rb
162
167
  - lib/taskinator/queues/delayed_job.rb
163
168
  - lib/taskinator/queues/resque.rb
164
169
  - lib/taskinator/queues/sidekiq.rb
@@ -200,6 +205,7 @@ files:
200
205
  - spec/taskinator/persistence_spec.rb
201
206
  - spec/taskinator/process_spec.rb
202
207
  - spec/taskinator/process_worker_spec.rb
208
+ - spec/taskinator/queues/active_job_spec.rb
203
209
  - spec/taskinator/queues/delayed_job_spec.rb
204
210
  - spec/taskinator/queues/resque_spec.rb
205
211
  - spec/taskinator/queues/sidekiq_spec.rb
@@ -232,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
238
  - !ruby/object:Gem::Version
233
239
  version: '0'
234
240
  requirements: []
235
- rubygems_version: 3.2.3
241
+ rubygems_version: 3.1.6
236
242
  signing_key:
237
243
  specification_version: 4
238
244
  summary: A simple orchestration library for running complex processes or workflows
@@ -266,6 +272,7 @@ test_files:
266
272
  - spec/taskinator/persistence_spec.rb
267
273
  - spec/taskinator/process_spec.rb
268
274
  - spec/taskinator/process_worker_spec.rb
275
+ - spec/taskinator/queues/active_job_spec.rb
269
276
  - spec/taskinator/queues/delayed_job_spec.rb
270
277
  - spec/taskinator/queues/resque_spec.rb
271
278
  - spec/taskinator/queues/sidekiq_spec.rb
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- os: linux
2
- dist: xenial
3
- language: ruby
4
- cache: bundler
5
-
6
- services:
7
- - redis
8
-
9
- rvm:
10
- - 2.5.8
11
- - 2.6.6
12
- - 2.7.2
13
- - 3.0.0
14
-
15
- script: 'bundle exec rake spec'
16
-
17
- notifications:
18
- email:
19
- recipients:
20
- - virtualstaticvoid@gmail.com
21
- on_failure: change
22
- on_success: never
23
-