trailblazer-macro 2.1.0.beta4 → 2.1.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +6 -0
- data/Gemfile +2 -3
- data/lib/trailblazer-macro.rb +2 -0
- data/lib/trailblazer/macro.rb +0 -1
- data/lib/trailblazer/macro/version.rb +1 -1
- data/lib/trailblazer/operation/model.rb +5 -9
- data/lib/trailblazer/operation/nested.rb +3 -3
- data/lib/trailblazer/operation/policy.rb +1 -1
- data/test/docs/guard_test.rb +0 -2
- data/test/test_helper.rb +1 -6
- data/trailblazer-macro.gemspec +1 -6
- metadata +6 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00614cb0bcb127cf89ff6c1e199fa6fc8f080ac7492a41155adfb9c90a4b55bd
|
4
|
+
data.tar.gz: 84d68e15a27452b1833679ff80f898f3158f908222ed2aa6a8fa288dc22b474d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c348fb564c7d873c716886c4764a7297d654acb1f31bfadc3568e5b2110ad01a3d6f12ade831db98c4ceae9e44a7fcd02a29ed8ab0aea533a6a546ab344d16f8
|
7
|
+
data.tar.gz: cc6be5f0b0b0ec3f5499dcfaaa846e4ef0d9afb8aa818e7ccaf02798a997f0b796d396acd2de05be4a1f7de16e4da975f603cf1a9e859e4c6d8523575c8c38dc
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -4,11 +4,10 @@ source 'https://rubygems.org'
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
# gem "trailblazer", github: "trailblazer/trailblazer"
|
7
|
+
# gem "trailblazer-activity", path: "../trailblazer-activity"
|
7
8
|
# gem "trailblazer-operation", path: "../operation"
|
8
|
-
# gem "trailblazer-
|
9
|
-
gem "trailblazer-activity"#, github: "trailblazer/trailblazer-activity"
|
9
|
+
# gem "trailblazer-activity"#, github: "trailblazer/trailblazer-activity"
|
10
10
|
# gem "trailblazer-macro-contract", git: "https://github.com/trailblazer/trailblazer-macro-contract"
|
11
|
-
gem "trailblazer-macro-contract", path: "../trailblazer-macro-contract"
|
12
11
|
|
13
12
|
gem "minitest-line"
|
14
13
|
gem "rubocop", require: false
|
data/lib/trailblazer/macro.rb
CHANGED
@@ -10,7 +10,7 @@ class Trailblazer::Operation
|
|
10
10
|
)
|
11
11
|
)
|
12
12
|
|
13
|
-
{ task: task, id: "model.build", extension
|
13
|
+
{ task: task, id: "model.build", Trailblazer::Activity::DSL::Extension.new(extension) => true }
|
14
14
|
end
|
15
15
|
|
16
16
|
class Model
|
@@ -27,7 +27,7 @@ class Trailblazer::Operation
|
|
27
27
|
action = options["model.action"] || :new
|
28
28
|
model_class = options["model.class"]
|
29
29
|
find_by_key = options["model.find_by_key"] || :id
|
30
|
-
action = :pass_through unless %i[new find_by
|
30
|
+
action = :pass_through unless %i[new find_by].include?(action)
|
31
31
|
|
32
32
|
send("#{action}!", model_class, params, options["model.action"], find_by_key)
|
33
33
|
end
|
@@ -36,18 +36,14 @@ class Trailblazer::Operation
|
|
36
36
|
model_class.new
|
37
37
|
end
|
38
38
|
|
39
|
-
def find!(model_class, params, *)
|
40
|
-
model_class.find(params[:id])
|
41
|
-
end
|
42
|
-
|
43
39
|
# Doesn't throw an exception and will return false to divert to Left.
|
44
40
|
def find_by!(model_class, params, action, find_by_key, *)
|
45
41
|
model_class.find_by(find_by_key.to_sym => params[find_by_key])
|
46
42
|
end
|
47
43
|
|
48
|
-
# Call any method on the model class and pass :id.
|
49
|
-
def pass_through!(model_class, params, action, *)
|
50
|
-
model_class.send(action, params[
|
44
|
+
# Call any method on the model class and pass find_by_key, for example find(params[:id]).
|
45
|
+
def pass_through!(model_class, params, action, find_by_key, *)
|
46
|
+
model_class.send(action, params[find_by_key])
|
51
47
|
end
|
52
48
|
end
|
53
49
|
end
|
@@ -22,7 +22,7 @@ module Trailblazer
|
|
22
22
|
{
|
23
23
|
task: task,
|
24
24
|
id: id,
|
25
|
-
|
25
|
+
Trailblazer::Activity::DSL::Extension.new(Trailblazer::Activity::TaskWrap::Merge.new(task_wrap_extensions)) => true,
|
26
26
|
outputs: operation.outputs
|
27
27
|
}
|
28
28
|
end
|
@@ -36,7 +36,7 @@ module Trailblazer
|
|
36
36
|
# The returned {Nested} instance is a valid circuit element and will be `call`ed in the circuit.
|
37
37
|
# It simply returns the nested activity's `signal,options,flow_options` return set.
|
38
38
|
# The actual wiring - where to go with that - is done by the step DSL.
|
39
|
-
return
|
39
|
+
return nested_operation, nested_operation, false
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.nestable_object?(object)
|
@@ -71,7 +71,7 @@ module Trailblazer
|
|
71
71
|
|
72
72
|
# Overwrite :task so task_wrap.call_task will call this activity.
|
73
73
|
# This is a trick so we don't have to repeat logic from #call_task here.
|
74
|
-
wrap_ctx[:task] =
|
74
|
+
wrap_ctx[:task] = activity
|
75
75
|
|
76
76
|
return Activity::Right, [wrap_ctx, original_args]
|
77
77
|
end
|
data/test/docs/guard_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
require "pp"
|
2
|
+
require "delegate" # Ruby 2.2
|
2
3
|
require "trailblazer/macro"
|
3
4
|
require "minitest/autorun"
|
4
5
|
|
5
|
-
require "reform"
|
6
|
-
require "reform/form/active_model/validations"
|
7
|
-
Reform::Form.class_eval do
|
8
|
-
include Reform::Form::ActiveModel::Validations
|
9
|
-
end
|
10
|
-
|
11
6
|
module Mock
|
12
7
|
class Result
|
13
8
|
def initialize(bool); @bool = bool end
|
data/trailblazer-macro.gemspec
CHANGED
@@ -19,14 +19,9 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler"
|
21
21
|
|
22
|
-
spec.add_development_dependency "trailblazer-operation", ">= 0.
|
23
|
-
spec.add_development_dependency "trailblazer-macro-contract", ">= 2.1.0.beta1", "< 2.2.0"
|
24
|
-
|
25
|
-
spec.add_development_dependency "reform"
|
26
|
-
spec.add_development_dependency "reform-rails"
|
22
|
+
spec.add_development_dependency "trailblazer-operation", ">= 0.3.0", "< 0.4.0"
|
27
23
|
|
28
24
|
spec.add_development_dependency "minitest"
|
29
|
-
spec.add_development_dependency "nokogiri"
|
30
25
|
spec.add_development_dependency "rake"
|
31
26
|
|
32
27
|
spec.add_development_dependency "roar"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailblazer-macro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0.
|
4
|
+
version: 2.1.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-03
|
12
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -30,69 +30,21 @@ dependencies:
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 0.2.5
|
35
|
-
- - "<"
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 0.3.0
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 0.2.5
|
45
|
-
- - "<"
|
46
33
|
- !ruby/object:Gem::Version
|
47
34
|
version: 0.3.0
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: trailblazer-macro-contract
|
50
|
-
requirement: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 2.1.0.beta1
|
55
35
|
- - "<"
|
56
36
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
37
|
+
version: 0.4.0
|
58
38
|
type: :development
|
59
39
|
prerelease: false
|
60
40
|
version_requirements: !ruby/object:Gem::Requirement
|
61
41
|
requirements:
|
62
42
|
- - ">="
|
63
43
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
44
|
+
version: 0.3.0
|
65
45
|
- - "<"
|
66
46
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
68
|
-
- !ruby/object:Gem::Dependency
|
69
|
-
name: reform
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
75
|
-
type: :development
|
76
|
-
prerelease: false
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: reform-rails
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
89
|
-
type: :development
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
47
|
+
version: 0.4.0
|
96
48
|
- !ruby/object:Gem::Dependency
|
97
49
|
name: minitest
|
98
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -107,20 +59,6 @@ dependencies:
|
|
107
59
|
- - ">="
|
108
60
|
- !ruby/object:Gem::Version
|
109
61
|
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: nokogiri
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
requirements:
|
114
|
-
- - ">="
|
115
|
-
- !ruby/object:Gem::Version
|
116
|
-
version: '0'
|
117
|
-
type: :development
|
118
|
-
prerelease: false
|
119
|
-
version_requirements: !ruby/object:Gem::Requirement
|
120
|
-
requirements:
|
121
|
-
- - ">="
|
122
|
-
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
124
62
|
- !ruby/object:Gem::Dependency
|
125
63
|
name: rake
|
126
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,6 +119,7 @@ files:
|
|
181
119
|
- LICENSE.txt
|
182
120
|
- README.md
|
183
121
|
- Rakefile
|
122
|
+
- lib/trailblazer-macro.rb
|
184
123
|
- lib/trailblazer/macro.rb
|
185
124
|
- lib/trailblazer/macro/version.rb
|
186
125
|
- lib/trailblazer/operation/guard.rb
|