luna_park 0.11.1 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/gem-push.yml +43 -0
- data/.github/workflows/gem-push.yml +43 -0
- data/.gitignore +18 -1
- data/CHANGELOG.md +13 -1
- data/Gemfile.lock +3 -3
- data/lib/luna_park/extensions/exceptions/substitutive.rb +0 -1
- data/lib/luna_park/extensions/injector/dependencies.rb +8 -1
- data/lib/luna_park/extensions/injector.rb +1 -1
- data/lib/luna_park/mappers/codirectional/copyists/nested.rb +92 -0
- data/lib/luna_park/mappers/codirectional/copyists/slice.rb +28 -0
- data/lib/luna_park/mappers/codirectional.rb +130 -0
- data/lib/luna_park/mappers/errors.rb +13 -0
- data/lib/luna_park/mappers/simple.rb +7 -3
- data/lib/luna_park/notifiers/log.rb +1 -1
- data/lib/luna_park/use_cases/scenario.rb +2 -1
- data/lib/luna_park/version.rb +1 -1
- data/lib/luna_park.rb +2 -1
- data/luna_park.gemspec +3 -2
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25c15d875ee58d0d61589f2041e81c65eeccde628e8a07c584722fc69865741a
|
4
|
+
data.tar.gz: 27f13cbf3d1073f651a13c714092e1ebac28b4b9e3c8eb0dcfcc2fdec4b0009e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e747fa427d30d6b64d3cd4300beb67d27b080b41de497f959caa05b719b94845178c8fa53944261a81fcedb9fb31950a5ba53d01ae87bf529b9eba16a4e92b9a
|
7
|
+
data.tar.gz: 0432dfffa7d6702f79fdfa2abdf68b4fee5d9d6fdd4f0864e01fd7829873db8c32a2656b72479f4735d0423256aecb5f97e55c03b5daa3b9c513036062be336f
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby 2.6
|
18
|
+
uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.5.x
|
21
|
+
|
22
|
+
- name: Publish to GPR
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
30
|
+
env:
|
31
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
32
|
+
OWNER: ${{ github.repository_owner }}
|
33
|
+
|
34
|
+
- name: Publish to RubyGems
|
35
|
+
run: |
|
36
|
+
mkdir -p $HOME/.gem
|
37
|
+
touch $HOME/.gem/credentials
|
38
|
+
chmod 0600 $HOME/.gem/credentials
|
39
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
40
|
+
gem build *.gemspec
|
41
|
+
gem push *.gem
|
42
|
+
env:
|
43
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
permissions:
|
12
|
+
contents: read
|
13
|
+
packages: write
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby 2.5
|
18
|
+
uses: actions/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: 2.5.x
|
21
|
+
|
22
|
+
- name: Publish to GPR
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
30
|
+
env:
|
31
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
|
32
|
+
OWNER: ${{ github.repository_owner }}
|
33
|
+
|
34
|
+
- name: Publish to RubyGems
|
35
|
+
run: |
|
36
|
+
mkdir -p $HOME/.gem
|
37
|
+
touch $HOME/.gem/credentials
|
38
|
+
chmod 0600 $HOME/.gem/credentials
|
39
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
40
|
+
gem build *.gemspec
|
41
|
+
gem push *.gem
|
42
|
+
env:
|
43
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [0.11.4] - 2022-07-11
|
8
|
+
Changed
|
9
|
+
- allow require Notifiers::Sentry when sentry-ruby version >= 4
|
10
|
+
|
11
|
+
## [0.11.3] - 2021-09-02
|
12
|
+
Added
|
13
|
+
- new mapper `Mappers::Codirectionsl` with DSL
|
14
|
+
|
15
|
+
## [0.11.2] - 2021-09-01
|
16
|
+
Added
|
17
|
+
- Github CI
|
18
|
+
|
7
19
|
## [0.11.1] - 2021-05-24
|
8
20
|
Added
|
9
21
|
- Inheritance of `Extensions::Injector`
|
@@ -16,7 +28,7 @@ Changed
|
|
16
28
|
## [0.11.0] - 2021-03-18
|
17
29
|
Changed
|
18
30
|
- Rename Interactors to UseCases
|
19
|
-
- Rename Errors::Adaptive to Errors:Base
|
31
|
+
- Rename Errors::Adaptive to Errors:Base
|
20
32
|
- Rename Errors::Processing to Errors::Business
|
21
33
|
Added
|
22
34
|
- Add class Errors::System
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
luna_park (0.11.
|
4
|
+
luna_park (0.11.4)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
addressable (2.
|
9
|
+
addressable (2.8.0)
|
10
10
|
public_suffix (>= 2.0.2, < 5.0)
|
11
11
|
ast (2.4.1)
|
12
12
|
bugsnag (6.13.1)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
pry-byebug (3.9.0)
|
96
96
|
byebug (~> 11.0)
|
97
97
|
pry (~> 0.13.0)
|
98
|
-
public_suffix (4.0.
|
98
|
+
public_suffix (4.0.6)
|
99
99
|
rainbow (3.0.0)
|
100
100
|
rake (13.0.1)
|
101
101
|
regexp_parser (1.7.1)
|
@@ -48,7 +48,7 @@ module LunaPark
|
|
48
48
|
# use_case.dependencies[:messenger] # => #<Proc:0x0000564a0d90d438@t.rb:34>
|
49
49
|
# use_case.dependencies.call_with_cache(:messenger) # => 'Foobar'
|
50
50
|
def call_with_cache(key)
|
51
|
-
cache.key?(key) ? cache[key] : cache[key] =
|
51
|
+
cache.key?(key) ? cache[key] : cache[key] = fetch(key).call
|
52
52
|
end
|
53
53
|
|
54
54
|
def []=(key, _val)
|
@@ -62,6 +62,13 @@ module LunaPark
|
|
62
62
|
@cache ||= {}
|
63
63
|
end
|
64
64
|
end
|
65
|
+
|
66
|
+
# @!parse include Injector::ClassMethods
|
67
|
+
# @!parse extend Injector::InstanceMethods
|
68
|
+
def self.included(base)
|
69
|
+
base.extend ClassMethods
|
70
|
+
base.include InstanceMethods
|
71
|
+
end
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LunaPark
|
4
|
+
module Mappers
|
5
|
+
class Codirectional < Simple
|
6
|
+
module Copyists
|
7
|
+
# Copyist for copiyng value between two schemas with DIFFERENT or NESTED paths
|
8
|
+
# (Works with only one described attribute)
|
9
|
+
class Nested
|
10
|
+
def initialize(attrs_path:, row_path:)
|
11
|
+
@attrs_path = attrs_path
|
12
|
+
@row_path = row_path
|
13
|
+
|
14
|
+
raise ArgumentError, 'attr path can not be nil' if attrs_path.nil?
|
15
|
+
raise ArgumentError, 'store path can not be nil' if row_path.nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
def from_row(row:, attrs:)
|
19
|
+
copy_nested(from: row, to: attrs, from_path: @row_path, to_path: @attrs_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_row(row:, attrs:)
|
23
|
+
copy_nested(from: attrs, to: row, from_path: @attrs_path, to_path: @row_path)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def copy_nested(from:, to:, from_path:, to_path:)
|
29
|
+
value = read(from, from_path)
|
30
|
+
|
31
|
+
return if value == Undefined # omit undefined keys
|
32
|
+
|
33
|
+
write(to, to_path, value)
|
34
|
+
end
|
35
|
+
|
36
|
+
def read(from, from_path)
|
37
|
+
if from_path.is_a?(Array) # when given `%i[key path]` - not just `:key`
|
38
|
+
read_nested(from, path: from_path)
|
39
|
+
else # when given just `:key`
|
40
|
+
read_plain(from, key: from_path)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def write(to, to_path, value)
|
45
|
+
if to_path.is_a?(Array) # when given `%i[key path]` - not just `:key`
|
46
|
+
write_nested(to, to_path, value)
|
47
|
+
else # when given just `:key`
|
48
|
+
to[to_path] = value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def read_nested(from, path:)
|
53
|
+
*path_to_head, head_key = path # split `[:a, :b, :c]` to `[:a, :b]` and `:c`
|
54
|
+
head_hash = from.dig(*path_to_head) # from `{a: {b: {c: 'value'}}}` get `{c: 'value'}`
|
55
|
+
|
56
|
+
return Undefined if head_hash.nil? # when there are no key at the path `[:a, :b]`
|
57
|
+
return Undefined unless head_hash.key?(head_key) # when there are no key at the path `[:a, :b, :c]`
|
58
|
+
|
59
|
+
head_hash[head_key] # get 'value' from from `{c: 'value'}` stored at `{a: {b: {c: 'value'}}}`
|
60
|
+
end
|
61
|
+
|
62
|
+
def read_plain(from, key:)
|
63
|
+
from.key?(key) ? from[key] : Undefined
|
64
|
+
end
|
65
|
+
|
66
|
+
def write_nested(hash, full_path, value)
|
67
|
+
*tail_path, head_key = full_path
|
68
|
+
build_nested_hash(hash, tail_path)[head_key] = value
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# @example
|
73
|
+
# hash = { a: { x: 'x' } }
|
74
|
+
# build_nested_hash(hash, [:a, :b, :c]) # => {} # (returns new hash at path [:a, :b, :c])
|
75
|
+
# hash # => { a: { b: { c: {} }, x: 'x' } }
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# hash = { a: { x: 'x' } }
|
79
|
+
# build_nested_hash(hash, [:a, :b, :c])[:d] = 'value'
|
80
|
+
# hash # => { a: { b: { c: { d: 'value' } }, x: 'x' } }
|
81
|
+
def build_nested_hash(nested_hash, path)
|
82
|
+
path.inject(nested_hash) { |output, key| output[key] ||= {} }
|
83
|
+
end
|
84
|
+
|
85
|
+
class Undefined; end
|
86
|
+
|
87
|
+
private_constant :Undefined
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LunaPark
|
4
|
+
module Mappers
|
5
|
+
class Codirectional < Simple
|
6
|
+
module Copyists
|
7
|
+
# Copyist for copiyng value between two schemas with SAME and PLAIN paths
|
8
|
+
class Slice
|
9
|
+
def initialize
|
10
|
+
@keys = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_key(key)
|
14
|
+
@keys << key
|
15
|
+
end
|
16
|
+
|
17
|
+
def from_row(row:, attrs:)
|
18
|
+
attrs.merge! row.slice(*@keys)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_row(row:, attrs:)
|
22
|
+
row.merge! attrs.slice(*@keys)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'luna_park/mappers/simple'
|
4
|
+
require 'luna_park/mappers/codirectional/copyists/slice'
|
5
|
+
require 'luna_park/mappers/codirectional/copyists/nested'
|
6
|
+
|
7
|
+
module LunaPark
|
8
|
+
module Mappers
|
9
|
+
##
|
10
|
+
# DSL for describe Nested Schema translation: entity attributes to database row and vice-versa
|
11
|
+
#
|
12
|
+
# @example
|
13
|
+
# class Mappers::Transaction < LunaPark::Mappers::Codirectional
|
14
|
+
# map attr: :uid, row: :id
|
15
|
+
# map attr: [:charge, :amount], row: :charge_amount
|
16
|
+
# map attr: [:charge, :currency], row: :charge_currency # using aliased args
|
17
|
+
# map :comment
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# mapper = Mappers::Transaction
|
21
|
+
#
|
22
|
+
# attrs = { charge: { amount: 10, currency: 'USD' }, comment: 'Foobar' }
|
23
|
+
# transaction = Entities::Transaction.new(attrs)
|
24
|
+
#
|
25
|
+
# # Mapper transforms attr attributes to database row and vice-verse
|
26
|
+
# row = mapper.to_row(transaction) # => { charge_amount: 10, charge_currency: 'USD', comment: 'Foobar' }
|
27
|
+
# new_row = sequel_database_table.insert(row) # => { id: 42, charge_amount: 10, charge_currency: 'USD', comment: 'Foobar' }
|
28
|
+
# new_attrs = mapper.from_row(new_row) # => { uid: 42, charge: { amount: 10, currency: 'USD' }, comment: 'Foobar' }
|
29
|
+
#
|
30
|
+
# transaction.set_attributes(new_attrs)
|
31
|
+
# transaction.to_h # => { uid: 42, charge: { amount: 10, currency: 'USD' }, comment: 'Foobar' }
|
32
|
+
class Codirectional < Simple
|
33
|
+
class << self
|
34
|
+
##
|
35
|
+
# Describe translation between two schemas: attr and table
|
36
|
+
#
|
37
|
+
# @example
|
38
|
+
# class Mappers::Transaction < LunaPark::Mappers::Codirectional
|
39
|
+
# map attr: :id, row: :uid
|
40
|
+
# map attr: [:charge, :amount], row: :charge_amount
|
41
|
+
# map :comment
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# Mappers::Transaction.from_row({ id: 1, charge_amount: 2 }) # => { uid: 1, charge: { amount: 2 } }
|
45
|
+
# Mappers::Transaction.to_row({ uid: 1, charge: { amount: 2 } }) # => { id: 1, charge_amount: 2 }
|
46
|
+
def map(*common_keys, attr: nil, row: nil)
|
47
|
+
attrs(*common_keys) if common_keys.any?
|
48
|
+
|
49
|
+
self.attr attr, row: row if attr
|
50
|
+
end
|
51
|
+
|
52
|
+
# @example
|
53
|
+
# class Mappers::Transaction < LunaPark::Mappers::Codirectional
|
54
|
+
# attr :uid, row: :id
|
55
|
+
# attr %i[charge amount], row: :charge_amount
|
56
|
+
# end
|
57
|
+
def attr(attr, row: nil)
|
58
|
+
return attrs(attr) if row.nil?
|
59
|
+
|
60
|
+
attr_path = to_path(attr)
|
61
|
+
row_path = to_path(row)
|
62
|
+
|
63
|
+
if attr_path == row_path
|
64
|
+
attrs(attr_path)
|
65
|
+
else
|
66
|
+
nested_copyists << Copyists::Nested.new(attrs_path: attr_path, row_path: row_path)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# @example
|
71
|
+
# class Mappers::Transaction < LunaPark::Mappers::Codirectional
|
72
|
+
# attrs :comment, :uid, %i[addresses home], :created_at
|
73
|
+
# end
|
74
|
+
def attrs(*common_keys)
|
75
|
+
common_keys.each do |common_key|
|
76
|
+
path = to_path(common_key)
|
77
|
+
if path.is_a?(Array)
|
78
|
+
nested_copyists << Copyists::Nested.new(attrs_path: path, row_path: path)
|
79
|
+
else
|
80
|
+
slice_copyist.add_key(path)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def from_row(input)
|
86
|
+
row = input.to_h
|
87
|
+
{}.tap do |attrs|
|
88
|
+
slice_copyist.from_row(row: row, attrs: attrs)
|
89
|
+
nested_copyists.each { |copyist| copyist.from_row(row: row, attrs: attrs) }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def to_row(input)
|
94
|
+
attrs = input.to_h
|
95
|
+
{}.tap do |row|
|
96
|
+
slice_copyist.to_row(row: row, attrs: attrs)
|
97
|
+
nested_copyists.each { |copyist| copyist.to_row(row: row, attrs: attrs) }
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
# @example
|
104
|
+
# to_path :email # => :email
|
105
|
+
# to_path ['email'] # => :email
|
106
|
+
# to_path [:charge, 'amount'] # => [:charge, :amount]
|
107
|
+
def to_path(input, full: input)
|
108
|
+
case input
|
109
|
+
when Symbol then input
|
110
|
+
when String then input.to_sym
|
111
|
+
when Array
|
112
|
+
return to_path(input.first, full: full) if input.size <= 1
|
113
|
+
|
114
|
+
input.flat_map { |elem| to_path(elem, full: full) }
|
115
|
+
else raise ArgumentError, "Unexpected path part `#{input.inspect}` in `#{full.inspect}`. " \
|
116
|
+
'Expected Symbol, String or Array'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def slice_copyist
|
121
|
+
@slice_copyist ||= Copyists::Slice.new
|
122
|
+
end
|
123
|
+
|
124
|
+
def nested_copyists
|
125
|
+
@nested_copyists ||= []
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'luna_park/errors'
|
4
|
+
|
5
|
+
module LunaPark
|
6
|
+
module Mappers
|
7
|
+
module Errors
|
8
|
+
class NotArray < LunaPark::Errors::System
|
9
|
+
message { |d| "input MUST be an Array, but given #{d[:input].class} `#{d[:input].inspect}`" }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'luna_park/errors'
|
3
|
+
require 'luna_park/mappers/errors'
|
4
4
|
|
5
5
|
module LunaPark
|
6
6
|
module Mappers
|
7
|
+
##
|
7
8
|
# Abstract mapper for transform data from Entity attributes schema to Database row schema
|
9
|
+
#
|
8
10
|
# @example
|
9
11
|
# class TransactionMapper < LunaPark::Mappers::Simple
|
10
12
|
# def self.from_row(row)
|
@@ -65,6 +67,7 @@ module LunaPark
|
|
65
67
|
# Transforms array of rows to array of attribute hashes
|
66
68
|
def from_rows(rows)
|
67
69
|
return [] if rows.nil?
|
70
|
+
raise Errors::NotArray.new(input: rows) unless rows.is_a?(Array)
|
68
71
|
|
69
72
|
rows.to_a.map { |hash| from_row(hash) }
|
70
73
|
end
|
@@ -73,18 +76,19 @@ module LunaPark
|
|
73
76
|
# Transforms array of attribute hashes to array of rows
|
74
77
|
def to_rows(attr_hashes)
|
75
78
|
return [] if attr_hashes.nil?
|
79
|
+
raise Errors::NotArray.new(input: attr_hashes) unless attr_hashes.is_a?(Array)
|
76
80
|
|
77
81
|
attr_hashes.to_a.map { |entity| to_row(entity) }
|
78
82
|
end
|
79
83
|
|
80
84
|
# @abstract
|
81
85
|
def from_row(_row)
|
82
|
-
raise Errors::AbstractMethod
|
86
|
+
raise LunaPark::Errors::AbstractMethod
|
83
87
|
end
|
84
88
|
|
85
89
|
# @abstract
|
86
90
|
def to_row(_attrs)
|
87
|
-
raise Errors::AbstractMethod
|
91
|
+
raise LunaPark::Errors::AbstractMethod
|
88
92
|
end
|
89
93
|
end
|
90
94
|
end
|
@@ -86,7 +86,7 @@ module LunaPark
|
|
86
86
|
#
|
87
87
|
# stderr = Stderr.new
|
88
88
|
# stderr.logger # => #<Logger:0x000056445e1e2118 ... @filename="example.log"...
|
89
|
-
# Or in the
|
89
|
+
# Or in the initialize of the instance
|
90
90
|
#
|
91
91
|
# - On instance
|
92
92
|
# stderr = LunaPark::Notifier::Log.new(logger: Logger.new(STDERR))
|
@@ -252,6 +252,7 @@ module LunaPark
|
|
252
252
|
end
|
253
253
|
|
254
254
|
alias failure? fail?
|
255
|
+
alias failed? fail?
|
255
256
|
|
256
257
|
# @return [Boolean] true if the scenario runs successfully
|
257
258
|
def success?
|
@@ -318,7 +319,7 @@ module LunaPark
|
|
318
319
|
end
|
319
320
|
|
320
321
|
def on_raise(error)
|
321
|
-
raise error
|
322
|
+
raise error
|
322
323
|
end
|
323
324
|
end
|
324
325
|
end
|
data/lib/luna_park/version.rb
CHANGED
data/lib/luna_park.rb
CHANGED
@@ -51,7 +51,7 @@ require 'luna_park/forms/single_item'
|
|
51
51
|
|
52
52
|
LunaPark::Tools.if_gem_installed('rest-client', '~> 2.1') { require 'luna_park/http/client' }
|
53
53
|
LunaPark::Tools.if_gem_installed('bugsnag', '~> 6') { require 'luna_park/notifiers/bugsnag' }
|
54
|
-
LunaPark::Tools.if_gem_installed('sentry-ruby', '
|
54
|
+
LunaPark::Tools.if_gem_installed('sentry-ruby', '>= 4') { require 'luna_park/notifiers/sentry' }
|
55
55
|
|
56
56
|
require 'luna_park/notifiers/log'
|
57
57
|
|
@@ -67,6 +67,7 @@ require 'luna_park/values/compound'
|
|
67
67
|
require 'luna_park/values/single'
|
68
68
|
require 'luna_park/values/attributable'
|
69
69
|
require 'luna_park/mappers/simple'
|
70
|
+
require 'luna_park/mappers/codirectional'
|
70
71
|
require 'luna_park/repository'
|
71
72
|
require 'luna_park/repositories/sequel'
|
72
73
|
require 'luna_park/repositories/postgres'
|
data/luna_park.gemspec
CHANGED
@@ -11,13 +11,14 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ['kudrin.alexander@gmail.com']
|
12
12
|
|
13
13
|
spec.summary = 'Domain driven oriented microservice framework.'
|
14
|
-
spec.homepage = 'https://am-team
|
14
|
+
spec.homepage = 'https://github.com/am-team/luna_park'
|
15
15
|
spec.license = 'MIT'
|
16
|
+
spec.required_ruby_version = '>= 2.5.1'
|
16
17
|
|
17
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
19
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
20
|
if spec.respond_to?(:metadata)
|
20
|
-
spec.metadata['allowed_push_host'] = '
|
21
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
22
|
else
|
22
23
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
23
24
|
'public gem pushes.'
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luna_park
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kudrin
|
8
8
|
- Philip Sorokin
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bugsnag
|
@@ -263,13 +263,15 @@ dependencies:
|
|
263
263
|
- - "~>"
|
264
264
|
- !ruby/object:Gem::Version
|
265
265
|
version: '0.9'
|
266
|
-
description:
|
266
|
+
description:
|
267
267
|
email:
|
268
268
|
- kudrin.alexander@gmail.com
|
269
269
|
executables: []
|
270
270
|
extensions: []
|
271
271
|
extra_rdoc_files: []
|
272
272
|
files:
|
273
|
+
- ".github/gem-push.yml"
|
274
|
+
- ".github/workflows/gem-push.yml"
|
273
275
|
- ".gitignore"
|
274
276
|
- ".overcommit.yml"
|
275
277
|
- ".rspec"
|
@@ -366,6 +368,10 @@ files:
|
|
366
368
|
- lib/luna_park/http/request.rb
|
367
369
|
- lib/luna_park/http/response.rb
|
368
370
|
- lib/luna_park/http/send.rb
|
371
|
+
- lib/luna_park/mappers/codirectional.rb
|
372
|
+
- lib/luna_park/mappers/codirectional/copyists/nested.rb
|
373
|
+
- lib/luna_park/mappers/codirectional/copyists/slice.rb
|
374
|
+
- lib/luna_park/mappers/errors.rb
|
369
375
|
- lib/luna_park/mappers/simple.rb
|
370
376
|
- lib/luna_park/notifiers/bugsnag.rb
|
371
377
|
- lib/luna_park/notifiers/log.rb
|
@@ -386,13 +392,12 @@ files:
|
|
386
392
|
- node_modules/.yarn-integrity
|
387
393
|
- package-lock.json
|
388
394
|
- yarn.lock
|
389
|
-
homepage: https://am-team
|
395
|
+
homepage: https://github.com/am-team/luna_park
|
390
396
|
licenses:
|
391
397
|
- MIT
|
392
398
|
metadata:
|
393
|
-
allowed_push_host: https://rubygems.org
|
394
399
|
yard.run: yri
|
395
|
-
post_install_message:
|
400
|
+
post_install_message:
|
396
401
|
rdoc_options: []
|
397
402
|
require_paths:
|
398
403
|
- lib
|
@@ -400,15 +405,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
400
405
|
requirements:
|
401
406
|
- - ">="
|
402
407
|
- !ruby/object:Gem::Version
|
403
|
-
version:
|
408
|
+
version: 2.5.1
|
404
409
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
405
410
|
requirements:
|
406
411
|
- - ">="
|
407
412
|
- !ruby/object:Gem::Version
|
408
413
|
version: '0'
|
409
414
|
requirements: []
|
410
|
-
|
411
|
-
|
415
|
+
rubyforge_project:
|
416
|
+
rubygems_version: 2.7.6.3
|
417
|
+
signing_key:
|
412
418
|
specification_version: 4
|
413
419
|
summary: Domain driven oriented microservice framework.
|
414
420
|
test_files: []
|