light-services 0.6.3 → 2.0.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/config/rubocop_linter_action.yml +4 -0
- data/.github/workflows/ci.yml +63 -0
- data/.gitignore +11 -4
- data/.rspec +1 -0
- data/.rubocop.yml +22 -8
- data/CHANGELOG.md +1 -0
- data/CODE_OF_CONDUCT.md +55 -30
- data/Gemfile +16 -2
- data/Gemfile.lock +102 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -149
- data/Rakefile +2 -2
- data/bin/console +4 -4
- data/lib/light/services.rb +4 -7
- data/lib/light/services/base.rb +151 -30
- data/lib/light/services/base_with_context.rb +33 -0
- data/lib/light/services/class_based_collection/base.rb +88 -0
- data/lib/light/services/class_based_collection/mount.rb +33 -0
- data/lib/light/services/collection/arguments.rb +34 -0
- data/lib/light/services/collection/base.rb +55 -0
- data/lib/light/services/collection/outputs.rb +16 -0
- data/lib/light/services/config.rb +63 -0
- data/lib/light/services/exceptions.rb +3 -2
- data/lib/light/services/messages.rb +67 -45
- data/lib/light/services/settings/argument.rb +50 -0
- data/lib/light/services/settings/output.rb +34 -0
- data/lib/light/services/settings/step.rb +77 -0
- data/lib/light/services/version.rb +1 -1
- data/light-services.gemspec +21 -25
- metadata +28 -122
- data/.codeclimate.yml +0 -18
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -33
- data/Appraisals +0 -13
- data/gemfiles/rails_5_0.gemfile +0 -7
- data/gemfiles/rails_5_0.gemfile.lock +0 -151
- data/gemfiles/rails_5_1.gemfile +0 -7
- data/gemfiles/rails_5_1.gemfile.lock +0 -151
- data/gemfiles/rails_5_2.gemfile +0 -7
- data/gemfiles/rails_5_2.gemfile.lock +0 -159
- data/lib/light/services/callbacks.rb +0 -54
- data/lib/light/services/outputs.rb +0 -70
- data/lib/light/services/parameters.rb +0 -96
data/gemfiles/rails_5_1.gemfile
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
light-services (0.6.3)
|
5
|
-
rails (> 5.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actioncable (5.1.7)
|
11
|
-
actionpack (= 5.1.7)
|
12
|
-
nio4r (~> 2.0)
|
13
|
-
websocket-driver (~> 0.6.1)
|
14
|
-
actionmailer (5.1.7)
|
15
|
-
actionpack (= 5.1.7)
|
16
|
-
actionview (= 5.1.7)
|
17
|
-
activejob (= 5.1.7)
|
18
|
-
mail (~> 2.5, >= 2.5.4)
|
19
|
-
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.1.7)
|
21
|
-
actionview (= 5.1.7)
|
22
|
-
activesupport (= 5.1.7)
|
23
|
-
rack (~> 2.0)
|
24
|
-
rack-test (>= 0.6.3)
|
25
|
-
rails-dom-testing (~> 2.0)
|
26
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.1.7)
|
28
|
-
activesupport (= 5.1.7)
|
29
|
-
builder (~> 3.1)
|
30
|
-
erubi (~> 1.4)
|
31
|
-
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
-
activejob (5.1.7)
|
34
|
-
activesupport (= 5.1.7)
|
35
|
-
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.1.7)
|
37
|
-
activesupport (= 5.1.7)
|
38
|
-
activerecord (5.1.7)
|
39
|
-
activemodel (= 5.1.7)
|
40
|
-
activesupport (= 5.1.7)
|
41
|
-
arel (~> 8.0)
|
42
|
-
activesupport (5.1.7)
|
43
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
-
i18n (>= 0.7, < 2)
|
45
|
-
minitest (~> 5.1)
|
46
|
-
tzinfo (~> 1.1)
|
47
|
-
appraisal (2.2.0)
|
48
|
-
bundler
|
49
|
-
rake
|
50
|
-
thor (>= 0.14.0)
|
51
|
-
arel (8.0.0)
|
52
|
-
builder (3.2.3)
|
53
|
-
codeclimate-test-reporter (1.0.8)
|
54
|
-
simplecov (<= 0.13)
|
55
|
-
concurrent-ruby (1.1.5)
|
56
|
-
crass (1.0.4)
|
57
|
-
diff-lcs (1.3)
|
58
|
-
docile (1.1.5)
|
59
|
-
erubi (1.8.0)
|
60
|
-
globalid (0.4.2)
|
61
|
-
activesupport (>= 4.2.0)
|
62
|
-
i18n (1.6.0)
|
63
|
-
concurrent-ruby (~> 1.0)
|
64
|
-
json (1.8.6)
|
65
|
-
loofah (2.2.3)
|
66
|
-
crass (~> 1.0.2)
|
67
|
-
nokogiri (>= 1.5.9)
|
68
|
-
mail (2.7.1)
|
69
|
-
mini_mime (>= 0.1.1)
|
70
|
-
method_source (0.9.2)
|
71
|
-
mini_mime (1.0.2)
|
72
|
-
mini_portile2 (2.4.0)
|
73
|
-
minitest (5.11.3)
|
74
|
-
nio4r (2.4.0)
|
75
|
-
nokogiri (1.10.4)
|
76
|
-
mini_portile2 (~> 2.4.0)
|
77
|
-
rack (2.0.7)
|
78
|
-
rack-test (1.1.0)
|
79
|
-
rack (>= 1.0, < 3)
|
80
|
-
rails (5.1.7)
|
81
|
-
actioncable (= 5.1.7)
|
82
|
-
actionmailer (= 5.1.7)
|
83
|
-
actionpack (= 5.1.7)
|
84
|
-
actionview (= 5.1.7)
|
85
|
-
activejob (= 5.1.7)
|
86
|
-
activemodel (= 5.1.7)
|
87
|
-
activerecord (= 5.1.7)
|
88
|
-
activesupport (= 5.1.7)
|
89
|
-
bundler (>= 1.3.0)
|
90
|
-
railties (= 5.1.7)
|
91
|
-
sprockets-rails (>= 2.0.0)
|
92
|
-
rails-dom-testing (2.0.3)
|
93
|
-
activesupport (>= 4.2.0)
|
94
|
-
nokogiri (>= 1.6)
|
95
|
-
rails-html-sanitizer (1.2.0)
|
96
|
-
loofah (~> 2.2, >= 2.2.2)
|
97
|
-
railties (5.1.7)
|
98
|
-
actionpack (= 5.1.7)
|
99
|
-
activesupport (= 5.1.7)
|
100
|
-
method_source
|
101
|
-
rake (>= 0.8.7)
|
102
|
-
thor (>= 0.18.1, < 2.0)
|
103
|
-
rake (10.5.0)
|
104
|
-
rspec (3.6.0)
|
105
|
-
rspec-core (~> 3.6.0)
|
106
|
-
rspec-expectations (~> 3.6.0)
|
107
|
-
rspec-mocks (~> 3.6.0)
|
108
|
-
rspec-core (3.6.0)
|
109
|
-
rspec-support (~> 3.6.0)
|
110
|
-
rspec-expectations (3.6.0)
|
111
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
112
|
-
rspec-support (~> 3.6.0)
|
113
|
-
rspec-mocks (3.6.0)
|
114
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
115
|
-
rspec-support (~> 3.6.0)
|
116
|
-
rspec-support (3.6.0)
|
117
|
-
simplecov (0.11.2)
|
118
|
-
docile (~> 1.1.0)
|
119
|
-
json (~> 1.8)
|
120
|
-
simplecov-html (~> 0.10.0)
|
121
|
-
simplecov-html (0.10.2)
|
122
|
-
sprockets (3.7.2)
|
123
|
-
concurrent-ruby (~> 1.0)
|
124
|
-
rack (> 1, < 3)
|
125
|
-
sprockets-rails (3.2.1)
|
126
|
-
actionpack (>= 4.0)
|
127
|
-
activesupport (>= 4.0)
|
128
|
-
sprockets (>= 3.0.0)
|
129
|
-
thor (0.20.0)
|
130
|
-
thread_safe (0.3.6)
|
131
|
-
tzinfo (1.2.5)
|
132
|
-
thread_safe (~> 0.1)
|
133
|
-
websocket-driver (0.6.5)
|
134
|
-
websocket-extensions (>= 0.1.0)
|
135
|
-
websocket-extensions (0.1.4)
|
136
|
-
|
137
|
-
PLATFORMS
|
138
|
-
ruby
|
139
|
-
|
140
|
-
DEPENDENCIES
|
141
|
-
appraisal (~> 2.1)
|
142
|
-
bundler (~> 2.0)
|
143
|
-
codeclimate-test-reporter
|
144
|
-
light-services!
|
145
|
-
rails (= 5.1.7)
|
146
|
-
rake (~> 10.0)
|
147
|
-
rspec (~> 3.0)
|
148
|
-
simplecov (~> 0.11.2)
|
149
|
-
|
150
|
-
BUNDLED WITH
|
151
|
-
2.0.2
|
data/gemfiles/rails_5_2.gemfile
DELETED
@@ -1,159 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
light-services (0.6.3)
|
5
|
-
rails (> 5.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
actioncable (5.2.3)
|
11
|
-
actionpack (= 5.2.3)
|
12
|
-
nio4r (~> 2.0)
|
13
|
-
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailer (5.2.3)
|
15
|
-
actionpack (= 5.2.3)
|
16
|
-
actionview (= 5.2.3)
|
17
|
-
activejob (= 5.2.3)
|
18
|
-
mail (~> 2.5, >= 2.5.4)
|
19
|
-
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.2.3)
|
21
|
-
actionview (= 5.2.3)
|
22
|
-
activesupport (= 5.2.3)
|
23
|
-
rack (~> 2.0)
|
24
|
-
rack-test (>= 0.6.3)
|
25
|
-
rails-dom-testing (~> 2.0)
|
26
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.2.3)
|
28
|
-
activesupport (= 5.2.3)
|
29
|
-
builder (~> 3.1)
|
30
|
-
erubi (~> 1.4)
|
31
|
-
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
-
activejob (5.2.3)
|
34
|
-
activesupport (= 5.2.3)
|
35
|
-
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.2.3)
|
37
|
-
activesupport (= 5.2.3)
|
38
|
-
activerecord (5.2.3)
|
39
|
-
activemodel (= 5.2.3)
|
40
|
-
activesupport (= 5.2.3)
|
41
|
-
arel (>= 9.0)
|
42
|
-
activestorage (5.2.3)
|
43
|
-
actionpack (= 5.2.3)
|
44
|
-
activerecord (= 5.2.3)
|
45
|
-
marcel (~> 0.3.1)
|
46
|
-
activesupport (5.2.3)
|
47
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
48
|
-
i18n (>= 0.7, < 2)
|
49
|
-
minitest (~> 5.1)
|
50
|
-
tzinfo (~> 1.1)
|
51
|
-
appraisal (2.2.0)
|
52
|
-
bundler
|
53
|
-
rake
|
54
|
-
thor (>= 0.14.0)
|
55
|
-
arel (9.0.0)
|
56
|
-
builder (3.2.3)
|
57
|
-
codeclimate-test-reporter (1.0.8)
|
58
|
-
simplecov (<= 0.13)
|
59
|
-
concurrent-ruby (1.1.5)
|
60
|
-
crass (1.0.4)
|
61
|
-
diff-lcs (1.3)
|
62
|
-
docile (1.1.5)
|
63
|
-
erubi (1.8.0)
|
64
|
-
globalid (0.4.2)
|
65
|
-
activesupport (>= 4.2.0)
|
66
|
-
i18n (1.6.0)
|
67
|
-
concurrent-ruby (~> 1.0)
|
68
|
-
json (1.8.6)
|
69
|
-
loofah (2.2.3)
|
70
|
-
crass (~> 1.0.2)
|
71
|
-
nokogiri (>= 1.5.9)
|
72
|
-
mail (2.7.1)
|
73
|
-
mini_mime (>= 0.1.1)
|
74
|
-
marcel (0.3.3)
|
75
|
-
mimemagic (~> 0.3.2)
|
76
|
-
method_source (0.9.2)
|
77
|
-
mimemagic (0.3.3)
|
78
|
-
mini_mime (1.0.2)
|
79
|
-
mini_portile2 (2.4.0)
|
80
|
-
minitest (5.11.3)
|
81
|
-
nio4r (2.4.0)
|
82
|
-
nokogiri (1.10.4)
|
83
|
-
mini_portile2 (~> 2.4.0)
|
84
|
-
rack (2.0.7)
|
85
|
-
rack-test (1.1.0)
|
86
|
-
rack (>= 1.0, < 3)
|
87
|
-
rails (5.2.3)
|
88
|
-
actioncable (= 5.2.3)
|
89
|
-
actionmailer (= 5.2.3)
|
90
|
-
actionpack (= 5.2.3)
|
91
|
-
actionview (= 5.2.3)
|
92
|
-
activejob (= 5.2.3)
|
93
|
-
activemodel (= 5.2.3)
|
94
|
-
activerecord (= 5.2.3)
|
95
|
-
activestorage (= 5.2.3)
|
96
|
-
activesupport (= 5.2.3)
|
97
|
-
bundler (>= 1.3.0)
|
98
|
-
railties (= 5.2.3)
|
99
|
-
sprockets-rails (>= 2.0.0)
|
100
|
-
rails-dom-testing (2.0.3)
|
101
|
-
activesupport (>= 4.2.0)
|
102
|
-
nokogiri (>= 1.6)
|
103
|
-
rails-html-sanitizer (1.2.0)
|
104
|
-
loofah (~> 2.2, >= 2.2.2)
|
105
|
-
railties (5.2.3)
|
106
|
-
actionpack (= 5.2.3)
|
107
|
-
activesupport (= 5.2.3)
|
108
|
-
method_source
|
109
|
-
rake (>= 0.8.7)
|
110
|
-
thor (>= 0.19.0, < 2.0)
|
111
|
-
rake (10.5.0)
|
112
|
-
rspec (3.8.0)
|
113
|
-
rspec-core (~> 3.8.0)
|
114
|
-
rspec-expectations (~> 3.8.0)
|
115
|
-
rspec-mocks (~> 3.8.0)
|
116
|
-
rspec-core (3.8.0)
|
117
|
-
rspec-support (~> 3.8.0)
|
118
|
-
rspec-expectations (3.8.1)
|
119
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
120
|
-
rspec-support (~> 3.8.0)
|
121
|
-
rspec-mocks (3.8.0)
|
122
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
123
|
-
rspec-support (~> 3.8.0)
|
124
|
-
rspec-support (3.8.0)
|
125
|
-
simplecov (0.11.2)
|
126
|
-
docile (~> 1.1.0)
|
127
|
-
json (~> 1.8)
|
128
|
-
simplecov-html (~> 0.10.0)
|
129
|
-
simplecov-html (0.10.2)
|
130
|
-
sprockets (3.7.2)
|
131
|
-
concurrent-ruby (~> 1.0)
|
132
|
-
rack (> 1, < 3)
|
133
|
-
sprockets-rails (3.2.1)
|
134
|
-
actionpack (>= 4.0)
|
135
|
-
activesupport (>= 4.0)
|
136
|
-
sprockets (>= 3.0.0)
|
137
|
-
thor (0.20.0)
|
138
|
-
thread_safe (0.3.6)
|
139
|
-
tzinfo (1.2.5)
|
140
|
-
thread_safe (~> 0.1)
|
141
|
-
websocket-driver (0.7.1)
|
142
|
-
websocket-extensions (>= 0.1.0)
|
143
|
-
websocket-extensions (0.1.4)
|
144
|
-
|
145
|
-
PLATFORMS
|
146
|
-
ruby
|
147
|
-
|
148
|
-
DEPENDENCIES
|
149
|
-
appraisal (~> 2.1)
|
150
|
-
bundler (~> 2.0)
|
151
|
-
codeclimate-test-reporter
|
152
|
-
light-services!
|
153
|
-
rails (= 5.2.3)
|
154
|
-
rake (~> 10.0)
|
155
|
-
rspec (~> 3.0)
|
156
|
-
simplecov (~> 0.11.2)
|
157
|
-
|
158
|
-
BUNDLED WITH
|
159
|
-
2.0.2
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Light
|
4
|
-
module Services
|
5
|
-
module Callbacks
|
6
|
-
def self.included(base)
|
7
|
-
base.extend ClassMethods
|
8
|
-
base.class_eval do
|
9
|
-
class << self
|
10
|
-
attr_accessor :callbacks
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def run_callbacks(type, options = {})
|
18
|
-
callbacks_by(type).each do |callback|
|
19
|
-
break if !success? && !options[:force_run]
|
20
|
-
send(callback[:method_name])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def callbacks_by(type)
|
25
|
-
all_callbacks.select { |callback| callback[:type] == type }
|
26
|
-
end
|
27
|
-
|
28
|
-
def all_callbacks
|
29
|
-
return @_all_callbacks if defined?(@_all_callbacks)
|
30
|
-
@_all_callbacks = self.class.ancestors.select { |klass| klass.ancestors.include?(::Light::Services::Base) }
|
31
|
-
.map(&:callbacks).compact.reverse.flatten.uniq
|
32
|
-
end
|
33
|
-
|
34
|
-
module ClassMethods
|
35
|
-
def before(method_name)
|
36
|
-
set_callback(:before, method_name)
|
37
|
-
end
|
38
|
-
|
39
|
-
def after(method_name)
|
40
|
-
set_callback(:after, method_name)
|
41
|
-
end
|
42
|
-
|
43
|
-
def finally(method_name)
|
44
|
-
set_callback(:finally, method_name)
|
45
|
-
end
|
46
|
-
|
47
|
-
def set_callback(type, method_name)
|
48
|
-
self.callbacks ||= []
|
49
|
-
self.callbacks << { type: type, method_name: method_name }
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Light
|
4
|
-
module Services
|
5
|
-
module Outputs
|
6
|
-
def self.included(base)
|
7
|
-
base.extend ClassMethods
|
8
|
-
base.class_eval do
|
9
|
-
class << self
|
10
|
-
attr_accessor :outputs
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# Getters
|
16
|
-
attr_reader :outputs
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
# Setters
|
21
|
-
attr_writer :outputs
|
22
|
-
|
23
|
-
def initialize_outputs
|
24
|
-
self.outputs = {}
|
25
|
-
|
26
|
-
all_outputs.each do |options|
|
27
|
-
store_output(options)
|
28
|
-
end
|
29
|
-
|
30
|
-
generate_outputs_methods
|
31
|
-
end
|
32
|
-
|
33
|
-
def all_outputs
|
34
|
-
return @_all_outputs if defined?(@_all_outputs)
|
35
|
-
@_all_outputs = self.class.ancestors.select { |klass| klass.ancestors.include?(::Light::Services::Base) }
|
36
|
-
.map(&:outputs).compact.flatten.uniq
|
37
|
-
end
|
38
|
-
|
39
|
-
def store_output(options)
|
40
|
-
output_name = options[:name]
|
41
|
-
output_value = options[:value]
|
42
|
-
|
43
|
-
outputs[output_name] = output_value
|
44
|
-
end
|
45
|
-
|
46
|
-
def generate_outputs_methods
|
47
|
-
outputs.keys.each do |output_name|
|
48
|
-
define_singleton_method output_name do
|
49
|
-
outputs[output_name]
|
50
|
-
end
|
51
|
-
|
52
|
-
define_singleton_method "#{output_name}=" do |value|
|
53
|
-
outputs[output_name] = value
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
module ClassMethods
|
59
|
-
def output(name, value = nil, options = {})
|
60
|
-
self.outputs ||= []
|
61
|
-
self.outputs << {
|
62
|
-
name: name,
|
63
|
-
value: value,
|
64
|
-
public: options.fetch(:private, false)
|
65
|
-
}
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|