hanami-model 1.0.0.rc1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/hanami-model.gemspec +3 -3
- data/lib/hanami/model/configuration.rb +7 -7
- data/lib/hanami/model/configurator.rb +5 -5
- data/lib/hanami/model/error.rb +2 -2
- data/lib/hanami/model/mapped_relation.rb +4 -4
- data/lib/hanami/model/migrator/connection.rb +1 -1
- data/lib/hanami/model/migrator/logger.rb +4 -4
- data/lib/hanami/model/migrator/mysql_adapter.rb +1 -1
- data/lib/hanami/model/migrator/postgres_adapter.rb +1 -1
- data/lib/hanami/model/version.rb +1 -1
- data/lib/hanami/repository.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70775a4002119bba8febe56e6a61619320d1a832
|
4
|
+
data.tar.gz: d1890cf53c762541f9821eaa4fe7d8ef50aac0dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c49a0c0249cb4e9083bdf0874d654e7cface01ede618be1cecb15a646abb34edab19b4597cdc5532dcf6657a0ec9b9dafba24559d9268dcd3558cb61204211cd
|
7
|
+
data.tar.gz: 661788bbaf06b16872f40c25091c68aa0e67137265df3ba807f458b9118cfe0487890d4f3f268d909920ac10f1e337ec8a37fab496994ea04f220cabcc89654f
|
data/CHANGELOG.md
CHANGED
data/hanami-model.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
spec.required_ruby_version = '>= 2.3.0'
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'hanami-utils', '~> 1.0
|
24
|
-
spec.add_runtime_dependency 'rom-sql', '~> 1.
|
25
|
-
spec.add_runtime_dependency 'rom-repository', '~> 1.
|
23
|
+
spec.add_runtime_dependency 'hanami-utils', '~> 1.0'
|
24
|
+
spec.add_runtime_dependency 'rom-sql', '~> 1.2'
|
25
|
+
spec.add_runtime_dependency 'rom-repository', '~> 1.3'
|
26
26
|
spec.add_runtime_dependency 'dry-types', '~> 0.9'
|
27
27
|
spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0'
|
28
28
|
|
@@ -17,11 +17,11 @@ module Hanami
|
|
17
17
|
# @api private
|
18
18
|
attr_reader :entities
|
19
19
|
|
20
|
-
# @since 1.0.0
|
20
|
+
# @since 1.0.0
|
21
21
|
# @api private
|
22
22
|
attr_reader :logger
|
23
23
|
|
24
|
-
# @since 1.0.0
|
24
|
+
# @since 1.0.0
|
25
25
|
# @api private
|
26
26
|
attr_reader :migrations_logger
|
27
27
|
|
@@ -109,26 +109,26 @@ module Hanami
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
-
# @since 1.0.0
|
112
|
+
# @since 1.0.0
|
113
113
|
# @api private
|
114
114
|
def configure_gateway
|
115
115
|
@gateway_config.call(gateway) unless @gateway_config.nil?
|
116
116
|
end
|
117
117
|
|
118
|
-
# @since 1.0.0
|
118
|
+
# @since 1.0.0
|
119
119
|
# @api private
|
120
120
|
def logger=(value)
|
121
121
|
return if value.nil?
|
122
122
|
gateway.use_logger(@logger = value)
|
123
123
|
end
|
124
124
|
|
125
|
-
# @since 1.0.0
|
125
|
+
# @since 1.0.0
|
126
126
|
# @api private
|
127
127
|
def rom
|
128
128
|
@rom ||= ROM::Configuration.new(@backend, @url, infer_relations: false)
|
129
129
|
end
|
130
130
|
|
131
|
-
# @since 1.0.0
|
131
|
+
# @since 1.0.0
|
132
132
|
# @api private
|
133
133
|
def load!(repositories, &blk) # rubocop:disable Metrics/AbcSize
|
134
134
|
rom.setup.auto_registration(config.directory.to_s) unless config.directory.nil?
|
@@ -144,7 +144,7 @@ module Hanami
|
|
144
144
|
raise Hanami::Model::Error.for(e)
|
145
145
|
end
|
146
146
|
|
147
|
-
# @since 1.0.0
|
147
|
+
# @since 1.0.0
|
148
148
|
# @api private
|
149
149
|
def method_missing(method_name, *args, &blk)
|
150
150
|
if rom.respond_to?(method_name)
|
@@ -25,11 +25,11 @@ module Hanami
|
|
25
25
|
# @api private
|
26
26
|
attr_reader :_schema
|
27
27
|
|
28
|
-
# @since 1.0.0
|
28
|
+
# @since 1.0.0
|
29
29
|
# @api private
|
30
30
|
attr_reader :_logger
|
31
31
|
|
32
|
-
# @since 1.0.0
|
32
|
+
# @since 1.0.0
|
33
33
|
# @api private
|
34
34
|
attr_reader :_gateway
|
35
35
|
|
@@ -39,7 +39,7 @@ module Hanami
|
|
39
39
|
new.tap { |config| config.instance_eval(&block) }
|
40
40
|
end
|
41
41
|
|
42
|
-
# @since 1.0.0
|
42
|
+
# @since 1.0.0
|
43
43
|
# @api private
|
44
44
|
def migrations_logger(stream = $stdout)
|
45
45
|
require 'hanami/model/migrator/logger'
|
@@ -73,7 +73,7 @@ module Hanami
|
|
73
73
|
@_schema = path
|
74
74
|
end
|
75
75
|
|
76
|
-
# @since 1.0.0
|
76
|
+
# @since 1.0.0
|
77
77
|
# @api private
|
78
78
|
def logger(stream, options = {})
|
79
79
|
require 'hanami/logger'
|
@@ -82,7 +82,7 @@ module Hanami
|
|
82
82
|
@_logger = Hanami::Logger.new('hanami.model', opts)
|
83
83
|
end
|
84
84
|
|
85
|
-
# @since 1.0.0
|
85
|
+
# @since 1.0.0
|
86
86
|
# @api private
|
87
87
|
def gateway(&blk)
|
88
88
|
@_gateway = blk
|
data/lib/hanami/model/error.rb
CHANGED
@@ -103,13 +103,13 @@ module Hanami
|
|
103
103
|
|
104
104
|
# Unknown database type error for repository auto-mapping
|
105
105
|
#
|
106
|
-
# @since 1.0.0
|
106
|
+
# @since 1.0.0
|
107
107
|
class UnknownDatabaseTypeError < Error
|
108
108
|
end
|
109
109
|
|
110
110
|
# Unknown primary key error
|
111
111
|
#
|
112
|
-
# @since 1.0.0
|
112
|
+
# @since 1.0.0
|
113
113
|
class MissingPrimaryKeyError < Error
|
114
114
|
end
|
115
115
|
end
|
@@ -4,7 +4,7 @@ module Hanami
|
|
4
4
|
#
|
5
5
|
# It eliminates the need of use #as for repository queries
|
6
6
|
#
|
7
|
-
# @since 1.0.0
|
7
|
+
# @since 1.0.0
|
8
8
|
# @api private
|
9
9
|
class MappedRelation < SimpleDelegator
|
10
10
|
# Mapper name.
|
@@ -13,17 +13,17 @@ module Hanami
|
|
13
13
|
# reference for it. Example: <tt>BookRepository</tt> references <tt>Book</tt>
|
14
14
|
# as <tt>:entity</tt>.
|
15
15
|
#
|
16
|
-
# @since 1.0.0
|
16
|
+
# @since 1.0.0
|
17
17
|
# @api private
|
18
18
|
MAPPER_NAME = :entity
|
19
19
|
|
20
|
-
# @since 1.0.0
|
20
|
+
# @since 1.0.0
|
21
21
|
# @api private
|
22
22
|
def self.mapper_name
|
23
23
|
MAPPER_NAME
|
24
24
|
end
|
25
25
|
|
26
|
-
# @since 1.0.0
|
26
|
+
# @since 1.0.0
|
27
27
|
# @api private
|
28
28
|
def initialize(relation)
|
29
29
|
super(relation.as(self.class.mapper_name))
|
@@ -5,24 +5,24 @@ module Hanami
|
|
5
5
|
class Migrator
|
6
6
|
# Automatic logger for migrations
|
7
7
|
#
|
8
|
-
# @since 1.0.0
|
8
|
+
# @since 1.0.0
|
9
9
|
# @api private
|
10
10
|
class Logger < Hanami::Logger
|
11
11
|
# Formatter for migrations logger
|
12
12
|
#
|
13
|
-
# @since 1.0.0
|
13
|
+
# @since 1.0.0
|
14
14
|
# @api private
|
15
15
|
class Formatter < Hanami::Logger::Formatter
|
16
16
|
private
|
17
17
|
|
18
|
-
# @since 1.0.0
|
18
|
+
# @since 1.0.0
|
19
19
|
# @api private
|
20
20
|
def _format(hash)
|
21
21
|
"[hanami] [#{hash.fetch(:severity)}] #{hash.fetch(:message)}\n"
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
# @since 1.0.0
|
25
|
+
# @since 1.0.0
|
26
26
|
# @api private
|
27
27
|
def initialize(stream)
|
28
28
|
super(nil, stream: stream, formatter: Formatter.new)
|
@@ -10,7 +10,7 @@ module Hanami
|
|
10
10
|
# @api private
|
11
11
|
PASSWORD = 'MYSQL_PWD'.freeze
|
12
12
|
|
13
|
-
# @since 1.0.0
|
13
|
+
# @since 1.0.0
|
14
14
|
# @api private
|
15
15
|
DB_CREATION_ERROR = 'Database creation failed. If the database exists, ' \
|
16
16
|
'then its console may be open. See this issue for more details: ' \
|
@@ -22,7 +22,7 @@ module Hanami
|
|
22
22
|
# @api private
|
23
23
|
PASSWORD = 'PGPASSWORD'.freeze
|
24
24
|
|
25
|
-
# @since 1.0.0
|
25
|
+
# @since 1.0.0
|
26
26
|
# @api private
|
27
27
|
DB_CREATION_ERROR = 'createdb: database creation failed. If the database exists, ' \
|
28
28
|
'then its console may be open. See this issue for more details: ' \
|
data/lib/hanami/model/version.rb
CHANGED
data/lib/hanami/repository.rb
CHANGED
@@ -226,7 +226,7 @@ module Hanami
|
|
226
226
|
#
|
227
227
|
# NOTE: This should be used **only** when Hanami can't find a corresponding Ruby type for your column.
|
228
228
|
#
|
229
|
-
# @since 1.0.0
|
229
|
+
# @since 1.0.0
|
230
230
|
#
|
231
231
|
# @example
|
232
232
|
# # In this example `name` is a PostgreSQL Enum type that we want to treat like a string.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hanami-utils
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.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: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rom-sql
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rom-repository
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.3'
|
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: '1.
|
54
|
+
version: '1.3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: dry-types
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,9 +187,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: 2.3.0
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
|
-
- - "
|
190
|
+
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
192
|
+
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
195
|
rubygems_version: 2.6.11
|