interactor_with_steroids 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.standard.yml +4 -0
- data/.travis.yml +37 -0
- data/CHANGELOG.md +50 -0
- data/CONTRIBUTING.md +49 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +22 -0
- data/README.md +602 -0
- data/Rakefile +7 -0
- data/interactor.gemspec +20 -0
- data/lib/interactor/context.rb +139 -0
- data/lib/interactor/declaration.rb +85 -0
- data/lib/interactor/error.rb +31 -0
- data/lib/interactor/hooks.rb +263 -0
- data/lib/interactor/organizer.rb +69 -0
- data/lib/interactor.rb +158 -0
- data/spec/interactor/context_spec.rb +141 -0
- data/spec/interactor/declaration_spec.rb +116 -0
- data/spec/interactor/hooks_spec.rb +358 -0
- data/spec/interactor/organizer_spec.rb +60 -0
- data/spec/interactor_spec.rb +127 -0
- data/spec/spec_helper.rb +6 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a01fa569ccb55a7a8c0c84cf3083e2f5a8eb43b34f1259494e9e0e2bce1efea5
|
4
|
+
data.tar.gz: 78dd08e37856356eca03ec1bd1c6ebf1c371f9222fe7711bf72acc31b5ededf0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3087d4c955abb3b8c7f6e0baa067826e47504ad2aab8623daaffca2058ef37864e5c9bb9899693cf1cd24f6bda626fb926c91e5aea52502270a2976472c45ad
|
7
|
+
data.tar.gz: c8012d42a398afd2340d5ec00cf30f7c9116bdf4be3ab7c48d4bb521a44cfd540fe206af7a3de3bf99013fcc638161a9bdc77c6a87967d13fd27acad3319570c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.standard.yml
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
after_success:
|
2
|
+
- bundle exec codeclimate-test-reporter
|
3
|
+
before_install:
|
4
|
+
- gem update bundler rake
|
5
|
+
branches:
|
6
|
+
only:
|
7
|
+
- master
|
8
|
+
- v3
|
9
|
+
env:
|
10
|
+
global:
|
11
|
+
- secure: | # CODECLIMATE_REPO_TOKEN
|
12
|
+
BIemhM273wHZMpuULDMYGPsxYdfw+NMw7IQbOD6gy5r+dha07y9ssTYYE5Gn
|
13
|
+
t1ptAb09lhQ4gexXTr83i6angMrnHgQ1ZX2wfeoZ0FvWDHQht9YkXyiNH+R6
|
14
|
+
odHUeDIYAlUiqLX9nAkklL89Rc22BrHMGGNyuA8Uc5sktW5P/FE=
|
15
|
+
language: ruby
|
16
|
+
matrix:
|
17
|
+
allow_failures:
|
18
|
+
- rvm: "2.0"
|
19
|
+
- rvm: "2.1"
|
20
|
+
- rvm: "2.2"
|
21
|
+
- rvm: ruby-head
|
22
|
+
notifications:
|
23
|
+
webhooks:
|
24
|
+
on_start: always
|
25
|
+
urls:
|
26
|
+
- http://buildlight.collectiveidea.com/
|
27
|
+
rvm:
|
28
|
+
- "2.0"
|
29
|
+
- "2.1"
|
30
|
+
- "2.2"
|
31
|
+
- "2.3"
|
32
|
+
- "2.4"
|
33
|
+
- "2.5"
|
34
|
+
- "2.6"
|
35
|
+
- "2.7"
|
36
|
+
- ruby-head
|
37
|
+
script: bundle exec rake
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
## 3.1.2 / 2019-12-29
|
2
|
+
* [BUGFIX] Fix Context#fail! on Ruby 2.7
|
3
|
+
|
4
|
+
## 3.1.1 / 2018-05-30
|
5
|
+
|
6
|
+
* [BUGFIX] Allow Context#fail! to accept a hash with string keys
|
7
|
+
* [ENHANCEMENT] Many documentation updates
|
8
|
+
|
9
|
+
## 3.1.0 / 2014-10-13
|
10
|
+
|
11
|
+
* [FEATURE] Add around hooks
|
12
|
+
|
13
|
+
## 3.0.1 / 2014-09-09
|
14
|
+
|
15
|
+
* [ENHANCEMENT] Add TomDoc code documentation
|
16
|
+
|
17
|
+
## 3.0.0 / 2014-09-07
|
18
|
+
|
19
|
+
* [FEATURE] Remove "magical" access to the context through the interactor
|
20
|
+
* [FEATURE] Manage context values via setters/getters rather than hash access
|
21
|
+
* [FEATURE] Change the primary interactor API method from "perform" to "call"
|
22
|
+
* [FEATURE] Return the mutated context rather than the interactor instance
|
23
|
+
* [FEATURE] Replace interactor setup with before and after hooks
|
24
|
+
* [FEATURE] Abort execution immediately upon interactor failure
|
25
|
+
* [ENHANCEMENT] Build a suite of realistic integration tests
|
26
|
+
* [ENHANCEMENT] Move rollback responsibility into the context
|
27
|
+
|
28
|
+
## 2.1.1 / 2014-09-30
|
29
|
+
|
30
|
+
* [FEATURE] Halt performance if the interactor fails prior
|
31
|
+
* [ENHANCEMENT] Add support for Ruby 2.1
|
32
|
+
|
33
|
+
## 2.1.0 / 2013-09-05
|
34
|
+
|
35
|
+
* [FEATURE] Roll back when an interactor within an organizer raises an error
|
36
|
+
* [BUGFIX] Ensure that context-deferred methods respect string keys
|
37
|
+
* [FEATURE] Respect context initialization from an indifferent access hash
|
38
|
+
|
39
|
+
## 2.0.1 / 2013-08-28
|
40
|
+
|
41
|
+
* [BUGFIX] Allow YAML (de)serialization by fixing interactor allocation
|
42
|
+
|
43
|
+
## 2.0.0 / 2013-08-19
|
44
|
+
|
45
|
+
* [BUGFIX] Fix rollback behavior within nested organizers
|
46
|
+
* [BUGFIX] Skip rollback for the failed interactor
|
47
|
+
|
48
|
+
## 1.0.0 / 2013-08-17
|
49
|
+
|
50
|
+
* Initial release!
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributing to Interactor
|
2
|
+
|
3
|
+
Interactor is open source and contributions from the community are encouraged!
|
4
|
+
No contribution is too small.
|
5
|
+
|
6
|
+
Please consider:
|
7
|
+
|
8
|
+
* adding a feature
|
9
|
+
* squashing a bug
|
10
|
+
* writing [documentation](http://tomdoc.org)
|
11
|
+
* reporting an issue
|
12
|
+
* fixing a typo
|
13
|
+
* correcting [style](https://github.com/styleguide/ruby)
|
14
|
+
|
15
|
+
## How do I contribute?
|
16
|
+
|
17
|
+
For the best chance of having your changes merged, please:
|
18
|
+
|
19
|
+
1. [Fork](https://github.com/collectiveidea/interactor/fork) the project.
|
20
|
+
2. [Write](http://en.wikipedia.org/wiki/Test-driven_development) a failing test.
|
21
|
+
3. [Commit](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) changes that fix the tests.
|
22
|
+
4. [Submit](https://github.com/collectiveidea/interactor/pulls) a pull request with *at least* one animated GIF.
|
23
|
+
5. Be patient.
|
24
|
+
|
25
|
+
If your proposed changes only affect documentation, include the following on a
|
26
|
+
new line in each of your commit messages:
|
27
|
+
|
28
|
+
```
|
29
|
+
[ci skip]
|
30
|
+
```
|
31
|
+
|
32
|
+
This will signal [Travis](https://travis-ci.org) that running the test suite is
|
33
|
+
not necessary for these changes.
|
34
|
+
|
35
|
+
## Bug Reports
|
36
|
+
|
37
|
+
If you are experiencing unexpected behavior and, after having read Interactor's
|
38
|
+
documentation, are convinced this behavior is a bug, please:
|
39
|
+
|
40
|
+
1. [Search](https://github.com/collectiveidea/interactor/issues) existing issues.
|
41
|
+
2. Collect enough information to reproduce the issue:
|
42
|
+
* Interactor version
|
43
|
+
* Ruby version
|
44
|
+
* Rails version (if applicable)
|
45
|
+
* Specific setup conditions
|
46
|
+
* Description of expected behavior
|
47
|
+
* Description of actual behavior
|
48
|
+
3. [Submit](https://github.com/collectiveidea/interactor/issues/new) an issue.
|
49
|
+
4. Be patient.
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Collective Idea
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|