porch 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/porch/context.rb +4 -4
- data/lib/porch/errors/context_stopped_error.rb +9 -0
- data/lib/porch/errors.rb +1 -0
- data/lib/porch/executable_step_decorator.rb +6 -1
- data/lib/porch/version.rb +1 -1
- data/pkg/porch-0.1.0.gem +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca5b85da7d6e9f54bdb5474e15320cdb7eb5045
|
4
|
+
data.tar.gz: fa4803e50502d7bc92816de9857a05c82ec49d2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4be1ef22ded594338c326c1623d9d3dd74f2bece271514f426cc7e4870bb7db059f72e6e430d24c4dabfe2c79b1a4273ccc239bbfa4c4c84101196488f2c6894
|
7
|
+
data.tar.gz: 83dfc12f0b384a384faa0b9023234d64c0d83b1f2774772de23886ed20026288d12d5574f97254029433dd6dbc8d7eccab706f914412471f6e5f092ac6534e79
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Porch
|
2
2
|
======
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/porch.svg)](https://badge.fury.io/rb/porch)
|
5
|
+
|
4
6
|
[ ![Codeship Status for jwright/porch](https://app.codeship.com/projects/8780ad70-b5ae-0134-fb0d-62cbe9f5cc84/status?branch=master)](https://app.codeship.com/projects/194128)
|
5
7
|
|
6
8
|
A simple service layer pattern for plain old Ruby objects.
|
@@ -125,7 +127,7 @@ module Services
|
|
125
127
|
def register
|
126
128
|
with(attributes) do |chain|
|
127
129
|
# ...
|
128
|
-
chain.add
|
130
|
+
chain.add do |context|
|
129
131
|
UserMailer.welcome(context.user).deliver_later
|
130
132
|
end
|
131
133
|
# ...
|
data/lib/porch/context.rb
CHANGED
@@ -20,7 +20,7 @@ module Porch
|
|
20
20
|
def fail!(message="")
|
21
21
|
@message = message
|
22
22
|
@success = false
|
23
|
-
|
23
|
+
raise Porch::ContextStoppedError.new(self)
|
24
24
|
end
|
25
25
|
|
26
26
|
def failure?
|
@@ -34,7 +34,7 @@ module Porch
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def guard!(&block)
|
37
|
-
result =
|
37
|
+
result = Guard.new(self).against(&block)
|
38
38
|
fail!(HumanError.new(result.errors).message) if result.failure?
|
39
39
|
result
|
40
40
|
end
|
@@ -48,9 +48,9 @@ module Porch
|
|
48
48
|
!!@skip_remaining
|
49
49
|
end
|
50
50
|
|
51
|
-
def skip_remaining!
|
51
|
+
def skip_remaining!
|
52
52
|
@skip_remaining = true
|
53
|
-
|
53
|
+
raise Porch::ContextStoppedError.new(self)
|
54
54
|
end
|
55
55
|
|
56
56
|
def success?
|
data/lib/porch/errors.rb
CHANGED
@@ -16,7 +16,12 @@ module Porch
|
|
16
16
|
|
17
17
|
def execute(context)
|
18
18
|
catch :stop_current_step_execution do
|
19
|
-
|
19
|
+
begin
|
20
|
+
decorated_step.execute context
|
21
|
+
rescue Porch::ContextStoppedError => e
|
22
|
+
# this exception is just used for flow control
|
23
|
+
e.context
|
24
|
+
end
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
data/lib/porch/version.rb
CHANGED
data/pkg/porch-0.1.0.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: porch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Wright
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-validation
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/porch/core_ext.rb
|
87
87
|
- lib/porch/core_ext/string.rb
|
88
88
|
- lib/porch/errors.rb
|
89
|
+
- lib/porch/errors/context_stopped_error.rb
|
89
90
|
- lib/porch/errors/invalid_step_type_error.rb
|
90
91
|
- lib/porch/executable_step_decorator.rb
|
91
92
|
- lib/porch/guard_rail.rb
|
@@ -97,6 +98,7 @@ files:
|
|
97
98
|
- lib/porch/step_decorators/method_step_decorator.rb
|
98
99
|
- lib/porch/step_decorators/proc_step_decorator.rb
|
99
100
|
- lib/porch/version.rb
|
101
|
+
- pkg/porch-0.1.0.gem
|
100
102
|
- porch.gemspec
|
101
103
|
homepage: https://github.com/jwright/porch
|
102
104
|
licenses:
|