polist 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rspec +1 -0
- data/.rubocop.yml +4 -203
- data/.travis.yml +22 -3
- data/README.md +14 -1
- data/Rakefile +1 -1
- data/lib/polist/service.rb +5 -4
- data/lib/polist/version.rb +1 -1
- data/polist.gemspec +7 -5
- metadata +50 -24
- data/bin/console +0 -15
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 73c8e323de7cb71b6b39441dd95abf7fbccb8de9cb391790faf2fde7f7f4a20a
|
4
|
+
data.tar.gz: a281f80553b3db467785bd1a2c04701a428c8dac372658369b8ddae8b5cc22b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af97512d4e3f8b135369ce37dedc444758c3d060af1df1839b80a296d2305469b4399138312f31b437d993681b726e01d54054b61d753da99ce4130a085fbef
|
7
|
+
data.tar.gz: 99420ff893d32b0eb1b02b498e0f51dede79054e24ef4f6282bdbb029f329e7fdebf19c6263e03c0298c44f42a8613d87b564c99e71dc88270fb07d40baaf4ec
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,205 +1,6 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
rubocop-config-umbrellio: lib/rubocop.yml
|
3
|
+
|
1
4
|
AllCops:
|
2
5
|
DisplayCopNames: true
|
3
|
-
TargetRubyVersion: 2.
|
4
|
-
Exclude:
|
5
|
-
- polist.gemspec
|
6
|
-
|
7
|
-
# Layout
|
8
|
-
|
9
|
-
Layout/AlignParameters:
|
10
|
-
Enabled: true
|
11
|
-
|
12
|
-
# Layout/MultilineMethodCallIndentation:
|
13
|
-
# Enabled: false
|
14
|
-
|
15
|
-
# Layout/MultilineOperationIndentation:
|
16
|
-
# Enabled: false
|
17
|
-
|
18
|
-
Layout/SpaceInLambdaLiteral:
|
19
|
-
EnforcedStyle: require_space
|
20
|
-
|
21
|
-
Layout/SpaceInsideBrackets:
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Layout/IndentArray:
|
25
|
-
EnforcedStyle: consistent
|
26
|
-
|
27
|
-
Layout/IndentHash:
|
28
|
-
EnforcedStyle: consistent
|
29
|
-
|
30
|
-
# Lint
|
31
|
-
|
32
|
-
Lint/AmbiguousBlockAssociation:
|
33
|
-
Enabled: false
|
34
|
-
|
35
|
-
Lint/AmbiguousOperator:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
Lint/NonLocalExitFromIterator:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Lint/HandleExceptions:
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
Lint/RescueType:
|
45
|
-
Enabled: true
|
46
|
-
|
47
|
-
Lint/ShadowingOuterLocalVariable:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
Lint/ScriptPermission:
|
51
|
-
Enabled: true
|
52
|
-
|
53
|
-
# Metrics
|
54
|
-
|
55
|
-
# Metrics/AbcSize:
|
56
|
-
# Enabled: false
|
57
|
-
|
58
|
-
Metrics/BlockLength:
|
59
|
-
Exclude:
|
60
|
-
- spec/**/*
|
61
|
-
|
62
|
-
# Metrics/ClassLength:
|
63
|
-
# Enabled: false
|
64
|
-
|
65
|
-
# Metrics/CyclomaticComplexity:
|
66
|
-
# Enabled: false
|
67
|
-
|
68
|
-
Metrics/LineLength:
|
69
|
-
Max: 100
|
70
|
-
|
71
|
-
Metrics/MethodLength:
|
72
|
-
Max: 20
|
73
|
-
|
74
|
-
Metrics/PerceivedComplexity:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
# Performance
|
78
|
-
|
79
|
-
Performance/Caller:
|
80
|
-
Enabled: true
|
81
|
-
|
82
|
-
Performance/Casecmp:
|
83
|
-
Enabled: false
|
84
|
-
|
85
|
-
# Security
|
86
|
-
|
87
|
-
Security/YAMLLoad:
|
88
|
-
Enabled: false
|
89
|
-
|
90
|
-
# Style
|
91
|
-
|
92
|
-
Style/AccessorMethodName:
|
93
|
-
# This cop assumes every method is accessor
|
94
|
-
Enabled: false
|
95
|
-
|
96
|
-
Style/AndOr:
|
97
|
-
# `do_something and return`
|
98
|
-
Enabled: false
|
99
|
-
|
100
|
-
Style/ClassAndModuleChildren:
|
101
|
-
# Enable it in non-rails projects with EnforcedStyle you prefer
|
102
|
-
Enabled: false
|
103
|
-
|
104
|
-
Style/CommentAnnotation:
|
105
|
-
# Also, i think that better to use yard's `@todo` and other in ruby code
|
106
|
-
Enabled: false
|
107
|
-
|
108
|
-
Style/ConditionalAssignment:
|
109
|
-
Enabled: false
|
110
|
-
|
111
|
-
Style/Documentation:
|
112
|
-
Enabled: false
|
113
|
-
|
114
|
-
Style/DoubleNegation:
|
115
|
-
# Always return booleans in predicates
|
116
|
-
Enabled: false
|
117
|
-
|
118
|
-
Style/EmptyCaseCondition:
|
119
|
-
Enabled: false
|
120
|
-
|
121
|
-
Style/EmptyElse:
|
122
|
-
Enabled: false
|
123
|
-
|
124
|
-
Style/Encoding:
|
125
|
-
Enabled: false
|
126
|
-
|
127
|
-
Style/FormatStringToken:
|
128
|
-
Enabled: true
|
129
|
-
|
130
|
-
Style/IfUnlessModifier:
|
131
|
-
Enabled: true
|
132
|
-
|
133
|
-
Style/GuardClause:
|
134
|
-
Enabled: false
|
135
|
-
|
136
|
-
Style/HashSyntax:
|
137
|
-
Exclude:
|
138
|
-
- Rakefile
|
139
|
-
|
140
|
-
Style/LambdaCall:
|
141
|
-
Enabled: false
|
142
|
-
|
143
|
-
Style/ModuleFunction:
|
144
|
-
Enabled: false
|
145
|
-
|
146
|
-
Style/MultilineTernaryOperator:
|
147
|
-
Enabled: false
|
148
|
-
|
149
|
-
Style/MultipleComparison:
|
150
|
-
Enabled: true
|
151
|
-
|
152
|
-
Style/NumericLiterals:
|
153
|
-
Description: 'Use indent in groups of 3 unlesss you meet project-specific rule'
|
154
|
-
Enabled: false
|
155
|
-
|
156
|
-
Style/ParallelAssignment:
|
157
|
-
Enabled: false
|
158
|
-
|
159
|
-
Style/PerlBackrefs:
|
160
|
-
Enabled: true
|
161
|
-
|
162
|
-
Style/PredicateName:
|
163
|
-
NamePrefixBlacklist:
|
164
|
-
- is_
|
165
|
-
|
166
|
-
Style/RaiseArgs:
|
167
|
-
Description: 'Use `raise, ErrorClass` in all cases but not when you need ErrorClass constructor'
|
168
|
-
Enabled: false
|
169
|
-
|
170
|
-
Style/RegexpLiteral:
|
171
|
-
EnforcedStyle: mixed
|
172
|
-
Enabled: true
|
173
|
-
|
174
|
-
Style/RescueModifier:
|
175
|
-
Enabled: false
|
176
|
-
|
177
|
-
|
178
|
-
Style/StringLiterals:
|
179
|
-
EnforcedStyle: double_quotes
|
180
|
-
ConsistentQuotesInMultiline: true
|
181
|
-
|
182
|
-
Style/SignalException:
|
183
|
-
EnforcedStyle: only_raise
|
184
|
-
|
185
|
-
Style/SingleLineBlockParams:
|
186
|
-
Enabled: false
|
187
|
-
|
188
|
-
Style/StringLiteralsInInterpolation:
|
189
|
-
Enabled: false
|
190
|
-
|
191
|
-
Style/SymbolArray:
|
192
|
-
Enabled: false
|
193
|
-
|
194
|
-
Style/TrailingCommaInArguments:
|
195
|
-
EnforcedStyleForMultiline: comma
|
196
|
-
|
197
|
-
Style/TrailingCommaInLiteral:
|
198
|
-
EnforcedStyleForMultiline: comma
|
199
|
-
|
200
|
-
Style/TrivialAccessors:
|
201
|
-
AllowPredicates: true
|
202
|
-
Enabled: false
|
203
|
-
|
204
|
-
Style/YodaCondition:
|
205
|
-
Enabled: false
|
6
|
+
TargetRubyVersion: 2.5
|
data/.travis.yml
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
-
sudo: false
|
2
1
|
language: ruby
|
2
|
+
|
3
|
+
sudo: false
|
4
|
+
|
3
5
|
rvm:
|
4
|
-
- 2.
|
5
|
-
|
6
|
+
- 2.3
|
7
|
+
- 2.4
|
8
|
+
- 2.5
|
9
|
+
- ruby-head
|
10
|
+
|
11
|
+
before_install: gem install bundler
|
12
|
+
|
13
|
+
env: SUITE="rspec"
|
14
|
+
|
15
|
+
script: bundle exec $SUITE
|
16
|
+
|
17
|
+
matrix:
|
18
|
+
fast_finish: true
|
19
|
+
# Only run RuboCop on the latest Ruby
|
20
|
+
include:
|
21
|
+
- rvm: 2.5
|
22
|
+
env: SUITE="rubocop"
|
23
|
+
allow_failures:
|
24
|
+
- rvm: ruby-head
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
# Polist
|
1
|
+
# Polist [![Gem Version](https://badge.fury.io/rb/polist.svg)](https://badge.fury.io/rb/polist) [![Build Status](https://travis-ci.org/umbrellio/polist.svg?branch=master)](https://travis-ci.org/umbrellio/polist) [![Coverage Status](https://coveralls.io/repos/github/umbrellio/polist/badge.svg?branch=master)](https://coveralls.io/github/umbrellio/polist?branch=master)
|
2
2
|
|
3
3
|
`Polist::Service` is a simple class designed for creating service classes.
|
4
4
|
|
5
|
+
### Installation
|
6
|
+
Juts add `gem "polist"` to your Gemfile.
|
7
|
+
|
5
8
|
### Basic usage example
|
6
9
|
```ruby
|
7
10
|
class MyService < Polist::Service
|
@@ -81,3 +84,13 @@ end
|
|
81
84
|
MyService.call(param1: "1", param2: "2") # prints false and then ["1", 2, "smth"]
|
82
85
|
```
|
83
86
|
The `#form` method is there just for convinience and by default it uses what `#form_attributes` returns as the attributes for the default form class which is the services' `Form` class. You are free to use as many different form classes as you want in your service.
|
87
|
+
|
88
|
+
## License
|
89
|
+
Released under MIT License.
|
90
|
+
|
91
|
+
## Authors
|
92
|
+
Created by Yuri Smirnov.
|
93
|
+
|
94
|
+
<a href="https://github.com/umbrellio/">
|
95
|
+
<img style="float: left;" src="https://umbrellio.github.io/Umbrellio/supported_by_umbrellio.svg" alt="Supported by Umbrellio" width="439" height="72">
|
96
|
+
</a>
|
data/Rakefile
CHANGED
data/lib/polist/service.rb
CHANGED
@@ -48,7 +48,8 @@ module Polist
|
|
48
48
|
self.params = params
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
# Should be implemented in subclasses
|
52
|
+
def call; end
|
52
53
|
|
53
54
|
def run
|
54
55
|
call
|
@@ -58,7 +59,7 @@ module Polist
|
|
58
59
|
end
|
59
60
|
|
60
61
|
def response
|
61
|
-
@response
|
62
|
+
@response
|
62
63
|
end
|
63
64
|
|
64
65
|
def failure?
|
@@ -83,7 +84,7 @@ module Polist
|
|
83
84
|
params
|
84
85
|
end
|
85
86
|
|
86
|
-
def fail!(response =
|
87
|
+
def fail!(response = nil)
|
87
88
|
raise self.class::Failure.new(response)
|
88
89
|
end
|
89
90
|
|
@@ -91,7 +92,7 @@ module Polist
|
|
91
92
|
fail!(error: message)
|
92
93
|
end
|
93
94
|
|
94
|
-
def success!(response =
|
95
|
+
def success!(response = nil)
|
95
96
|
@response = response
|
96
97
|
end
|
97
98
|
end
|
data/lib/polist/version.rb
CHANGED
data/polist.gemspec
CHANGED
@@ -18,13 +18,15 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "tainbox"
|
22
|
-
spec.add_runtime_dependency "plissken", ">= 0.3"
|
23
21
|
spec.add_runtime_dependency "activemodel", ">= 3.0"
|
22
|
+
spec.add_runtime_dependency "plissken", ">= 0.3"
|
23
|
+
spec.add_runtime_dependency "tainbox"
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler"
|
26
|
-
spec.add_development_dependency "
|
27
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
spec.add_development_dependency "bundler"
|
26
|
+
spec.add_development_dependency "coveralls"
|
28
27
|
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency "rubocop-config-umbrellio"
|
29
31
|
spec.add_development_dependency "simplecov"
|
30
32
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: polist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuri Smirnov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activemodel
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: plissken
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,63 +39,91 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: tainbox
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
89
|
+
version: '0'
|
62
90
|
type: :development
|
63
91
|
prerelease: false
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
65
93
|
requirements:
|
66
|
-
- - "
|
94
|
+
- - ">="
|
67
95
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: rake
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
103
|
+
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: rspec
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - "
|
115
|
+
- - ">="
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
117
|
+
version: '0'
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - "
|
122
|
+
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
124
|
+
version: '0'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
126
|
+
name: rubocop-config-umbrellio
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
100
128
|
requirements:
|
101
129
|
- - ">="
|
@@ -137,8 +165,6 @@ files:
|
|
137
165
|
- LICENSE.txt
|
138
166
|
- README.md
|
139
167
|
- Rakefile
|
140
|
-
- bin/console
|
141
|
-
- bin/setup
|
142
168
|
- lib/polist.rb
|
143
169
|
- lib/polist/service.rb
|
144
170
|
- lib/polist/version.rb
|
@@ -163,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
189
|
version: '0'
|
164
190
|
requirements: []
|
165
191
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.6
|
192
|
+
rubygems_version: 2.7.6
|
167
193
|
signing_key:
|
168
194
|
specification_version: 4
|
169
195
|
summary: A gem for creating simple service classes.
|
data/bin/console
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "polist"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
-
# require "pry"
|
12
|
-
# Pry.start
|
13
|
-
|
14
|
-
require "irb"
|
15
|
-
IRB.start(__FILE__)
|