trailblazer-macro 2.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rubocop.yml +16 -0
- data/.rubocop_todo.yml +642 -0
- data/.travis.yml +15 -0
- data/CHANGES.md +3 -0
- data/COMM-LICENSE +91 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +9 -0
- data/README.md +5 -0
- data/Rakefile +13 -0
- data/lib/trailblazer/macro.rb +13 -0
- data/lib/trailblazer/macro/version.rb +5 -0
- data/lib/trailblazer/operation/guard.rb +18 -0
- data/lib/trailblazer/operation/input_output.rb +28 -0
- data/lib/trailblazer/operation/model.rb +52 -0
- data/lib/trailblazer/operation/nested.rb +90 -0
- data/lib/trailblazer/operation/policy.rb +44 -0
- data/lib/trailblazer/operation/pundit.rb +38 -0
- data/lib/trailblazer/operation/rescue.rb +42 -0
- data/lib/trailblazer/operation/wrap.rb +83 -0
- data/test/docs/guard_test.rb +162 -0
- data/test/docs/macro_test.rb +36 -0
- data/test/docs/model_test.rb +75 -0
- data/test/docs/nested_test.rb +113 -0
- data/test/docs/pundit_test.rb +133 -0
- data/test/docs/rescue_test.rb +126 -0
- data/test/docs/wrap_test.rb +274 -0
- data/test/lib/methods.rb +25 -0
- data/test/operation/model_test.rb +54 -0
- data/test/operation/nested_test.rb +293 -0
- data/test/operation/pundit_test.rb +106 -0
- data/test/test_helper.rb +39 -0
- data/trailblazer-macro.gemspec +36 -0
- metadata +243 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "pp"
|
2
|
+
require "trailblazer/macro"
|
3
|
+
require "minitest/autorun"
|
4
|
+
|
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
|
+
module Mock
|
12
|
+
class Result
|
13
|
+
def initialize(bool); @bool = bool end
|
14
|
+
def success?; @bool end
|
15
|
+
def errors; ["hihi"] end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
module Test
|
20
|
+
module ReturnCall
|
21
|
+
def self.included(includer)
|
22
|
+
includer._insert :_insert, ReturnResult, {replace: Trailblazer::Operation::Result::Build}, ReturnResult, ""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
ReturnResult = ->(last, input, options) { input }
|
26
|
+
end
|
27
|
+
|
28
|
+
require "pp"
|
29
|
+
|
30
|
+
Minitest::Spec::Operation = Trailblazer::Operation
|
31
|
+
|
32
|
+
Memo = Struct.new(:id, :body) do
|
33
|
+
def self.find(id)
|
34
|
+
return new(id, "Yo!") if id
|
35
|
+
nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
require_relative "lib/methods"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'trailblazer/macro/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "trailblazer-macro"
|
7
|
+
spec.version = Trailblazer::Macro::VERSION
|
8
|
+
spec.authors = ["Nick Sutterer", "Marc Tich"]
|
9
|
+
spec.email = ["apotonick@gmail.com", "marc@mudsu.com"]
|
10
|
+
spec.description = "Macros for Trailblazer's operation"
|
11
|
+
spec.summary = "Macros for Trailblazer's operation: Policy, Wrap, Rescue and more."
|
12
|
+
spec.homepage = "http://trailblazer.to"
|
13
|
+
spec.license = "LGPL-3.0"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler"
|
21
|
+
|
22
|
+
spec.add_development_dependency "trailblazer-operation", ">= 0.2.4", "< 0.3.0"
|
23
|
+
spec.add_development_dependency "trailblazer-macro-contract", ">= 2.1.0.beta4", "< 2.2.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "reform"
|
26
|
+
spec.add_development_dependency "reform-rails"
|
27
|
+
|
28
|
+
spec.add_development_dependency "minitest"
|
29
|
+
spec.add_development_dependency "nokogiri"
|
30
|
+
spec.add_development_dependency "rake"
|
31
|
+
|
32
|
+
spec.add_development_dependency "roar"
|
33
|
+
spec.add_development_dependency "multi_json"
|
34
|
+
|
35
|
+
spec.required_ruby_version = ">= 2.0.0"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trailblazer-macro
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.0.beta1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Sutterer
|
8
|
+
- Marc Tich
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: trailblazer-operation
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.2.4
|
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.4
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
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.beta4
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 2.2.0
|
58
|
+
type: :development
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 2.1.0.beta4
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 2.2.0
|
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'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: minitest
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
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
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: rake
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: roar
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - ">="
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0'
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
- !ruby/object:Gem::Dependency
|
153
|
+
name: multi_json
|
154
|
+
requirement: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
type: :development
|
160
|
+
prerelease: false
|
161
|
+
version_requirements: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
description: Macros for Trailblazer's operation
|
167
|
+
email:
|
168
|
+
- apotonick@gmail.com
|
169
|
+
- marc@mudsu.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- ".rubocop.yml"
|
176
|
+
- ".rubocop_todo.yml"
|
177
|
+
- ".travis.yml"
|
178
|
+
- CHANGES.md
|
179
|
+
- COMM-LICENSE
|
180
|
+
- Gemfile
|
181
|
+
- LICENSE.txt
|
182
|
+
- README.md
|
183
|
+
- Rakefile
|
184
|
+
- lib/trailblazer/macro.rb
|
185
|
+
- lib/trailblazer/macro/version.rb
|
186
|
+
- lib/trailblazer/operation/guard.rb
|
187
|
+
- lib/trailblazer/operation/input_output.rb
|
188
|
+
- lib/trailblazer/operation/model.rb
|
189
|
+
- lib/trailblazer/operation/nested.rb
|
190
|
+
- lib/trailblazer/operation/policy.rb
|
191
|
+
- lib/trailblazer/operation/pundit.rb
|
192
|
+
- lib/trailblazer/operation/rescue.rb
|
193
|
+
- lib/trailblazer/operation/wrap.rb
|
194
|
+
- test/docs/guard_test.rb
|
195
|
+
- test/docs/macro_test.rb
|
196
|
+
- test/docs/model_test.rb
|
197
|
+
- test/docs/nested_test.rb
|
198
|
+
- test/docs/pundit_test.rb
|
199
|
+
- test/docs/rescue_test.rb
|
200
|
+
- test/docs/wrap_test.rb
|
201
|
+
- test/lib/methods.rb
|
202
|
+
- test/operation/model_test.rb
|
203
|
+
- test/operation/nested_test.rb
|
204
|
+
- test/operation/pundit_test.rb
|
205
|
+
- test/test_helper.rb
|
206
|
+
- trailblazer-macro.gemspec
|
207
|
+
homepage: http://trailblazer.to
|
208
|
+
licenses:
|
209
|
+
- LGPL-3.0
|
210
|
+
metadata: {}
|
211
|
+
post_install_message:
|
212
|
+
rdoc_options: []
|
213
|
+
require_paths:
|
214
|
+
- lib
|
215
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
+
requirements:
|
217
|
+
- - ">="
|
218
|
+
- !ruby/object:Gem::Version
|
219
|
+
version: 2.0.0
|
220
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
221
|
+
requirements:
|
222
|
+
- - ">"
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: 1.3.1
|
225
|
+
requirements: []
|
226
|
+
rubyforge_project:
|
227
|
+
rubygems_version: 2.7.3
|
228
|
+
signing_key:
|
229
|
+
specification_version: 4
|
230
|
+
summary: 'Macros for Trailblazer''s operation: Policy, Wrap, Rescue and more.'
|
231
|
+
test_files:
|
232
|
+
- test/docs/guard_test.rb
|
233
|
+
- test/docs/macro_test.rb
|
234
|
+
- test/docs/model_test.rb
|
235
|
+
- test/docs/nested_test.rb
|
236
|
+
- test/docs/pundit_test.rb
|
237
|
+
- test/docs/rescue_test.rb
|
238
|
+
- test/docs/wrap_test.rb
|
239
|
+
- test/lib/methods.rb
|
240
|
+
- test/operation/model_test.rb
|
241
|
+
- test/operation/nested_test.rb
|
242
|
+
- test/operation/pundit_test.rb
|
243
|
+
- test/test_helper.rb
|